/* remove-contact.c generated by valac 0.13.4, the Vala compiler
 * generated from remove-contact.vala, do not modify */

/*
 * Copyright (C) 2011 Collabora Ltd.
 *
 * 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, see <http://www.gnu.org/licenses/>.
 *
 * Authors: Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>
 *
 */

#include <glib.h>
#include <glib-object.h>
#include <folks-test.h>
#include <tracker-test.h>
#include <folks/folks.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <folks/folks-tracker.h>
#include <gio/gio.h>


#define TYPE_REMOVE_CONTACT_TESTS (remove_contact_tests_get_type ())
#define REMOVE_CONTACT_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_REMOVE_CONTACT_TESTS, RemoveContactTests))
#define REMOVE_CONTACT_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_REMOVE_CONTACT_TESTS, RemoveContactTestsClass))
#define IS_REMOVE_CONTACT_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_REMOVE_CONTACT_TESTS))
#define IS_REMOVE_CONTACT_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_REMOVE_CONTACT_TESTS))
#define REMOVE_CONTACT_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_REMOVE_CONTACT_TESTS, RemoveContactTestsClass))

typedef struct _RemoveContactTests RemoveContactTests;
typedef struct _RemoveContactTestsClass RemoveContactTestsClass;
typedef struct _RemoveContactTestsPrivate RemoveContactTestsPrivate;
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
#define _tracker_test_backend_unref0(var) ((var == NULL) ? NULL : (var = (tracker_test_backend_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#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 _RemoveContactTestsTestRemoveContactAsyncData RemoveContactTestsTestRemoveContactAsyncData;

struct _RemoveContactTests {
	FolksTestCase parent_instance;
	RemoveContactTestsPrivate * priv;
};

struct _RemoveContactTestsClass {
	FolksTestCaseClass parent_class;
};

struct _RemoveContactTestsPrivate {
	GMainLoop* _main_loop;
	TrackerTestBackend* _tracker_backend;
	FolksIndividualAggregator* _aggregator;
	gboolean _contact_added;
	gboolean _contact_removed;
	gchar* _individual_id;
	gchar* _persona_fullname;
};

struct _RemoveContactTestsTestRemoveContactAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RemoveContactTests* self;
	FolksBackendStore* _tmp0_;
	FolksBackendStore* store;
	FolksIndividualAggregator* _tmp1_;
	FolksIndividualAggregator* _tmp2_;
	FolksIndividualAggregator* _tmp3_;
	GError* e;
	GError* _tmp4_;
	const gchar* _tmp5_;
	GError * _inner_error_;
};


static gpointer remove_contact_tests_parent_class = NULL;

