/* queued-proxy-wrapper.c generated by valac 0.26.1, the Vala compiler
 * generated from queued-proxy-wrapper.vala, do not modify */

/*
 * Copyright © 2012 Canonical Ltd.
 *             By Siegfried-A. Gevatter <siegfried.gevatter@collabora.co.uk>
 *
 * Based upon a C implementation (© 2010-2012 Canonical Ltd) by:
 *  Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com>
 *  Michal Hruby <michal.hruby@canonical.com>
 *
 * This program 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 program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

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


#define ZEITGEIST_TYPE_QUEUED_PROXY_WRAPPER (zeitgeist_queued_proxy_wrapper_get_type ())
#define ZEITGEIST_QUEUED_PROXY_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ZEITGEIST_TYPE_QUEUED_PROXY_WRAPPER, ZeitgeistQueuedProxyWrapper))
#define ZEITGEIST_QUEUED_PROXY_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ZEITGEIST_TYPE_QUEUED_PROXY_WRAPPER, ZeitgeistQueuedProxyWrapperClass))
#define ZEITGEIST_IS_QUEUED_PROXY_WRAPPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZEITGEIST_TYPE_QUEUED_PROXY_WRAPPER))
#define ZEITGEIST_IS_QUEUED_PROXY_WRAPPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ZEITGEIST_TYPE_QUEUED_PROXY_WRAPPER))
#define ZEITGEIST_QUEUED_PROXY_WRAPPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ZEITGEIST_TYPE_QUEUED_PROXY_WRAPPER, ZeitgeistQueuedProxyWrapperClass))

typedef struct _ZeitgeistQueuedProxyWrapper ZeitgeistQueuedProxyWrapper;
typedef struct _ZeitgeistQueuedProxyWrapperClass ZeitgeistQueuedProxyWrapperClass;
typedef struct _ZeitgeistQueuedProxyWrapperPrivate ZeitgeistQueuedProxyWrapperPrivate;

#define ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD (zeitgeist_queued_proxy_wrapper_queued_method_get_type ())
#define ZEITGEIST_QUEUED_PROXY_WRAPPER_QUEUED_METHOD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD, ZeitgeistQueuedProxyWrapperQueuedMethod))
#define ZEITGEIST_QUEUED_PROXY_WRAPPER_QUEUED_METHOD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD, ZeitgeistQueuedProxyWrapperQueuedMethodClass))
#define ZEITGEIST_QUEUED_PROXY_WRAPPER_IS_QUEUED_METHOD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD))
#define ZEITGEIST_QUEUED_PROXY_WRAPPER_IS_QUEUED_METHOD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD))
#define ZEITGEIST_QUEUED_PROXY_WRAPPER_QUEUED_METHOD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD, ZeitgeistQueuedProxyWrapperQueuedMethodClass))

typedef struct _ZeitgeistQueuedProxyWrapperQueuedMethod ZeitgeistQueuedProxyWrapperQueuedMethod;
typedef struct _ZeitgeistQueuedProxyWrapperQueuedMethodClass ZeitgeistQueuedProxyWrapperQueuedMethodClass;
#define __g_slist_free__zeitgeist_queued_proxy_wrapper_queued_method_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_slist_free__zeitgeist_queued_proxy_wrapper_queued_method_unref0_ (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _zeitgeist_queued_proxy_wrapper_queued_method_unref0(var) ((var == NULL) ? NULL : (var = (zeitgeist_queued_proxy_wrapper_queued_method_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _ZeitgeistQueuedProxyWrapperWaitForProxyData ZeitgeistQueuedProxyWrapperWaitForProxyData;
typedef struct _ZeitgeistQueuedProxyWrapperQueuedMethodPrivate ZeitgeistQueuedProxyWrapperQueuedMethodPrivate;
typedef struct _ZeitgeistQueuedProxyWrapperParamSpecQueuedMethod ZeitgeistQueuedProxyWrapperParamSpecQueuedMethod;

struct _ZeitgeistQueuedProxyWrapper {
	GObject parent_instance;
	ZeitgeistQueuedProxyWrapperPrivate * priv;
};

struct _ZeitgeistQueuedProxyWrapperClass {
	GObjectClass parent_class;
	void (*on_connection_established) (ZeitgeistQueuedProxyWrapper* self);
	void (*on_connection_lost) (ZeitgeistQueuedProxyWrapper* self);
};

struct _ZeitgeistQueuedProxyWrapperPrivate {
	gboolean _proxy_created;
	gboolean _is_connected;
	GSList* method_dispatch_queue;
	GError* log_error;
	GDBusProxy* dbus_proxy;
};

struct _ZeitgeistQueuedProxyWrapperWaitForProxyData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ZeitgeistQueuedProxyWrapper* self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	GSList* _tmp2_;
	ZeitgeistQueuedProxyWrapperQueuedMethod* _tmp3_;
	GError* _tmp4_;
	GError* _tmp5_;
	GError* _tmp6_;
	GError * _inner_error_;
};

struct _ZeitgeistQueuedProxyWrapperQueuedMethod {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ZeitgeistQueuedProxyWrapperQueuedMethodPrivate * priv;
};

struct _ZeitgeistQueuedProxyWrapperQueuedMethodClass {
	GTypeClass parent_class;
	void (*finalize) (ZeitgeistQueuedProxyWrapperQueuedMethod *self);
};

struct _ZeitgeistQueuedProxyWrapperQueuedMethodPrivate {
	GSourceFunc _queued_method;
	gpointer _queued_method_target;
	GDestroyNotify _queued_method_target_destroy_notify;
};

struct _ZeitgeistQueuedProxyWrapperParamSpecQueuedMethod {
	GParamSpec parent_instance;
};


static gpointer zeitgeist_queued_proxy_wrapper_parent_class = NULL;
static gpointer zeitgeist_queued_proxy_wrapper_queued_method_parent_class = NULL;

GType zeitgeist_queued_proxy_wrapper_get_type (void) G_GNUC_CONST;
gpointer zeitgeist_queued_proxy_wrapper_queued_method_ref (gpointer instance);
void zeitgeist_queued_proxy_wrapper_queued_method_unref (gpointer instance);
GParamSpec* zeitgeist_queued_proxy_wrapper_param_spec_queued_method (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void zeitgeist_queued_proxy_wrapper_value_set_queued_method (GValue* value, gpointer v_object);
void zeitgeist_queued_proxy_wrapper_value_take_queued_method (GValue* value, gpointer v_object);
gpointer zeitgeist_queued_proxy_wrapper_value_get_queued_method (const GValue* value);
GType zeitgeist_queued_proxy_wrapper_queued_method_get_type (void) G_GNUC_CONST;
#define ZEITGEIST_QUEUED_PROXY_WRAPPER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ZEITGEIST_TYPE_QUEUED_PROXY_WRAPPER, ZeitgeistQueuedProxyWrapperPrivate))
enum  {
	ZEITGEIST_QUEUED_PROXY_WRAPPER_DUMMY_PROPERTY,
	ZEITGEIST_QUEUED_PROXY_WRAPPER_PROXY_CREATED,
	ZEITGEIST_QUEUED_PROXY_WRAPPER_IS_CONNECTED
};
static void _zeitgeist_queued_proxy_wrapper_queued_method_unref0_ (gpointer var);
static void _g_slist_free__zeitgeist_queued_proxy_wrapper_queued_method_unref0_ (GSList* self);
void zeitgeist_queued_proxy_wrapper_proxy_acquired (ZeitgeistQueuedProxyWrapper* self, GObject* proxy);
static void zeitgeist_queued_proxy_wrapper_set_is_connected (ZeitgeistQueuedProxyWrapper* self, gboolean value);
static void zeitgeist_queued_proxy_wrapper_set_proxy_created (ZeitgeistQueuedProxyWrapper* self, gboolean value);
void zeitgeist_queued_proxy_wrapper_name_owner_changed (ZeitgeistQueuedProxyWrapper* self, GParamSpec* pspec);
static void _zeitgeist_queued_proxy_wrapper_name_owner_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
void zeitgeist_queued_proxy_wrapper_on_connection_established (ZeitgeistQueuedProxyWrapper* self);
void zeitgeist_queued_proxy_wrapper_process_queued_methods (ZeitgeistQueuedProxyWrapper* self);
void zeitgeist_queued_proxy_wrapper_proxy_unavailable (ZeitgeistQueuedProxyWrapper* self, GError* err);
GSourceFunc zeitgeist_queued_proxy_wrapper_queued_method_get_queued_method (ZeitgeistQueuedProxyWrapperQueuedMethod* self, gpointer* result_target);
gboolean zeitgeist_queued_proxy_wrapper_get_is_connected (ZeitgeistQueuedProxyWrapper* self);
void zeitgeist_queued_proxy_wrapper_on_connection_lost (ZeitgeistQueuedProxyWrapper* self);
static void zeitgeist_queued_proxy_wrapper_real_on_connection_established (ZeitgeistQueuedProxyWrapper* self);
static void zeitgeist_queued_proxy_wrapper_real_on_connection_lost (ZeitgeistQueuedProxyWrapper* self);
static void zeitgeist_queued_proxy_wrapper_wait_for_proxy_data_free (gpointer _data);
void zeitgeist_queued_proxy_wrapper_wait_for_proxy (ZeitgeistQueuedProxyWrapper* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void zeitgeist_queued_proxy_wrapper_wait_for_proxy_finish (ZeitgeistQueuedProxyWrapper* self, GAsyncResult* _res_, GError** error);
static gboolean zeitgeist_queued_proxy_wrapper_wait_for_proxy_co (ZeitgeistQueuedProxyWrapperWaitForProxyData* _data_);
gboolean zeitgeist_queued_proxy_wrapper_get_proxy_created (ZeitgeistQueuedProxyWrapper* self);
static gboolean _zeitgeist_queued_proxy_wrapper_wait_for_proxy_co_gsource_func (gpointer self);
ZeitgeistQueuedProxyWrapperQueuedMethod* zeitgeist_queued_proxy_wrapper_queued_method_new (GSourceFunc callback, void* callback_target, GDestroyNotify callback_target_destroy_notify);
ZeitgeistQueuedProxyWrapperQueuedMethod* zeitgeist_queued_proxy_wrapper_queued_method_construct (GType object_type, GSourceFunc callback, void* callback_target, GDestroyNotify callback_target_destroy_notify);
ZeitgeistQueuedProxyWrapper* zeitgeist_queued_proxy_wrapper_construct (GType object_type);
#define ZEITGEIST_QUEUED_PROXY_WRAPPER_QUEUED_METHOD_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD, ZeitgeistQueuedProxyWrapperQueuedMethodPrivate))
enum  {
	ZEITGEIST_QUEUED_PROXY_WRAPPER_QUEUED_METHOD_DUMMY_PROPERTY
};
static void zeitgeist_queued_proxy_wrapper_queued_method_set_queued_method (ZeitgeistQueuedProxyWrapperQueuedMethod* self, GSourceFunc value, gpointer value_target, GDestroyNotify value_target_destroy_notify);
static void zeitgeist_queued_proxy_wrapper_queued_method_finalize (ZeitgeistQueuedProxyWrapperQueuedMethod* obj);
static void zeitgeist_queued_proxy_wrapper_finalize (GObject* obj);
static void _vala_zeitgeist_queued_proxy_wrapper_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_zeitgeist_queued_proxy_wrapper_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static void _zeitgeist_queued_proxy_wrapper_queued_method_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (zeitgeist_queued_proxy_wrapper_queued_method_unref (var), NULL));
}


static void _g_slist_free__zeitgeist_queued_proxy_wrapper_queued_method_unref0_ (GSList* self) {
	g_slist_foreach (self, (GFunc) _zeitgeist_queued_proxy_wrapper_queued_method_unref0_, NULL);
	g_slist_free (self);
}


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


static void _zeitgeist_queued_proxy_wrapper_name_owner_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	zeitgeist_queued_proxy_wrapper_name_owner_changed ((ZeitgeistQueuedProxyWrapper*) self, pspec);
}


void zeitgeist_queued_proxy_wrapper_proxy_acquired (ZeitgeistQueuedProxyWrapper* self, GObject* proxy) {
	GObject* _tmp0_ = NULL;
	GDBusProxy* _tmp1_ = NULL;
	GObject* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (proxy != NULL);
	zeitgeist_queued_proxy_wrapper_set_is_connected (self, TRUE);
	zeitgeist_queued_proxy_wrapper_set_proxy_created (self, TRUE);
	_tmp0_ = proxy;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, G_TYPE_DBUS_PROXY) ? ((GDBusProxy*) _tmp0_) : NULL);
	_g_object_unref0 (self->priv->dbus_proxy);
	self->priv->dbus_proxy = _tmp1_;
	_tmp2_ = proxy;
	g_signal_connect_object (_tmp2_, "notify::g-name-owner", (GCallback) _zeitgeist_queued_proxy_wrapper_name_owner_changed_g_object_notify, self, 0);
	zeitgeist_queued_proxy_wrapper_on_connection_established (self);
	zeitgeist_queued_proxy_wrapper_process_queued_methods (self);
}


static gpointer _g_error_copy0 (gpointer self) {
	return self ? g_error_copy (self) : NULL;
}


void zeitgeist_queued_proxy_wrapper_proxy_unavailable (ZeitgeistQueuedProxyWrapper* self, GError* err) {
	GError* _tmp0_ = NULL;
	GError* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = err;
	_tmp1_ = _g_error_copy0 (_tmp0_);
	_g_error_free0 (self->priv->log_error);
	self->priv->log_error = _tmp1_;
	zeitgeist_queued_proxy_wrapper_process_queued_methods (self);
}


static gpointer _zeitgeist_queued_proxy_wrapper_queued_method_ref0 (gpointer self) {
	return self ? zeitgeist_queued_proxy_wrapper_queued_method_ref (self) : NULL;
}


void zeitgeist_queued_proxy_wrapper_process_queued_methods (ZeitgeistQueuedProxyWrapper* self) {
	GSList* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	self->priv->method_dispatch_queue = g_slist_reverse (self->priv->method_dispatch_queue);
	_tmp0_ = self->priv->method_dispatch_queue;
	{
		GSList* m_collection = NULL;
		GSList* m_it = NULL;
		m_collection = _tmp0_;
		for (m_it = m_collection; m_it != NULL; m_it = m_it->next) {
			ZeitgeistQueuedProxyWrapperQueuedMethod* _tmp1_ = NULL;
			ZeitgeistQueuedProxyWrapperQueuedMethod* m = NULL;
			_tmp1_ = _zeitgeist_queued_proxy_wrapper_queued_method_ref0 ((ZeitgeistQueuedProxyWrapperQueuedMethod*) m_it->data);
			m = _tmp1_;
			{
				ZeitgeistQueuedProxyWrapperQueuedMethod* _tmp2_ = NULL;
				GSourceFunc _tmp3_ = NULL;
				void* _tmp3__target = NULL;
				GSourceFunc _tmp4_ = NULL;
				void* _tmp4__target = NULL;
				_tmp2_ = m;
				_tmp3_ = zeitgeist_queued_proxy_wrapper_queued_method_get_queued_method (_tmp2_, &_tmp3__target);
				_tmp4_ = _tmp3_;
				_tmp4__target = _tmp3__target;
				_tmp4_ (_tmp4__target);
				_zeitgeist_queued_proxy_wrapper_queued_method_unref0 (m);
			}
		}
	}
	__g_slist_free__zeitgeist_queued_proxy_wrapper_queued_method_unref0_0 (self->priv->method_dispatch_queue);
	self->priv->method_dispatch_queue = NULL;
}


void zeitgeist_queued_proxy_wrapper_name_owner_changed (ZeitgeistQueuedProxyWrapper* self, GParamSpec* pspec) {
	gchar* name_owner = NULL;
	GDBusProxy* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gboolean _tmp3_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (pspec != NULL);
	_tmp0_ = self->priv->dbus_proxy;
	_tmp1_ = g_dbus_proxy_get_name_owner (_tmp0_);
	name_owner = _tmp1_;
	_tmp2_ = name_owner;
	zeitgeist_queued_proxy_wrapper_set_is_connected (self, _tmp2_ != NULL);
	_tmp3_ = self->priv->_is_connected;
	if (_tmp3_) {
		zeitgeist_queued_proxy_wrapper_on_connection_established (self);
	} else {
		zeitgeist_queued_proxy_wrapper_on_connection_lost (self);
	}
	_g_free0 (name_owner);
}


static void zeitgeist_queued_proxy_wrapper_real_on_connection_established (ZeitgeistQueuedProxyWrapper* self) {
	g_critical ("Type `%s' does not implement abstract method `zeitgeist_queued_proxy_wrapper_on_connection_established'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}


void zeitgeist_queued_proxy_wrapper_on_connection_established (ZeitgeistQueuedProxyWrapper* self) {
	g_return_if_fail (self != NULL);
	ZEITGEIST_QUEUED_PROXY_WRAPPER_GET_CLASS (self)->on_connection_established (self);
}


static void zeitgeist_queued_proxy_wrapper_real_on_connection_lost (ZeitgeistQueuedProxyWrapper* self) {
	g_critical ("Type `%s' does not implement abstract method `zeitgeist_queued_proxy_wrapper_on_connection_lost'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}


void zeitgeist_queued_proxy_wrapper_on_connection_lost (ZeitgeistQueuedProxyWrapper* self) {
	g_return_if_fail (self != NULL);
	ZEITGEIST_QUEUED_PROXY_WRAPPER_GET_CLASS (self)->on_connection_lost (self);
}


static void zeitgeist_queued_proxy_wrapper_wait_for_proxy_data_free (gpointer _data) {
	ZeitgeistQueuedProxyWrapperWaitForProxyData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ZeitgeistQueuedProxyWrapperWaitForProxyData, _data_);
}


void zeitgeist_queued_proxy_wrapper_wait_for_proxy (ZeitgeistQueuedProxyWrapper* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ZeitgeistQueuedProxyWrapperWaitForProxyData* _data_;
	ZeitgeistQueuedProxyWrapper* _tmp0_ = NULL;
	_data_ = g_slice_new0 (ZeitgeistQueuedProxyWrapperWaitForProxyData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, zeitgeist_queued_proxy_wrapper_wait_for_proxy);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, zeitgeist_queued_proxy_wrapper_wait_for_proxy_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	zeitgeist_queued_proxy_wrapper_wait_for_proxy_co (_data_);
}


void zeitgeist_queued_proxy_wrapper_wait_for_proxy_finish (ZeitgeistQueuedProxyWrapper* self, GAsyncResult* _res_, GError** error) {
	ZeitgeistQueuedProxyWrapperWaitForProxyData* _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 gboolean _zeitgeist_queued_proxy_wrapper_wait_for_proxy_co_gsource_func (gpointer self) {
	gboolean result;
	result = zeitgeist_queued_proxy_wrapper_wait_for_proxy_co (self);
	return result;
}


static gboolean zeitgeist_queued_proxy_wrapper_wait_for_proxy_co (ZeitgeistQueuedProxyWrapperWaitForProxyData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = FALSE;
	_data_->_tmp0_ = _data_->self->priv->_proxy_created;
	_data_->_tmp1_ = FALSE;
	_data_->_tmp1_ = G_LIKELY (_data_->_tmp0_);
	if (_data_->_tmp1_) {
		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_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->self->priv->method_dispatch_queue;
	if (_data_->_tmp2_ == NULL) {
		__g_slist_free__zeitgeist_queued_proxy_wrapper_queued_method_unref0_0 (_data_->self->priv->method_dispatch_queue);
		_data_->self->priv->method_dispatch_queue = NULL;
	}
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = zeitgeist_queued_proxy_wrapper_queued_method_new (_zeitgeist_queued_proxy_wrapper_wait_for_proxy_co_gsource_func, _data_, NULL);
	_data_->self->priv->method_dispatch_queue = g_slist_prepend (_data_->self->priv->method_dispatch_queue, _data_->_tmp3_);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = _data_->self->priv->log_error;
	if (_data_->_tmp4_ != NULL) {
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = _data_->self->priv->log_error;
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = _g_error_copy0 (_data_->_tmp5_);
		_data_->_inner_error_ = _data_->_tmp6_;
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		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;
	}
	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;
}


ZeitgeistQueuedProxyWrapper* zeitgeist_queued_proxy_wrapper_construct (GType object_type) {
	ZeitgeistQueuedProxyWrapper * self = NULL;
	self = (ZeitgeistQueuedProxyWrapper*) g_object_new (object_type, NULL);
	return self;
}


gboolean zeitgeist_queued_proxy_wrapper_get_proxy_created (ZeitgeistQueuedProxyWrapper* self) {
	gboolean result;
	gboolean _tmp0_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_proxy_created;
	result = _tmp0_;
	return result;
}


static void zeitgeist_queued_proxy_wrapper_set_proxy_created (ZeitgeistQueuedProxyWrapper* self, gboolean value) {
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_proxy_created = _tmp0_;
	g_object_notify ((GObject *) self, "proxy-created");
}


gboolean zeitgeist_queued_proxy_wrapper_get_is_connected (ZeitgeistQueuedProxyWrapper* self) {
	gboolean result;
	gboolean _tmp0_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_is_connected;
	result = _tmp0_;
	return result;
}


static void zeitgeist_queued_proxy_wrapper_set_is_connected (ZeitgeistQueuedProxyWrapper* self, gboolean value) {
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_is_connected = _tmp0_;
	g_object_notify ((GObject *) self, "is-connected");
}


ZeitgeistQueuedProxyWrapperQueuedMethod* zeitgeist_queued_proxy_wrapper_queued_method_construct (GType object_type, GSourceFunc callback, void* callback_target, GDestroyNotify callback_target_destroy_notify) {
	ZeitgeistQueuedProxyWrapperQueuedMethod* self = NULL;
	GSourceFunc _tmp0_ = NULL;
	void* _tmp0__target = NULL;
	GDestroyNotify _tmp0__target_destroy_notify = NULL;
	self = (ZeitgeistQueuedProxyWrapperQueuedMethod*) g_type_create_instance (object_type);
	_tmp0_ = callback;
	_tmp0__target = callback_target;
	_tmp0__target_destroy_notify = callback_target_destroy_notify;
	callback_target_destroy_notify = NULL;
	zeitgeist_queued_proxy_wrapper_queued_method_set_queued_method (self, _tmp0_, _tmp0__target, _tmp0__target_destroy_notify);
	(callback_target_destroy_notify == NULL) ? NULL : (callback_target_destroy_notify (callback_target), NULL);
	callback = NULL;
	callback_target = NULL;
	callback_target_destroy_notify = NULL;
	return self;
}


ZeitgeistQueuedProxyWrapperQueuedMethod* zeitgeist_queued_proxy_wrapper_queued_method_new (GSourceFunc callback, void* callback_target, GDestroyNotify callback_target_destroy_notify) {
	return zeitgeist_queued_proxy_wrapper_queued_method_construct (ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD, callback, callback_target, callback_target_destroy_notify);
}


GSourceFunc zeitgeist_queued_proxy_wrapper_queued_method_get_queued_method (ZeitgeistQueuedProxyWrapperQueuedMethod* self, gpointer* result_target) {
	GSourceFunc result;
	GSourceFunc _tmp0_ = NULL;
	void* _tmp0__target = NULL;
	GSourceFunc _tmp1_ = NULL;
	void* _tmp1__target = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_queued_method;
	_tmp0__target = self->priv->_queued_method_target;
	_tmp1_ = _tmp0_;
	_tmp1__target = _tmp0__target;
	*result_target = _tmp1__target;
	result = _tmp1_;
	return result;
}


static void zeitgeist_queued_proxy_wrapper_queued_method_set_queued_method (ZeitgeistQueuedProxyWrapperQueuedMethod* self, GSourceFunc value, gpointer value_target, GDestroyNotify value_target_destroy_notify) {
	GSourceFunc _tmp0_ = NULL;
	void* _tmp0__target = NULL;
	GDestroyNotify _tmp0__target_destroy_notify = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp0__target = value_target;
	_tmp0__target_destroy_notify = value_target_destroy_notify;
	value_target_destroy_notify = NULL;
	(self->priv->_queued_method_target_destroy_notify == NULL) ? NULL : (self->priv->_queued_method_target_destroy_notify (self->priv->_queued_method_target), NULL);
	self->priv->_queued_method = NULL;
	self->priv->_queued_method_target = NULL;
	self->priv->_queued_method_target_destroy_notify = NULL;
	self->priv->_queued_method = _tmp0_;
	self->priv->_queued_method_target = _tmp0__target;
	self->priv->_queued_method_target_destroy_notify = _tmp0__target_destroy_notify;
	(value_target_destroy_notify == NULL) ? NULL : (value_target_destroy_notify (value_target), NULL);
	value = NULL;
	value_target = NULL;
	value_target_destroy_notify = NULL;
}


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


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


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


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


static gchar* zeitgeist_queued_proxy_wrapper_value_queued_method_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		ZeitgeistQueuedProxyWrapperQueuedMethod* 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 = zeitgeist_queued_proxy_wrapper_queued_method_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* zeitgeist_queued_proxy_wrapper_value_queued_method_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	ZeitgeistQueuedProxyWrapperQueuedMethod** 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 = zeitgeist_queued_proxy_wrapper_queued_method_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* zeitgeist_queued_proxy_wrapper_param_spec_queued_method (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ZeitgeistQueuedProxyWrapperParamSpecQueuedMethod* spec;
	g_return_val_if_fail (g_type_is_a (object_type, ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD), 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 zeitgeist_queued_proxy_wrapper_value_get_queued_method (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD), NULL);
	return value->data[0].v_pointer;
}


void zeitgeist_queued_proxy_wrapper_value_set_queued_method (GValue* value, gpointer v_object) {
	ZeitgeistQueuedProxyWrapperQueuedMethod* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD));
		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;
		zeitgeist_queued_proxy_wrapper_queued_method_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		zeitgeist_queued_proxy_wrapper_queued_method_unref (old);
	}
}


void zeitgeist_queued_proxy_wrapper_value_take_queued_method (GValue* value, gpointer v_object) {
	ZeitgeistQueuedProxyWrapperQueuedMethod* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD));
		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) {
		zeitgeist_queued_proxy_wrapper_queued_method_unref (old);
	}
}


static void zeitgeist_queued_proxy_wrapper_queued_method_class_init (ZeitgeistQueuedProxyWrapperQueuedMethodClass * klass) {
	zeitgeist_queued_proxy_wrapper_queued_method_parent_class = g_type_class_peek_parent (klass);
	((ZeitgeistQueuedProxyWrapperQueuedMethodClass *) klass)->finalize = zeitgeist_queued_proxy_wrapper_queued_method_finalize;
	g_type_class_add_private (klass, sizeof (ZeitgeistQueuedProxyWrapperQueuedMethodPrivate));
}


static void zeitgeist_queued_proxy_wrapper_queued_method_instance_init (ZeitgeistQueuedProxyWrapperQueuedMethod * self) {
	self->priv = ZEITGEIST_QUEUED_PROXY_WRAPPER_QUEUED_METHOD_GET_PRIVATE (self);
	self->ref_count = 1;
}


static void zeitgeist_queued_proxy_wrapper_queued_method_finalize (ZeitgeistQueuedProxyWrapperQueuedMethod* obj) {
	ZeitgeistQueuedProxyWrapperQueuedMethod * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ZEITGEIST_QUEUED_PROXY_WRAPPER_TYPE_QUEUED_METHOD, ZeitgeistQueuedProxyWrapperQueuedMethod);
	g_signal_handlers_destroy (self);
	(self->priv->_queued_method_target_destroy_notify == NULL) ? NULL : (self->priv->_queued_method_target_destroy_notify (self->priv->_queued_method_target), NULL);
	self->priv->_queued_method = NULL;
	self->priv->_queued_method_target = NULL;
	self->priv->_queued_method_target_destroy_notify = NULL;
}


GType zeitgeist_queued_proxy_wrapper_queued_method_get_type (void) {
	static volatile gsize zeitgeist_queued_proxy_wrapper_queued_method_type_id__volatile = 0;
	if (g_once_init_enter (&zeitgeist_queued_proxy_wrapper_queued_method_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { zeitgeist_queued_proxy_wrapper_value_queued_method_init, zeitgeist_queued_proxy_wrapper_value_queued_method_free_value, zeitgeist_queued_proxy_wrapper_value_queued_method_copy_value, zeitgeist_queued_proxy_wrapper_value_queued_method_peek_pointer, "p", zeitgeist_queued_proxy_wrapper_value_queued_method_collect_value, "p", zeitgeist_queued_proxy_wrapper_value_queued_method_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (ZeitgeistQueuedProxyWrapperQueuedMethodClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) zeitgeist_queued_proxy_wrapper_queued_method_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ZeitgeistQueuedProxyWrapperQueuedMethod), 0, (GInstanceInitFunc) zeitgeist_queued_proxy_wrapper_queued_method_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 zeitgeist_queued_proxy_wrapper_queued_method_type_id;
		zeitgeist_queued_proxy_wrapper_queued_method_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ZeitgeistQueuedProxyWrapperQueuedMethod", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&zeitgeist_queued_proxy_wrapper_queued_method_type_id__volatile, zeitgeist_queued_proxy_wrapper_queued_method_type_id);
	}
	return zeitgeist_queued_proxy_wrapper_queued_method_type_id__volatile;
}


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


void zeitgeist_queued_proxy_wrapper_queued_method_unref (gpointer instance) {
	ZeitgeistQueuedProxyWrapperQueuedMethod* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		ZEITGEIST_QUEUED_PROXY_WRAPPER_QUEUED_METHOD_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


static void zeitgeist_queued_proxy_wrapper_class_init (ZeitgeistQueuedProxyWrapperClass * klass) {
	zeitgeist_queued_proxy_wrapper_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ZeitgeistQueuedProxyWrapperPrivate));
	((ZeitgeistQueuedProxyWrapperClass *) klass)->on_connection_established = zeitgeist_queued_proxy_wrapper_real_on_connection_established;
	((ZeitgeistQueuedProxyWrapperClass *) klass)->on_connection_lost = zeitgeist_queued_proxy_wrapper_real_on_connection_lost;
	G_OBJECT_CLASS (klass)->get_property = _vala_zeitgeist_queued_proxy_wrapper_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_zeitgeist_queued_proxy_wrapper_set_property;
	G_OBJECT_CLASS (klass)->finalize = zeitgeist_queued_proxy_wrapper_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), ZEITGEIST_QUEUED_PROXY_WRAPPER_PROXY_CREATED, g_param_spec_boolean ("proxy-created", "proxy-created", "proxy-created", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), ZEITGEIST_QUEUED_PROXY_WRAPPER_IS_CONNECTED, g_param_spec_boolean ("is-connected", "is-connected", "is-connected", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void zeitgeist_queued_proxy_wrapper_instance_init (ZeitgeistQueuedProxyWrapper * self) {
	self->priv = ZEITGEIST_QUEUED_PROXY_WRAPPER_GET_PRIVATE (self);
	self->priv->_proxy_created = FALSE;
	self->priv->_is_connected = FALSE;
}


static void zeitgeist_queued_proxy_wrapper_finalize (GObject* obj) {
	ZeitgeistQueuedProxyWrapper * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ZEITGEIST_TYPE_QUEUED_PROXY_WRAPPER, ZeitgeistQueuedProxyWrapper);
	__g_slist_free__zeitgeist_queued_proxy_wrapper_queued_method_unref0_0 (self->priv->method_dispatch_queue);
	_g_error_free0 (self->priv->log_error);
	_g_object_unref0 (self->priv->dbus_proxy);
	G_OBJECT_CLASS (zeitgeist_queued_proxy_wrapper_parent_class)->finalize (obj);
}


GType zeitgeist_queued_proxy_wrapper_get_type (void) {
	static volatile gsize zeitgeist_queued_proxy_wrapper_type_id__volatile = 0;
	if (g_once_init_enter (&zeitgeist_queued_proxy_wrapper_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ZeitgeistQueuedProxyWrapperClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) zeitgeist_queued_proxy_wrapper_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ZeitgeistQueuedProxyWrapper), 0, (GInstanceInitFunc) zeitgeist_queued_proxy_wrapper_instance_init, NULL };
		GType zeitgeist_queued_proxy_wrapper_type_id;
		zeitgeist_queued_proxy_wrapper_type_id = g_type_register_static (G_TYPE_OBJECT, "ZeitgeistQueuedProxyWrapper", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&zeitgeist_queued_proxy_wrapper_type_id__volatile, zeitgeist_queued_proxy_wrapper_type_id);
	}
	return zeitgeist_queued_proxy_wrapper_type_id__volatile;
}


static void _vala_zeitgeist_queued_proxy_wrapper_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	ZeitgeistQueuedProxyWrapper * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, ZEITGEIST_TYPE_QUEUED_PROXY_WRAPPER, ZeitgeistQueuedProxyWrapper);
	switch (property_id) {
		case ZEITGEIST_QUEUED_PROXY_WRAPPER_PROXY_CREATED:
		g_value_set_boolean (value, zeitgeist_queued_proxy_wrapper_get_proxy_created (self));
		break;
		case ZEITGEIST_QUEUED_PROXY_WRAPPER_IS_CONNECTED:
		g_value_set_boolean (value, zeitgeist_queued_proxy_wrapper_get_is_connected (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_zeitgeist_queued_proxy_wrapper_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	ZeitgeistQueuedProxyWrapper * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, ZEITGEIST_TYPE_QUEUED_PROXY_WRAPPER, ZeitgeistQueuedProxyWrapper);
	switch (property_id) {
		case ZEITGEIST_QUEUED_PROXY_WRAPPER_PROXY_CREATED:
		zeitgeist_queued_proxy_wrapper_set_proxy_created (self, g_value_get_boolean (value));
		break;
		case ZEITGEIST_QUEUED_PROXY_WRAPPER_IS_CONNECTED:
		zeitgeist_queued_proxy_wrapper_set_is_connected (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



