1 /*
2  * Copyright (C) 2007 Juan Pablo Ugarte.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program 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
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * Authors:
19  *   Juan Pablo Ugarte <juanpablougarte@gmail.com>
20  */
21 
22 #ifndef _GLADE_WIDGET_ACTION_H_
23 #define _GLADE_WIDGET_ACTION_H_
24 
25 #include <glib-object.h>
26 
27 G_BEGIN_DECLS
28 
29 #define GLADE_TYPE_WIDGET_ACTION             (glade_widget_action_get_type ())
30 #define GLADE_WIDGET_ACTION(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_WIDGET_ACTION, GladeWidgetAction))
31 #define GLADE_WIDGET_ACTION_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_WIDGET_ACTION, GladeWidgetActionClass))
32 #define GLADE_IS_WIDGET_ACTION(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_WIDGET_ACTION))
33 #define GLADE_IS_WIDGET_ACTION_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_WIDGET_ACTION))
34 #define GLADE_WIDGET_ACTION_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_WIDGET_ACTION, GladeWidgetActionClass))
35 
36 typedef struct _GladeWidgetActionClass   GladeWidgetActionClass;
37 typedef struct _GladeWidgetAction        GladeWidgetAction;
38 typedef struct _GladeWidgetActionPrivate GladeWidgetActionPrivate;
39 typedef struct _GWActionClass            GWActionClass;
40 
41 struct _GWActionClass
42 {
43   const gchar    *id;     /* The identifier of this action in the action tree */
44   gchar          *path;	  /* Full action path  */
45   gchar          *label;  /* A translated label to show in the UI for this action */
46   gchar          *stock;  /* If set, this stock item will be shown in the UI along side
47 			   * the label */
48   gboolean        important;  /* If this action is important */
49 
50   GList          *actions;/* Recursive list of child actions */
51 };
52 
53 struct _GladeWidgetAction
54 {
55   GObject parent_instance;
56 
57   GladeWidgetActionPrivate *priv;
58 };
59 
60 struct _GladeWidgetActionClass
61 {
62   GObjectClass parent_class;
63 
64   void   (* glade_reserved1)   (void);
65   void   (* glade_reserved2)   (void);
66   void   (* glade_reserved3)   (void);
67   void   (* glade_reserved4)   (void);
68 };
69 
70 
71 GType          glade_widget_action_get_type      (void) G_GNUC_CONST;
72 
73 void           glade_widget_action_set_sensitive (GladeWidgetAction *action,
74 						  gboolean           sensitive);
75 gboolean       glade_widget_action_get_sensitive (GladeWidgetAction *action);
76 void           glade_widget_action_set_visible   (GladeWidgetAction *action,
77 						  gboolean           visible);
78 gboolean       glade_widget_action_get_visible   (GladeWidgetAction *action);
79 GList         *glade_widget_action_get_children  (GladeWidgetAction *action);
80 GWActionClass *glade_widget_action_get_class     (GladeWidgetAction *action);
81 
82 
83 GWActionClass *glade_widget_action_class_new           (const gchar   *path);
84 GWActionClass *glade_widget_action_class_clone         (GWActionClass *action);
85 void           glade_widget_action_class_free          (GWActionClass *action);
86 void           glade_widget_action_class_set_label     (GWActionClass *action,
87 							const gchar   *label);
88 void           glade_widget_action_class_set_stock     (GWActionClass *action,
89 							const gchar   *stock);
90 void           glade_widget_action_class_set_important (GWActionClass *action,
91 							gboolean       important);
92 
93 
94 G_END_DECLS
95 
96 #endif /* _GLADE_WIDGET_ACTION_H_ */
97