/* disconnection-queue.c generated by valac 0.29.3.10-b87a, the Vala compiler
 * generated from disconnection-queue.vala, do not modify */

/* disconnection-queue.vala - disconnect signals automagically
 *
 * Copyright © 2013 Intel Corporation
 *
 * 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
 *
 * Author:
 *      Simon McVittie <simon.mcvittie@collabora.co.uk>
 */

#include <glib.h>
#include <glib-object.h>


#define FOLKS_TYPE_DISCONNECTION_QUEUE (folks_disconnection_queue_get_type ())
#define FOLKS_DISCONNECTION_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_TYPE_DISCONNECTION_QUEUE, FolksDisconnectionQueue))
#define FOLKS_DISCONNECTION_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_TYPE_DISCONNECTION_QUEUE, FolksDisconnectionQueueClass))
#define FOLKS_IS_DISCONNECTION_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_TYPE_DISCONNECTION_QUEUE))
#define FOLKS_IS_DISCONNECTION_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_TYPE_DISCONNECTION_QUEUE))
#define FOLKS_DISCONNECTION_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_TYPE_DISCONNECTION_QUEUE, FolksDisconnectionQueueClass))

typedef struct _FolksDisconnectionQueue FolksDisconnectionQueue;
typedef struct _FolksDisconnectionQueueClass FolksDisconnectionQueueClass;
typedef struct _FolksDisconnectionQueuePrivate FolksDisconnectionQueuePrivate;
typedef struct _FolksDisconnectionQueue_Connection FolksDisconnectionQueue_Connection;
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))

struct _FolksDisconnectionQueue {
	GObject parent_instance;
	FolksDisconnectionQueuePrivate * priv;
};

struct _FolksDisconnectionQueueClass {
	GObjectClass parent_class;
};

struct _FolksDisconnectionQueuePrivate {
	GPtrArray* _conns;
};

struct _FolksDisconnectionQueue_Connection {
	GObject* obj;
	gulong id;
};


static gpointer folks_disconnection_queue_parent_class = NULL;

GType folks_disconnection_queue_get_type (void) G_GNUC_CONST;
static void folks_disconnection_queue__connection_free (FolksDisconnectionQueue_Connection* self);
#define FOLKS_DISCONNECTION_QUEUE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FOLKS_TYPE_DISCONNECTION_QUEUE, FolksDisconnectionQueuePrivate))
enum  {
	FOLKS_DISCONNECTION_QUEUE_DUMMY_PROPERTY
};
void folks_disconnection_queue_drain (FolksDisconnectionQueue* self);
FolksDisconnectionQueue* folks_disconnection_queue_new (void);
FolksDisconnectionQueue* folks_disconnection_queue_construct (GType object_type);
static void _folks_disconnection_queue__connection_free0_ (gpointer var);
void folks_disconnection_queue_push (FolksDisconnectionQueue* self, GObject* obj, gulong id);
static FolksDisconnectionQueue_Connection* folks_disconnection_queue__connection_new (GObject* obj, gulong id);
static FolksDisconnectionQueue_Connection* folks_disconnection_queue__connection_new (GObject* obj, gulong id);
static void folks_disconnection_queue__connection_instance_init (FolksDisconnectionQueue_Connection * self);
static void folks_disconnection_queue_finalize (GObject* obj);


static void _folks_disconnection_queue__connection_free0_ (gpointer var) {
#line 42 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	(var == NULL) ? NULL : (var = (folks_disconnection_queue__connection_free (var), NULL));
#line 85 "disconnection-queue.c"
}


FolksDisconnectionQueue* folks_disconnection_queue_construct (GType object_type) {
	FolksDisconnectionQueue * self = NULL;
	GPtrArray* _tmp0_ = NULL;
#line 40 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	self = (FolksDisconnectionQueue*) g_object_new (object_type, NULL);
#line 42 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_tmp0_ = g_ptr_array_new_with_free_func (_folks_disconnection_queue__connection_free0_);
#line 42 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_g_ptr_array_unref0 (self->priv->_conns);
#line 42 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	self->priv->_conns = _tmp0_;
#line 40 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	return self;
#line 102 "disconnection-queue.c"
}


FolksDisconnectionQueue* folks_disconnection_queue_new (void) {
#line 40 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	return folks_disconnection_queue_construct (FOLKS_TYPE_DISCONNECTION_QUEUE);
#line 109 "disconnection-queue.c"
}


