/* data-source-stuff.c generated by valac 0.20.1, the Vala compiler
 * generated from data-source-stuff.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include "zeitgeist.h"
#include "zeitgeist-datamodel.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _DoStuffData DoStuffData;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _OnSourceEnabledData OnSourceEnabledData;
typedef struct _PrintDataSourcesData PrintDataSourcesData;
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))

struct _DoStuffData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ZeitgeistDataSourceRegistry* _tmp0_;
	ZeitgeistDataSourceRegistry* registry;
	ZeitgeistDataSourceRegistry* _tmp1_;
	ZeitgeistDataSourceRegistry* _tmp2_;
	GPtrArray* _tmp3_;
	GPtrArray* _tmp4_;
	ZeitgeistDataSource* _tmp5_;
	ZeitgeistDataSource* _tmp6_;
	ZeitgeistDataSource* my_data_source;
	FILE* _tmp7_;
	ZeitgeistDataSourceRegistry* _tmp8_;
	ZeitgeistDataSource* _tmp9_;
	gboolean _tmp10_;
	gboolean enabled;
	const gchar* _tmp11_;
	gboolean _tmp12_;
	FILE* _tmp13_;
	const gchar* _tmp14_;
	FILE* _tmp15_;
	ZeitgeistDataSourceRegistry* _tmp16_;
	ZeitgeistDataSource* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	ZeitgeistDataSourceRegistry* _tmp20_;
	FILE* _tmp21_;
	ZeitgeistDataSourceRegistry* _tmp22_;
	ZeitgeistDataSource* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	ZeitgeistDataSourceRegistry* _tmp26_;
	GMainLoop* _tmp27_;
	GError * _inner_error_;
};

struct _OnSourceEnabledData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	gchar* unique_id;
	gboolean enabled;
	ZeitgeistDataSourceRegistry* _tmp0_;
	ZeitgeistDataSourceRegistry* registry;
	ZeitgeistDataSource* source;
	const gchar* _tmp1_;
	ZeitgeistDataSource* _tmp2_;
	ZeitgeistDataSource* _tmp3_;
	const gchar* _tmp4_;
	gboolean _tmp5_;
	FILE* _tmp6_;
	ZeitgeistDataSource* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	GError* e;
	GError* _tmp11_;
	const gchar* _tmp12_;
	GError * _inner_error_;
};

struct _PrintDataSourcesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ZeitgeistDataSourceRegistry* registry;
	GPtrArray* datasources;
	ZeitgeistDataSourceRegistry* _tmp0_;
	GPtrArray* _tmp1_;
	GPtrArray* _tmp2_;
	FILE* _tmp3_;
	gint i;
	gboolean _tmp4_;
	gboolean _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	GPtrArray* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	GPtrArray* _tmp11_;
	gint _tmp12_;
	gconstpointer _tmp13_;
	ZeitgeistDataSource* _tmp14_;
	ZeitgeistDataSource* datasource;
	const gchar* _tmp15_;
	ZeitgeistDataSource* _tmp16_;
	gboolean _tmp17_;
	gboolean _tmp18_;
	FILE* _tmp19_;
	ZeitgeistDataSource* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	GError * _inner_error_;
};


extern GMainLoop* loop;
GMainLoop* loop = NULL;

static void do_stuff_data_free (gpointer _data);
void do_stuff (GAsyncReadyCallback _callback_, gpointer _user_data_);
void do_stuff_finish (GAsyncResult* _res_, GError** error);
static gboolean do_stuff_co (DoStuffData* _data_);
void on_source_registered (ZeitgeistDataSource* source);
static void _on_source_registered_zeitgeist_data_source_registry_source_registered (ZeitgeistDataSourceRegistry* _sender, ZeitgeistDataSource* data_source, gpointer self);
void on_source_enabled (const gchar* unique_id, gboolean enabled, GAsyncReadyCallback _callback_, gpointer _user_data_);
void on_source_enabled_finish (GAsyncResult* _res_);
static void _on_source_enabled_zeitgeist_data_source_registry_source_enabled (ZeitgeistDataSourceRegistry* _sender, const gchar* unique_id, gboolean enabled, gpointer self);
static void _g_object_unref0_ (gpointer var);
static void do_stuff_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void print_data_sources (ZeitgeistDataSourceRegistry* registry, GAsyncReadyCallback _callback_, gpointer _user_data_);
void print_data_sources_finish (GAsyncResult* _res_, GError** error);
static void on_source_enabled_data_free (gpointer _data);
static gboolean on_source_enabled_co (OnSourceEnabledData* _data_);
static void on_source_enabled_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void print_data_sources_data_free (gpointer _data);
static gboolean print_data_sources_co (PrintDataSourcesData* _data_);
static void print_data_sources_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
gint _vala_main (void);


static void do_stuff_data_free (gpointer _data) {
	DoStuffData* _data_;
	_data_ = _data;
	g_slice_free (DoStuffData, _data_);
}


void do_stuff (GAsyncReadyCallback _callback_, gpointer _user_data_) {
	DoStuffData* _data_;
	_data_ = g_slice_new0 (DoStuffData);
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, do_stuff);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, do_stuff_data_free);
	do_stuff_co (_data_);
}


void do_stuff_finish (GAsyncResult* _res_, GError** error) {
	DoStuffData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void _on_source_registered_zeitgeist_data_source_registry_source_registered (ZeitgeistDataSourceRegistry* _sender, ZeitgeistDataSource* data_source, gpointer self) {
	on_source_registered (data_source);
}


static void _on_source_enabled_zeitgeist_data_source_registry_source_enabled (ZeitgeistDataSourceRegistry* _sender, const gchar* unique_id, gboolean enabled, gpointer self) {
	on_source_enabled (unique_id, enabled, NULL, NULL);
}


static void _g_object_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}


static void do_stuff_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	DoStuffData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	do_stuff_co (_data_);
}


static gboolean do_stuff_co (DoStuffData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = zeitgeist_data_source_registry_new ();
	_data_->registry = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->registry;
	g_signal_connect (_data_->_tmp1_, "source-registered", (GCallback) _on_source_registered_zeitgeist_data_source_registry_source_registered, NULL);
	_data_->_tmp2_ = _data_->registry;
	g_signal_connect (_data_->_tmp2_, "source-enabled", (GCallback) _on_source_enabled_zeitgeist_data_source_registry_source_enabled, NULL);
	_data_->_tmp3_ = g_ptr_array_new_with_free_func (_g_object_unref0_);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = zeitgeist_data_source_new_full ("com.example.test/my-ds", "Example Data-Source", "An example data-source for testing libzeitgeist2", _data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_g_ptr_array_unref0 (_data_->_tmp4_);
	_data_->my_data_source = _data_->_tmp6_;
	_data_->_tmp7_ = stdout;
	fprintf (_data_->_tmp7_, "Registering with data-source registry...\n");
	_data_->_tmp8_ = _data_->registry;
	_data_->_tmp9_ = _data_->my_data_source;
	_data_->_state_ = 1;
	zeitgeist_data_source_registry_register_data_source (_data_->_tmp8_, _data_->_tmp9_, NULL, do_stuff_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp10_ = FALSE;
	_data_->_tmp10_ = zeitgeist_data_source_registry_register_data_source_finish (_data_->_tmp8_, _data_->_res_, &_data_->_inner_error_);
	_data_->enabled = _data_->_tmp10_;
	if (_data_->_inner_error_ != NULL) {
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_object_unref0 (_data_->my_data_source);
		_g_object_unref0 (_data_->registry);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp12_ = _data_->enabled;
	if (_data_->_tmp12_) {
		_data_->_tmp11_ = "enabled";
	} else {
		_data_->_tmp11_ = "disabled";
	}
	_data_->_tmp13_ = stdout;
	_data_->_tmp14_ = _data_->_tmp11_;
	fprintf (_data_->_tmp13_, "Done. The data-source is %s.\n\n", _data_->_tmp14_);
	_data_->_tmp15_ = stdout;
	fprintf (_data_->_tmp15_, "Disabling the data-source...\n");
	_data_->_tmp16_ = _data_->registry;
	_data_->_tmp17_ = _data_->my_data_source;
	_data_->_tmp18_ = zeitgeist_data_source_get_unique_id (_data_->_tmp17_);
	_data_->_tmp19_ = _data_->_tmp18_;
	_data_->_state_ = 2;
	zeitgeist_data_source_registry_set_data_source_enabled (_data_->_tmp16_, _data_->_tmp19_, FALSE, NULL, do_stuff_ready, _data_);
	return FALSE;
	_state_2:
	zeitgeist_data_source_registry_set_data_source_enabled_finish (_data_->_tmp16_, _data_->_res_, &_data_->_inner_error_);
	if (_data_->_inner_error_ != NULL) {
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_object_unref0 (_data_->my_data_source);
		_g_object_unref0 (_data_->registry);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp20_ = _data_->registry;
	_data_->_state_ = 3;
	print_data_sources (_data_->_tmp20_, do_stuff_ready, _data_);
	return FALSE;
	_state_3:
	print_data_sources_finish (_data_->_res_, &_data_->_inner_error_);
	if (_data_->_inner_error_ != NULL) {
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_object_unref0 (_data_->my_data_source);
		_g_object_unref0 (_data_->registry);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp21_ = stdout;
	fprintf (_data_->_tmp21_, "\nEnabling it again...\n");
	_data_->_tmp22_ = _data_->registry;
	_data_->_tmp23_ = _data_->my_data_source;
	_data_->_tmp24_ = zeitgeist_data_source_get_unique_id (_data_->_tmp23_);
	_data_->_tmp25_ = _data_->_tmp24_;
	_data_->_state_ = 4;
	zeitgeist_data_source_registry_set_data_source_enabled (_data_->_tmp22_, _data_->_tmp25_, TRUE, NULL, do_stuff_ready, _data_);
	return FALSE;
	_state_4:
	zeitgeist_data_source_registry_set_data_source_enabled_finish (_data_->_tmp22_, _data_->_res_, &_data_->_inner_error_);
	if (_data_->_inner_error_ != NULL) {
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_object_unref0 (_data_->my_data_source);
		_g_object_unref0 (_data_->registry);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp26_ = _data_->registry;
	_data_->_state_ = 5;
	print_data_sources (_data_->_tmp26_, do_stuff_ready, _data_);
	return FALSE;
	_state_5:
	print_data_sources_finish (_data_->_res_, &_data_->_inner_error_);
	if (_data_->_inner_error_ != NULL) {
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_object_unref0 (_data_->my_data_source);
		_g_object_unref0 (_data_->registry);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp27_ = loop;
	g_main_loop_quit (_data_->_tmp27_);
	_g_object_unref0 (_data_->my_data_source);
	_g_object_unref0 (_data_->registry);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


void on_source_registered (ZeitgeistDataSource* source) {
	FILE* _tmp0_;
	ZeitgeistDataSource* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (source != NULL);
	_tmp0_ = stdout;
	_tmp1_ = source;
	_tmp2_ = zeitgeist_data_source_get_name (_tmp1_);
	_tmp3_ = _tmp2_;
	fprintf (_tmp0_, "%s registered!\n", _tmp3_);
}


static void on_source_enabled_data_free (gpointer _data) {
	OnSourceEnabledData* _data_;
	_data_ = _data;
	_g_free0 (_data_->unique_id);
	g_slice_free (OnSourceEnabledData, _data_);
}


void on_source_enabled (const gchar* unique_id, gboolean enabled, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	OnSourceEnabledData* _data_;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_;
	_data_ = g_slice_new0 (OnSourceEnabledData);
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, on_source_enabled);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, on_source_enabled_data_free);
	_tmp0_ = unique_id;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (_data_->unique_id);
	_data_->unique_id = _tmp1_;
	_tmp2_ = enabled;
	_data_->enabled = _tmp2_;
	on_source_enabled_co (_data_);
}


void on_source_enabled_finish (GAsyncResult* _res_) {
	OnSourceEnabledData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void on_source_enabled_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	OnSourceEnabledData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	on_source_enabled_co (_data_);
}


static gboolean on_source_enabled_co (OnSourceEnabledData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = zeitgeist_data_source_registry_new ();
	_data_->registry = _data_->_tmp0_;
	{
		_data_->_tmp1_ = _data_->unique_id;
		_data_->_state_ = 1;
		zeitgeist_data_source_registry_get_data_source_from_id (_data_->registry, _data_->_tmp1_, NULL, on_source_enabled_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp2_ = NULL;
		_data_->_tmp2_ = zeitgeist_data_source_registry_get_data_source_from_id_finish (_data_->registry, _data_->_res_, &_data_->_inner_error_);
		_data_->_tmp3_ = _data_->_tmp2_;
		if (_data_->_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
		_g_object_unref0 (_data_->source);
		_data_->source = _data_->_tmp3_;
		_data_->_tmp5_ = _data_->enabled;
		if (_data_->_tmp5_) {
			_data_->_tmp4_ = "enabled";
		} else {
			_data_->_tmp4_ = "disabled";
		}
		_data_->_tmp6_ = stdout;
		_data_->_tmp7_ = _data_->source;
		_data_->_tmp8_ = zeitgeist_data_source_get_name (_data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp10_ = _data_->_tmp4_;
		fprintf (_data_->_tmp6_, "%s has been %s!\n", _data_->_tmp9_, _data_->_tmp10_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp11_ = _data_->e;
		_data_->_tmp12_ = _data_->_tmp11_->message;
		g_critical ("data-source-stuff.vala:52: Error retrieving data-source information: %" \
"s", _data_->_tmp12_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (_data_->_inner_error_ != NULL) {
		_g_object_unref0 (_data_->source);
		_g_object_unref0 (_data_->registry);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	_g_object_unref0 (_data_->source);
	_g_object_unref0 (_data_->registry);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void print_data_sources_data_free (gpointer _data) {
	PrintDataSourcesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->registry);
	g_slice_free (PrintDataSourcesData, _data_);
}


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


void print_data_sources (ZeitgeistDataSourceRegistry* registry, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	PrintDataSourcesData* _data_;
	ZeitgeistDataSourceRegistry* _tmp0_;
	ZeitgeistDataSourceRegistry* _tmp1_;
	_data_ = g_slice_new0 (PrintDataSourcesData);
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, print_data_sources);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, print_data_sources_data_free);
	_tmp0_ = registry;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data_->registry);
	_data_->registry = _tmp1_;
	print_data_sources_co (_data_);
}


void print_data_sources_finish (GAsyncResult* _res_, GError** error) {
	PrintDataSourcesData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void print_data_sources_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	PrintDataSourcesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	print_data_sources_co (_data_);
}


static gint g_ptr_array_get_length (GPtrArray* self) {
	gint result;
	guint _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->len;
	result = (gint) _tmp0_;
	return result;
}


static void g_ptr_array_set_length (GPtrArray* self, gint value) {
	gint _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	g_ptr_array_set_size (self, _tmp0_);
}


static gboolean print_data_sources_co (PrintDataSourcesData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->datasources = NULL;
	_data_->_tmp0_ = _data_->registry;
	_data_->_state_ = 1;
	zeitgeist_data_source_registry_get_data_sources (_data_->_tmp0_, NULL, print_data_sources_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = zeitgeist_data_source_registry_get_data_sources_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (_data_->_inner_error_ != NULL) {
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_ptr_array_unref0 (_data_->datasources);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_ptr_array_unref0 (_data_->datasources);
	_data_->datasources = _data_->_tmp2_;
	_data_->_tmp3_ = stdout;
	fprintf (_data_->_tmp3_, "\nThe following data-sources are registered:\n");
	{
		_data_->i = 0;
		{
			_data_->_tmp4_ = TRUE;
			while (TRUE) {
				_data_->_tmp5_ = _data_->_tmp4_;
				if (!_data_->_tmp5_) {
					_data_->_tmp6_ = _data_->i;
					_data_->i = _data_->_tmp6_ + 1;
				}
				_data_->_tmp4_ = FALSE;
				_data_->_tmp7_ = _data_->i;
				_data_->_tmp8_ = _data_->datasources;
				_data_->_tmp9_ = g_ptr_array_get_length (_data_->_tmp8_);
				_data_->_tmp10_ = _data_->_tmp9_;
				if (!(_data_->_tmp7_ < _data_->_tmp10_)) {
					break;
				}
				_data_->_tmp11_ = _data_->datasources;
				_data_->_tmp12_ = _data_->i;
				_data_->_tmp13_ = NULL;
				_data_->_tmp13_ = g_ptr_array_index (_data_->_tmp11_, (guint) _data_->_tmp12_);
				_data_->_tmp14_ = _g_object_ref0 ((ZeitgeistDataSource*) _data_->_tmp13_);
				_data_->datasource = _data_->_tmp14_;
				_data_->_tmp16_ = _data_->datasource;
				_data_->_tmp17_ = zeitgeist_data_source_get_enabled (_data_->_tmp16_);
				_data_->_tmp18_ = _data_->_tmp17_;
				if (_data_->_tmp18_) {
					_data_->_tmp15_ = "enabled";
				} else {
					_data_->_tmp15_ = "disabled";
				}
				_data_->_tmp19_ = stdout;
				_data_->_tmp20_ = _data_->datasource;
				_data_->_tmp21_ = zeitgeist_data_source_get_name (_data_->_tmp20_);
				_data_->_tmp22_ = _data_->_tmp21_;
				_data_->_tmp23_ = _data_->_tmp15_;
				fprintf (_data_->_tmp19_, " - %s [%s]\n", _data_->_tmp22_, _data_->_tmp23_);
				_g_object_unref0 (_data_->datasource);
			}
		}
	}
	_g_ptr_array_unref0 (_data_->datasources);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


gint _vala_main (void) {
	gint result = 0;
	GMainLoop* _tmp0_;
	GMainLoop* _tmp1_;
	_tmp0_ = g_main_loop_new (NULL, FALSE);
	_g_main_loop_unref0 (loop);
	loop = _tmp0_;
	do_stuff (NULL, NULL);
	_tmp1_ = loop;
	g_main_loop_run (_tmp1_);
	result = 0;
	return result;
}


int main (int argc, char ** argv) {
	g_type_init ();
	return _vala_main ();
}



