/* persona-store-capabilities.c generated by valac 0.13.1.106-1068, the Vala compiler
 * generated from persona-store-capabilities.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: Travis Reitter <travis.reitter@collabora.co.uk>
 */

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


#define TYPE_PERSONA_STORE_CAPABILITIES_TESTS (persona_store_capabilities_tests_get_type ())
#define PERSONA_STORE_CAPABILITIES_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PERSONA_STORE_CAPABILITIES_TESTS, PersonaStoreCapabilitiesTests))
#define PERSONA_STORE_CAPABILITIES_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PERSONA_STORE_CAPABILITIES_TESTS, PersonaStoreCapabilitiesTestsClass))
#define IS_PERSONA_STORE_CAPABILITIES_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PERSONA_STORE_CAPABILITIES_TESTS))
#define IS_PERSONA_STORE_CAPABILITIES_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PERSONA_STORE_CAPABILITIES_TESTS))
#define PERSONA_STORE_CAPABILITIES_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PERSONA_STORE_CAPABILITIES_TESTS, PersonaStoreCapabilitiesTestsClass))

typedef struct _PersonaStoreCapabilitiesTests PersonaStoreCapabilitiesTests;
typedef struct _PersonaStoreCapabilitiesTestsClass PersonaStoreCapabilitiesTestsClass;
typedef struct _PersonaStoreCapabilitiesTestsPrivate PersonaStoreCapabilitiesTestsPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block1Data Block1Data;
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
typedef struct _Block2Data Block2Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _PersonaStoreCapabilitiesTests {
	FolksTestCase parent_instance;
	PersonaStoreCapabilitiesTestsPrivate * priv;
};

struct _PersonaStoreCapabilitiesTestsClass {
	FolksTestCaseClass parent_class;
};

struct _PersonaStoreCapabilitiesTestsPrivate {
	TpTestBackend* tp_backend;
	void* _account_handle;
	GeeHashSet* group_flags_received;
	gint _test_timeout;
};

struct _Block1Data {
	int _ref_count_;
	PersonaStoreCapabilitiesTests * self;
	GMainLoop* main_loop;
};

struct _Block2Data {
	int _ref_count_;
	PersonaStoreCapabilitiesTests * self;
	FolksPersonaStore* store;
};


static gpointer persona_store_capabilities_tests_parent_class = NULL;

GType persona_store_capabilities_tests_get_type (void) G_GNUC_CONST;
#define PERSONA_STORE_CAPABILITIES_TESTS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PERSONA_STORE_CAPABILITIES_TESTS, PersonaStoreCapabilitiesTestsPrivate))
enum  {
	PERSONA_STORE_CAPABILITIES_TESTS_DUMMY_PROPERTY
};
PersonaStoreCapabilitiesTests* persona_store_capabilities_tests_new (void);
PersonaStoreCapabilitiesTests* persona_store_capabilities_tests_construct (GType object_type);
void persona_store_capabilities_tests_test_persona_store_capabilities (PersonaStoreCapabilitiesTests* self);
static void _persona_store_capabilities_tests_test_persona_store_capabilities_folks_test_case_test_method (gpointer self);
static void persona_store_capabilities_tests_real_set_up (FolksTestCase* base);
static void persona_store_capabilities_tests_real_tear_down (FolksTestCase* base);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (Block1Data* _data1_);
static void _lambda0_ (FolksBackend* b, PersonaStoreCapabilitiesTests* self);
static void _lambda1_ (FolksPersonaStore* ps, PersonaStoreCapabilitiesTests* self);
static void persona_store_capabilities_tests_set_up_persona_store (PersonaStoreCapabilitiesTests* self, FolksPersonaStore* store);
static void __lambda1__folks_backend_persona_store_added (FolksBackend* _sender, FolksPersonaStore* store, gpointer self);
static void __lambda0__folks_backend_store_backend_available (FolksBackendStore* _sender, FolksBackend* backend, gpointer self);
static gboolean _lambda3_ (Block1Data* _data1_);
static gboolean __lambda3__gsource_func (gpointer self);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (Block2Data* _data2_);
static void _lambda2_ (GObject* obj, GAsyncResult* _result_, Block2Data* _data2_);
static void persona_store_capabilities_tests_can_add_personas_cb (PersonaStoreCapabilitiesTests* self, GObject* s, GParamSpec* p);
static void _persona_store_capabilities_tests_can_add_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void persona_store_capabilities_tests_can_remove_personas_cb (PersonaStoreCapabilitiesTests* self, GObject* s, GParamSpec* p);
static void _persona_store_capabilities_tests_can_remove_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void persona_store_capabilities_tests_can_alias_personas_cb (PersonaStoreCapabilitiesTests* self, GObject* s, GParamSpec* p);
static void _persona_store_capabilities_tests_can_alias_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void persona_store_capabilities_tests_can_group_personas_cb (PersonaStoreCapabilitiesTests* self, GObject* s, GParamSpec* p);
static void _persona_store_capabilities_tests_can_group_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void __lambda2__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
static void persona_store_capabilities_tests_finalize (GObject* obj);
gint _vala_main (gchar** args, int args_length1);