GType remove_contact_tests_get_type (void) G_GNUC_CONST;
#define REMOVE_CONTACT_TESTS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_REMOVE_CONTACT_TESTS, RemoveContactTestsPrivate))
enum  {
	REMOVE_CONTACT_TESTS_DUMMY_PROPERTY
};
RemoveContactTests* remove_contact_tests_new (void);
RemoveContactTests* remove_contact_tests_construct (GType object_type);
void remove_contact_tests_test_remove_contact (RemoveContactTests* self);
static void _remove_contact_tests_test_remove_contact_folks_test_case_test_method (gpointer self);
static void remove_contact_tests_real_set_up (FolksTestCase* base);
static void remove_contact_tests_real_tear_down (FolksTestCase* base);
static void _remove_contact_tests_test_remove_contact_async (RemoveContactTests* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _remove_contact_tests_test_remove_contact_finish (RemoveContactTests* self, GAsyncResult* _res_);
static gboolean __lambda0_ (RemoveContactTests* self);
static gboolean ___lambda0__gsource_func (gpointer self);
static void _remove_contact_tests_test_remove_contact_async_data_free (gpointer _data);
static gboolean _remove_contact_tests_test_remove_contact_async_co (RemoveContactTestsTestRemoveContactAsyncData* _data_);
static void _remove_contact_tests_test_remove_contact_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _remove_contact_tests_individuals_changed_cb (RemoveContactTests* self, GeeMultiMap* changes);
static void __remove_contact_tests_individuals_changed_cb_folks_individual_aggregator_individuals_changed_detailed (FolksIndividualAggregator* _sender, GeeMultiMap* changes, gpointer self);
static void remove_contact_tests_finalize (GObject* obj);
gint _vala_main (gchar** args, int args_length1);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


static void _remove_contact_tests_test_remove_contact_folks_test_case_test_method (gpointer self) {
#line 42 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	remove_contact_tests_test_remove_contact (self);
#line 123 "remove-contact.c"
}


RemoveContactTests* remove_contact_tests_construct (GType object_type) {
	RemoveContactTests * self = NULL;
	TrackerTestBackend* _tmp0_;
#line 38 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	self = (RemoveContactTests*) folks_test_case_construct (object_type, "RemoveContactTests");
#line 40 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp0_ = tracker_test_backend_new ();
#line 40 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tracker_test_backend_unref0 (self->priv->_tracker_backend);
#line 40 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	self->priv->_tracker_backend = _tmp0_;
#line 42 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	folks_test_case_add_test ((FolksTestCase*) self, "test removing contacts ", _remove_contact_tests_test_remove_contact_folks_test_case_test_method, self);
#line 36 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	return self;
#line 142 "remove-contact.c"
}


RemoveContactTests* remove_contact_tests_new (void) {
#line 36 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	return remove_contact_tests_construct (TYPE_REMOVE_CONTACT_TESTS);
#line 149 "remove-contact.c"
}


static void remove_contact_tests_real_set_up (FolksTestCase* base) {
	RemoveContactTests * self;
#line 45 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	self = (RemoveContactTests*) base;
#line 157 "remove-contact.c"
}


static void remove_contact_tests_real_tear_down (FolksTestCase* base) {
	RemoveContactTests * self;
#line 49 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	self = (RemoveContactTests*) base;
#line 165 "remove-contact.c"
}


static gboolean __lambda0_ (RemoveContactTests* self) {
	gboolean result = FALSE;
	GMainLoop* _tmp0_;
#line 71 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp0_ = self->priv->_main_loop;
#line 71 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_main_loop_quit (_tmp0_);
#line 72 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_assert_not_reached ();
#line 69 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	return result;
#line 180 "remove-contact.c"
}


static gboolean ___lambda0__gsource_func (gpointer self) {
	gboolean result;
	result = __lambda0_ (self);
#line 69 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	return result;
#line 189 "remove-contact.c"
}


void remove_contact_tests_test_remove_contact (RemoveContactTests* self) {
	GMainLoop* _tmp0_;
	gchar* _tmp1_;
	GeeHashMap* _tmp2_;
	GeeHashMap* c1;
	const gchar* _tmp3_;
	TrackerTestBackend* _tmp4_;
	TrackerTestBackend* _tmp5_;
	gchar* _tmp6_;
	GMainLoop* _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	TrackerTestBackend* _tmp10_;
#line 53 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_return_if_fail (self != NULL);
#line 55 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp0_ = g_main_loop_new (NULL, FALSE);
#line 55 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_main_loop_unref0 (self->priv->_main_loop);
#line 55 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	self->priv->_main_loop = _tmp0_;
#line 56 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp1_ = g_strdup ("persona #1");
#line 56 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_free0 (self->priv->_persona_fullname);
#line 56 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	self->priv->_persona_fullname = _tmp1_;
#line 57 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp2_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
#line 57 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	c1 = _tmp2_;
#line 59 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp3_ = self->priv->_persona_fullname;
#line 59 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	gee_abstract_map_set ((GeeAbstractMap*) c1, TRF_ONTOLOGY_DEFS_NCO_FULLNAME, _tmp3_);
#line 60 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp4_ = self->priv->_tracker_backend;
#line 60 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	tracker_test_backend_add_contact (_tmp4_, c1);
#line 61 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp5_ = self->priv->_tracker_backend;
#line 61 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	tracker_test_backend_set_up (_tmp5_);
#line 63 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	self->priv->_contact_added = FALSE;
#line 64 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	self->priv->_contact_removed = FALSE;
#line 65 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp6_ = g_strdup ("");
#line 65 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_free0 (self->priv->_individual_id);
#line 65 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	self->priv->_individual_id = _tmp6_;
#line 67 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_remove_contact_tests_test_remove_contact_async (self, NULL, NULL);
#line 69 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 5, ___lambda0__gsource_func, g_object_ref (self), g_object_unref);
#line 75 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp7_ = self->priv->_main_loop;
#line 75 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_main_loop_run (_tmp7_);
#line 77 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp8_ = self->priv->_contact_added;
#line 77 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_assert (_tmp8_ == TRUE);
#line 78 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp9_ = self->priv->_contact_removed;
#line 78 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_assert (_tmp9_ == TRUE);
#line 80 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp10_ = self->priv->_tracker_backend;
#line 80 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	tracker_test_backend_tear_down (_tmp10_);
#line 53 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_object_unref0 (c1);
#line 268 "remove-contact.c"
}


static void _remove_contact_tests_test_remove_contact_async_data_free (gpointer _data) {
	RemoveContactTestsTestRemoveContactAsyncData* _data_;
	_data_ = _data;
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_object_unref0 (_data_->self);
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_slice_free (RemoveContactTestsTestRemoveContactAsyncData, _data_);
#line 279 "remove-contact.c"
}


static gpointer _g_object_ref0 (gpointer self) {
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	return self ? g_object_ref (self) : NULL;
#line 286 "remove-contact.c"
}


static void _remove_contact_tests_test_remove_contact_async (RemoveContactTests* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RemoveContactTestsTestRemoveContactAsyncData* _data_;
	RemoveContactTests* _tmp0_;
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_ = g_slice_new0 (RemoveContactTestsTestRemoveContactAsyncData);
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, _remove_contact_tests_test_remove_contact_async);
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, _remove_contact_tests_test_remove_contact_async_data_free);
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp0_ = _g_object_ref0 (self);
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_->self = _tmp0_;
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_remove_contact_tests_test_remove_contact_async_co (_data_);
#line 305 "remove-contact.c"
}


