/* persona-store-capabilities.c generated by valac 0.12.0, the Vala compiler
 * generated from persona-store-capabilities.vala, do not modify */


#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_ = NULL;
	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;
	GeeHashSet* _tmp0_ = NULL;
	void* _tmp1_ = NULL;
	self = (PersonaStoreCapabilitiesTests*) base;
	_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, g_str_hash, g_str_equal);
	_g_object_unref0 (self->priv->group_flags_received);
	self->priv->group_flags_received = _tmp0_;
	tp_test_backend_set_up (self->priv->tp_backend);
	_tmp1_ = tp_test_backend_add_account (self->priv->tp_backend, "protocol", "me@example.com", "cm", "account");
	self->priv->_account_handle = _tmp1_;
}


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


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) {
	g_return_if_fail (ps != NULL);
	persona_store_capabilities_tests_set_up_persona_store (self, ps);
}


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


static void _lambda0_ (FolksBackend* b, PersonaStoreCapabilitiesTests* self) {
	const gchar* _tmp0_ = NULL;
	g_return_if_fail (b != NULL);
	_tmp0_ = folks_backend_get_name (b);
	if (g_strcmp0 (_tmp0_, "telepathy") == 0) {
		g_signal_connect_object (b, "persona-store-added", (GCallback) __lambda1__folks_backend_persona_store_added, self, 0);
		{
			GeeMap* _tmp1_ = NULL;
			GeeCollection* _tmp2_ = NULL;
			GeeCollection* _tmp3_;
			GeeIterator* _tmp4_ = NULL;
			GeeIterator* _tmp5_;
			GeeIterator* _store_it;
			_tmp1_ = folks_backend_get_persona_stores (b);
			_tmp2_ = gee_map_get_values (_tmp1_);
			_tmp3_ = _tmp2_;
			_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
			_tmp5_ = _tmp4_;
			_g_object_unref0 (_tmp3_);
			_store_it = _tmp5_;
			while (TRUE) {
				gboolean _tmp6_;
				gpointer _tmp7_ = NULL;
				FolksPersonaStore* store;
				_tmp6_ = gee_iterator_next (_store_it);
				if (!_tmp6_) {
					break;
				}
				_tmp7_ = gee_iterator_get (_store_it);
				store = (FolksPersonaStore*) _tmp7_;
				persona_store_capabilities_tests_set_up_persona_store (self, store);
				_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;
	self = _data1_->self;
	g_main_loop_quit (_data1_->main_loop);
	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_ = NULL;
	FolksBackendStore* _tmp1_ = NULL;
	FolksBackendStore* backend_store;
	gboolean _tmp2_;
	gboolean _tmp3_;
	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_;
	g_signal_connect_object (backend_store, "backend-available", (GCallback) __lambda0__folks_backend_store_backend_available, self, 0);
	folks_backend_store_load_backends (backend_store, NULL, NULL);
	g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) self->priv->_test_timeout, __lambda3__gsource_func, block1_data_ref (_data1_), block1_data_unref);
	g_main_loop_run (_data1_->main_loop);
	_tmp2_ = gee_abstract_collection_contains ((GeeAbstractCollection*) self->priv->group_flags_received, "can-add-personas");
	g_assert (_tmp2_);
	_tmp3_ = gee_abstract_collection_contains ((GeeAbstractCollection*) self->priv->group_flags_received, "can-remove-personas");
	g_assert (_tmp3_);
	_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;
	FolksMaybeBool _tmp0_;
	FolksMaybeBool _tmp1_;
	FolksMaybeBool _tmp2_;
	FolksMaybeBool _tmp3_;
	GError * _inner_error_ = NULL;
	self = _data2_->self;
	g_return_if_fail (_result_ != NULL);
	folks_persona_store_prepare_finish (_data2_->store, _result_, &_inner_error_);
	if (_inner_error_ != NULL) {
		goto __catch0_g_error;
	}
	_tmp0_ = folks_persona_store_get_can_add_personas (_data2_->store);
	if (_tmp0_ != FOLKS_MAYBE_BOOL_UNSET) {
		persona_store_capabilities_tests_can_add_personas_cb (self, (GObject*) _data2_->store, NULL);
	} else {
		g_signal_connect_object ((GObject*) _data2_->store, "notify::can-add-personas", (GCallback) _persona_store_capabilities_tests_can_add_personas_cb_g_object_notify, self, 0);
	}
	_tmp1_ = folks_persona_store_get_can_remove_personas (_data2_->store);
	if (_tmp1_ != FOLKS_MAYBE_BOOL_UNSET) {
		persona_store_capabilities_tests_can_remove_personas_cb (self, (GObject*) _data2_->store, NULL);
	} else {
		g_signal_connect_object ((GObject*) _data2_->store, "notify::can-remove-personas", (GCallback) _persona_store_capabilities_tests_can_remove_personas_cb_g_object_notify, self, 0);
	}
	_tmp2_ = folks_persona_store_get_can_alias_personas (_data2_->store);
	if (_tmp2_ != FOLKS_MAYBE_BOOL_UNSET) {
		persona_store_capabilities_tests_can_alias_personas_cb (self, (GObject*) _data2_->store, NULL);
	} else {
		g_signal_connect_object ((GObject*) _data2_->store, "notify::can-alias-personas", (GCallback) _persona_store_capabilities_tests_can_alias_personas_cb_g_object_notify, self, 0);
	}
	_tmp3_ = folks_persona_store_get_can_group_personas (_data2_->store);
	if (_tmp3_ != FOLKS_MAYBE_BOOL_UNSET) {
		persona_store_capabilities_tests_can_group_personas_cb (self, (GObject*) _data2_->store, NULL);
	} else {
		g_signal_connect_object ((GObject*) _data2_->store, "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;
		const gchar* _tmp4_ = NULL;
		const gchar* _tmp5_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp4_ = folks_persona_store_get_type_id (_data2_->store);
		_tmp5_ = folks_persona_store_get_id (_data2_->store);
		g_warning ("Error preparing PersonaStore type: %s, id: %s: " "'%s'", _tmp4_, _tmp5_, e->message);
		_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_;
	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);
	_data2_->store = _g_object_ref0 (store);
	folks_persona_store_prepare (_data2_->store, __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) {
	TpfPersonaStore* _tmp0_;
	TpfPersonaStore* store;
	FolksMaybeBool _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	g_assert (TPF_IS_PERSONA_STORE (s));
	_tmp0_ = _g_object_ref0 (TPF_PERSONA_STORE (s));
	store = _tmp0_;
	_tmp1_ = folks_persona_store_get_can_add_personas ((FolksPersonaStore*) store);
	if (_tmp1_ != FOLKS_MAYBE_BOOL_UNSET) {
		FolksMaybeBool _tmp2_;
		guint _tmp3_;
		GQuark _tmp4_;
		_tmp2_ = folks_persona_store_get_can_add_personas ((FolksPersonaStore*) store);
		g_assert (_tmp2_ == FOLKS_MAYBE_BOOL_TRUE);
		gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->group_flags_received, "can-add-personas");
		g_signal_parse_name ("notify::can-add-personas", G_TYPE_OBJECT, &_tmp3_, &_tmp4_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) store, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, _tmp4_, 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) {
	TpfPersonaStore* _tmp0_;
	TpfPersonaStore* store;
	FolksMaybeBool _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	g_assert (TPF_IS_PERSONA_STORE (s));
	_tmp0_ = _g_object_ref0 (TPF_PERSONA_STORE (s));
	store = _tmp0_;
	_tmp1_ = folks_persona_store_get_can_remove_personas ((FolksPersonaStore*) store);
	if (_tmp1_ != FOLKS_MAYBE_BOOL_UNSET) {
		FolksMaybeBool _tmp2_;
		guint _tmp3_;
		GQuark _tmp4_;
		_tmp2_ = folks_persona_store_get_can_remove_personas ((FolksPersonaStore*) store);
		g_assert (_tmp2_ == FOLKS_MAYBE_BOOL_TRUE);
		gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->group_flags_received, "can-remove-personas");
		g_signal_parse_name ("notify::can-remove-personas", G_TYPE_OBJECT, &_tmp3_, &_tmp4_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) store, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, _tmp4_, 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) {
	TpfPersonaStore* _tmp0_;
	TpfPersonaStore* store;
	FolksMaybeBool _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	g_assert (TPF_IS_PERSONA_STORE (s));
	_tmp0_ = _g_object_ref0 (TPF_PERSONA_STORE (s));
	store = _tmp0_;
	_tmp1_ = folks_persona_store_get_can_alias_personas ((FolksPersonaStore*) store);
	if (_tmp1_ != FOLKS_MAYBE_BOOL_UNSET) {
		FolksMaybeBool _tmp2_;
		guint _tmp3_;
		GQuark _tmp4_;
		_tmp2_ = folks_persona_store_get_can_alias_personas ((FolksPersonaStore*) store);
		g_assert (_tmp2_ == FOLKS_MAYBE_BOOL_TRUE);
		gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->group_flags_received, "can-alias-personas");
		g_signal_parse_name ("notify::can-alias-personas", G_TYPE_OBJECT, &_tmp3_, &_tmp4_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) store, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, _tmp4_, 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) {
	TpfPersonaStore* _tmp0_;
	TpfPersonaStore* store;
	FolksMaybeBool _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (s != NULL);
	g_assert (TPF_IS_PERSONA_STORE (s));
	_tmp0_ = _g_object_ref0 (TPF_PERSONA_STORE (s));
	store = _tmp0_;
	_tmp1_ = folks_persona_store_get_can_group_personas ((FolksPersonaStore*) store);
	if (_tmp1_ != FOLKS_MAYBE_BOOL_UNSET) {
		FolksMaybeBool _tmp2_;
		guint _tmp3_;
		GQuark _tmp4_;
		_tmp2_ = folks_persona_store_get_can_group_personas ((FolksPersonaStore*) store);
		g_assert (_tmp2_ == FOLKS_MAYBE_BOOL_TRUE);
		gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->group_flags_received, "can-group-personas");
		g_signal_parse_name ("notify::can-group-personas", G_TYPE_OBJECT, &_tmp3_, &_tmp4_, TRUE);
		g_signal_handlers_disconnect_matched ((GObject*) store, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, _tmp4_, 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;
	PersonaStoreCapabilitiesTests* _tmp1_ = NULL;
	PersonaStoreCapabilitiesTests* _tmp2_;
	GTestSuite* _tmp3_ = NULL;
	g_test_init (&args_length1, &args, NULL);
	_tmp0_ = g_test_get_root ();
	root = _tmp0_;
	_tmp1_ = persona_store_capabilities_tests_new ();
	_tmp2_ = _tmp1_;
	_tmp3_ = folks_test_case_get_suite ((FolksTestCase*) _tmp2_);
	g_test_suite_add_suite (root, _tmp3_);
	_g_object_unref0 (_tmp2_);
	g_test_run ();
	result = 0;
	return result;
}


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



