gactiongroup.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. * Copyright © 2010 Codethink Limited
  3. *
  4. * SPDX-License-Identifier: LGPL-2.1-or-later
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General
  17. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  18. *
  19. * Authors: Ryan Lortie <desrt@desrt.ca>
  20. */
  21. #ifndef __G_ACTION_GROUP_H__
  22. #define __G_ACTION_GROUP_H__
  23. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  24. #error "Only <gio/gio.h> can be included directly."
  25. #endif
  26. #include <gio/giotypes.h>
  27. G_BEGIN_DECLS
  28. #define G_TYPE_ACTION_GROUP (g_action_group_get_type ())
  29. #define G_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
  30. G_TYPE_ACTION_GROUP, GActionGroup))
  31. #define G_IS_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
  32. G_TYPE_ACTION_GROUP))
  33. #define G_ACTION_GROUP_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
  34. G_TYPE_ACTION_GROUP, GActionGroupInterface))
  35. typedef struct _GActionGroupInterface GActionGroupInterface;
  36. struct _GActionGroupInterface
  37. {
  38. GTypeInterface g_iface;
  39. /* virtual functions */
  40. gboolean (* has_action) (GActionGroup *action_group,
  41. const gchar *action_name);
  42. gchar ** (* list_actions) (GActionGroup *action_group);
  43. gboolean (* get_action_enabled) (GActionGroup *action_group,
  44. const gchar *action_name);
  45. const GVariantType * (* get_action_parameter_type) (GActionGroup *action_group,
  46. const gchar *action_name);
  47. const GVariantType * (* get_action_state_type) (GActionGroup *action_group,
  48. const gchar *action_name);
  49. GVariant * (* get_action_state_hint) (GActionGroup *action_group,
  50. const gchar *action_name);
  51. GVariant * (* get_action_state) (GActionGroup *action_group,
  52. const gchar *action_name);
  53. void (* change_action_state) (GActionGroup *action_group,
  54. const gchar *action_name,
  55. GVariant *value);
  56. void (* activate_action) (GActionGroup *action_group,
  57. const gchar *action_name,
  58. GVariant *parameter);
  59. /* signals */
  60. void (* action_added) (GActionGroup *action_group,
  61. const gchar *action_name);
  62. void (* action_removed) (GActionGroup *action_group,
  63. const gchar *action_name);
  64. void (* action_enabled_changed) (GActionGroup *action_group,
  65. const gchar *action_name,
  66. gboolean enabled);
  67. void (* action_state_changed) (GActionGroup *action_group,
  68. const gchar *action_name,
  69. GVariant *state);
  70. /* more virtual functions */
  71. gboolean (* query_action) (GActionGroup *action_group,
  72. const gchar *action_name,
  73. gboolean *enabled,
  74. const GVariantType **parameter_type,
  75. const GVariantType **state_type,
  76. GVariant **state_hint,
  77. GVariant **state);
  78. };
  79. GIO_AVAILABLE_IN_ALL
  80. GType g_action_group_get_type (void) G_GNUC_CONST;
  81. GIO_AVAILABLE_IN_ALL
  82. gboolean g_action_group_has_action (GActionGroup *action_group,
  83. const gchar *action_name);
  84. GIO_AVAILABLE_IN_ALL
  85. gchar ** g_action_group_list_actions (GActionGroup *action_group);
  86. GIO_AVAILABLE_IN_ALL
  87. const GVariantType * g_action_group_get_action_parameter_type (GActionGroup *action_group,
  88. const gchar *action_name);
  89. GIO_AVAILABLE_IN_ALL
  90. const GVariantType * g_action_group_get_action_state_type (GActionGroup *action_group,
  91. const gchar *action_name);
  92. GIO_AVAILABLE_IN_ALL
  93. GVariant * g_action_group_get_action_state_hint (GActionGroup *action_group,
  94. const gchar *action_name);
  95. GIO_AVAILABLE_IN_ALL
  96. gboolean g_action_group_get_action_enabled (GActionGroup *action_group,
  97. const gchar *action_name);
  98. GIO_AVAILABLE_IN_ALL
  99. GVariant * g_action_group_get_action_state (GActionGroup *action_group,
  100. const gchar *action_name);
  101. GIO_AVAILABLE_IN_ALL
  102. void g_action_group_change_action_state (GActionGroup *action_group,
  103. const gchar *action_name,
  104. GVariant *value);
  105. GIO_AVAILABLE_IN_ALL
  106. void g_action_group_activate_action (GActionGroup *action_group,
  107. const gchar *action_name,
  108. GVariant *parameter);
  109. /* signals */
  110. GIO_AVAILABLE_IN_ALL
  111. void g_action_group_action_added (GActionGroup *action_group,
  112. const gchar *action_name);
  113. GIO_AVAILABLE_IN_ALL
  114. void g_action_group_action_removed (GActionGroup *action_group,
  115. const gchar *action_name);
  116. GIO_AVAILABLE_IN_ALL
  117. void g_action_group_action_enabled_changed (GActionGroup *action_group,
  118. const gchar *action_name,
  119. gboolean enabled);
  120. GIO_AVAILABLE_IN_ALL
  121. void g_action_group_action_state_changed (GActionGroup *action_group,
  122. const gchar *action_name,
  123. GVariant *state);
  124. GIO_AVAILABLE_IN_2_32
  125. gboolean g_action_group_query_action (GActionGroup *action_group,
  126. const gchar *action_name,
  127. gboolean *enabled,
  128. const GVariantType **parameter_type,
  129. const GVariantType **state_type,
  130. GVariant **state_hint,
  131. GVariant **state) G_GNUC_WARN_UNUSED_RESULT;
  132. G_END_DECLS
  133. #endif /* __G_ACTION_GROUP_H__ */