File: signalwaiter.c

package info (click to toggle)
libfsoframework 0.12.0-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,640 kB
  • ctags: 8,717
  • sloc: ansic: 52,981; sh: 11,367; makefile: 819
file content (711 lines) | stat: -rw-r--r-- 29,088 bytes parent folder | download | duplicates (2)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
/* signalwaiter.c generated by valac 0.16.1, the Vala compiler
 * generated from signalwaiter.vala, do not modify */

/*
 * (C) 2011-2012 Simon Busch <morphis@gravedo.de>
 *
 * This library 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.1 of the License, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gobject/gvaluecollector.h>


#define FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER (fso_framework_test_signal_wrapper_get_type ())
#define FSO_FRAMEWORK_TEST_SIGNAL_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER, FsoFrameworkTestSignalWrapper))
#define FSO_FRAMEWORK_TEST_SIGNAL_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER, FsoFrameworkTestSignalWrapperClass))
#define FSO_FRAMEWORK_TEST_IS_SIGNAL_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER))
#define FSO_FRAMEWORK_TEST_IS_SIGNAL_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER))
#define FSO_FRAMEWORK_TEST_SIGNAL_WRAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER, FsoFrameworkTestSignalWrapperClass))

typedef struct _FsoFrameworkTestSignalWrapper FsoFrameworkTestSignalWrapper;
typedef struct _FsoFrameworkTestSignalWrapperClass FsoFrameworkTestSignalWrapperClass;
typedef struct _FsoFrameworkTestSignalWrapperPrivate FsoFrameworkTestSignalWrapperPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _FsoFrameworkTestParamSpecSignalWrapper FsoFrameworkTestParamSpecSignalWrapper;

#define FSO_FRAMEWORK_TEST_TYPE_MULTI_SIGNAL_WAITER (fso_framework_test_multi_signal_waiter_get_type ())
#define FSO_FRAMEWORK_TEST_MULTI_SIGNAL_WAITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FSO_FRAMEWORK_TEST_TYPE_MULTI_SIGNAL_WAITER, FsoFrameworkTestMultiSignalWaiter))
#define FSO_FRAMEWORK_TEST_MULTI_SIGNAL_WAITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FSO_FRAMEWORK_TEST_TYPE_MULTI_SIGNAL_WAITER, FsoFrameworkTestMultiSignalWaiterClass))
#define FSO_FRAMEWORK_TEST_IS_MULTI_SIGNAL_WAITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FSO_FRAMEWORK_TEST_TYPE_MULTI_SIGNAL_WAITER))
#define FSO_FRAMEWORK_TEST_IS_MULTI_SIGNAL_WAITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FSO_FRAMEWORK_TEST_TYPE_MULTI_SIGNAL_WAITER))
#define FSO_FRAMEWORK_TEST_MULTI_SIGNAL_WAITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FSO_FRAMEWORK_TEST_TYPE_MULTI_SIGNAL_WAITER, FsoFrameworkTestMultiSignalWaiterClass))

typedef struct _FsoFrameworkTestMultiSignalWaiter FsoFrameworkTestMultiSignalWaiter;
typedef struct _FsoFrameworkTestMultiSignalWaiterClass FsoFrameworkTestMultiSignalWaiterClass;
typedef struct _FsoFrameworkTestMultiSignalWaiterPrivate FsoFrameworkTestMultiSignalWaiterPrivate;
#define __g_list_free__fso_framework_test_signal_wrapper_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__fso_framework_test_signal_wrapper_unref0_ (var), NULL)))
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
#define _fso_framework_test_signal_wrapper_unref0(var) ((var == NULL) ? NULL : (var = (fso_framework_test_signal_wrapper_unref (var), NULL)))

struct _FsoFrameworkTestSignalWrapper {
	GTypeInstance parent_instance;
	volatile int ref_count;
	FsoFrameworkTestSignalWrapperPrivate * priv;
};

struct _FsoFrameworkTestSignalWrapperClass {
	GTypeClass parent_class;
	void (*finalize) (FsoFrameworkTestSignalWrapper *self);
};

struct _FsoFrameworkTestSignalWrapperPrivate {
	GObject* _emitter;
	gchar* _signame;
	gulong _id;
	gint _timeout;
	gint _catch_count;
};

struct _FsoFrameworkTestParamSpecSignalWrapper {
	GParamSpec parent_instance;
};

struct _FsoFrameworkTestMultiSignalWaiter {
	GObject parent_instance;
	FsoFrameworkTestMultiSignalWaiterPrivate * priv;
};

struct _FsoFrameworkTestMultiSignalWaiterClass {
	GObjectClass parent_class;
};

struct _FsoFrameworkTestMultiSignalWaiterPrivate {
	GList* signals;
	guint succeeded_count;
	GMainLoop* mainloop;
};

typedef void (*FsoFrameworkTestBlock) (void* user_data);

static gpointer fso_framework_test_signal_wrapper_parent_class = NULL;
static gpointer fso_framework_test_multi_signal_waiter_parent_class = NULL;

gpointer fso_framework_test_signal_wrapper_ref (gpointer instance);
void fso_framework_test_signal_wrapper_unref (gpointer instance);
GParamSpec* fso_framework_test_param_spec_signal_wrapper (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void fso_framework_test_value_set_signal_wrapper (GValue* value, gpointer v_object);
void fso_framework_test_value_take_signal_wrapper (GValue* value, gpointer v_object);
gpointer fso_framework_test_value_get_signal_wrapper (const GValue* value);
GType fso_framework_test_signal_wrapper_get_type (void) G_GNUC_CONST;
#define FSO_FRAMEWORK_TEST_SIGNAL_WRAPPER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER, FsoFrameworkTestSignalWrapperPrivate))
enum  {
	FSO_FRAMEWORK_TEST_SIGNAL_WRAPPER_DUMMY_PROPERTY
};
gint fso_framework_test_signal_wrapper_callback (FsoFrameworkTestSignalWrapper* self);
gint fso_framework_test_signal_wrapper_get_catch_count (FsoFrameworkTestSignalWrapper* self);
void fso_framework_test_signal_wrapper_set_catch_count (FsoFrameworkTestSignalWrapper* self, gint value);
void fso_framework_test_signal_wrapper_setup (FsoFrameworkTestSignalWrapper* self);
GObject* fso_framework_test_signal_wrapper_get_emitter (FsoFrameworkTestSignalWrapper* self);
const gchar* fso_framework_test_signal_wrapper_get_signame (FsoFrameworkTestSignalWrapper* self);
void fso_framework_test_signal_wrapper_set_id (FsoFrameworkTestSignalWrapper* self, gulong value);
void fso_framework_test_signal_wrapper_release (FsoFrameworkTestSignalWrapper* self);
gulong fso_framework_test_signal_wrapper_get_id (FsoFrameworkTestSignalWrapper* self);
FsoFrameworkTestSignalWrapper* fso_framework_test_signal_wrapper_new (void);
FsoFrameworkTestSignalWrapper* fso_framework_test_signal_wrapper_construct (GType object_type);
void fso_framework_test_signal_wrapper_set_emitter (FsoFrameworkTestSignalWrapper* self, GObject* value);
void fso_framework_test_signal_wrapper_set_signame (FsoFrameworkTestSignalWrapper* self, const gchar* value);
gint fso_framework_test_signal_wrapper_get_timeout (FsoFrameworkTestSignalWrapper* self);
void fso_framework_test_signal_wrapper_set_timeout (FsoFrameworkTestSignalWrapper* self, gint value);
static void fso_framework_test_signal_wrapper_finalize (FsoFrameworkTestSignalWrapper* obj);
GType fso_framework_test_multi_signal_waiter_get_type (void) G_GNUC_CONST;
#define FSO_FRAMEWORK_TEST_MULTI_SIGNAL_WAITER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FSO_FRAMEWORK_TEST_TYPE_MULTI_SIGNAL_WAITER, FsoFrameworkTestMultiSignalWaiterPrivate))
enum  {
	FSO_FRAMEWORK_TEST_MULTI_SIGNAL_WAITER_DUMMY_PROPERTY
};
static void _fso_framework_test_signal_wrapper_unref0_ (gpointer var);
static void _g_list_free__fso_framework_test_signal_wrapper_unref0_ (GList* self);
void fso_framework_test_multi_signal_waiter_add_signal (FsoFrameworkTestMultiSignalWaiter* self, GObject* emitter, const gchar* signame, gint timeout);
static void __lambda4_ (FsoFrameworkTestMultiSignalWaiter* self);
static void ___lambda4__fso_framework_test_signal_wrapper_triggered (FsoFrameworkTestSignalWrapper* _sender, gpointer self);
gboolean fso_framework_test_multi_signal_waiter_run (FsoFrameworkTestMultiSignalWaiter* self, FsoFrameworkTestBlock block, void* block_target, gint timeout);
static gboolean __lambda5_ (FsoFrameworkTestMultiSignalWaiter* self);
static gboolean ___lambda5__gsource_func (gpointer self);
FsoFrameworkTestMultiSignalWaiter* fso_framework_test_multi_signal_waiter_new (void);
FsoFrameworkTestMultiSignalWaiter* fso_framework_test_multi_signal_waiter_construct (GType object_type);
static void fso_framework_test_multi_signal_waiter_finalize (GObject* obj);


gint fso_framework_test_signal_wrapper_callback (FsoFrameworkTestSignalWrapper* self) {
	gint result = 0;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_catch_count;
	fso_framework_test_signal_wrapper_set_catch_count (self, _tmp0_ + 1);
	g_signal_emit_by_name (self, "triggered");
	result = 0;
	return result;
}


void fso_framework_test_signal_wrapper_setup (FsoFrameworkTestSignalWrapper* self) {
	GObject* _tmp0_;
	const gchar* _tmp1_;
	gulong _tmp2_ = 0UL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_emitter;
	_tmp1_ = self->priv->_signame;
	_tmp2_ = g_signal_connect_swapped (_tmp0_, _tmp1_, (GCallback) fso_framework_test_signal_wrapper_callback, self);
	fso_framework_test_signal_wrapper_set_id (self, _tmp2_);
	fso_framework_test_signal_wrapper_set_catch_count (self, 0);
}


void fso_framework_test_signal_wrapper_release (FsoFrameworkTestSignalWrapper* self) {
	GObject* _tmp0_;
	gulong _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_emitter;
	_tmp1_ = self->priv->_id;
	g_signal_handler_disconnect (_tmp0_, _tmp1_);
}


FsoFrameworkTestSignalWrapper* fso_framework_test_signal_wrapper_construct (GType object_type) {
	FsoFrameworkTestSignalWrapper* self = NULL;
	self = (FsoFrameworkTestSignalWrapper*) g_type_create_instance (object_type);
	return self;
}


FsoFrameworkTestSignalWrapper* fso_framework_test_signal_wrapper_new (void) {
	return fso_framework_test_signal_wrapper_construct (FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER);
}


GObject* fso_framework_test_signal_wrapper_get_emitter (FsoFrameworkTestSignalWrapper* self) {
	GObject* result;
	GObject* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_emitter;
	result = _tmp0_;
	return result;
}


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


void fso_framework_test_signal_wrapper_set_emitter (FsoFrameworkTestSignalWrapper* self, GObject* value) {
	GObject* _tmp0_;
	GObject* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_emitter);
	self->priv->_emitter = _tmp1_;
}


const gchar* fso_framework_test_signal_wrapper_get_signame (FsoFrameworkTestSignalWrapper* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_signame;
	result = _tmp0_;
	return result;
}


void fso_framework_test_signal_wrapper_set_signame (FsoFrameworkTestSignalWrapper* self, const gchar* value) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_signame);
	self->priv->_signame = _tmp1_;
}


gulong fso_framework_test_signal_wrapper_get_id (FsoFrameworkTestSignalWrapper* self) {
	gulong result;
	gulong _tmp0_;
	g_return_val_if_fail (self != NULL, 0UL);
	_tmp0_ = self->priv->_id;
	result = _tmp0_;
	return result;
}


void fso_framework_test_signal_wrapper_set_id (FsoFrameworkTestSignalWrapper* self, gulong value) {
	gulong _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_id = _tmp0_;
}


gint fso_framework_test_signal_wrapper_get_timeout (FsoFrameworkTestSignalWrapper* self) {
	gint result;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_timeout;
	result = _tmp0_;
	return result;
}


void fso_framework_test_signal_wrapper_set_timeout (FsoFrameworkTestSignalWrapper* self, gint value) {
	gint _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_timeout = _tmp0_;
}


gint fso_framework_test_signal_wrapper_get_catch_count (FsoFrameworkTestSignalWrapper* self) {
	gint result;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_catch_count;
	result = _tmp0_;
	return result;
}


void fso_framework_test_signal_wrapper_set_catch_count (FsoFrameworkTestSignalWrapper* self, gint value) {
	gint _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_catch_count = _tmp0_;
}


static void fso_framework_test_value_signal_wrapper_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void fso_framework_test_value_signal_wrapper_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		fso_framework_test_signal_wrapper_unref (value->data[0].v_pointer);
	}
}


static void fso_framework_test_value_signal_wrapper_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = fso_framework_test_signal_wrapper_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer fso_framework_test_value_signal_wrapper_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* fso_framework_test_value_signal_wrapper_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		FsoFrameworkTestSignalWrapper* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = fso_framework_test_signal_wrapper_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* fso_framework_test_value_signal_wrapper_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	FsoFrameworkTestSignalWrapper** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = fso_framework_test_signal_wrapper_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* fso_framework_test_param_spec_signal_wrapper (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	FsoFrameworkTestParamSpecSignalWrapper* spec;
	g_return_val_if_fail (g_type_is_a (object_type, FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer fso_framework_test_value_get_signal_wrapper (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER), NULL);
	return value->data[0].v_pointer;
}


void fso_framework_test_value_set_signal_wrapper (GValue* value, gpointer v_object) {
	FsoFrameworkTestSignalWrapper* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		fso_framework_test_signal_wrapper_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		fso_framework_test_signal_wrapper_unref (old);
	}
}


void fso_framework_test_value_take_signal_wrapper (GValue* value, gpointer v_object) {
	FsoFrameworkTestSignalWrapper* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		fso_framework_test_signal_wrapper_unref (old);
	}
}


static void fso_framework_test_signal_wrapper_class_init (FsoFrameworkTestSignalWrapperClass * klass) {
	fso_framework_test_signal_wrapper_parent_class = g_type_class_peek_parent (klass);
	FSO_FRAMEWORK_TEST_SIGNAL_WRAPPER_CLASS (klass)->finalize = fso_framework_test_signal_wrapper_finalize;
	g_type_class_add_private (klass, sizeof (FsoFrameworkTestSignalWrapperPrivate));
	g_signal_new ("triggered", FSO_FRAMEWORK_TEST_TYPE_SIGNAL_WRAPPER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}


static void fso_framework_test_signal_wrapper_instance_init (FsoFrameworkTestSignalWrapper * self) {
	gchar* _tmp0_;
	self->priv = FSO_FRAMEWORK_TEST_SIGNAL_WRAPPER_GET_PRIVATE (self);
	_tmp0_ = g_strdup ("");
	self->priv->_signame = _tmp0_;
	self->ref_count = 1;
}


static void fso_framework_test_signal_wrapper_finalize (FsoFrameworkTestSignalWrapper* obj) {
	FsoFrameworkTestSignalWrapper * self;
	self = FSO_FRAMEWORK_TEST_SIGNAL_WRAPPER (obj);
	_g_object_unref0 (self->priv->_emitter);
	_g_free0 (self->priv->_signame);
}


GType fso_framework_test_signal_wrapper_get_type (void) {
	static volatile gsize fso_framework_test_signal_wrapper_type_id__volatile = 0;
	if (g_once_init_enter (&fso_framework_test_signal_wrapper_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { fso_framework_test_value_signal_wrapper_init, fso_framework_test_value_signal_wrapper_free_value, fso_framework_test_value_signal_wrapper_copy_value, fso_framework_test_value_signal_wrapper_peek_pointer, "p", fso_framework_test_value_signal_wrapper_collect_value, "p", fso_framework_test_value_signal_wrapper_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (FsoFrameworkTestSignalWrapperClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) fso_framework_test_signal_wrapper_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FsoFrameworkTestSignalWrapper), 0, (GInstanceInitFunc) fso_framework_test_signal_wrapper_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType fso_framework_test_signal_wrapper_type_id;
		fso_framework_test_signal_wrapper_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FsoFrameworkTestSignalWrapper", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&fso_framework_test_signal_wrapper_type_id__volatile, fso_framework_test_signal_wrapper_type_id);
	}
	return fso_framework_test_signal_wrapper_type_id__volatile;
}


gpointer fso_framework_test_signal_wrapper_ref (gpointer instance) {
	FsoFrameworkTestSignalWrapper* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void fso_framework_test_signal_wrapper_unref (gpointer instance) {
	FsoFrameworkTestSignalWrapper* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		FSO_FRAMEWORK_TEST_SIGNAL_WRAPPER_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


static void _fso_framework_test_signal_wrapper_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (fso_framework_test_signal_wrapper_unref (var), NULL));
}


static void _g_list_free__fso_framework_test_signal_wrapper_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _fso_framework_test_signal_wrapper_unref0_, NULL);
	g_list_free (self);
}


/**
         * Add a signal of an object called emitter to listen for until a timeout is
         * reached.
         *
         * @param emitter Object which emits the signal
         * @param signame Name of the signal
         * @param timeout Timeout Specifies the maximum amount of time to wait for the
         *                signal to be triggerd.
         **/
