/* deletable.c generated by valac 0.20.1.64-fa28c, the Vala compiler
 * generated from deletable.vala, do not modify */

/*
 * Seahorse
 *
 * Copyright (C) 2004,2005 Stefan Walter
 * Copyright (C) 2011 Collabora Ltd.
 * Copyright (C) 2012 Stefan Walter
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 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 General Public License
 * along with this program; if not, write to the
 * Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#include <glib.h>
#include <glib-object.h>
#include "seahorse-internal.h"
#include <gtk/gtk.h>
#include <gio/gio.h>

typedef struct _Block2Data Block2Data;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))

struct _Block2Data {
	int _ref_count_;
	GMainLoop* loop;
	GAsyncResult* _result_;
};



static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static void ____lambda6_ (Block2Data* _data2_, GObject* obj, GAsyncResult* res);
static void _____lambda6__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);


SeahorseDeleter* seahorse_deletable_create_deleter (SeahorseDeletable* self) {
#line 27 "/data/projects/seahorse/common/deletable.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 27 "/data/projects/seahorse/common/deletable.vala"
	return SEAHORSE_DELETABLE_GET_INTERFACE (self)->create_deleter (self);
#line 58 "deletable.c"
}


gboolean seahorse_deletable_can_delete (GObject* obj) {
	gboolean result = FALSE;
	GObject* _tmp0_ = NULL;
#line 30 "/data/projects/seahorse/common/deletable.vala"
	g_return_val_if_fail (obj != NULL, FALSE);
#line 31 "/data/projects/seahorse/common/deletable.vala"
	_tmp0_ = obj;
#line 31 "/data/projects/seahorse/common/deletable.vala"
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, SEAHORSE_TYPE_DELETABLE)) {
#line 71 "deletable.c"
		GObject* _tmp1_ = NULL;
		gboolean _tmp2_ = FALSE;
		gboolean _tmp3_ = FALSE;
#line 32 "/data/projects/seahorse/common/deletable.vala"
		_tmp1_ = obj;
#line 32 "/data/projects/seahorse/common/deletable.vala"
		_tmp2_ = seahorse_deletable_get_deletable (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, SEAHORSE_TYPE_DELETABLE, SeahorseDeletable));
#line 32 "/data/projects/seahorse/common/deletable.vala"
		_tmp3_ = _tmp2_;
#line 32 "/data/projects/seahorse/common/deletable.vala"
		result = _tmp3_;
#line 32 "/data/projects/seahorse/common/deletable.vala"
		return result;
#line 85 "deletable.c"
	}
#line 33 "/data/projects/seahorse/common/deletable.vala"
	result = FALSE;
#line 33 "/data/projects/seahorse/common/deletable.vala"
	return result;
#line 91 "deletable.c"
}


static Block2Data* block2_data_ref (Block2Data* _data2_) {
#line 36 "/data/projects/seahorse/common/deletable.vala"
	g_atomic_int_inc (&_data2_->_ref_count_);
#line 36 "/data/projects/seahorse/common/deletable.vala"
	return _data2_;
#line 100 "deletable.c"
}


static void block2_data_unref (void * _userdata_) {
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
#line 36 "/data/projects/seahorse/common/deletable.vala"
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
#line 36 "/data/projects/seahorse/common/deletable.vala"
		_g_object_unref0 (_data2_->_result_);
#line 36 "/data/projects/seahorse/common/deletable.vala"
		_g_main_loop_unref0 (_data2_->loop);
#line 36 "/data/projects/seahorse/common/deletable.vala"
		g_slice_free (Block2Data, _data2_);
#line 115 "deletable.c"
	}
}


static gpointer _g_object_ref0 (gpointer self) {
#line 45 "/data/projects/seahorse/common/deletable.vala"
	return self ? g_object_ref (self) : NULL;
#line 123 "deletable.c"
}


static void ____lambda6_ (Block2Data* _data2_, GObject* obj, GAsyncResult* res) {
	GAsyncResult* _tmp0_ = NULL;
	GAsyncResult* _tmp1_ = NULL;
	GMainLoop* _tmp2_ = NULL;
#line 72 "/data/projects/seahorse/common/deletable.vala"
	g_return_if_fail (res != NULL);
#line 73 "/data/projects/seahorse/common/deletable.vala"
	_tmp0_ = res;
#line 73 "/data/projects/seahorse/common/deletable.vala"
	_tmp1_ = _g_object_ref0 (_tmp0_);
#line 73 "/data/projects/seahorse/common/deletable.vala"
	_g_object_unref0 (_data2_->_result_);
#line 73 "/data/projects/seahorse/common/deletable.vala"
	_data2_->_result_ = _tmp1_;
#line 74 "/data/projects/seahorse/common/deletable.vala"
	_tmp2_ = _data2_->loop;
#line 74 "/data/projects/seahorse/common/deletable.vala"
	g_main_loop_quit (_tmp2_);
#line 145 "deletable.c"
}


static void _____lambda6__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
#line 72 "/data/projects/seahorse/common/deletable.vala"
	____lambda6_ (self, source_object, res);
#line 72 "/data/projects/seahorse/common/deletable.vala"
	block2_data_unref (self);
#line 154 "deletable.c"
}


gint seahorse_deletable_delete_with_prompt_wait (GList* objects, GtkWindow* parent, GError** error) {
	gint result = 0;
	Block2Data* _data2_;
	GMainLoop* _tmp0_ = NULL;
	gint count = 0;
	GHashTable* pending = NULL;
	GHashFunc _tmp1_ = NULL;
	GEqualFunc _tmp2_ = NULL;
	GHashTable* _tmp3_ = NULL;
	GList* _tmp4_ = NULL;
	GList* _tmp8_ = NULL;
	GError * _inner_error_ = NULL;
#line 36 "/data/projects/seahorse/common/deletable.vala"
	_data2_ = g_slice_new0 (Block2Data);
#line 36 "/data/projects/seahorse/common/deletable.vala"
	_data2_->_ref_count_ = 1;
#line 39 "/data/projects/seahorse/common/deletable.vala"
	_tmp0_ = g_main_loop_new (NULL, FALSE);
#line 39 "/data/projects/seahorse/common/deletable.vala"
	_data2_->loop = _tmp0_;
#line 40 "/data/projects/seahorse/common/deletable.vala"
	_data2_->_result_ = NULL;
#line 41 "/data/projects/seahorse/common/deletable.vala"
	count = 0;
#line 44 "/data/projects/seahorse/common/deletable.vala"
	_tmp1_ = g_direct_hash;
#line 44 "/data/projects/seahorse/common/deletable.vala"
	_tmp2_ = g_direct_equal;
#line 44 "/data/projects/seahorse/common/deletable.vala"
	_tmp3_ = g_hash_table_new_full (_tmp1_, _tmp2_, NULL, NULL);
#line 44 "/data/projects/seahorse/common/deletable.vala"
	pending = _tmp3_;
#line 45 "/data/projects/seahorse/common/deletable.vala"
	_tmp4_ = objects;
#line 192 "deletable.c"
	{
		GList* obj_collection = NULL;
		GList* obj_it = NULL;
#line 45 "/data/projects/seahorse/common/deletable.vala"
		obj_collection = _tmp4_;
#line 45 "/data/projects/seahorse/common/deletable.vala"
		for (obj_it = obj_collection; obj_it != NULL; obj_it = obj_it->next) {
#line 200 "deletable.c"
			GObject* _tmp5_ = NULL;
			GObject* obj = NULL;
#line 45 "/data/projects/seahorse/common/deletable.vala"
			_tmp5_ = _g_object_ref0 ((GObject*) obj_it->data);
#line 45 "/data/projects/seahorse/common/deletable.vala"
			obj = _tmp5_;
#line 207 "deletable.c"
			{
				GHashTable* _tmp6_ = NULL;
				GObject* _tmp7_ = NULL;
#line 46 "/data/projects/seahorse/common/deletable.vala"
				_tmp6_ = pending;
#line 46 "/data/projects/seahorse/common/deletable.vala"
				_tmp7_ = obj;
#line 46 "/data/projects/seahorse/common/deletable.vala"
				g_hash_table_add (_tmp6_, _tmp7_);
#line 45 "/data/projects/seahorse/common/deletable.vala"
				_g_object_unref0 (obj);
#line 219 "deletable.c"
			}
		}
	}
#line 48 "/data/projects/seahorse/common/deletable.vala"
	_tmp8_ = objects;
#line 225 "deletable.c"
	{
		GList* obj_collection = NULL;
		GList* obj_it = NULL;
#line 48 "/data/projects/seahorse/common/deletable.vala"
		obj_collection = _tmp8_;
#line 48 "/data/projects/seahorse/common/deletable.vala"
		for (obj_it = obj_collection; obj_it != NULL; obj_it = obj_it->next) {
#line 233 "deletable.c"
			GObject* _tmp9_ = NULL;
			GObject* obj = NULL;
#line 48 "/data/projects/seahorse/common/deletable.vala"
			_tmp9_ = _g_object_ref0 ((GObject*) obj_it->data);
#line 48 "/data/projects/seahorse/common/deletable.vala"
			obj = _tmp9_;
#line 240 "deletable.c"
			{
				GHashTable* _tmp10_ = NULL;
				GObject* _tmp11_ = NULL;
				gconstpointer _tmp12_ = NULL;
				GObject* _tmp13_ = NULL;
				gboolean _tmp14_ = FALSE;
				SeahorseDeleter* deleter = NULL;
				GObject* _tmp17_ = NULL;
				SeahorseDeleter* _tmp18_ = NULL;
				GList* _tmp19_ = NULL;
				gboolean ret = FALSE;
				SeahorseDeleter* _tmp28_ = NULL;
				GtkWindow* _tmp29_ = NULL;
				gboolean _tmp30_ = FALSE;
				gboolean _tmp31_ = FALSE;
				SeahorseDeleter* _tmp32_ = NULL;
				GMainLoop* _tmp33_ = NULL;
				gboolean _tmp34_ = FALSE;
				SeahorseDeleter* _tmp35_ = NULL;
				GAsyncResult* _tmp36_ = NULL;
				gboolean _tmp37_ = FALSE;
#line 49 "/data/projects/seahorse/common/deletable.vala"
				_tmp10_ = pending;
#line 49 "/data/projects/seahorse/common/deletable.vala"
				_tmp11_ = obj;
#line 49 "/data/projects/seahorse/common/deletable.vala"
				_tmp12_ = g_hash_table_lookup (_tmp10_, _tmp11_);
#line 49 "/data/projects/seahorse/common/deletable.vala"
				if (((GObject*) _tmp12_) == NULL) {
#line 50 "/data/projects/seahorse/common/deletable.vala"
					_g_object_unref0 (obj);
#line 50 "/data/projects/seahorse/common/deletable.vala"
					continue;
#line 274 "deletable.c"
				}
#line 52 "/data/projects/seahorse/common/deletable.vala"
				_tmp13_ = obj;
#line 52 "/data/projects/seahorse/common/deletable.vala"
				_tmp14_ = seahorse_deletable_can_delete (_tmp13_);
#line 52 "/data/projects/seahorse/common/deletable.vala"
				if (!_tmp14_) {
#line 282 "deletable.c"
					GHashTable* _tmp15_ = NULL;
					GObject* _tmp16_ = NULL;
#line 53 "/data/projects/seahorse/common/deletable.vala"
					_tmp15_ = pending;
#line 53 "/data/projects/seahorse/common/deletable.vala"
					_tmp16_ = obj;
#line 53 "/data/projects/seahorse/common/deletable.vala"
					g_hash_table_remove (_tmp15_, _tmp16_);
#line 54 "/data/projects/seahorse/common/deletable.vala"
					_g_object_unref0 (obj);
#line 54 "/data/projects/seahorse/common/deletable.vala"
					continue;
#line 295 "deletable.c"
				}
#line 57 "/data/projects/seahorse/common/deletable.vala"
				_tmp17_ = obj;
#line 57 "/data/projects/seahorse/common/deletable.vala"
				_tmp18_ = seahorse_deletable_create_deleter (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, SEAHORSE_TYPE_DELETABLE, SeahorseDeletable));
#line 57 "/data/projects/seahorse/common/deletable.vala"
				deleter = _tmp18_;
#line 60 "/data/projects/seahorse/common/deletable.vala"
				_tmp19_ = objects;
#line 305 "deletable.c"
				{
					GList* x_collection = NULL;
					GList* x_it = NULL;
#line 60 "/data/projects/seahorse/common/deletable.vala"
					x_collection = _tmp19_;
#line 60 "/data/projects/seahorse/common/deletable.vala"
					for (x_it = x_collection; x_it != NULL; x_it = x_it->next) {
#line 313 "deletable.c"
						GObject* _tmp20_ = NULL;
						GObject* x = NULL;
#line 60 "/data/projects/seahorse/common/deletable.vala"
						_tmp20_ = _g_object_ref0 ((GObject*) x_it->data);
#line 60 "/data/projects/seahorse/common/deletable.vala"
						x = _tmp20_;
#line 320 "deletable.c"
						{
							GObject* _tmp21_ = NULL;
							GObject* _tmp22_ = NULL;
							GHashTable* _tmp23_ = NULL;
							GObject* _tmp24_ = NULL;
							gconstpointer _tmp25_ = NULL;
#line 61 "/data/projects/seahorse/common/deletable.vala"
							_tmp21_ = x;
#line 61 "/data/projects/seahorse/common/deletable.vala"
							_tmp22_ = obj;
#line 61 "/data/projects/seahorse/common/deletable.vala"
							if (_tmp21_ == _tmp22_) {
#line 62 "/data/projects/seahorse/common/deletable.vala"
								_g_object_unref0 (x);
#line 62 "/data/projects/seahorse/common/deletable.vala"
								continue;
#line 337 "deletable.c"
							}
#line 63 "/data/projects/seahorse/common/deletable.vala"
							_tmp23_ = pending;
#line 63 "/data/projects/seahorse/common/deletable.vala"
							_tmp24_ = x;
#line 63 "/data/projects/seahorse/common/deletable.vala"
							_tmp25_ = g_hash_table_lookup (_tmp23_, _tmp24_);
#line 63 "/data/projects/seahorse/common/deletable.vala"
							if (((GObject*) _tmp25_) != NULL) {
#line 347 "deletable.c"
								SeahorseDeleter* _tmp26_ = NULL;
								GObject* _tmp27_ = NULL;
#line 64 "/data/projects/seahorse/common/deletable.vala"
								_tmp26_ = deleter;
#line 64 "/data/projects/seahorse/common/deletable.vala"
								_tmp27_ = x;
#line 64 "/data/projects/seahorse/common/deletable.vala"
								seahorse_deleter_add_object (_tmp26_, _tmp27_);
#line 356 "deletable.c"
							}
#line 60 "/data/projects/seahorse/common/deletable.vala"
							_g_object_unref0 (x);
#line 360 "deletable.c"
						}
					}
				}
#line 68 "/data/projects/seahorse/common/deletable.vala"
				_tmp28_ = deleter;
#line 68 "/data/projects/seahorse/common/deletable.vala"
				_tmp29_ = parent;
#line 68 "/data/projects/seahorse/common/deletable.vala"
				_tmp30_ = seahorse_deleter_prompt (_tmp28_, _tmp29_);
#line 68 "/data/projects/seahorse/common/deletable.vala"
				ret = _tmp30_;
#line 69 "/data/projects/seahorse/common/deletable.vala"
				_tmp31_ = ret;
#line 69 "/data/projects/seahorse/common/deletable.vala"
				if (!_tmp31_) {
#line 70 "/data/projects/seahorse/common/deletable.vala"
					_g_object_unref0 (deleter);
#line 70 "/data/projects/seahorse/common/deletable.vala"
					_g_object_unref0 (obj);
#line 70 "/data/projects/seahorse/common/deletable.vala"
					break;
#line 382 "deletable.c"
				}
#line 72 "/data/projects/seahorse/common/deletable.vala"
				_tmp32_ = deleter;
#line 72 "/data/projects/seahorse/common/deletable.vala"
				seahorse_deleter_delete (_tmp32_, NULL, _____lambda6__gasync_ready_callback, block2_data_ref (_data2_));
#line 77 "/data/projects/seahorse/common/deletable.vala"
				_tmp33_ = _data2_->loop;
#line 77 "/data/projects/seahorse/common/deletable.vala"
				g_main_loop_run (_tmp33_);
#line 79 "/data/projects/seahorse/common/deletable.vala"
				_tmp35_ = deleter;
#line 79 "/data/projects/seahorse/common/deletable.vala"
				_tmp36_ = _data2_->_result_;
#line 79 "/data/projects/seahorse/common/deletable.vala"
				_tmp37_ = seahorse_deleter_delete_finish (_tmp35_, _tmp36_, &_inner_error_);
#line 79 "/data/projects/seahorse/common/deletable.vala"
				_tmp34_ = _tmp37_;
#line 79 "/data/projects/seahorse/common/deletable.vala"
				if (_inner_error_ != NULL) {
#line 79 "/data/projects/seahorse/common/deletable.vala"
					g_propagate_error (error, _inner_error_);
#line 79 "/data/projects/seahorse/common/deletable.vala"
					_g_object_unref0 (deleter);
#line 79 "/data/projects/seahorse/common/deletable.vala"
					_g_object_unref0 (obj);
#line 79 "/data/projects/seahorse/common/deletable.vala"
					_g_hash_table_unref0 (pending);
#line 79 "/data/projects/seahorse/common/deletable.vala"
					block2_data_unref (_data2_);
#line 79 "/data/projects/seahorse/common/deletable.vala"
					_data2_ = NULL;
#line 79 "/data/projects/seahorse/common/deletable.vala"
					return 0;
#line 416 "deletable.c"
				}
#line 79 "/data/projects/seahorse/common/deletable.vala"
				if (_tmp34_) {
#line 420 "deletable.c"
					SeahorseDeleter* _tmp38_ = NULL;
					GList* _tmp39_ = NULL;
#line 80 "/data/projects/seahorse/common/deletable.vala"
					_tmp38_ = deleter;
#line 80 "/data/projects/seahorse/common/deletable.vala"
					_tmp39_ = seahorse_deleter_get_objects (_tmp38_);
#line 427 "deletable.c"
					{
						GList* x_collection = NULL;
						GList* x_it = NULL;
#line 80 "/data/projects/seahorse/common/deletable.vala"
						x_collection = _tmp39_;
#line 80 "/data/projects/seahorse/common/deletable.vala"
						for (x_it = x_collection; x_it != NULL; x_it = x_it->next) {
#line 435 "deletable.c"
							GObject* x = NULL;
#line 80 "/data/projects/seahorse/common/deletable.vala"
							x = (GObject*) x_it->data;
#line 439 "deletable.c"
							{
								GHashTable* _tmp40_ = NULL;
								GObject* _tmp41_ = NULL;
								gint _tmp42_ = 0;
#line 81 "/data/projects/seahorse/common/deletable.vala"
								_tmp40_ = pending;
#line 81 "/data/projects/seahorse/common/deletable.vala"
								_tmp41_ = x;
#line 81 "/data/projects/seahorse/common/deletable.vala"
								g_hash_table_remove (_tmp40_, _tmp41_);
#line 82 "/data/projects/seahorse/common/deletable.vala"
								_tmp42_ = count;
#line 82 "/data/projects/seahorse/common/deletable.vala"
								count = _tmp42_ + 1;
#line 454 "deletable.c"
							}
						}
					}
				} else {
#line 85 "/data/projects/seahorse/common/deletable.vala"
					_g_object_unref0 (deleter);
#line 85 "/data/projects/seahorse/common/deletable.vala"
					_g_object_unref0 (obj);
#line 85 "/data/projects/seahorse/common/deletable.vala"
					break;
#line 465 "deletable.c"
				}
#line 48 "/data/projects/seahorse/common/deletable.vala"
				_g_object_unref0 (deleter);
#line 48 "/data/projects/seahorse/common/deletable.vala"
				_g_object_unref0 (obj);
#line 471 "deletable.c"
			}
		}
	}
#line 89 "/data/projects/seahorse/common/deletable.vala"
	result = count;
#line 89 "/data/projects/seahorse/common/deletable.vala"
	_g_hash_table_unref0 (pending);
#line 89 "/data/projects/seahorse/common/deletable.vala"
	block2_data_unref (_data2_);
#line 89 "/data/projects/seahorse/common/deletable.vala"
	_data2_ = NULL;
#line 89 "/data/projects/seahorse/common/deletable.vala"
	return result;
#line 485 "deletable.c"
}


gboolean seahorse_deletable_get_deletable (SeahorseDeletable* self) {
#line 28 "/data/projects/seahorse/common/deletable.vala"
	g_return_val_if_fail (self != NULL, FALSE);
#line 28 "/data/projects/seahorse/common/deletable.vala"
	return SEAHORSE_DELETABLE_GET_INTERFACE (self)->get_deletable (self);
#line 494 "deletable.c"
}


static void seahorse_deletable_base_init (SeahorseDeletableIface * iface) {
#line 26 "/data/projects/seahorse/common/deletable.vala"
	static gboolean initialized = FALSE;
#line 26 "/data/projects/seahorse/common/deletable.vala"
	if (!initialized) {
#line 26 "/data/projects/seahorse/common/deletable.vala"
		initialized = TRUE;
#line 26 "/data/projects/seahorse/common/deletable.vala"
		g_object_interface_install_property (iface, g_param_spec_boolean ("deletable", "deletable", "deletable", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
#line 507 "deletable.c"
	}
}


GType seahorse_deletable_get_type (void) {
	static volatile gsize seahorse_deletable_type_id__volatile = 0;
	if (g_once_init_enter (&seahorse_deletable_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (SeahorseDeletableIface), (GBaseInitFunc) seahorse_deletable_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
		GType seahorse_deletable_type_id;
		seahorse_deletable_type_id = g_type_register_static (G_TYPE_INTERFACE, "SeahorseDeletable", &g_define_type_info, 0);
		g_type_interface_add_prerequisite (seahorse_deletable_type_id, G_TYPE_OBJECT);
		g_once_init_leave (&seahorse_deletable_type_id__volatile, seahorse_deletable_type_id);
	}
	return seahorse_deletable_type_id__volatile;
}



