Check for overflow when allocating RcBox
[glib.git] / gio / gaction.h
blobf9f4b38e7d5472264028518170a9599b77413a1e
1 /*
2 * Copyright © 2010 Codethink Limited
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.
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.
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/>.
17 * Authors: Ryan Lortie <desrt@desrt.ca>
20 #ifndef __G_ACTION_H__
21 #define __G_ACTION_H__
23 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
25 #endif
27 #include <gio/giotypes.h>
29 G_BEGIN_DECLS
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))
38 typedef struct _GActionInterface GActionInterface;
40 struct _GActionInterface
42 GTypeInterface g_iface;
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);
50 gboolean (* get_enabled) (GAction *action);
51 GVariant * (* get_state) (GAction *action);
53 void (* change_state) (GAction *action,
54 GVariant *value);
55 void (* activate) (GAction *action,
56 GVariant *parameter);
59 GLIB_AVAILABLE_IN_2_30
60 GType g_action_get_type (void) G_GNUC_CONST;
62 GLIB_AVAILABLE_IN_ALL
63 const gchar * g_action_get_name (GAction *action);
64 GLIB_AVAILABLE_IN_ALL
65 const GVariantType * g_action_get_parameter_type (GAction *action);
66 GLIB_AVAILABLE_IN_ALL
67 const GVariantType * g_action_get_state_type (GAction *action);
68 GLIB_AVAILABLE_IN_ALL
69 GVariant * g_action_get_state_hint (GAction *action);
71 GLIB_AVAILABLE_IN_ALL
72 gboolean g_action_get_enabled (GAction *action);
73 GLIB_AVAILABLE_IN_ALL
74 GVariant * g_action_get_state (GAction *action);
76 GLIB_AVAILABLE_IN_ALL
77 void g_action_change_state (GAction *action,
78 GVariant *value);
79 GLIB_AVAILABLE_IN_ALL
80 void g_action_activate (GAction *action,
81 GVariant *parameter);
83 GLIB_AVAILABLE_IN_2_28
84 gboolean g_action_name_is_valid (const gchar *action_name);
86 GLIB_AVAILABLE_IN_2_38
87 gboolean g_action_parse_detailed_name (const gchar *detailed_name,
88 gchar **action_name,
89 GVariant **target_value,
90 GError **error);
92 GLIB_AVAILABLE_IN_2_38
93 gchar * g_action_print_detailed_name (const gchar *action_name,
94 GVariant *target_value);
96 G_END_DECLS
98 #endif /* __G_ACTION_H__ */