gactiongroup.h 8.95 KB
Newer Older
1 2 3
/*
 * Copyright © 2010 Codethink Limited
 *
4 5 6 7
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
8 9 10 11 12 13 14
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * 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 18 19
 *
 * Authors: Ryan Lortie <desrt@desrt.ca>
 */

20 21 22
#ifndef __G_ACTION_GROUP_H__
#define __G_ACTION_GROUP_H__

23 24 25 26 27 28 29 30 31
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
#error "Only <gio/gio.h> can be included directly."
#endif

#include <gio/giotypes.h>

G_BEGIN_DECLS


32 33 34 35 36 37 38 39
#define G_TYPE_ACTION_GROUP                                 (g_action_group_get_type ())
#define G_ACTION_GROUP(inst)                                (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
                                                             G_TYPE_ACTION_GROUP, GActionGroup))
#define G_IS_ACTION_GROUP(inst)                             (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
                                                             G_TYPE_ACTION_GROUP))
#define G_ACTION_GROUP_GET_IFACE(inst)                      (G_TYPE_INSTANCE_GET_INTERFACE ((inst),                  \
                                                             G_TYPE_ACTION_GROUP, GActionGroupInterface))

40
typedef struct _GActionGroupInterface                       GActionGroupInterface;
41

42
struct _GActionGroupInterface
43
{
44
  GTypeInterface g_iface;
45 46

  /* virtual functions */
47 48
  gboolean              (* has_action)                 (GActionGroup  *action_group,
                                                        const gchar   *action_name);
49

50
  gchar **              (* list_actions)               (GActionGroup  *action_group);
51

52 53
  gboolean              (* get_action_enabled)         (GActionGroup  *action_group,
                                                        const gchar   *action_name);
54

55 56
  const GVariantType *  (* get_action_parameter_type)  (GActionGroup  *action_group,
                                                        const gchar   *action_name);
57

58 59
  const GVariantType *  (* get_action_state_type)      (GActionGroup  *action_group,
                                                        const gchar   *action_name);
60

61 62
  GVariant *            (* get_action_state_hint)      (GActionGroup  *action_group,
                                                        const gchar   *action_name);
63

64 65
  GVariant *            (* get_action_state)           (GActionGroup  *action_group,
                                                        const gchar   *action_name);
66

67 68 69
  void                  (* change_action_state)        (GActionGroup  *action_group,
                                                        const gchar   *action_name,
                                                        GVariant      *value);
70

71 72 73
  void                  (* activate_action)            (GActionGroup  *action_group,
                                                        const gchar   *action_name,
                                                        GVariant      *parameter);
74 75

  /* signals */
76 77 78 79 80 81 82
  void                  (* action_added)               (GActionGroup  *action_group,
                                                        const gchar   *action_name);
  void                  (* action_removed)             (GActionGroup  *action_group,
                                                        const gchar   *action_name);
  void                  (* action_enabled_changed)     (GActionGroup  *action_group,
                                                        const gchar   *action_name,
                                                        gboolean       enabled);
83 84
  void                  (* action_state_changed)       (GActionGroup   *action_group,
                                                        const gchar    *action_name,
85
                                                        GVariant       *state);
86 87 88 89 90 91 92 93 94

  /* more virtual functions */
  gboolean              (* query_action)               (GActionGroup        *action_group,
                                                        const gchar         *action_name,
                                                        gboolean            *enabled,
                                                        const GVariantType **parameter_type,
                                                        const GVariantType **state_type,
                                                        GVariant           **state_hint,
                                                        GVariant           **state);
95 96
};

97
GLIB_AVAILABLE_IN_ALL
98 99
GType                   g_action_group_get_type                         (void) G_GNUC_CONST;

100
GLIB_AVAILABLE_IN_ALL
101 102
gboolean                g_action_group_has_action                       (GActionGroup *action_group,
                                                                         const gchar  *action_name);
103
GLIB_AVAILABLE_IN_ALL
104 105
gchar **                g_action_group_list_actions                     (GActionGroup *action_group);

106
GLIB_AVAILABLE_IN_ALL
107
const GVariantType *    g_action_group_get_action_parameter_type        (GActionGroup *action_group,
108
                                                                         const gchar  *action_name);
109
GLIB_AVAILABLE_IN_ALL
110
const GVariantType *    g_action_group_get_action_state_type            (GActionGroup *action_group,
111
                                                                         const gchar  *action_name);
112
GLIB_AVAILABLE_IN_ALL
113
GVariant *              g_action_group_get_action_state_hint            (GActionGroup *action_group,
114 115
                                                                         const gchar  *action_name);

116
GLIB_AVAILABLE_IN_ALL
117
gboolean                g_action_group_get_action_enabled               (GActionGroup *action_group,
118 119
                                                                         const gchar  *action_name);

120
GLIB_AVAILABLE_IN_ALL
121
GVariant *              g_action_group_get_action_state                 (GActionGroup *action_group,
122
                                                                         const gchar  *action_name);
123
GLIB_AVAILABLE_IN_ALL
124
void                    g_action_group_change_action_state              (GActionGroup *action_group,
125 126 127
                                                                         const gchar  *action_name,
                                                                         GVariant     *value);

128
GLIB_AVAILABLE_IN_ALL
129
void                    g_action_group_activate_action                  (GActionGroup *action_group,
130 131 132 133
                                                                         const gchar  *action_name,
                                                                         GVariant     *parameter);

/* signals */
134
GLIB_AVAILABLE_IN_ALL
135 136
void                    g_action_group_action_added                     (GActionGroup *action_group,
                                                                         const gchar  *action_name);
137
GLIB_AVAILABLE_IN_ALL
138 139
void                    g_action_group_action_removed                   (GActionGroup *action_group,
                                                                         const gchar  *action_name);
140
GLIB_AVAILABLE_IN_ALL
141 142 143 144
void                    g_action_group_action_enabled_changed           (GActionGroup *action_group,
                                                                         const gchar  *action_name,
                                                                         gboolean      enabled);

145
GLIB_AVAILABLE_IN_ALL
146 147 148 149
void                    g_action_group_action_state_changed             (GActionGroup *action_group,
                                                                         const gchar  *action_name,
                                                                         GVariant     *state);

150
GLIB_AVAILABLE_IN_2_32
151 152 153 154 155 156 157 158
gboolean                g_action_group_query_action                     (GActionGroup        *action_group,
                                                                         const gchar         *action_name,
                                                                         gboolean            *enabled,
                                                                         const GVariantType **parameter_type,
                                                                         const GVariantType **state_type,
                                                                         GVariant           **state_hint,
                                                                         GVariant           **state);

159 160 161
G_END_DECLS

#endif /* __G_ACTION_GROUP_H__ */