static void _remove_contact_tests_test_remove_contact_finish (RemoveContactTests* self, GAsyncResult* _res_) {
	RemoveContactTestsTestRemoveContactAsyncData* _data_;
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
#line 313 "remove-contact.c"
}


static void _remove_contact_tests_test_remove_contact_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RemoveContactTestsTestRemoveContactAsyncData* _data_;
#line 86 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_ = _user_data_;
#line 86 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_->_source_object_ = source_object;
#line 86 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_->_res_ = _res_;
#line 86 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_remove_contact_tests_test_remove_contact_async_co (_data_);
#line 327 "remove-contact.c"
}


static void __remove_contact_tests_individuals_changed_cb_folks_individual_aggregator_individuals_changed_detailed (FolksIndividualAggregator* _sender, GeeMultiMap* changes, gpointer self) {
#line 88 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_remove_contact_tests_individuals_changed_cb (self, changes);
#line 334 "remove-contact.c"
}


static gboolean _remove_contact_tests_test_remove_contact_async_co (RemoveContactTestsTestRemoveContactAsyncData* _data_) {
#line 83 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	switch (_data_->_state_) {
#line 83 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		case 0:
#line 343 "remove-contact.c"
		goto _state_0;
#line 83 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		case 1:
#line 347 "remove-contact.c"
		goto _state_1;
#line 83 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		case 2:
#line 351 "remove-contact.c"
		goto _state_2;
		default:
#line 83 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		g_assert_not_reached ();
#line 356 "remove-contact.c"
	}
	_state_0:
#line 85 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_->_tmp0_ = NULL;
#line 85 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_->_tmp0_ = folks_backend_store_dup ();
#line 85 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_->store = _data_->_tmp0_;
#line 86 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_->_state_ = 1;
#line 86 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	folks_backend_store_prepare (_data_->store, _remove_contact_tests_test_remove_contact_async_ready, _data_);
#line 86 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	return FALSE;
#line 371 "remove-contact.c"
	_state_1:
#line 86 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	folks_backend_store_prepare_finish (_data_->store, _data_->_res_);
#line 87 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_->_tmp1_ = folks_individual_aggregator_new ();
#line 87 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_object_unref0 (_data_->self->priv->_aggregator);
#line 87 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_->self->priv->_aggregator = _data_->_tmp1_;
#line 88 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_data_->_tmp2_ = _data_->self->priv->_aggregator;
#line 88 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_signal_connect_object (_data_->_tmp2_, "individuals-changed-detailed", (GCallback) __remove_contact_tests_individuals_changed_cb_folks_individual_aggregator_individuals_changed_detailed, _data_->self, 0);
#line 385 "remove-contact.c"
	{
#line 92 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_data_->_tmp3_ = _data_->self->priv->_aggregator;
#line 92 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_data_->_state_ = 2;
#line 92 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		folks_individual_aggregator_prepare (_data_->_tmp3_, _remove_contact_tests_test_remove_contact_async_ready, _data_);
#line 92 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		return FALSE;
#line 395 "remove-contact.c"
		_state_2:
#line 92 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		folks_individual_aggregator_prepare_finish (_data_->_tmp3_, _data_->_res_, &_data_->_inner_error_);
#line 92 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		if (_data_->_inner_error_ != NULL) {
#line 401 "remove-contact.c"
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
#line 90 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_data_->e = _data_->_inner_error_;
#line 90 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_data_->_inner_error_ = NULL;
#line 96 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_data_->_tmp4_ = _data_->e;
#line 96 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_data_->_tmp5_ = _data_->_tmp4_->message;
#line 96 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		g_warning ("remove-contact.vala:96: Error when calling prepare: %s\n", _data_->_tmp5_);
#line 90 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_g_error_free0 (_data_->e);
#line 420 "remove-contact.c"
	}
	__finally0:
