gaction.h 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright © 2010 Codethink Limited
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published
  6. * by the Free Software Foundation; either version 2 of the licence or (at
  7. * your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General
  15. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  16. *
  17. * Authors: Ryan Lortie <[email protected]>
  18. */
  19. #ifndef __G_ACTION_H__
  20. #define __G_ACTION_H__
  21. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  22. #error "Only <gio/gio.h> can be included directly."
  23. #endif
  24. #include <gio/giotypes.h>
  25. G_BEGIN_DECLS
  26. #define G_TYPE_ACTION (g_action_get_type ())
  27. #define G_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
  28. G_TYPE_ACTION, GAction))
  29. #define G_IS_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_ACTION))
  30. #define G_ACTION_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
  31. G_TYPE_ACTION, GActionInterface))
  32. typedef struct _GActionInterface GActionInterface;
  33. struct _GActionInterface
  34. {
  35. GTypeInterface g_iface;
  36. /* virtual functions */
  37. const gchar * (* get_name) (GAction *action);
  38. const GVariantType * (* get_parameter_type) (GAction *action);
  39. const GVariantType * (* get_state_type) (GAction *action);
  40. GVariant * (* get_state_hint) (GAction *action);
  41. gboolean (* get_enabled) (GAction *action);
  42. GVariant * (* get_state) (GAction *action);
  43. void (* change_state) (GAction *action,
  44. GVariant *value);
  45. void (* activate) (GAction *action,
  46. GVariant *parameter);
  47. };
  48. GLIB_AVAILABLE_IN_2_30
  49. GType g_action_get_type (void) G_GNUC_CONST;
  50. GLIB_AVAILABLE_IN_ALL
  51. const gchar * g_action_get_name (GAction *action);
  52. GLIB_AVAILABLE_IN_ALL
  53. const GVariantType * g_action_get_parameter_type (GAction *action);
  54. GLIB_AVAILABLE_IN_ALL
  55. const GVariantType * g_action_get_state_type (GAction *action);
  56. GLIB_AVAILABLE_IN_ALL
  57. GVariant * g_action_get_state_hint (GAction *action);
  58. GLIB_AVAILABLE_IN_ALL
  59. gboolean g_action_get_enabled (GAction *action);
  60. GLIB_AVAILABLE_IN_ALL
  61. GVariant * g_action_get_state (GAction *action);
  62. GLIB_AVAILABLE_IN_ALL
  63. void g_action_change_state (GAction *action,
  64. GVariant *value);
  65. GLIB_AVAILABLE_IN_ALL
  66. void g_action_activate (GAction *action,
  67. GVariant *parameter);
  68. GLIB_AVAILABLE_IN_2_28
  69. gboolean g_action_name_is_valid (const gchar *action_name);
  70. GLIB_AVAILABLE_IN_2_38
  71. gboolean g_action_parse_detailed_name (const gchar *detailed_name,
  72. gchar **action_name,
  73. GVariant **target_value,
  74. GError **error);
  75. GLIB_AVAILABLE_IN_2_38
  76. gchar * g_action_print_detailed_name (const gchar *action_name,
  77. GVariant *target_value);
  78. G_END_DECLS
  79. #endif /* __G_ACTION_H__ */