/* 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;
}