#line 90 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	if (_data_->_inner_error_ != NULL) {
#line 90 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_g_object_unref0 (_data_->store);
#line 90 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		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);
#line 90 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		g_clear_error (&_data_->_inner_error_);
#line 90 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		return FALSE;
#line 433 "remove-contact.c"
	}
#line 83 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_object_unref0 (_data_->store);
#line 83 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	if (_data_->_state_ == 0) {
#line 83 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		g_simple_async_result_complete_in_idle (_data_->_async_result);
#line 441 "remove-contact.c"
	} else {
#line 83 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		g_simple_async_result_complete (_data_->_async_result);
#line 445 "remove-contact.c"
	}
#line 83 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_object_unref (_data_->_async_result);
#line 83 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	return FALSE;
#line 451 "remove-contact.c"
}


static void _remove_contact_tests_individuals_changed_cb (RemoveContactTests* self, GeeMultiMap* changes) {
	GeeMultiMap* _tmp0_;
	GeeCollection* _tmp1_ = NULL;
	GeeCollection* added;
	GeeMultiMap* _tmp2_;
	GeeSet* _tmp3_ = NULL;
	GeeSet* removed;
#line 100 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_return_if_fail (self != NULL);
#line 100 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_return_if_fail (changes != NULL);
#line 103 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp0_ = changes;
#line 103 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp1_ = gee_multi_map_get_values (_tmp0_);
#line 103 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	added = _tmp1_;
#line 104 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp2_ = changes;
#line 104 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp3_ = gee_multi_map_get_keys (_tmp2_);
#line 104 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	removed = _tmp3_;
#line 478 "remove-contact.c"
	{
		GeeCollection* _tmp4_;
		GeeIterator* _tmp5_ = NULL;
		GeeIterator* _i_it;
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_tmp4_ = added;
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_i_it = _tmp5_;
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		while (TRUE) {
#line 491 "remove-contact.c"
			GeeIterator* _tmp6_;
			gboolean _tmp7_ = FALSE;
			GeeIterator* _tmp8_;
			gpointer _tmp9_ = NULL;
			FolksIndividual* i;
			FolksIndividual* _tmp10_;
			FolksIndividual* _tmp11_;
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			gchar* _tmp14_;
			gchar* full_name;
			const gchar* _tmp15_;
			const gchar* _tmp16_;
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp6_ = _i_it;
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp7_ = gee_iterator_next (_tmp6_);
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			if (!_tmp7_) {
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				break;
#line 513 "remove-contact.c"
			}
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp8_ = _i_it;
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp9_ = gee_iterator_get (_tmp8_);
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			i = (FolksIndividual*) _tmp9_;
#line 108 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp10_ = i;
#line 108 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			if (_tmp10_ == NULL) {
#line 110 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				_g_object_unref0 (i);
#line 110 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				continue;
#line 529 "remove-contact.c"
			}
#line 113 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp11_ = i;
#line 113 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp12_ = folks_name_details_get_full_name ((FolksNameDetails*) _tmp11_);
#line 113 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp13_ = _tmp12_;
#line 113 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp14_ = g_strdup (_tmp13_);
#line 113 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			full_name = _tmp14_;
#line 114 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp15_ = full_name;
#line 114 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp16_ = self->priv->_persona_fullname;
#line 114 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			if (g_strcmp0 (_tmp15_, _tmp16_) == 0) {
#line 547 "remove-contact.c"
				FolksIndividual* _tmp17_;
				const gchar* _tmp18_;
				const gchar* _tmp19_;
				gchar* _tmp20_;
#line 116 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				self->priv->_contact_added = TRUE;
#line 117 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				_tmp17_ = i;
#line 117 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				_tmp18_ = folks_individual_get_id (_tmp17_);
#line 117 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				_tmp19_ = _tmp18_;
#line 117 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				_tmp20_ = g_strdup (_tmp19_);
#line 117 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				_g_free0 (self->priv->_individual_id);
#line 117 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				self->priv->_individual_id = _tmp20_;
#line 566 "remove-contact.c"
				{
					FolksIndividual* _tmp21_;
					GeeSet* _tmp22_;
					GeeSet* _tmp23_;
					GeeIterator* _tmp24_ = NULL;
					GeeIterator* _persona_it;
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
					_tmp21_ = i;
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
					_tmp22_ = folks_individual_get_personas (_tmp21_);
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
					_tmp23_ = _tmp22_;
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
					_tmp24_ = gee_iterable_iterator ((GeeIterable*) _tmp23_);
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
					_persona_it = _tmp24_;
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
					while (TRUE) {
#line 585 "remove-contact.c"
						GeeIterator* _tmp25_;
						gboolean _tmp26_ = FALSE;
						GeeIterator* _tmp27_;
						gpointer _tmp28_ = NULL;
						FolksPersona* persona;
						FolksPersona* _tmp29_;
						const gchar* _tmp30_;
						const gchar* _tmp31_;
						gchar** _tmp32_;
						gchar** _tmp33_ = NULL;
						gchar** _tmp34_;
						gint _tmp34__length1;
						const gchar* _tmp35_;
						gchar* _tmp36_;
						gchar* _tmp37_;
						gchar* contact_id;
						TrackerTestBackend* _tmp38_;
						const gchar* _tmp39_;
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp25_ = _persona_it;
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp26_ = gee_iterator_next (_tmp25_);
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						if (!_tmp26_) {
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
							break;
#line 612 "remove-contact.c"
						}
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp27_ = _persona_it;
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp28_ = gee_iterator_get (_tmp27_);
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						persona = (FolksPersona*) _tmp28_;
#line 120 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp29_ = persona;
#line 120 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp30_ = folks_persona_get_iid (_tmp29_);
#line 120 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp31_ = _tmp30_;
#line 120 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp33_ = _tmp32_ = g_strsplit (_tmp31_, ":", 0);
#line 120 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp34_ = _tmp33_;
#line 120 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp34__length1 = _vala_array_length (_tmp32_);
#line 120 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp35_ = _tmp34_[1];
#line 120 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp36_ = g_strdup (_tmp35_);
#line 120 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp37_ = _tmp36_;
#line 120 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp34_ = (_vala_array_free (_tmp34_, _tmp34__length1, (GDestroyNotify) g_free), NULL);
#line 120 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						contact_id = _tmp37_;
#line 121 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp38_ = self->priv->_tracker_backend;
#line 121 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_tmp39_ = contact_id;
#line 121 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						tracker_test_backend_remove_contact (_tmp38_, _tmp39_);
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_g_free0 (contact_id);
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
						_g_object_unref0 (persona);
#line 652 "remove-contact.c"
					}
#line 118 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
					_g_object_unref0 (_persona_it);
#line 656 "remove-contact.c"
				}
			}
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_g_free0 (full_name);
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_g_object_unref0 (i);
#line 663 "remove-contact.c"
		}