void folks_disconnection_queue_push (FolksDisconnectionQueue* self, GObject* obj, gulong id) {
	gulong _tmp0_ = 0UL;
	GPtrArray* _tmp1_ = NULL;
	GObject* _tmp2_ = NULL;
	gulong _tmp3_ = 0UL;
	FolksDisconnectionQueue_Connection* _tmp4_ = NULL;
#line 45 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	g_return_if_fail (self != NULL);
#line 45 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	g_return_if_fail (obj != NULL);
#line 47 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_tmp0_ = id;
#line 47 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	g_return_if_fail (_tmp0_ != ((gulong) 0));
#line 49 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_tmp1_ = self->priv->_conns;
#line 49 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_tmp2_ = obj;
#line 49 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_tmp3_ = id;
#line 49 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_tmp4_ = folks_disconnection_queue__connection_new (_tmp2_, _tmp3_);
#line 49 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	g_ptr_array_add (_tmp1_, _tmp4_);
#line 137 "disconnection-queue.c"
}


static gpointer _g_ptr_array_ref0 (gpointer self) {
#line 54 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	return self ? g_ptr_array_ref (self) : NULL;
#line 144 "disconnection-queue.c"
}


static gint g_ptr_array_get_length (GPtrArray* self) {
	gint result;
	guint _tmp0_ = 0U;
#line 4430 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, 0);
#line 4430 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	_tmp0_ = self->len;
#line 4430 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	result = (gint) _tmp0_;
#line 4430 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	return result;
#line 159 "disconnection-queue.c"
}


static void g_ptr_array_set_length (GPtrArray* self, gint value) {
	gint _tmp0_ = 0;
#line 4431 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	g_return_if_fail (self != NULL);
#line 4431 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	_tmp0_ = value;
#line 4431 "/opt/gnome3/build/share/vala-0.30/vapi/glib-2.0.vapi"
	g_ptr_array_set_size (self, _tmp0_);
#line 171 "disconnection-queue.c"
}


void folks_disconnection_queue_drain (FolksDisconnectionQueue* self) {
	GPtrArray* conns = NULL;
	GPtrArray* _tmp0_ = NULL;
	GPtrArray* _tmp1_ = NULL;
	GPtrArray* _tmp2_ = NULL;
#line 52 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	g_return_if_fail (self != NULL);
#line 54 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_tmp0_ = self->priv->_conns;
#line 54 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_tmp1_ = _g_ptr_array_ref0 (_tmp0_);
#line 54 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	conns = _tmp1_;
#line 55 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_tmp2_ = g_ptr_array_new_with_free_func (_folks_disconnection_queue__connection_free0_);
#line 55 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_g_ptr_array_unref0 (self->priv->_conns);
#line 55 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	self->priv->_conns = _tmp2_;
#line 194 "disconnection-queue.c"
	{
		guint i = 0U;
#line 57 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
		i = (guint) 1;
#line 199 "disconnection-queue.c"
		{
			gboolean _tmp3_ = FALSE;
#line 57 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
			_tmp3_ = TRUE;
#line 57 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
			while (TRUE) {
#line 206 "disconnection-queue.c"
				guint _tmp5_ = 0U;
				GPtrArray* _tmp6_ = NULL;
				gint _tmp7_ = 0;
				gint _tmp8_ = 0;
				FolksDisconnectionQueue_Connection* conn = NULL;
				GPtrArray* _tmp9_ = NULL;
				GPtrArray* _tmp10_ = NULL;
				gint _tmp11_ = 0;
				gint _tmp12_ = 0;
				guint _tmp13_ = 0U;
				gconstpointer _tmp14_ = NULL;
				gboolean _tmp15_ = FALSE;
				FolksDisconnectionQueue_Connection* _tmp16_ = NULL;
				GObject* _tmp17_ = NULL;
#line 57 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				if (!_tmp3_) {
#line 223 "disconnection-queue.c"
					guint _tmp4_ = 0U;
#line 57 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
					_tmp4_ = i;
#line 57 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
					i = _tmp4_ + 1;
#line 229 "disconnection-queue.c"
				}
#line 57 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				_tmp3_ = FALSE;
#line 57 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				_tmp5_ = i;
#line 57 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				_tmp6_ = conns;
#line 57 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				_tmp7_ = g_ptr_array_get_length (_tmp6_);
#line 57 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				_tmp8_ = _tmp7_;
#line 57 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				if (!(_tmp5_ <= ((guint) _tmp8_))) {
#line 57 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
					break;
#line 245 "disconnection-queue.c"
				}
#line 59 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				_tmp9_ = conns;
#line 59 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				_tmp10_ = conns;
#line 59 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				_tmp11_ = g_ptr_array_get_length (_tmp10_);
#line 59 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				_tmp12_ = _tmp11_;
#line 59 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				_tmp13_ = i;
#line 59 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				_tmp14_ = g_ptr_array_index (_tmp9_, _tmp12_ - _tmp13_);
#line 59 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				conn = (FolksDisconnectionQueue_Connection*) _tmp14_;
#line 61 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				_tmp16_ = conn;
#line 61 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				_tmp17_ = _tmp16_->obj;
#line 61 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				if (_tmp17_ != NULL) {
#line 267 "disconnection-queue.c"
					FolksDisconnectionQueue_Connection* _tmp18_ = NULL;
					gulong _tmp19_ = 0UL;
#line 61 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
					_tmp18_ = conn;
#line 61 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
					_tmp19_ = _tmp18_->id;
#line 61 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
					_tmp15_ = _tmp19_ != ((gulong) 0);
#line 276 "disconnection-queue.c"
				} else {
#line 61 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
					_tmp15_ = FALSE;
#line 280 "disconnection-queue.c"
				}
#line 61 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
				if (_tmp15_) {
#line 284 "disconnection-queue.c"
					FolksDisconnectionQueue_Connection* _tmp20_ = NULL;
					GObject* _tmp21_ = NULL;
					FolksDisconnectionQueue_Connection* _tmp22_ = NULL;
					gulong _tmp23_ = 0UL;
#line 62 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
					_tmp20_ = conn;
#line 62 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
					_tmp21_ = _tmp20_->obj;
#line 62 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
					_tmp22_ = conn;
#line 62 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
					_tmp23_ = _tmp22_->id;
#line 62 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
					g_signal_handler_disconnect (G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, G_TYPE_OBJECT, GObject), _tmp23_);
#line 299 "disconnection-queue.c"
				}
			}
		}
	}