static void __lambda4_ (FsoFrameworkTestMultiSignalWaiter* self) {
	guint _tmp0_;
	guint _tmp1_;
	GList* _tmp2_;
	guint _tmp3_ = 0U;
	_tmp0_ = self->priv->succeeded_count;
	self->priv->succeeded_count = _tmp0_ + 1;
	_tmp1_ = self->priv->succeeded_count;
	_tmp2_ = self->priv->signals;
	_tmp3_ = g_list_length (_tmp2_);
	if (_tmp1_ == _tmp3_) {
		GMainLoop* _tmp4_;
		_tmp4_ = self->priv->mainloop;
		g_main_loop_quit (_tmp4_);
	}
}


static void ___lambda4__fso_framework_test_signal_wrapper_triggered (FsoFrameworkTestSignalWrapper* _sender, gpointer self) {
	__lambda4_ (self);
}


static gpointer _fso_framework_test_signal_wrapper_ref0 (gpointer self) {
	return self ? fso_framework_test_signal_wrapper_ref (self) : NULL;
}


void fso_framework_test_multi_signal_waiter_add_signal (FsoFrameworkTestMultiSignalWaiter* self, GObject* emitter, const gchar* signame, gint timeout) {
	GObject* _tmp0_;
	GObject* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gint _tmp4_;
	FsoFrameworkTestSignalWrapper* _tmp5_ = NULL;
	FsoFrameworkTestSignalWrapper* s;
	FsoFrameworkTestSignalWrapper* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (emitter != NULL);
	g_return_if_fail (signame != NULL);
	_tmp0_ = emitter;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_tmp2_ = signame;
	_tmp3_ = g_strdup (_tmp2_);
	_tmp4_ = timeout;
	_tmp5_ = fso_framework_test_signal_wrapper_new ();
	fso_framework_test_signal_wrapper_set_emitter (_tmp5_, _tmp1_);
	fso_framework_test_signal_wrapper_set_signame (_tmp5_, _tmp3_);
	fso_framework_test_signal_wrapper_set_timeout (_tmp5_, _tmp4_);
	s = _tmp5_;
	g_signal_connect_object (s, "triggered", (GCallback) ___lambda4__fso_framework_test_signal_wrapper_triggered, self, 0);
	_tmp6_ = _fso_framework_test_signal_wrapper_ref0 (s);
	self->priv->signals = g_list_append (self->priv->signals, _tmp6_);
	_fso_framework_test_signal_wrapper_unref0 (s);
}


