gactiongroup.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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_GROUP_H__
  20. #define __G_ACTION_GROUP_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_GROUP (g_action_group_get_type ())
  27. #define G_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
  28. G_TYPE_ACTION_GROUP, GActionGroup))
  29. #define G_IS_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
  30. G_TYPE_ACTION_GROUP))
  31. #define G_ACTION_GROUP_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
  32. G_TYPE_ACTION_GROUP, GActionGroupInterface))
  33. typedef struct _GActionGroupInterface GActionGroupInterface;
  34. struct _GActionGroupInterface
  35. {
  36. GTypeInterface g_iface;
  37. /* virtual functions */
  38. gboolean (* has_action) (GActionGroup *action_group,
  39. const gchar *action_name);
  40. gchar ** (* list_actions) (GActionGroup *action_group);
  41. gboolean (* get_action_enabled) (GActionGroup *action_group,
  42. const gchar *action_name);
  43. const GVariantType * (* get_action_parameter_type) (GActionGroup *action_group,
  44. const gchar *action_name);
  45. const GVariantType * (* get_action_state_type) (GActionGroup *action_group,
  46. const gchar *action_name);
  47. GVariant * (* get_action_state_hint) (GActionGroup *action_group,
  48. const gchar *action_name);
  49. GVariant * (* get_action_state) (GActionGroup *action_group,
  50. const gchar *action_name);
  51. void (* change_action_state) (GActionGroup *action_group,
  52. const gchar *action_name,
  53. GVariant *value);
  54. void (* activate_action) (GActionGroup *action_group,
  55. const gchar *action_name,
  56. GVariant *parameter);
  57. /* signals */
  58. void (* action_added) (GActionGroup *action_group,
  59. const gchar *action_name);
  60. void (* action_removed) (GActionGroup *action_group,
  61. const gchar *action_name);
  62. void (* action_enabled_changed) (GActionGroup *action_group,
  63. const gchar *action_name,
  64. gboolean enabled);
  65. void (* action_state_changed) (GActionGroup *action_group,
  66. const gchar *action_name,
  67. GVariant *state);
  68. /* more virtual functions */
  69. gboolean (* query_action) (GActionGroup *action_group,
  70. const gchar *action_name,
  71. gboolean *enabled,
  72. const GVariantType **parameter_type,
  73. const GVariantType **state_type,
  74. GVariant **state_hint,
  75. GVariant **state);
  76. };
  77. GLIB_AVAILABLE_IN_ALL
  78. GType g_action_group_get_type (void) G_GNUC_CONST;
  79. GLIB_AVAILABLE_IN_ALL
  80. gboolean g_action_group_has_action (GActionGroup *action_group,
  81. const gchar *action_name);
  82. GLIB_AVAILABLE_IN_ALL
  83. gchar ** g_action_group_list_actions (GActionGroup *action_group);
  84. GLIB_AVAILABLE_IN_ALL
  85. const GVariantType * g_action_group_get_action_parameter_type (GActionGroup *action_group,
  86. const gchar *action_name);
  87. GLIB_AVAILABLE_IN_ALL
  88. const GVariantType * g_action_group_get_action_state_type (GActionGroup *action_group,
  89. const gchar *action_name);
  90. GLIB_AVAILABLE_IN_ALL
  91. GVariant * g_action_group_get_action_state_hint (GActionGroup *action_group,
  92. const gchar *action_name);
  93. GLIB_AVAILABLE_IN_ALL
  94. gboolean g_action_group_get_action_enabled (GActionGroup *action_group,
  95. const gchar *action_name);
  96. GLIB_AVAILABLE_IN_ALL
  97. GVariant * g_action_group_get_action_state (GActionGroup *action_group,
  98. const gchar *action_name);
  99. GLIB_AVAILABLE_IN_ALL
  100. void g_action_group_change_action_state (GActionGroup *action_group,
  101. const gchar *action_name,
  102. GVariant *value);
  103. GLIB_AVAILABLE_IN_ALL
  104. void g_action_group_activate_action (GActionGroup *action_group,
  105. const gchar *action_name,
  106. GVariant *parameter);
  107. /* signals */
  108. GLIB_AVAILABLE_IN_ALL
  109. void g_action_group_action_added (GActionGroup *action_group,
  110. const gchar *action_name);
  111. GLIB_AVAILABLE_IN_ALL
  112. void g_action_group_action_removed (GActionGroup *action_group,
  113. const gchar *action_name);
  114. GLIB_AVAILABLE_IN_ALL
  115. void g_action_group_action_enabled_changed (GActionGroup *action_group,
  116. const gchar *action_name,
  117. gboolean enabled);
  118. GLIB_AVAILABLE_IN_ALL
  119. void g_action_group_action_state_changed (GActionGroup *action_group,
  120. const gchar *action_name,
  121. GVariant *state);
  122. GLIB_AVAILABLE_IN_2_32
  123. gboolean g_action_group_query_action (GActionGroup *action_group,
  124. const gchar *action_name,
  125. gboolean *enabled,
  126. const GVariantType **parameter_type,
  127. const GVariantType **state_type,
  128. GVariant **state_hint,
  129. GVariant **state);
  130. G_END_DECLS
  131. #endif /* __G_ACTION_GROUP_H__ */