gactiongroup.h 8.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
/*
 * Copyright © 2010 Codethink Limited
 *
 * This program 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 of the licence or (at
 * your option) any later version.
 *
 * 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
 * Public License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Authors: Ryan Lortie <desrt@desrt.ca>
 */

#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
#error "Only <gio/gio.h> can be included directly."
#endif

#ifndef __G_ACTION_GROUP_H__
#define __G_ACTION_GROUP_H__

#include <gio/giotypes.h>

G_BEGIN_DECLS


34 35 36 37 38 39 40 41
#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))

42
typedef struct _GActionGroupInterface                       GActionGroupInterface;
43

44
struct _GActionGroupInterface
45
{
46
  GTypeInterface g_iface;
47 48

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

52
  gchar **              (* list_actions)               (GActionGroup  *action_group);
53

54 55
  gboolean              (* get_action_enabled)         (GActionGroup  *action_group,
                                                        const gchar   *action_name);
56

57 58
  const GVariantType *  (* get_action_parameter_type)  (GActionGroup  *action_group,
                                                        const gchar   *action_name);
59

60 61
  const GVariantType *  (* get_action_state_type)      (GActionGroup  *action_group,
                                                        const gchar   *action_name);
62

63 64
  GVariant *            (* get_action_state_hint)      (GActionGroup  *action_group,
                                                        const gchar   *action_name);
65

66 67
  GVariant *            (* get_action_state)           (GActionGroup  *action_group,
                                                        const gchar   *action_name);
68

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

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

  /* signals */
78 79 80 81 82 83 84
  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);
85 86
  void                  (* action_state_changed)       (GActionGroup   *action_group,
                                                        const gchar    *action_name,
87
                                                        GVariant       *state);
88 89 90 91 92 93 94 95 96

  /* 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);
97 98 99 100 101 102 103 104
};

GType                   g_action_group_get_type                         (void) G_GNUC_CONST;

gboolean                g_action_group_has_action                       (GActionGroup *action_group,
                                                                         const gchar  *action_name);
gchar **                g_action_group_list_actions                     (GActionGroup *action_group);

105
const GVariantType *    g_action_group_get_action_parameter_type        (GActionGroup *action_group,
106
                                                                         const gchar  *action_name);
107
const GVariantType *    g_action_group_get_action_state_type            (GActionGroup *action_group,
108
                                                                         const gchar  *action_name);
109
GVariant *              g_action_group_get_action_state_hint            (GActionGroup *action_group,
110 111
                                                                         const gchar  *action_name);

112
gboolean                g_action_group_get_action_enabled               (GActionGroup *action_group,
113 114
                                                                         const gchar  *action_name);

115
GVariant *              g_action_group_get_action_state                 (GActionGroup *action_group,
116
                                                                         const gchar  *action_name);
117
void                    g_action_group_change_action_state              (GActionGroup *action_group,
118 119 120
                                                                         const gchar  *action_name,
                                                                         GVariant     *value);

121
void                    g_action_group_activate_action                  (GActionGroup *action_group,
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
                                                                         const gchar  *action_name,
                                                                         GVariant     *parameter);

/* signals */
void                    g_action_group_action_added                     (GActionGroup *action_group,
                                                                         const gchar  *action_name);
void                    g_action_group_action_removed                   (GActionGroup *action_group,
                                                                         const gchar  *action_name);
void                    g_action_group_action_enabled_changed           (GActionGroup *action_group,
                                                                         const gchar  *action_name,
                                                                         gboolean      enabled);

void                    g_action_group_action_state_changed             (GActionGroup *action_group,
                                                                         const gchar  *action_name,
                                                                         GVariant     *state);

138 139 140 141 142 143 144 145
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);

146 147 148
G_END_DECLS

#endif /* __G_ACTION_GROUP_H__ */