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_H__
21#define __G_ACTION_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#define G_TYPE_ACTION (g_action_get_type ())
32#define G_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
33 G_TYPE_ACTION, GAction))
34#define G_IS_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_ACTION))
35#define G_ACTION_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
36 G_TYPE_ACTION, GActionInterface))
37
38typedef struct _GActionInterface GActionInterface;
39
40struct _GActionInterface
41{
42 GTypeInterface g_iface;
43
44 /* virtual functions */
45 const gchar * (* get_name) (GAction *action);
46 const GVariantType * (* get_parameter_type) (GAction *action);
47 const GVariantType * (* get_state_type) (GAction *action);
48 GVariant * (* get_state_hint) (GAction *action);
49
50 gboolean (* get_enabled) (GAction *action);
51 GVariant * (* get_state) (GAction *action);
52
53 void (* change_state) (GAction *action,
54 GVariant *value);
55 void (* activate) (GAction *action,
56 GVariant *parameter);
57};
58
59GLIB_AVAILABLE_IN_2_30
60GType g_action_get_type (void) G_GNUC_CONST;
61
62GLIB_AVAILABLE_IN_ALL
63const gchar * g_action_get_name (GAction *action);
64GLIB_AVAILABLE_IN_ALL
65const GVariantType * g_action_get_parameter_type (GAction *action);
66GLIB_AVAILABLE_IN_ALL
67const GVariantType * g_action_get_state_type (GAction *action);
68GLIB_AVAILABLE_IN_ALL
69GVariant * g_action_get_state_hint (GAction *action);
70
71GLIB_AVAILABLE_IN_ALL
72gboolean g_action_get_enabled (GAction *action);
73GLIB_AVAILABLE_IN_ALL
74GVariant * g_action_get_state (GAction *action);
75
76GLIB_AVAILABLE_IN_ALL
77void g_action_change_state (GAction *action,
78 GVariant *value);
79GLIB_AVAILABLE_IN_ALL
80void g_action_activate (GAction *action,
81 GVariant *parameter);
82
83GLIB_AVAILABLE_IN_2_28
84gboolean g_action_name_is_valid (const gchar *action_name);
85
86GLIB_AVAILABLE_IN_2_38
87gboolean g_action_parse_detailed_name (const gchar *detailed_name,
88 gchar **action_name,
89 GVariant **target_value,
90 GError **error);
91
92GLIB_AVAILABLE_IN_2_38
93gchar * g_action_print_detailed_name (const gchar *action_name,
94 GVariant *target_value);
95
96G_END_DECLS
97
98#endif /* __G_ACTION_H__ */
99

source code of include/glib-2.0/gio/gaction.h