static void _persona_store_capabilities_tests_test_persona_store_capabilities_folks_test_case_test_method (gpointer self) {
	persona_store_capabilities_tests_test_persona_store_capabilities (self);
}


PersonaStoreCapabilitiesTests* persona_store_capabilities_tests_construct (GType object_type) {
	PersonaStoreCapabilitiesTests * self = NULL;
	TpTestBackend* _tmp0_;
	const gchar* _tmp1_ = NULL;
	self = (PersonaStoreCapabilitiesTests*) folks_test_case_construct (object_type, "PersonaStoreCapabilities");
	_tmp0_ = tp_test_backend_new ();
	_g_object_unref0 (self->priv->tp_backend);
	self->priv->tp_backend = _tmp0_;
	folks_test_case_add_test ((FolksTestCase*) self, "persona store capabilities", _persona_store_capabilities_tests_test_persona_store_capabilities_folks_test_case_test_method, self);
	_tmp1_ = g_getenv ("FOLKS_TEST_VALGRIND");
	if (_tmp1_ != NULL) {
		self->priv->_test_timeout = 10;
	}
	return self;
}


PersonaStoreCapabilitiesTests* persona_store_capabilities_tests_new (void) {
	return persona_store_capabilities_tests_construct (TYPE_PERSONA_STORE_CAPABILITIES_TESTS);
}


static void persona_store_capabilities_tests_real_set_up (FolksTestCase* base) {
	PersonaStoreCapabilitiesTests * self;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GeeHashSet* _tmp2_;
	TpTestBackend* _tmp3_;
	TpTestBackend* _tmp4_;
	void* _tmp5_ = NULL;
	self = (PersonaStoreCapabilitiesTests*) base;
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, _tmp0_, _tmp1_);
	_g_object_unref0 (self->priv->group_flags_received);
	self->priv->group_flags_received = _tmp2_;
	_tmp3_ = self->priv->tp_backend;
	tp_test_backend_set_up (_tmp3_);
	_tmp4_ = self->priv->tp_backend;
	_tmp5_ = tp_test_backend_add_account (_tmp4_, "protocol", "me@example.com", "cm", "account");
	self->priv->_account_handle = _tmp5_;
}


static void persona_store_capabilities_tests_real_tear_down (FolksTestCase* base) {
	PersonaStoreCapabilitiesTests * self;
	TpTestBackend* _tmp0_;
	void* _tmp1_;
	TpTestBackend* _tmp2_;
	self = (PersonaStoreCapabilitiesTests*) base;
	_tmp0_ = self->priv->tp_backend;
	_tmp1_ = self->priv->_account_handle;
	tp_test_backend_remove_account (_tmp0_, _tmp1_);
	_tmp2_ = self->priv->tp_backend;
	tp_test_backend_tear_down (_tmp2_);
}


static Block1Data* block1_data_ref (Block1Data* _data1_) {
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}


static void block1_data_unref (Block1Data* _data1_) {
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		_g_object_unref0 (_data1_->self);
		_g_main_loop_unref0 (_data1_->main_loop);
		g_slice_free (Block1Data, _data1_);
	}
}


static void _lambda1_ (FolksPersonaStore* ps, PersonaStoreCapabilitiesTests* self) {
	FolksPersonaStore* _tmp0_;
	g_return_if_fail (ps != NULL);
	_tmp0_ = ps;
	persona_store_capabilities_tests_set_up_persona_store (self, _tmp0_);
}


static void __lambda1__folks_backend_persona_store_added (FolksBackend* _sender, FolksPersonaStore* store, gpointer self) {
	_lambda1_ (store, self);
}