#line 106 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_g_object_unref0 (_i_it);
#line 667 "remove-contact.c"
	}
	{
		GeeSet* _tmp40_;
		GeeIterator* _tmp41_ = NULL;
		GeeIterator* _i_it;
#line 126 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_tmp40_ = removed;
#line 126 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_tmp41_ = gee_iterable_iterator ((GeeIterable*) _tmp40_);
#line 126 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_i_it = _tmp41_;
#line 126 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		while (TRUE) {
#line 681 "remove-contact.c"
			GeeIterator* _tmp42_;
			gboolean _tmp43_ = FALSE;
			GeeIterator* _tmp44_;
			gpointer _tmp45_ = NULL;
			FolksIndividual* i;
			FolksIndividual* _tmp46_;
			FolksIndividual* _tmp47_;
			const gchar* _tmp48_;
			const gchar* _tmp49_;
			const gchar* _tmp50_;
#line 126 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp42_ = _i_it;
#line 126 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp43_ = gee_iterator_next (_tmp42_);
#line 126 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			if (!_tmp43_) {
#line 126 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				break;
#line 700 "remove-contact.c"
			}
#line 126 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp44_ = _i_it;
#line 126 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp45_ = gee_iterator_get (_tmp44_);
#line 126 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			i = (FolksIndividual*) _tmp45_;
#line 128 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp46_ = i;
#line 128 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			if (_tmp46_ == NULL) {
#line 130 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				_g_object_unref0 (i);
#line 130 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				continue;
#line 716 "remove-contact.c"
			}