#line 52 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_g_ptr_array_unref0 (conns);
#line 306 "disconnection-queue.c"
}


static FolksDisconnectionQueue_Connection* folks_disconnection_queue__connection_new (GObject* obj, gulong id) {
	FolksDisconnectionQueue_Connection* self;
	GObject* _tmp0_ = NULL;
	gulong _tmp1_ = 0UL;
#line 31 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	g_return_val_if_fail (obj != NULL, NULL);
#line 31 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	self = g_slice_new0 (FolksDisconnectionQueue_Connection);
#line 31 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	folks_disconnection_queue__connection_instance_init (self);
#line 33 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_tmp0_ = obj;
#line 33 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	self->obj = _tmp0_;
#line 34 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_tmp1_ = id;
#line 34 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	self->id = _tmp1_;
#line 31 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	return self;
#line 330 "disconnection-queue.c"
}


static void folks_disconnection_queue__connection_instance_init (FolksDisconnectionQueue_Connection * self) {
}


static void folks_disconnection_queue__connection_free (FolksDisconnectionQueue_Connection* self) {
#line 26 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	g_slice_free (FolksDisconnectionQueue_Connection, self);
#line 341 "disconnection-queue.c"
}


static void folks_disconnection_queue_class_init (FolksDisconnectionQueueClass * klass) {
#line 23 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	folks_disconnection_queue_parent_class = g_type_class_peek_parent (klass);
#line 23 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	g_type_class_add_private (klass, sizeof (FolksDisconnectionQueuePrivate));
#line 23 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	G_OBJECT_CLASS (klass)->finalize = folks_disconnection_queue_finalize;
#line 352 "disconnection-queue.c"
}


static void folks_disconnection_queue_instance_init (FolksDisconnectionQueue * self) {
#line 23 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	self->priv = FOLKS_DISCONNECTION_QUEUE_GET_PRIVATE (self);
#line 359 "disconnection-queue.c"
}


static void folks_disconnection_queue_finalize (GObject* obj) {
	FolksDisconnectionQueue * self;
#line 23 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLKS_TYPE_DISCONNECTION_QUEUE, FolksDisconnectionQueue);
#line 68 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	folks_disconnection_queue_drain (self);
#line 38 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	_g_ptr_array_unref0 (self->priv->_conns);
#line 23 "/opt/gnome3/source/folks/tests/lib/disconnection-queue.vala"
	G_OBJECT_CLASS (folks_disconnection_queue_parent_class)->finalize (obj);
#line 373 "disconnection-queue.c"
}


GType folks_disconnection_queue_get_type (void) {
	static volatile gsize folks_disconnection_queue_type_id__volatile = 0;
	if (g_once_init_enter (&folks_disconnection_queue_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FolksDisconnectionQueueClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folks_disconnection_queue_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolksDisconnectionQueue), 0, (GInstanceInitFunc) folks_disconnection_queue_instance_init, NULL };
		GType folks_disconnection_queue_type_id;
		folks_disconnection_queue_type_id = g_type_register_static (G_TYPE_OBJECT, "FolksDisconnectionQueue", &g_define_type_info, 0);
		g_once_init_leave (&folks_disconnection_queue_type_id__volatile, folks_disconnection_queue_type_id);
	}
	return folks_disconnection_queue_type_id__volatile;
}