static void _lambda0_ (FolksBackend* b, PersonaStoreCapabilitiesTests* self) {
	FolksBackend* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (b != NULL);
	_tmp0_ = b;
	_tmp1_ = folks_backend_get_name (_tmp0_);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp2_, "telepathy") == 0) {
		FolksBackend* _tmp3_;
		_tmp3_ = b;
		g_signal_connect_object (_tmp3_, "persona-store-added", (GCallback) __lambda1__folks_backend_persona_store_added, self, 0);
		{
			FolksBackend* _tmp4_;
			GeeMap* _tmp5_;
			GeeMap* _tmp6_;
			GeeCollection* _tmp7_;
			GeeCollection* _tmp8_;
			GeeCollection* _tmp9_;
			GeeIterator* _tmp10_ = NULL;
			GeeIterator* _tmp11_;
			GeeIterator* _store_it;
			_tmp4_ = b;
			_tmp5_ = folks_backend_get_persona_stores (_tmp4_);
			_tmp6_ = _tmp5_;
			_tmp7_ = gee_map_get_values (_tmp6_);
			_tmp8_ = _tmp7_;
			_tmp9_ = _tmp8_;
			_tmp10_ = gee_iterable_iterator ((GeeIterable*) _tmp9_);
			_tmp11_ = _tmp10_;
			_g_object_unref0 (_tmp9_);
			_store_it = _tmp11_;
			while (TRUE) {
				GeeIterator* _tmp12_;
				gboolean _tmp13_ = FALSE;
				GeeIterator* _tmp14_;
				gpointer _tmp15_ = NULL;
				FolksPersonaStore* store;
				FolksPersonaStore* _tmp16_;
				_tmp12_ = _store_it;
				_tmp13_ = gee_iterator_next (_tmp12_);
				if (!_tmp13_) {
					break;
				}
				_tmp14_ = _store_it;
				_tmp15_ = gee_iterator_get (_tmp14_);
				store = (FolksPersonaStore*) _tmp15_;
				_tmp16_ = store;
				persona_store_capabilities_tests_set_up_persona_store (self, _tmp16_);
				_g_object_unref0 (store);
			}
			_g_object_unref0 (_store_it);
		}
	}
}


static void __lambda0__folks_backend_store_backend_available (FolksBackendStore* _sender, FolksBackend* backend, gpointer self) {
	_lambda0_ (backend, self);
}


static gboolean _lambda3_ (Block1Data* _data1_) {
	PersonaStoreCapabilitiesTests * self;
	gboolean result = FALSE;
	GMainLoop* _tmp0_;
	self = _data1_->self;
	_tmp0_ = _data1_->main_loop;
	g_main_loop_quit (_tmp0_);
	result = FALSE;
	return result;
}


static gboolean __lambda3__gsource_func (gpointer self) {
	gboolean result;
	result = _lambda3_ (self);
	return result;
}


void persona_store_capabilities_tests_test_persona_store_capabilities (PersonaStoreCapabilitiesTests* self) {
	Block1Data* _data1_;
	GMainLoop* _tmp0_;
	FolksBackendStore* _tmp1_ = NULL;
	FolksBackendStore* backend_store;
	FolksBackendStore* _tmp2_;
	FolksBackendStore* _tmp3_;
	gint _tmp4_;
	GMainLoop* _tmp5_;
	GeeHashSet* _tmp6_;
	gboolean _tmp7_ = FALSE;
	GeeHashSet* _tmp8_;
	gboolean _tmp9_ = FALSE;
	g_return_if_fail (self != NULL);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = g_object_ref (self);
	_tmp0_ = g_main_loop_new (NULL, FALSE);
	_data1_->main_loop = _tmp0_;
	_tmp1_ = folks_backend_store_dup ();
	backend_store = _tmp1_;
	_tmp2_ = backend_store;
	g_signal_connect_object (_tmp2_, "backend-available", (GCallback) __lambda0__folks_backend_store_backend_available, self, 0);
	_tmp3_ = backend_store;
	folks_backend_store_load_backends (_tmp3_, NULL, NULL);
	_tmp4_ = self->priv->_test_timeout;
	g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) _tmp4_, __lambda3__gsource_func, block1_data_ref (_data1_), block1_data_unref);
	_tmp5_ = _data1_->main_loop;
	g_main_loop_run (_tmp5_);
	_tmp6_ = self->priv->group_flags_received;
	_tmp7_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp6_, "can-add-personas");
	g_assert (_tmp7_);
	_tmp8_ = self->priv->group_flags_received;
	_tmp9_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp8_, "can-remove-personas");
	g_assert (_tmp9_);
	_g_object_unref0 (backend_store);
	block1_data_unref (_data1_);
	_data1_ = NULL;
}


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


