GAction is now an interface
[platform/upstream/glib.git] / gio / gsimpleaction.h
1 /*
2  * Copyright © 2010 Codethink Limited
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published
6  * by the Free Software Foundation; either version 2 of the licence or (at
7  * 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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17  * Boston, MA 02111-1307, USA.
18  *
19  * Authors: Ryan Lortie <desrt@desrt.ca>
20  */
21
22 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
23 #error "Only <gio/gio.h> can be included directly."
24 #endif
25
26 #ifndef __G_SIMPLE_ACTION_H__
27 #define __G_SIMPLE_ACTION_H__
28
29 #include <gio/giotypes.h>
30
31 G_BEGIN_DECLS
32
33 #define G_TYPE_SIMPLE_ACTION                                (g_simple_action_get_type ())
34 #define G_SIMPLE_ACTION(inst)                               (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
35                                                              G_TYPE_SIMPLE_ACTION, GSimpleAction))
36 #define G_SIMPLE_ACTION_CLASS(class)                        (G_TYPE_CHECK_CLASS_CAST ((class),                       \
37                                                              G_TYPE_SIMPLE_ACTION, GSimpleActionClass))
38 #define G_IS_SIMPLE_ACTION(inst)                            (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
39                                                              G_TYPE_SIMPLE_ACTION))
40 #define G_IS_SIMPLE_ACTION_CLASS(class)                     (G_TYPE_CHECK_CLASS_TYPE ((class),                       \
41                                                              G_TYPE_SIMPLE_ACTION))
42 #define G_SIMPLE_ACTION_GET_CLASS(inst)                     (G_TYPE_INSTANCE_GET_CLASS ((inst),                      \
43                                                              G_TYPE_SIMPLE_ACTION, GSimpleActionClass))
44
45 typedef struct _GSimpleActionPrivate                        GSimpleActionPrivate;
46 typedef struct _GSimpleActionClass                          GSimpleActionClass;
47
48 /**
49  * GSimpleAction:
50  *
51  * The <structname>GSimpleAction</structname> structure contains private
52  * data and should only be accessed using the provided API
53  *
54  * Since: 2.26
55  */
56 struct _GSimpleAction
57 {
58   /*< private >*/
59   GObject parent_instance;
60
61   GSimpleActionPrivate *priv;
62 };
63
64 /**
65  * GSimpleActionClass:
66  * @activate: the class closure for the activate signal
67  *
68  * Since: 2.26
69  */
70 struct _GSimpleActionClass
71 {
72   GObjectClass parent_class;
73
74   /* signals */
75   void  (* activate)  (GSimpleAction *simple,
76                        GVariant      *parameter);
77   /*< private >*/
78   gpointer padding[6];
79 };
80
81 GType                   g_simple_action_get_type                        (void) G_GNUC_CONST;
82
83 GSimpleAction *         g_simple_action_new                             (const gchar        *name,
84                                                                          const GVariantType *parameter_type);
85
86 GSimpleAction *         g_simple_action_new_stateful                    (const gchar        *name,
87                                                                          const GVariantType *parameter_type,
88                                                                          GVariant           *state);
89
90 void                    g_simple_action_set_enabled                     (GSimpleAction      *simple,
91                                                                          gboolean            enabled);
92
93 G_END_DECLS
94
95 #endif /* __G_SIMPLE_ACTION_H__ */