1/*
2 * Copyright © 2010 Codethink Limited
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at 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 <desrt@desrt.ca>
18 */
19
20#ifndef __G_ACTION_GROUP_H__
21#define __G_ACTION_GROUP_H__
22
23#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24#error "Only <gio/gio.h> can be included directly."
25#endif
26
27#include <gio/giotypes.h>
28
29G_BEGIN_DECLS
30
31
32#define G_TYPE_ACTION_GROUP (g_action_group_get_type ())
33#define G_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
34 G_TYPE_ACTION_GROUP, GActionGroup))
35#define G_IS_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
36 G_TYPE_ACTION_GROUP))
37#define G_ACTION_GROUP_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
38 G_TYPE_ACTION_GROUP, GActionGroupInterface))
39
40typedef struct _GActionGroupInterface GActionGroupInterface;
41
42struct _GActionGroupInterface
43{
44 GTypeInterface g_iface;
45
46 /* virtual functions */
47 gboolean (* has_action) (GActionGroup *action_group,
48 const gchar *action_name);
49
50 gchar ** (* list_actions) (GActionGroup *action_group);
51
52 gboolean (* get_action_enabled) (GActionGroup *action_group,
53 const gchar *action_name);
54
55 const GVariantType * (* get_action_parameter_type) (GActionGroup *action_group,
56 const gchar *action_name);
57
58 const GVariantType * (* get_action_state_type) (GActionGroup *action_group,
59 const gchar *action_name);
60
61 GVariant * (* get_action_state_hint) (GActionGroup *action_group,
62 const gchar *action_name);
63
64 GVariant * (* get_action_state) (GActionGroup *action_group,
65 const gchar *action_name);
66
67 void (* change_action_state) (GActionGroup *action_group,
68 const gchar *action_name,
69 GVariant *value);
70
71 void (* activate_action) (GActionGroup *action_group,
72 const gchar *action_name,
73 GVariant *parameter);
74
75 /* signals */
76 void (* action_added) (GActionGroup *action_group,
77 const gchar *action_name);
78 void (* action_removed) (GActionGroup *action_group,
79 const gchar *action_name);
80 void (* action_enabled_changed) (GActionGroup *action_group,
81 const gchar *action_name,
82 gboolean enabled);
83 void (* action_state_changed) (GActionGroup *action_group,
84 const gchar *action_name,
85 GVariant *state);
86
87 /* more virtual functions */
88 gboolean (* query_action) (GActionGroup *action_group,
89 const gchar *action_name,
90 gboolean *enabled,
91 const GVariantType **parameter_type,
92 const GVariantType **state_type,
93 GVariant **state_hint,
94 GVariant **state);
95};
96
97GLIB_AVAILABLE_IN_ALL
98GType g_action_group_get_type (void) G_GNUC_CONST;
99
100GLIB_AVAILABLE_IN_ALL
101gboolean g_action_group_has_action (GActionGroup *action_group,
102 const gchar *action_name);
103GLIB_AVAILABLE_IN_ALL
104gchar ** g_action_group_list_actions (GActionGroup *action_group);
105
106GLIB_AVAILABLE_IN_ALL
107const GVariantType * g_action_group_get_action_parameter_type (GActionGroup *action_group,
108 const gchar *action_name);
109GLIB_AVAILABLE_IN_ALL
110const GVariantType * g_action_group_get_action_state_type (GActionGroup *action_group,
111 const gchar *action_name);
112GLIB_AVAILABLE_IN_ALL
113GVariant * g_action_group_get_action_state_hint (GActionGroup *action_group,
114 const gchar *action_name);
115
116GLIB_AVAILABLE_IN_ALL
117gboolean g_action_group_get_action_enabled (GActionGroup *action_group,
118 const gchar *action_name);
119
120GLIB_AVAILABLE_IN_ALL
121GVariant * g_action_group_get_action_state (GActionGroup *action_group,
122 const gchar *action_name);
123GLIB_AVAILABLE_IN_ALL
124void g_action_group_change_action_state (GActionGroup *action_group,
125 const gchar *action_name,
126 GVariant *value);
127
128GLIB_AVAILABLE_IN_ALL
129void g_action_group_activate_action (GActionGroup *action_group,
130 const gchar *action_name,
131 GVariant *parameter);
132
133/* signals */
134GLIB_AVAILABLE_IN_ALL
135void g_action_group_action_added (GActionGroup *action_group,
136 const gchar *action_name);
137GLIB_AVAILABLE_IN_ALL
138void g_action_group_action_removed (GActionGroup *action_group,
139 const gchar *action_name);
140GLIB_AVAILABLE_IN_ALL
141void g_action_group_action_enabled_changed (GActionGroup *action_group,
142 const gchar *action_name,
143 gboolean enabled);
144
145GLIB_AVAILABLE_IN_ALL
146void g_action_group_action_state_changed (GActionGroup *action_group,
147 const gchar *action_name,
148 GVariant *state);
149
150GLIB_AVAILABLE_IN_2_32
151gboolean g_action_group_query_action (GActionGroup *action_group,
152 const gchar *action_name,
153 gboolean *enabled,
154 const GVariantType **parameter_type,
155 const GVariantType **state_type,
156 GVariant **state_hint,
157 GVariant **state);
158
159G_END_DECLS
160
161#endif /* __G_ACTION_GROUP_H__ */
162