static Block2Data* block2_data_ref (Block2Data* _data2_) {
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}


static void block2_data_unref (Block2Data* _data2_) {
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		_g_object_unref0 (_data2_->self);
		_g_object_unref0 (_data2_->store);
		g_slice_free (Block2Data, _data2_);
	}
}


static void _persona_store_capabilities_tests_can_add_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	persona_store_capabilities_tests_can_add_personas_cb (self, _sender, pspec);
}


static void _persona_store_capabilities_tests_can_remove_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	persona_store_capabilities_tests_can_remove_personas_cb (self, _sender, pspec);
}


static void _persona_store_capabilities_tests_can_alias_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	persona_store_capabilities_tests_can_alias_personas_cb (self, _sender, pspec);
}


static void _persona_store_capabilities_tests_can_group_personas_cb_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	persona_store_capabilities_tests_can_group_personas_cb (self, _sender, pspec);
}


static void _lambda2_ (GObject* obj, GAsyncResult* _result_, Block2Data* _data2_) {
	PersonaStoreCapabilitiesTests * self;
	GError * _inner_error_ = NULL;
	self = _data2_->self;
	g_return_if_fail (_result_ != NULL);
	{
		FolksPersonaStore* _tmp0_;
		GAsyncResult* _tmp1_;
		FolksPersonaStore* _tmp2_;
		FolksMaybeBool _tmp3_;
		FolksMaybeBool _tmp4_;
		FolksPersonaStore* _tmp7_;
		FolksMaybeBool _tmp8_;
		FolksMaybeBool _tmp9_;
		FolksPersonaStore* _tmp12_;
		FolksMaybeBool _tmp13_;
		FolksMaybeBool _tmp14_;
		FolksPersonaStore* _tmp17_;
		FolksMaybeBool _tmp18_;
		FolksMaybeBool _tmp19_;
		_tmp0_ = _data2_->store;
		_tmp1_ = _result_;
		folks_persona_store_prepare_finish (_tmp0_, _tmp1_, &_inner_error_);
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
		_tmp2_ = _data2_->store;
		_tmp3_ = folks_persona_store_get_can_add_personas (_tmp2_);
		_tmp4_ = _tmp3_;
		if (_tmp4_ != FOLKS_MAYBE_BOOL_UNSET) {
			FolksPersonaStore* _tmp5_;
			_tmp5_ = _data2_->store;
			persona_store_capabilities_tests_can_add_personas_cb (self, (GObject*) _tmp5_, NULL);
		} else {
			FolksPersonaStore* _tmp6_;
			_tmp6_ = _data2_->store;
			g_signal_connect_object ((GObject*) _tmp6_, "notify::can-add-personas", (GCallback) _persona_store_capabilities_tests_can_add_personas_cb_g_object_notify, self, 0);
		}
		_tmp7_ = _data2_->store;
		_tmp8_ = folks_persona_store_get_can_remove_personas (_tmp7_);
		_tmp9_ = _tmp8_;
		if (_tmp9_ != FOLKS_MAYBE_BOOL_UNSET) {
			FolksPersonaStore* _tmp10_;
			_tmp10_ = _data2_->store;
			persona_store_capabilities_tests_can_remove_personas_cb (self, (GObject*) _tmp10_, NULL);
		} else {
			FolksPersonaStore* _tmp11_;
			_tmp11_ = _data2_->store;
			g_signal_connect_object ((GObject*) _tmp11_, "notify::can-remove-personas", (GCallback) _persona_store_capabilities_tests_can_remove_personas_cb_g_object_notify, self, 0);
		}
		_tmp12_ = _data2_->store;
		_tmp13_ = folks_persona_store_get_can_alias_personas (_tmp12_);
		_tmp14_ = _tmp13_;
		if (_tmp14_ != FOLKS_MAYBE_BOOL_UNSET) {
			FolksPersonaStore* _tmp15_;
			_tmp15_ = _data2_->store;
			persona_store_capabilities_tests_can_alias_personas_cb (self, (GObject*) _tmp15_, NULL);
		} else {
			FolksPersonaStore* _tmp16_;
			_tmp16_ = _data2_->store;
			g_signal_connect_object ((GObject*) _tmp16_, "notify::can-alias-personas", (GCallback) _persona_store_capabilities_tests_can_alias_personas_cb_g_object_notify, self, 0);
		}
		_tmp17_ = _data2_->store;
		_tmp18_ = folks_persona_store_get_can_group_personas (_tmp17_);
		_tmp19_ = _tmp18_;
		if (_tmp19_ != FOLKS_MAYBE_BOOL_UNSET) {
			FolksPersonaStore* _tmp20_;
			_tmp20_ = _data2_->store;
			persona_store_capabilities_tests_can_group_personas_cb (self, (GObject*) _tmp20_, NULL);
		} else {
			FolksPersonaStore* _tmp21_;
			_tmp21_ = _data2_->store;
			g_signal_connect_object ((GObject*) _tmp21_, "notify::can-group-personas", (GCallback) _persona_store_capabilities_tests_can_group_personas_cb_g_object_notify, self, 0);
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		FolksPersonaStore* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		FolksPersonaStore* _tmp25_;
		const gchar* _tmp26_;
		const gchar* _tmp27_;
		GError* _tmp28_;
		const gchar* _tmp29_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp22_ = _data2_->store;
		_tmp23_ = folks_persona_store_get_type_id (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp25_ = _data2_->store;
		_tmp26_ = folks_persona_store_get_id (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = e;
		_tmp29_ = _tmp28_->message;
		g_warning ("Error preparing PersonaStore type: %s, id: %s: " "'%s'", _tmp24_, _tmp27_, _tmp29_);
		_g_error_free0 (e);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


static void __lambda2__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	_lambda2_ (source_object, res, self);
	block2_data_unref (self);
}


static void persona_store_capabilities_tests_set_up_persona_store (PersonaStoreCapabilitiesTests* self, FolksPersonaStore* store) {
	Block2Data* _data2_;
	FolksPersonaStore* _tmp0_;
	FolksPersonaStore* _tmp1_;
	FolksPersonaStore* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (store != NULL);
	_data2_ = g_slice_new0 (Block2Data);
	_data2_->_ref_count_ = 1;
	_data2_->self = g_object_ref (self);
	_tmp0_ = store;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_data2_->store = _tmp1_;
	_tmp2_ = _data2_->store;
	folks_persona_store_prepare (_tmp2_, __lambda2__gasync_ready_callback, block2_data_ref (_data2_));
	block2_data_unref (_data2_);
	_data2_ = NULL;
}


static void persona_store_capabilities_tests_can_add_personas_cb (PersonaStoreCapabilitiesTests* self, GObject* s, GParamSpec* p) {
	GObject* _tmp0_;
	GObject* _tmp1_;
	TpfPersonaStore* _tmp2_;
	TpfPersonaStore* store;
	TpfPersonaStore* _tmp3_;
	FolksMaybeBool _tmp4_;
	FolksMaybeBool _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	_tmp0_ = s;
	g_assert (TPF_IS_PERSONA_STORE (_tmp0_));
	_tmp1_ = s;
	_tmp2_ = _g_object_ref0 (TPF_PERSONA_STORE (_tmp1_));
	store = _tmp2_;
	_tmp3_ = store;
	_tmp4_ = folks_persona_store_get_can_add_personas ((FolksPersonaStore*) _tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ != FOLKS_MAYBE_BOOL_UNSET) {
		TpfPersonaStore* _tmp6_;
		FolksMaybeBool _tmp7_;
		FolksMaybeBool _tmp8_;
		GeeHashSet* _tmp9_;
		TpfPersonaStore* _tmp10_;
		guint _tmp11_ = 0U;
		GQuark _tmp12_ = 0U;
		_tmp6_ = store;
		_tmp7_ = folks_persona_store_get_can_add_personas ((FolksPersonaStore*) _tmp6_);
		_tmp8_ = _tmp7_;
		g_assert (_tmp8_ == FOLKS_MAYBE_BOOL_TRUE);
		_tmp9_ = self->priv->group_flags_received;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, "can-add-personas");
		_tmp10_ = store;
		g_signal_parse_name ("notify::can-add-personas", G_TYPE_OBJECT, &_tmp11_, &_tmp12_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp10_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp11_, _tmp12_, NULL, (GCallback) _persona_store_capabilities_tests_can_add_personas_cb_g_object_notify, self);
	}
	_g_object_unref0 (store);
}


static void persona_store_capabilities_tests_can_remove_personas_cb (PersonaStoreCapabilitiesTests* self, GObject* s, GParamSpec* p) {
	GObject* _tmp0_;
	GObject* _tmp1_;
	TpfPersonaStore* _tmp2_;
	TpfPersonaStore* store;
	TpfPersonaStore* _tmp3_;
	FolksMaybeBool _tmp4_;
	FolksMaybeBool _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	_tmp0_ = s;
	g_assert (TPF_IS_PERSONA_STORE (_tmp0_));
	_tmp1_ = s;
	_tmp2_ = _g_object_ref0 (TPF_PERSONA_STORE (_tmp1_));
	store = _tmp2_;
	_tmp3_ = store;
	_tmp4_ = folks_persona_store_get_can_remove_personas ((FolksPersonaStore*) _tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ != FOLKS_MAYBE_BOOL_UNSET) {
		TpfPersonaStore* _tmp6_;
		FolksMaybeBool _tmp7_;
		FolksMaybeBool _tmp8_;
		GeeHashSet* _tmp9_;
		TpfPersonaStore* _tmp10_;
		guint _tmp11_ = 0U;
		GQuark _tmp12_ = 0U;
		_tmp6_ = store;
		_tmp7_ = folks_persona_store_get_can_remove_personas ((FolksPersonaStore*) _tmp6_);
		_tmp8_ = _tmp7_;
		g_assert (_tmp8_ == FOLKS_MAYBE_BOOL_TRUE);
		_tmp9_ = self->priv->group_flags_received;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, "can-remove-personas");
		_tmp10_ = store;
		g_signal_parse_name ("notify::can-remove-personas", G_TYPE_OBJECT, &_tmp11_, &_tmp12_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp10_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp11_, _tmp12_, NULL, (GCallback) _persona_store_capabilities_tests_can_remove_personas_cb_g_object_notify, self);
	}
	_g_object_unref0 (store);
}


static void persona_store_capabilities_tests_can_alias_personas_cb (PersonaStoreCapabilitiesTests* self, GObject* s, GParamSpec* p) {
	GObject* _tmp0_;
	GObject* _tmp1_;
	TpfPersonaStore* _tmp2_;
	TpfPersonaStore* store;
	TpfPersonaStore* _tmp3_;
	FolksMaybeBool _tmp4_;
	FolksMaybeBool _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	_tmp0_ = s;
	g_assert (TPF_IS_PERSONA_STORE (_tmp0_));
	_tmp1_ = s;
	_tmp2_ = _g_object_ref0 (TPF_PERSONA_STORE (_tmp1_));
	store = _tmp2_;
	_tmp3_ = store;
	_tmp4_ = folks_persona_store_get_can_alias_personas ((FolksPersonaStore*) _tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ != FOLKS_MAYBE_BOOL_UNSET) {
		TpfPersonaStore* _tmp6_;
		FolksMaybeBool _tmp7_;
		FolksMaybeBool _tmp8_;
		GeeHashSet* _tmp9_;
		TpfPersonaStore* _tmp10_;
		guint _tmp11_ = 0U;
		GQuark _tmp12_ = 0U;
		_tmp6_ = store;
		_tmp7_ = folks_persona_store_get_can_alias_personas ((FolksPersonaStore*) _tmp6_);
		_tmp8_ = _tmp7_;
		g_assert (_tmp8_ == FOLKS_MAYBE_BOOL_TRUE);
		_tmp9_ = self->priv->group_flags_received;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, "can-alias-personas");
		_tmp10_ = store;
		g_signal_parse_name ("notify::can-alias-personas", G_TYPE_OBJECT, &_tmp11_, &_tmp12_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp10_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp11_, _tmp12_, NULL, (GCallback) _persona_store_capabilities_tests_can_alias_personas_cb_g_object_notify, self);
	}
	_g_object_unref0 (store);
}


static void persona_store_capabilities_tests_can_group_personas_cb (PersonaStoreCapabilitiesTests* self, GObject* s, GParamSpec* p) {
	GObject* _tmp0_;
	GObject* _tmp1_;
	TpfPersonaStore* _tmp2_;
	TpfPersonaStore* store;
	TpfPersonaStore* _tmp3_;
	FolksMaybeBool _tmp4_;
	FolksMaybeBool _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	_tmp0_ = s;
	g_assert (TPF_IS_PERSONA_STORE (_tmp0_));
	_tmp1_ = s;
	_tmp2_ = _g_object_ref0 (TPF_PERSONA_STORE (_tmp1_));
	store = _tmp2_;
	_tmp3_ = store;
	_tmp4_ = folks_persona_store_get_can_group_personas ((FolksPersonaStore*) _tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ != FOLKS_MAYBE_BOOL_UNSET) {
		TpfPersonaStore* _tmp6_;
		FolksMaybeBool _tmp7_;
		FolksMaybeBool _tmp8_;
		GeeHashSet* _tmp9_;
		TpfPersonaStore* _tmp10_;
		guint _tmp11_ = 0U;
		GQuark _tmp12_ = 0U;
		_tmp6_ = store;
		_tmp7_ = folks_persona_store_get_can_group_personas ((FolksPersonaStore*) _tmp6_);
		_tmp8_ = _tmp7_;
		g_assert (_tmp8_ == FOLKS_MAYBE_BOOL_TRUE);
		_tmp9_ = self->priv->group_flags_received;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, "can-group-personas");
		_tmp10_ = store;
		g_signal_parse_name ("notify::can-group-personas", G_TYPE_OBJECT, &_tmp11_, &_tmp12_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) _tmp10_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp11_, _tmp12_, NULL, (GCallback) _persona_store_capabilities_tests_can_group_personas_cb_g_object_notify, self);
	}
	_g_object_unref0 (store);
}