/**
         * Run the code block which causes the added signals to be triggered. After block
         * is executed and timeout is reached or all signals has arrived the result is
         * returned to the caller.
         *
         * @param block Code block to execute
         * @param timeout Timeout to wait before returning to caller
         * @return True, if all signals has been triggered. False, if timeout is reached
         *         and not all signals has been triggered.
         **/
static gboolean __lambda5_ (FsoFrameworkTestMultiSignalWaiter* self) {
	gboolean result = FALSE;
	GMainLoop* _tmp0_;
	_tmp0_ = self->priv->mainloop;
	g_main_loop_quit (_tmp0_);
	result = FALSE;
	return result;
}


static gboolean ___lambda5__gsource_func (gpointer self) {
	gboolean result;
	result = __lambda5_ (self);
	return result;
}


gboolean fso_framework_test_multi_signal_waiter_run (FsoFrameworkTestMultiSignalWaiter* self, FsoFrameworkTestBlock block, void* block_target, gint timeout) {
	gboolean result = FALSE;
	GMainContext* _tmp0_ = NULL;
	GMainLoop* _tmp1_;
	GList* _tmp2_;
	FsoFrameworkTestBlock _tmp5_;
	void* _tmp5__target;
	gint _tmp6_;
	guint _tmp7_ = 0U;
	guint t1;
	gboolean succeeded;
	GList* _tmp11_;
	guint _tmp17_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = g_main_context_default ();
	_tmp1_ = g_main_loop_new (_tmp0_, TRUE);
	_g_main_loop_unref0 (self->priv->mainloop);
	self->priv->mainloop = _tmp1_;
	self->priv->succeeded_count = (guint) 0;
	_tmp2_ = self->priv->signals;
	{
		GList* s_collection = NULL;
		GList* s_it = NULL;
		s_collection = _tmp2_;
		for (s_it = s_collection; s_it != NULL; s_it = s_it->next) {
			FsoFrameworkTestSignalWrapper* _tmp3_;
			FsoFrameworkTestSignalWrapper* s = NULL;
			_tmp3_ = _fso_framework_test_signal_wrapper_ref0 ((FsoFrameworkTestSignalWrapper*) s_it->data);
			s = _tmp3_;
			{
				FsoFrameworkTestSignalWrapper* _tmp4_;
				_tmp4_ = s;
				fso_framework_test_signal_wrapper_setup (_tmp4_);
				_fso_framework_test_signal_wrapper_unref0 (s);
			}
		}
	}
	_tmp5_ = block;
	_tmp5__target = block_target;
	_tmp5_ (_tmp5__target);
	_tmp6_ = timeout;
	_tmp7_ = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) _tmp6_, ___lambda5__gsource_func, g_object_ref (self), g_object_unref);
	t1 = _tmp7_;
	while (TRUE) {
		GMainLoop* _tmp8_;
		gboolean _tmp9_ = FALSE;
		GMainLoop* _tmp10_;
		_tmp8_ = self->priv->mainloop;
		_tmp9_ = g_main_loop_is_running (_tmp8_);
		if (!_tmp9_) {
			break;
		}
		_tmp10_ = self->priv->mainloop;
		g_main_loop_run (_tmp10_);
	}
	succeeded = TRUE;
	_tmp11_ = self->priv->signals;
	{
		GList* s_collection = NULL;
		GList* s_it = NULL;
		s_collection = _tmp11_;
		for (s_it = s_collection; s_it != NULL; s_it = s_it->next) {
			FsoFrameworkTestSignalWrapper* _tmp12_;
			FsoFrameworkTestSignalWrapper* s = NULL;
			_tmp12_ = _fso_framework_test_signal_wrapper_ref0 ((FsoFrameworkTestSignalWrapper*) s_it->data);
			s = _tmp12_;
			{
				FsoFrameworkTestSignalWrapper* _tmp13_;
				FsoFrameworkTestSignalWrapper* _tmp14_;
				gint _tmp15_;
				gint _tmp16_;
				_tmp13_ = s;
				fso_framework_test_signal_wrapper_release (_tmp13_);
				_tmp14_ = s;
				_tmp15_ = fso_framework_test_signal_wrapper_get_catch_count (_tmp14_);
				_tmp16_ = _tmp15_;
				if (_tmp16_ == 0) {
					succeeded = FALSE;
				}
				_fso_framework_test_signal_wrapper_unref0 (s);
			}
		}
	}
	_tmp17_ = t1;
	g_source_remove (_tmp17_);
	result = succeeded;
	return result;
}


