run vala
[moonshot-ui.git] / src / moonshot-custom-vbox.c
1 /* moonshot-custom-vbox.c generated by valac 0.10.4, the Vala compiler
2  * generated from moonshot-custom-vbox.vala, do not modify */
3
4
5 #include <glib.h>
6 #include <glib-object.h>
7 #include <gtk/gtk.h>
8
9
10 #define TYPE_CUSTOM_VBOX (custom_vbox_get_type ())
11 #define CUSTOM_VBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CUSTOM_VBOX, CustomVBox))
12 #define CUSTOM_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CUSTOM_VBOX, CustomVBoxClass))
13 #define IS_CUSTOM_VBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CUSTOM_VBOX))
14 #define IS_CUSTOM_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CUSTOM_VBOX))
15 #define CUSTOM_VBOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CUSTOM_VBOX, CustomVBoxClass))
16
17 typedef struct _CustomVBox CustomVBox;
18 typedef struct _CustomVBoxClass CustomVBoxClass;
19 typedef struct _CustomVBoxPrivate CustomVBoxPrivate;
20
21 #define TYPE_ID_CARD_WIDGET (id_card_widget_get_type ())
22 #define ID_CARD_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ID_CARD_WIDGET, IdCardWidget))
23 #define ID_CARD_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ID_CARD_WIDGET, IdCardWidgetClass))
24 #define IS_ID_CARD_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ID_CARD_WIDGET))
25 #define IS_ID_CARD_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ID_CARD_WIDGET))
26 #define ID_CARD_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ID_CARD_WIDGET, IdCardWidgetClass))
27
28 typedef struct _IdCardWidget IdCardWidget;
29 typedef struct _IdCardWidgetClass IdCardWidgetClass;
30 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
31 #define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))
32
33 struct _CustomVBox {
34         GtkVBox parent_instance;
35         CustomVBoxPrivate * priv;
36 };
37
38 struct _CustomVBoxClass {
39         GtkVBoxClass parent_class;
40 };
41
42 struct _CustomVBoxPrivate {
43         IdCardWidget* _current_idcard;
44 };
45
46
47 static gpointer custom_vbox_parent_class = NULL;
48
49 GType custom_vbox_get_type (void) G_GNUC_CONST;
50 GType id_card_widget_get_type (void) G_GNUC_CONST;
51 #define CUSTOM_VBOX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_CUSTOM_VBOX, CustomVBoxPrivate))
52 enum  {
53         CUSTOM_VBOX_DUMMY_PROPERTY,
54         CUSTOM_VBOX_CURRENT_IDCARD
55 };
56 CustomVBox* custom_vbox_new (gboolean homogeneous, gint spacing);
57 CustomVBox* custom_vbox_construct (GType object_type, gboolean homogeneous, gint spacing);
58 void custom_vbox_receive_expanded_event (CustomVBox* self, IdCardWidget* id_card_widget);
59 void id_card_widget_collapse (IdCardWidget* self);
60 void custom_vbox_add_id_card_widget (CustomVBox* self, IdCardWidget* id_card_widget);
61 void custom_vbox_remove_id_card_widget (CustomVBox* self, IdCardWidget* id_card_widget);
62 IdCardWidget* custom_vbox_get_current_idcard (CustomVBox* self);
63 void custom_vbox_set_current_idcard (CustomVBox* self, IdCardWidget* value);
64 static void custom_vbox_finalize (GObject* obj);
65 static void custom_vbox_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
66 static void custom_vbox_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
67
68
69
70 CustomVBox* custom_vbox_construct (GType object_type, gboolean homogeneous, gint spacing) {
71         CustomVBox * self;
72         self = g_object_newv (object_type, 0, NULL);
73         gtk_box_set_homogeneous ((GtkBox*) self, homogeneous);
74         gtk_box_set_spacing ((GtkBox*) self, spacing);
75         return self;
76 }
77
78
79 CustomVBox* custom_vbox_new (gboolean homogeneous, gint spacing) {
80         return custom_vbox_construct (TYPE_CUSTOM_VBOX, homogeneous, spacing);
81 }
82
83
84 static gpointer _g_object_ref0 (gpointer self) {
85         return self ? g_object_ref (self) : NULL;
86 }
87
88
89 void custom_vbox_receive_expanded_event (CustomVBox* self, IdCardWidget* id_card_widget) {
90         GList* list;
91         g_return_if_fail (self != NULL);
92         g_return_if_fail (id_card_widget != NULL);
93         list = gtk_container_get_children ((GtkContainer*) self);
94         {
95                 GList* id_card_collection;
96                 GList* id_card_it;
97                 id_card_collection = list;
98                 for (id_card_it = id_card_collection; id_card_it != NULL; id_card_it = id_card_it->next) {
99                         GtkWidget* id_card;
100                         id_card = _g_object_ref0 ((GtkWidget*) id_card_it->data);
101                         {
102                                 if (id_card != GTK_WIDGET (id_card_widget)) {
103                                         id_card_widget_collapse (ID_CARD_WIDGET (id_card));
104                                 }
105                                 _g_object_unref0 (id_card);
106                         }
107                 }
108         }
109         _g_list_free0 (list);
110 }
111
112
113 void custom_vbox_add_id_card_widget (CustomVBox* self, IdCardWidget* id_card_widget) {
114         g_return_if_fail (self != NULL);
115         g_return_if_fail (id_card_widget != NULL);
116         gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) id_card_widget, FALSE, FALSE, 0);
117 }
118
119
120 void custom_vbox_remove_id_card_widget (CustomVBox* self, IdCardWidget* id_card_widget) {
121         g_return_if_fail (self != NULL);
122         g_return_if_fail (id_card_widget != NULL);
123         gtk_container_remove ((GtkContainer*) self, (GtkWidget*) id_card_widget);
124 }
125
126
127 IdCardWidget* custom_vbox_get_current_idcard (CustomVBox* self) {
128         IdCardWidget* result;
129         g_return_val_if_fail (self != NULL, NULL);
130         result = self->priv->_current_idcard;
131         return result;
132 }
133
134
135 void custom_vbox_set_current_idcard (CustomVBox* self, IdCardWidget* value) {
136         IdCardWidget* _tmp0_;
137         g_return_if_fail (self != NULL);
138         self->priv->_current_idcard = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_current_idcard), _tmp0_);
139         g_object_notify ((GObject *) self, "current-idcard");
140 }
141
142
143 static void custom_vbox_class_init (CustomVBoxClass * klass) {
144         custom_vbox_parent_class = g_type_class_peek_parent (klass);
145         g_type_class_add_private (klass, sizeof (CustomVBoxPrivate));
146         G_OBJECT_CLASS (klass)->get_property = custom_vbox_get_property;
147         G_OBJECT_CLASS (klass)->set_property = custom_vbox_set_property;
148         G_OBJECT_CLASS (klass)->finalize = custom_vbox_finalize;
149         g_object_class_install_property (G_OBJECT_CLASS (klass), CUSTOM_VBOX_CURRENT_IDCARD, g_param_spec_object ("current-idcard", "current-idcard", "current-idcard", TYPE_ID_CARD_WIDGET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
150 }
151
152
153 static void custom_vbox_instance_init (CustomVBox * self) {
154         self->priv = CUSTOM_VBOX_GET_PRIVATE (self);
155         self->priv->_current_idcard = NULL;
156 }
157
158
159 static void custom_vbox_finalize (GObject* obj) {
160         CustomVBox * self;
161         self = CUSTOM_VBOX (obj);
162         _g_object_unref0 (self->priv->_current_idcard);
163         G_OBJECT_CLASS (custom_vbox_parent_class)->finalize (obj);
164 }
165
166
167 GType custom_vbox_get_type (void) {
168         static volatile gsize custom_vbox_type_id__volatile = 0;
169         if (g_once_init_enter (&custom_vbox_type_id__volatile)) {
170                 static const GTypeInfo g_define_type_info = { sizeof (CustomVBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) custom_vbox_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CustomVBox), 0, (GInstanceInitFunc) custom_vbox_instance_init, NULL };
171                 GType custom_vbox_type_id;
172                 custom_vbox_type_id = g_type_register_static (GTK_TYPE_VBOX, "CustomVBox", &g_define_type_info, 0);
173                 g_once_init_leave (&custom_vbox_type_id__volatile, custom_vbox_type_id);
174         }
175         return custom_vbox_type_id__volatile;
176 }
177
178
179 static void custom_vbox_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
180         CustomVBox * self;
181         self = CUSTOM_VBOX (object);
182         switch (property_id) {
183                 case CUSTOM_VBOX_CURRENT_IDCARD:
184                 g_value_set_object (value, custom_vbox_get_current_idcard (self));
185                 break;
186                 default:
187                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
188                 break;
189         }
190 }
191
192
193 static void custom_vbox_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
194         CustomVBox * self;
195         self = CUSTOM_VBOX (object);
196         switch (property_id) {
197                 case CUSTOM_VBOX_CURRENT_IDCARD:
198                 custom_vbox_set_current_idcard (self, g_value_get_object (value));
199                 break;
200                 default:
201                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
202                 break;
203         }
204 }
205
206
207
208