static void persona_store_capabilities_tests_class_init (PersonaStoreCapabilitiesTestsClass * klass) {
	persona_store_capabilities_tests_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (PersonaStoreCapabilitiesTestsPrivate));
	FOLKS_TEST_CASE_CLASS (klass)->set_up = persona_store_capabilities_tests_real_set_up;
	FOLKS_TEST_CASE_CLASS (klass)->tear_down = persona_store_capabilities_tests_real_tear_down;
	G_OBJECT_CLASS (klass)->finalize = persona_store_capabilities_tests_finalize;
}


static void persona_store_capabilities_tests_instance_init (PersonaStoreCapabilitiesTests * self) {
	self->priv = PERSONA_STORE_CAPABILITIES_TESTS_GET_PRIVATE (self);
	self->priv->_test_timeout = 3;
}


static void persona_store_capabilities_tests_finalize (GObject* obj) {
	PersonaStoreCapabilitiesTests * self;
	self = PERSONA_STORE_CAPABILITIES_TESTS (obj);
	_g_object_unref0 (self->priv->tp_backend);
	_g_object_unref0 (self->priv->group_flags_received);
	G_OBJECT_CLASS (persona_store_capabilities_tests_parent_class)->finalize (obj);
}


GType persona_store_capabilities_tests_get_type (void) {
	static volatile gsize persona_store_capabilities_tests_type_id__volatile = 0;
	if (g_once_init_enter (&persona_store_capabilities_tests_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (PersonaStoreCapabilitiesTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) persona_store_capabilities_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PersonaStoreCapabilitiesTests), 0, (GInstanceInitFunc) persona_store_capabilities_tests_instance_init, NULL };
		GType persona_store_capabilities_tests_type_id;
		persona_store_capabilities_tests_type_id = g_type_register_static (FOLKS_TYPE_TEST_CASE, "PersonaStoreCapabilitiesTests", &g_define_type_info, 0);
		g_once_init_leave (&persona_store_capabilities_tests_type_id__volatile, persona_store_capabilities_tests_type_id);
	}
	return persona_store_capabilities_tests_type_id__volatile;
}


gint _vala_main (gchar** args, int args_length1) {
	gint result = 0;
	GTestSuite* _tmp0_ = NULL;
	GTestSuite* root;
	GTestSuite* _tmp1_;
	PersonaStoreCapabilitiesTests* _tmp2_;
	PersonaStoreCapabilitiesTests* _tmp3_;
	GTestSuite* _tmp4_ = NULL;
	g_test_init (&args_length1, &args, NULL);
	_tmp0_ = g_test_get_root ();
	root = _tmp0_;
	_tmp1_ = root;
	_tmp2_ = persona_store_capabilities_tests_new ();
	_tmp3_ = _tmp2_;
	_tmp4_ = folks_test_case_get_suite ((FolksTestCase*) _tmp3_);
	g_test_suite_add_suite (_tmp1_, _tmp4_);
	_g_object_unref0 (_tmp3_);
	g_test_run ();
	result = 0;
	return result;
}


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