FsoFrameworkTestMultiSignalWaiter* fso_framework_test_multi_signal_waiter_construct (GType object_type) {
	FsoFrameworkTestMultiSignalWaiter * self = NULL;
	self = (FsoFrameworkTestMultiSignalWaiter*) g_object_new (object_type, NULL);
	return self;
}


FsoFrameworkTestMultiSignalWaiter* fso_framework_test_multi_signal_waiter_new (void) {
	return fso_framework_test_multi_signal_waiter_construct (FSO_FRAMEWORK_TEST_TYPE_MULTI_SIGNAL_WAITER);
}


static void fso_framework_test_multi_signal_waiter_class_init (FsoFrameworkTestMultiSignalWaiterClass * klass) {
	fso_framework_test_multi_signal_waiter_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (FsoFrameworkTestMultiSignalWaiterPrivate));
	G_OBJECT_CLASS (klass)->finalize = fso_framework_test_multi_signal_waiter_finalize;
}


static void fso_framework_test_multi_signal_waiter_instance_init (FsoFrameworkTestMultiSignalWaiter * self) {
	self->priv = FSO_FRAMEWORK_TEST_MULTI_SIGNAL_WAITER_GET_PRIVATE (self);
	self->priv->signals = NULL;
	self->priv->succeeded_count = (guint) 0;
}