#line 133 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp47_ = i;
#line 133 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp48_ = folks_individual_get_id (_tmp47_);
#line 133 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp49_ = _tmp48_;
#line 133 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_tmp50_ = self->priv->_individual_id;
#line 133 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			if (g_strcmp0 (_tmp49_, _tmp50_) == 0) {
#line 728 "remove-contact.c"
				GMainLoop* _tmp51_;
#line 135 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				self->priv->_contact_removed = TRUE;
#line 136 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				_tmp51_ = self->priv->_main_loop;
#line 136 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
				g_main_loop_quit (_tmp51_);
#line 736 "remove-contact.c"
			}
#line 126 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
			_g_object_unref0 (i);
#line 740 "remove-contact.c"
		}
#line 126 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
		_g_object_unref0 (_i_it);
#line 744 "remove-contact.c"
	}
#line 100 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_object_unref0 (removed);
#line 100 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_object_unref0 (added);
#line 750 "remove-contact.c"
}


static void remove_contact_tests_class_init (RemoveContactTestsClass * klass) {
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	remove_contact_tests_parent_class = g_type_class_peek_parent (klass);
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_type_class_add_private (klass, sizeof (RemoveContactTestsPrivate));
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	FOLKS_TEST_CASE_CLASS (klass)->set_up = remove_contact_tests_real_set_up;
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	FOLKS_TEST_CASE_CLASS (klass)->tear_down = remove_contact_tests_real_tear_down;
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	G_OBJECT_CLASS (klass)->finalize = remove_contact_tests_finalize;
#line 765 "remove-contact.c"
}


static void remove_contact_tests_instance_init (RemoveContactTests * self) {
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	self->priv = REMOVE_CONTACT_TESTS_GET_PRIVATE (self);
#line 772 "remove-contact.c"
}


static void remove_contact_tests_finalize (GObject* obj) {
	RemoveContactTests * self;
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	self = REMOVE_CONTACT_TESTS (obj);
#line 28 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_main_loop_unref0 (self->priv->_main_loop);
#line 29 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tracker_test_backend_unref0 (self->priv->_tracker_backend);
#line 30 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_object_unref0 (self->priv->_aggregator);
#line 33 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_free0 (self->priv->_individual_id);
#line 34 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_free0 (self->priv->_persona_fullname);
#line 26 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	G_OBJECT_CLASS (remove_contact_tests_parent_class)->finalize (obj);
#line 792 "remove-contact.c"
}


GType remove_contact_tests_get_type (void) {
	static volatile gsize remove_contact_tests_type_id__volatile = 0;
	if (g_once_init_enter (&remove_contact_tests_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RemoveContactTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) remove_contact_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RemoveContactTests), 0, (GInstanceInitFunc) remove_contact_tests_instance_init, NULL };
		GType remove_contact_tests_type_id;
		remove_contact_tests_type_id = g_type_register_static (FOLKS_TYPE_TEST_CASE, "RemoveContactTests", &g_define_type_info, 0);
		g_once_init_leave (&remove_contact_tests_type_id__volatile, remove_contact_tests_type_id);
	}
	return remove_contact_tests_type_id__volatile;
}


gint _vala_main (gchar** args, int args_length1) {
	gint result = 0;
	GTestSuite* _tmp0_ = NULL;
	GTestSuite* root;
	RemoveContactTests* _tmp1_;
	RemoveContactTests* _tmp2_;
	GTestSuite* _tmp3_ = NULL;
#line 144 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_test_init (&args_length1, &args, NULL);
#line 146 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp0_ = g_test_get_root ();
#line 146 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	root = _tmp0_;
#line 147 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp1_ = remove_contact_tests_new ();
#line 147 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp2_ = _tmp1_;
#line 147 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_tmp3_ = folks_test_case_get_suite ((FolksTestCase*) _tmp2_);
#line 147 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_test_suite_add_suite (root, _tmp3_);
#line 147 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	_g_object_unref0 (_tmp2_);
#line 149 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_test_run ();
#line 151 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	result = 0;
#line 151 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	return result;
#line 837 "remove-contact.c"
}


int main (int argc, char ** argv) {
#line 142 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	g_type_init ();
#line 142 "/debian/rgs/devel/folks/tests/tracker/remove-contact.vala"
	return _vala_main (argv, argc);
#line 846 "remove-contact.c"
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



