1 /* level-model.c generated by valac 0.32.0.49-00a57, the Vala compiler
2 * generated from level-model.vala, do not modify */
3
4
5 #include <glib.h>
6 #include <glib-object.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <gee.h>
10
11
12 #define CARIBOU_TYPE_ISCANNABLE_GROUP (caribou_iscannable_group_get_type ())
13 #define CARIBOU_ISCANNABLE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_ISCANNABLE_GROUP, CaribouIScannableGroup))
14 #define CARIBOU_IS_ISCANNABLE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_ISCANNABLE_GROUP))
15 #define CARIBOU_ISCANNABLE_GROUP_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CARIBOU_TYPE_ISCANNABLE_GROUP, CaribouIScannableGroupIface))
16
17 typedef struct _CaribouIScannableGroup CaribouIScannableGroup;
18 typedef struct _CaribouIScannableGroupIface CaribouIScannableGroupIface;
19
20 #define CARIBOU_TYPE_ISCANNABLE_ITEM (caribou_iscannable_item_get_type ())
21 #define CARIBOU_ISCANNABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_ISCANNABLE_ITEM, CaribouIScannableItem))
22 #define CARIBOU_IS_ISCANNABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_ISCANNABLE_ITEM))
23 #define CARIBOU_ISCANNABLE_ITEM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CARIBOU_TYPE_ISCANNABLE_ITEM, CaribouIScannableItemIface))
24
25 typedef struct _CaribouIScannableItem CaribouIScannableItem;
26 typedef struct _CaribouIScannableItemIface CaribouIScannableItemIface;
27
28 #define CARIBOU_TYPE_SCAN_GROUPING (caribou_scan_grouping_get_type ())
29
30 #define CARIBOU_TYPE_SCANNABLE_GROUP (caribou_scannable_group_get_type ())
31 #define CARIBOU_SCANNABLE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_SCANNABLE_GROUP, CaribouScannableGroup))
32 #define CARIBOU_SCANNABLE_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_SCANNABLE_GROUP, CaribouScannableGroupClass))
33 #define CARIBOU_IS_SCANNABLE_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_SCANNABLE_GROUP))
34 #define CARIBOU_IS_SCANNABLE_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_SCANNABLE_GROUP))
35 #define CARIBOU_SCANNABLE_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_SCANNABLE_GROUP, CaribouScannableGroupClass))
36
37 typedef struct _CaribouScannableGroup CaribouScannableGroup;
38 typedef struct _CaribouScannableGroupClass CaribouScannableGroupClass;
39 typedef struct _CaribouScannableGroupPrivate CaribouScannableGroupPrivate;
40
41 #define CARIBOU_TYPE_IKEYBOARD_OBJECT (caribou_ikeyboard_object_get_type ())
42 #define CARIBOU_IKEYBOARD_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_IKEYBOARD_OBJECT, CaribouIKeyboardObject))
43 #define CARIBOU_IS_IKEYBOARD_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_IKEYBOARD_OBJECT))
44 #define CARIBOU_IKEYBOARD_OBJECT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CARIBOU_TYPE_IKEYBOARD_OBJECT, CaribouIKeyboardObjectIface))
45
46 typedef struct _CaribouIKeyboardObject CaribouIKeyboardObject;
47 typedef struct _CaribouIKeyboardObjectIface CaribouIKeyboardObjectIface;
48
49 #define CARIBOU_TYPE_KEY_MODEL (caribou_key_model_get_type ())
50 #define CARIBOU_KEY_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_KEY_MODEL, CaribouKeyModel))
51 #define CARIBOU_KEY_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_KEY_MODEL, CaribouKeyModelClass))
52 #define CARIBOU_IS_KEY_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_KEY_MODEL))
53 #define CARIBOU_IS_KEY_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_KEY_MODEL))
54 #define CARIBOU_KEY_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_KEY_MODEL, CaribouKeyModelClass))
55
56 typedef struct _CaribouKeyModel CaribouKeyModel;
57 typedef struct _CaribouKeyModelClass CaribouKeyModelClass;
58
59 #define CARIBOU_TYPE_LEVEL_MODEL (caribou_level_model_get_type ())
60 #define CARIBOU_LEVEL_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_LEVEL_MODEL, CaribouLevelModel))
61 #define CARIBOU_LEVEL_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_LEVEL_MODEL, CaribouLevelModelClass))
62 #define CARIBOU_IS_LEVEL_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_LEVEL_MODEL))
63 #define CARIBOU_IS_LEVEL_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_LEVEL_MODEL))
64 #define CARIBOU_LEVEL_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_LEVEL_MODEL, CaribouLevelModelClass))
65
66 typedef struct _CaribouLevelModel CaribouLevelModel;
67 typedef struct _CaribouLevelModelClass CaribouLevelModelClass;
68 typedef struct _CaribouLevelModelPrivate CaribouLevelModelPrivate;
69
70 #define CARIBOU_TYPE_ROW_MODEL (caribou_row_model_get_type ())
71 #define CARIBOU_ROW_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CARIBOU_TYPE_ROW_MODEL, CaribouRowModel))
72 #define CARIBOU_ROW_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CARIBOU_TYPE_ROW_MODEL, CaribouRowModelClass))
73 #define CARIBOU_IS_ROW_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CARIBOU_TYPE_ROW_MODEL))
74 #define CARIBOU_IS_ROW_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CARIBOU_TYPE_ROW_MODEL))
75 #define CARIBOU_ROW_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CARIBOU_TYPE_ROW_MODEL, CaribouRowModelClass))
76
77 typedef struct _CaribouRowModel CaribouRowModel;
78 typedef struct _CaribouRowModelClass CaribouRowModelClass;
79 #define _g_free0(var) (var = (g_free (var), NULL))
80 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
81
82 struct _CaribouIScannableItemIface {
83 GTypeInterface parent_iface;
84 gboolean (*get_scan_stepping) (CaribouIScannableItem* self);
85 void (*set_scan_stepping) (CaribouIScannableItem* self, gboolean value);
86 gboolean (*get_scan_selected) (CaribouIScannableItem* self);
87 void (*set_scan_selected) (CaribouIScannableItem* self, gboolean value);
88 };
89
90 typedef enum {
91 CARIBOU_SCAN_GROUPING_NONE,
92 CARIBOU_SCAN_GROUPING_SUBGROUPS,
93 CARIBOU_SCAN_GROUPING_ROWS,
94 CARIBOU_SCAN_GROUPING_LINEAR
95 } CaribouScanGrouping;
96
97 struct _CaribouIScannableGroupIface {
98 GTypeInterface parent_iface;
99 CaribouIScannableItem* (*child_select) (CaribouIScannableGroup* self);
100 void (*scan_reset) (CaribouIScannableGroup* self);
101 CaribouIScannableItem** (*get_scan_children) (CaribouIScannableGroup* self, int* result_length1);
102 CaribouIScannableItem* (*child_step) (CaribouIScannableGroup* self, gint cycles);
103 CaribouIScannableItem** (*get_step_path) (CaribouIScannableGroup* self, int* result_length1);
104 CaribouIScannableItem** (*get_selected_path) (CaribouIScannableGroup* self, int* result_length1);
105 CaribouScanGrouping (*get_scan_grouping) (CaribouIScannableGroup* self);
106 void (*set_scan_grouping) (CaribouIScannableGroup* self, CaribouScanGrouping value);
107 };
108
109 struct _CaribouScannableGroup {
110 GObject parent_instance;
111 CaribouScannableGroupPrivate * priv;
112 };
113
114 struct _CaribouScannableGroupClass {
115 GObjectClass parent_class;
116 CaribouIScannableItem** (*get_scan_children) (CaribouScannableGroup* self, int* result_length1);
117 CaribouIScannableItem* (*child_select) (CaribouScannableGroup* self);
118 };
119
120 struct _CaribouIKeyboardObjectIface {
121 GTypeInterface parent_iface;
122 CaribouIKeyboardObject** (*get_children) (CaribouIKeyboardObject* self, int* result_length1);
123 CaribouKeyModel** (*get_keys) (CaribouIKeyboardObject* self, int* result_length1);
124 };
125
126 struct _CaribouLevelModel {
127 CaribouScannableGroup parent_instance;
128 CaribouLevelModelPrivate * priv;
129 };
130
131 struct _CaribouLevelModelClass {
132 CaribouScannableGroupClass parent_class;
133 };
134
135 struct _CaribouLevelModelPrivate {
136 gchar* _mode;
137 GeeArrayList* rows;
138 };
139
140
141 static gpointer caribou_level_model_parent_class = NULL;
142 static CaribouIKeyboardObjectIface* caribou_level_model_caribou_ikeyboard_object_parent_iface = NULL;
143
144 GType caribou_iscannable_item_get_type (void) G_GNUC_CONST;
145 GType caribou_scan_grouping_get_type (void) G_GNUC_CONST;
146 GType caribou_iscannable_group_get_type (void) G_GNUC_CONST;
147 GType caribou_scannable_group_get_type (void) G_GNUC_CONST;
148 GType caribou_key_model_get_type (void) G_GNUC_CONST;
149 GType caribou_ikeyboard_object_get_type (void) G_GNUC_CONST;
150 GType caribou_level_model_get_type (void) G_GNUC_CONST;
151 GType caribou_row_model_get_type (void) G_GNUC_CONST;
152 #define CARIBOU_LEVEL_MODEL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CARIBOU_TYPE_LEVEL_MODEL, CaribouLevelModelPrivate))
153 enum {
154 CARIBOU_LEVEL_MODEL_DUMMY_PROPERTY,
155 CARIBOU_LEVEL_MODEL_MODE
156 };
157 CaribouLevelModel* caribou_level_model_new (const gchar* mode);
158 CaribouLevelModel* caribou_level_model_construct (GType object_type, const gchar* mode);
159 CaribouScannableGroup* caribou_scannable_group_construct (GType object_type);
160 static void caribou_level_model_set_mode (CaribouLevelModel* self, const gchar* value);
161 void caribou_level_model_add_row (CaribouLevelModel* self, CaribouRowModel* row);
162 static void caribou_level_model_on_key_clicked (CaribouLevelModel* self, CaribouKeyModel* key);
163 static void _caribou_level_model_on_key_clicked_caribou_ikeyboard_object_key_clicked (CaribouIKeyboardObject* _sender, CaribouKeyModel* key, gpointer self);
164 static void __lambda11_ (CaribouLevelModel* self, CaribouKeyModel* k);
165 static void ___lambda11__caribou_ikeyboard_object_key_pressed (CaribouIKeyboardObject* _sender, CaribouKeyModel* key, gpointer self);
166 static void __lambda12_ (CaribouLevelModel* self, CaribouKeyModel* k);
167 static void ___lambda12__caribou_ikeyboard_object_key_released (CaribouIKeyboardObject* _sender, CaribouKeyModel* key, gpointer self);
168 CaribouRowModel** caribou_level_model_get_rows (CaribouLevelModel* self, int* result_length1);
169 const gchar* caribou_key_model_get_toggle (CaribouKeyModel* self);
170 const gchar* caribou_level_model_get_mode (CaribouLevelModel* self);
171 static CaribouIScannableItem** caribou_level_model_real_get_scan_children (CaribouScannableGroup* base, int* result_length1);
172 CaribouScanGrouping caribou_iscannable_group_get_scan_grouping (CaribouIScannableGroup* self);
173 CaribouKeyModel** caribou_ikeyboard_object_get_keys (CaribouIKeyboardObject* self, int* result_length1);
174 static CaribouIKeyboardObject** caribou_level_model_real_get_children (CaribouIKeyboardObject* base, int* result_length1);
175 static void caribou_level_model_finalize (GObject* obj);
176 static void _vala_caribou_level_model_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
177 static void _vala_caribou_level_model_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
178
179
caribou_level_model_construct(GType object_type,const gchar * mode)180 CaribouLevelModel* caribou_level_model_construct (GType object_type, const gchar* mode) {
181 CaribouLevelModel * self = NULL;
182 const gchar* _tmp0_ = NULL;
183 GeeArrayList* _tmp1_ = NULL;
184 g_return_val_if_fail (mode != NULL, NULL);
185 self = (CaribouLevelModel*) caribou_scannable_group_construct (object_type);
186 _tmp0_ = mode;
187 caribou_level_model_set_mode (self, _tmp0_);
188 _tmp1_ = gee_array_list_new (CARIBOU_TYPE_ROW_MODEL, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
189 _g_object_unref0 (self->priv->rows);
190 self->priv->rows = _tmp1_;
191 return self;
192 }
193
194
caribou_level_model_new(const gchar * mode)195 CaribouLevelModel* caribou_level_model_new (const gchar* mode) {
196 return caribou_level_model_construct (CARIBOU_TYPE_LEVEL_MODEL, mode);
197 }
198
199
_caribou_level_model_on_key_clicked_caribou_ikeyboard_object_key_clicked(CaribouIKeyboardObject * _sender,CaribouKeyModel * key,gpointer self)200 static void _caribou_level_model_on_key_clicked_caribou_ikeyboard_object_key_clicked (CaribouIKeyboardObject* _sender, CaribouKeyModel* key, gpointer self) {
201 caribou_level_model_on_key_clicked ((CaribouLevelModel*) self, key);
202 }
203
204
__lambda11_(CaribouLevelModel * self,CaribouKeyModel * k)205 static void __lambda11_ (CaribouLevelModel* self, CaribouKeyModel* k) {
206 CaribouKeyModel* _tmp0_ = NULL;
207 g_return_if_fail (k != NULL);
208 _tmp0_ = k;
209 g_signal_emit_by_name ((CaribouIKeyboardObject*) self, "key-pressed", _tmp0_);
210 }
211
212
___lambda11__caribou_ikeyboard_object_key_pressed(CaribouIKeyboardObject * _sender,CaribouKeyModel * key,gpointer self)213 static void ___lambda11__caribou_ikeyboard_object_key_pressed (CaribouIKeyboardObject* _sender, CaribouKeyModel* key, gpointer self) {
214 __lambda11_ ((CaribouLevelModel*) self, key);
215 }
216
217
__lambda12_(CaribouLevelModel * self,CaribouKeyModel * k)218 static void __lambda12_ (CaribouLevelModel* self, CaribouKeyModel* k) {
219 CaribouKeyModel* _tmp0_ = NULL;
220 g_return_if_fail (k != NULL);
221 _tmp0_ = k;
222 g_signal_emit_by_name ((CaribouIKeyboardObject*) self, "key-released", _tmp0_);
223 }
224
225
___lambda12__caribou_ikeyboard_object_key_released(CaribouIKeyboardObject * _sender,CaribouKeyModel * key,gpointer self)226 static void ___lambda12__caribou_ikeyboard_object_key_released (CaribouIKeyboardObject* _sender, CaribouKeyModel* key, gpointer self) {
227 __lambda12_ ((CaribouLevelModel*) self, key);
228 }
229
230
caribou_level_model_add_row(CaribouLevelModel * self,CaribouRowModel * row)231 void caribou_level_model_add_row (CaribouLevelModel* self, CaribouRowModel* row) {
232 CaribouRowModel* _tmp0_ = NULL;
233 CaribouRowModel* _tmp1_ = NULL;
234 CaribouRowModel* _tmp2_ = NULL;
235 GeeArrayList* _tmp3_ = NULL;
236 CaribouRowModel* _tmp4_ = NULL;
237 g_return_if_fail (self != NULL);
238 g_return_if_fail (row != NULL);
239 _tmp0_ = row;
240 g_signal_connect_object ((CaribouIKeyboardObject*) _tmp0_, "key-clicked", (GCallback) _caribou_level_model_on_key_clicked_caribou_ikeyboard_object_key_clicked, self, 0);
241 _tmp1_ = row;
242 g_signal_connect_object ((CaribouIKeyboardObject*) _tmp1_, "key-pressed", (GCallback) ___lambda11__caribou_ikeyboard_object_key_pressed, self, 0);
243 _tmp2_ = row;
244 g_signal_connect_object ((CaribouIKeyboardObject*) _tmp2_, "key-released", (GCallback) ___lambda12__caribou_ikeyboard_object_key_released, self, 0);
245 _tmp3_ = self->priv->rows;
246 _tmp4_ = row;
247 gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, _tmp4_);
248 }
249
250
caribou_level_model_get_rows(CaribouLevelModel * self,int * result_length1)251 CaribouRowModel** caribou_level_model_get_rows (CaribouLevelModel* self, int* result_length1) {
252 CaribouRowModel** result = NULL;
253 GeeArrayList* _tmp0_ = NULL;
254 gint _tmp1_ = 0;
255 gpointer* _tmp2_ = NULL;
256 CaribouRowModel** _tmp3_ = NULL;
257 gint _tmp3__length1 = 0;
258 g_return_val_if_fail (self != NULL, NULL);
259 _tmp0_ = self->priv->rows;
260 _tmp2_ = gee_collection_to_array ((GeeCollection*) _tmp0_, &_tmp1_);
261 _tmp3_ = (CaribouRowModel**) _tmp2_;
262 _tmp3__length1 = (_tmp1_ * sizeof (CaribouRowModel*)) / sizeof (CaribouRowModel*);
263 if (result_length1) {
264 *result_length1 = _tmp3__length1;
265 }
266 result = _tmp3_;
267 return result;
268 }
269
270
caribou_level_model_on_key_clicked(CaribouLevelModel * self,CaribouKeyModel * key)271 static void caribou_level_model_on_key_clicked (CaribouLevelModel* self, CaribouKeyModel* key) {
272 CaribouKeyModel* _tmp0_ = NULL;
273 const gchar* _tmp1_ = NULL;
274 const gchar* _tmp2_ = NULL;
275 CaribouKeyModel* _tmp7_ = NULL;
276 g_return_if_fail (self != NULL);
277 g_return_if_fail (key != NULL);
278 _tmp0_ = key;
279 _tmp1_ = caribou_key_model_get_toggle (_tmp0_);
280 _tmp2_ = _tmp1_;
281 if (g_strcmp0 (_tmp2_, "") != 0) {
282 CaribouKeyModel* _tmp3_ = NULL;
283 const gchar* _tmp4_ = NULL;
284 const gchar* _tmp5_ = NULL;
285 _tmp3_ = key;
286 _tmp4_ = caribou_key_model_get_toggle (_tmp3_);
287 _tmp5_ = _tmp4_;
288 g_signal_emit_by_name (self, "level-toggled", _tmp5_);
289 } else {
290 const gchar* _tmp6_ = NULL;
291 _tmp6_ = self->priv->_mode;
292 if (g_strcmp0 (_tmp6_, "latched") == 0) {
293 g_signal_emit_by_name (self, "level-toggled", "default");
294 }
295 }
296 _tmp7_ = key;
297 g_signal_emit_by_name ((CaribouIKeyboardObject*) self, "key-clicked", _tmp7_);
298 }
299
300
caribou_level_model_real_get_scan_children(CaribouScannableGroup * base,int * result_length1)301 static CaribouIScannableItem** caribou_level_model_real_get_scan_children (CaribouScannableGroup* base, int* result_length1) {
302 CaribouLevelModel * self;
303 CaribouIScannableItem** result = NULL;
304 CaribouScanGrouping _tmp0_ = 0;
305 CaribouScanGrouping _tmp1_ = 0;
306 self = (CaribouLevelModel*) base;
307 _tmp0_ = caribou_iscannable_group_get_scan_grouping ((CaribouIScannableGroup*) self);
308 _tmp1_ = _tmp0_;
309 if (_tmp1_ == CARIBOU_SCAN_GROUPING_LINEAR) {
310 gint _tmp2_ = 0;
311 CaribouKeyModel** _tmp3_ = NULL;
312 CaribouIScannableItem** _tmp4_ = NULL;
313 gint _tmp4__length1 = 0;
314 _tmp3_ = caribou_ikeyboard_object_get_keys ((CaribouIKeyboardObject*) self, &_tmp2_);
315 _tmp4_ = (CaribouIScannableItem**) _tmp3_;
316 _tmp4__length1 = (_tmp2_ * sizeof (CaribouKeyModel*)) / sizeof (CaribouIScannableItem*);
317 if (result_length1) {
318 *result_length1 = _tmp4__length1;
319 }
320 result = _tmp4_;
321 return result;
322 } else {
323 GeeArrayList* _tmp5_ = NULL;
324 gint _tmp6_ = 0;
325 gpointer* _tmp7_ = NULL;
326 CaribouIScannableItem** _tmp8_ = NULL;
327 gint _tmp8__length1 = 0;
328 _tmp5_ = self->priv->rows;
329 _tmp7_ = gee_collection_to_array ((GeeCollection*) _tmp5_, &_tmp6_);
330 _tmp8_ = (CaribouIScannableItem**) _tmp7_;
331 _tmp8__length1 = (_tmp6_ * sizeof (CaribouRowModel*)) / sizeof (CaribouIScannableItem*);
332 if (result_length1) {
333 *result_length1 = _tmp8__length1;
334 }
335 result = _tmp8_;
336 return result;
337 }
338 }
339
340
caribou_level_model_real_get_children(CaribouIKeyboardObject * base,int * result_length1)341 static CaribouIKeyboardObject** caribou_level_model_real_get_children (CaribouIKeyboardObject* base, int* result_length1) {
342 CaribouLevelModel * self;
343 CaribouIKeyboardObject** result = NULL;
344 gint _tmp0_ = 0;
345 CaribouRowModel** _tmp1_ = NULL;
346 CaribouIKeyboardObject** _tmp2_ = NULL;
347 gint _tmp2__length1 = 0;
348 self = (CaribouLevelModel*) base;
349 _tmp1_ = caribou_level_model_get_rows (self, &_tmp0_);
350 _tmp2_ = (CaribouIKeyboardObject**) _tmp1_;
351 _tmp2__length1 = (_tmp0_ * sizeof (CaribouRowModel*)) / sizeof (CaribouIKeyboardObject*);
352 if (result_length1) {
353 *result_length1 = _tmp2__length1;
354 }
355 result = _tmp2_;
356 return result;
357 }
358
359
caribou_level_model_get_mode(CaribouLevelModel * self)360 const gchar* caribou_level_model_get_mode (CaribouLevelModel* self) {
361 const gchar* result;
362 const gchar* _tmp0_ = NULL;
363 g_return_val_if_fail (self != NULL, NULL);
364 _tmp0_ = self->priv->_mode;
365 result = _tmp0_;
366 return result;
367 }
368
369
caribou_level_model_set_mode(CaribouLevelModel * self,const gchar * value)370 static void caribou_level_model_set_mode (CaribouLevelModel* self, const gchar* value) {
371 const gchar* _tmp0_ = NULL;
372 gchar* _tmp1_ = NULL;
373 g_return_if_fail (self != NULL);
374 _tmp0_ = value;
375 _tmp1_ = g_strdup (_tmp0_);
376 _g_free0 (self->priv->_mode);
377 self->priv->_mode = _tmp1_;
378 g_object_notify ((GObject *) self, "mode");
379 }
380
381
caribou_level_model_class_init(CaribouLevelModelClass * klass)382 static void caribou_level_model_class_init (CaribouLevelModelClass * klass) {
383 caribou_level_model_parent_class = g_type_class_peek_parent (klass);
384 g_type_class_add_private (klass, sizeof (CaribouLevelModelPrivate));
385 ((CaribouScannableGroupClass *) klass)->get_scan_children = caribou_level_model_real_get_scan_children;
386 G_OBJECT_CLASS (klass)->get_property = _vala_caribou_level_model_get_property;
387 G_OBJECT_CLASS (klass)->set_property = _vala_caribou_level_model_set_property;
388 G_OBJECT_CLASS (klass)->finalize = caribou_level_model_finalize;
389 g_object_class_install_property (G_OBJECT_CLASS (klass), CARIBOU_LEVEL_MODEL_MODE, g_param_spec_string ("mode", "mode", "mode", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
390 g_signal_new ("level_toggled", CARIBOU_TYPE_LEVEL_MODEL, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
391 }
392
393
caribou_level_model_caribou_ikeyboard_object_interface_init(CaribouIKeyboardObjectIface * iface)394 static void caribou_level_model_caribou_ikeyboard_object_interface_init (CaribouIKeyboardObjectIface * iface) {
395 caribou_level_model_caribou_ikeyboard_object_parent_iface = g_type_interface_peek_parent (iface);
396 iface->get_children = (CaribouIKeyboardObject** (*)(CaribouIKeyboardObject*, int*)) caribou_level_model_real_get_children;
397 }
398
399
caribou_level_model_instance_init(CaribouLevelModel * self)400 static void caribou_level_model_instance_init (CaribouLevelModel * self) {
401 gchar* _tmp0_ = NULL;
402 self->priv = CARIBOU_LEVEL_MODEL_GET_PRIVATE (self);
403 _tmp0_ = g_strdup ("");
404 self->priv->_mode = _tmp0_;
405 }
406
407
caribou_level_model_finalize(GObject * obj)408 static void caribou_level_model_finalize (GObject* obj) {
409 CaribouLevelModel * self;
410 self = G_TYPE_CHECK_INSTANCE_CAST (obj, CARIBOU_TYPE_LEVEL_MODEL, CaribouLevelModel);
411 _g_free0 (self->priv->_mode);
412 _g_object_unref0 (self->priv->rows);
413 G_OBJECT_CLASS (caribou_level_model_parent_class)->finalize (obj);
414 }
415
416
417 /**
418 * Object representing a level in a group.
419 *
420 * This is used for implementing custom keyboard service.
421 *
422 * A keyboard object consists of {@link RowModel} objects.
423 */
caribou_level_model_get_type(void)424 GType caribou_level_model_get_type (void) {
425 static volatile gsize caribou_level_model_type_id__volatile = 0;
426 if (g_once_init_enter (&caribou_level_model_type_id__volatile)) {
427 static const GTypeInfo g_define_type_info = { sizeof (CaribouLevelModelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) caribou_level_model_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CaribouLevelModel), 0, (GInstanceInitFunc) caribou_level_model_instance_init, NULL };
428 static const GInterfaceInfo caribou_ikeyboard_object_info = { (GInterfaceInitFunc) caribou_level_model_caribou_ikeyboard_object_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
429 GType caribou_level_model_type_id;
430 caribou_level_model_type_id = g_type_register_static (CARIBOU_TYPE_SCANNABLE_GROUP, "CaribouLevelModel", &g_define_type_info, 0);
431 g_type_add_interface_static (caribou_level_model_type_id, CARIBOU_TYPE_IKEYBOARD_OBJECT, &caribou_ikeyboard_object_info);
432 g_once_init_leave (&caribou_level_model_type_id__volatile, caribou_level_model_type_id);
433 }
434 return caribou_level_model_type_id__volatile;
435 }
436
437
_vala_caribou_level_model_get_property(GObject * object,guint property_id,GValue * value,GParamSpec * pspec)438 static void _vala_caribou_level_model_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
439 CaribouLevelModel * self;
440 self = G_TYPE_CHECK_INSTANCE_CAST (object, CARIBOU_TYPE_LEVEL_MODEL, CaribouLevelModel);
441 switch (property_id) {
442 case CARIBOU_LEVEL_MODEL_MODE:
443 g_value_set_string (value, caribou_level_model_get_mode (self));
444 break;
445 default:
446 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
447 break;
448 }
449 }
450
451
_vala_caribou_level_model_set_property(GObject * object,guint property_id,const GValue * value,GParamSpec * pspec)452 static void _vala_caribou_level_model_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
453 CaribouLevelModel * self;
454 self = G_TYPE_CHECK_INSTANCE_CAST (object, CARIBOU_TYPE_LEVEL_MODEL, CaribouLevelModel);
455 switch (property_id) {
456 case CARIBOU_LEVEL_MODEL_MODE:
457 caribou_level_model_set_mode (self, g_value_get_string (value));
458 break;
459 default:
460 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
461 break;
462 }
463 }
464
465
466
467