static void fso_framework_test_multi_signal_waiter_finalize (GObject* obj) {
	FsoFrameworkTestMultiSignalWaiter * self;
	self = FSO_FRAMEWORK_TEST_MULTI_SIGNAL_WAITER (obj);
	__g_list_free__fso_framework_test_signal_wrapper_unref0_0 (self->priv->signals);
	_g_main_loop_unref0 (self->priv->mainloop);
	G_OBJECT_CLASS (fso_framework_test_multi_signal_waiter_parent_class)->finalize (obj);
}


/**
     * Wait for one or more signals to arrived when executing a operation which causes
     * this signals to be triggered. The waiter will return a failure when a timeout is
     * reached and no or not all signals has triggered.
     *
     * Example:
     *  var waiter = new MultiSignalWaiter();
     *  waiter.add_signal( emitter, "signal0" );
     *  var result = waiter.run( () => { triggerSignal0(); } );
     **/
GType fso_framework_test_multi_signal_waiter_get_type (void) {
	static volatile gsize fso_framework_test_multi_signal_waiter_type_id__volatile = 0;
	if (g_once_init_enter (&fso_framework_test_multi_signal_waiter_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FsoFrameworkTestMultiSignalWaiterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) fso_framework_test_multi_signal_waiter_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FsoFrameworkTestMultiSignalWaiter), 0, (GInstanceInitFunc) fso_framework_test_multi_signal_waiter_instance_init, NULL };
		GType fso_framework_test_multi_signal_waiter_type_id;
		fso_framework_test_multi_signal_waiter_type_id = g_type_register_static (G_TYPE_OBJECT, "FsoFrameworkTestMultiSignalWaiter", &g_define_type_info, 0);
		g_once_init_leave (&fso_framework_test_multi_signal_waiter_type_id__volatile, fso_framework_test_multi_signal_waiter_type_id);
	}
	return fso_framework_test_multi_signal_waiter_type_id__volatile;
}