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

/*
 * Copyright (C) 2010 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/folks.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <telepathy-glib/telepathy-glib.h>


#define TPF_TYPE_PERSONA (tpf_persona_get_type ())
#define TPF_PERSONA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPF_TYPE_PERSONA, TpfPersona))
#define TPF_PERSONA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TPF_TYPE_PERSONA, TpfPersonaClass))
#define TPF_IS_PERSONA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPF_TYPE_PERSONA))
#define TPF_IS_PERSONA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPF_TYPE_PERSONA))
#define TPF_PERSONA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPF_TYPE_PERSONA, TpfPersonaClass))

typedef struct _TpfPersona TpfPersona;
typedef struct _TpfPersonaClass TpfPersonaClass;
typedef struct _TpfPersonaPrivate TpfPersonaPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define TPF_TYPE_PERSONA_STORE (tpf_persona_store_get_type ())
#define TPF_PERSONA_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPF_TYPE_PERSONA_STORE, TpfPersonaStore))
#define TPF_PERSONA_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TPF_TYPE_PERSONA_STORE, TpfPersonaStoreClass))
#define TPF_IS_PERSONA_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPF_TYPE_PERSONA_STORE))
#define TPF_IS_PERSONA_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPF_TYPE_PERSONA_STORE))
#define TPF_PERSONA_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPF_TYPE_PERSONA_STORE, TpfPersonaStoreClass))

typedef struct _TpfPersonaStore TpfPersonaStore;
typedef struct _TpfPersonaStoreClass TpfPersonaStoreClass;
typedef struct _TpfPersonaChangeGroupData TpfPersonaChangeGroupData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block1Data Block1Data;
#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))

struct _TpfPersona {
	FolksPersona parent_instance;
	TpfPersonaPrivate * priv;
};

struct _TpfPersonaClass {
	FolksPersonaClass parent_class;
};

struct _TpfPersonaPrivate {
	GeeHashSet* _groups;
	GeeSet* _groups_ro;
	gboolean _is_favourite;
	gchar* _alias;
	GeeHashMultiMap* _im_addresses;
	gboolean _is_constructed;
	gboolean _is_in_contact_list;
	GFile* _avatar;
	FolksPresenceType _presence_type;
	gchar* _presence_message;
	TpContact* _contact;
};

struct _TpfPersonaChangeGroupData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TpfPersona* self;
	gchar* group;
	gboolean is_member;
	gboolean _tmp0_;
	FolksPersonaStore* _tmp1_;
	TpfPersonaStore* _tmp2_;
	TpfPersonaStore* store;
};

struct _Block1Data {
	int _ref_count_;
	TpAccount* account_found;
	TpConnection* conn;
};


static gpointer tpf_persona_parent_class = NULL;
static FolksAliasDetailsIface* tpf_persona_folks_alias_details_parent_iface = NULL;
static FolksAvatarDetailsIface* tpf_persona_folks_avatar_details_parent_iface = NULL;
static FolksFavouriteDetailsIface* tpf_persona_folks_favourite_details_parent_iface = NULL;
static FolksGroupDetailsIface* tpf_persona_folks_group_details_parent_iface = NULL;
static FolksImDetailsIface* tpf_persona_folks_im_details_parent_iface = NULL;
static FolksPresenceDetailsIface* tpf_persona_folks_presence_details_parent_iface = NULL;

GType tpf_persona_get_type (void) G_GNUC_CONST;
#define TPF_PERSONA_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TPF_TYPE_PERSONA, TpfPersonaPrivate))
enum  {
	TPF_PERSONA_DUMMY_PROPERTY,
	TPF_PERSONA_IS_IN_CONTACT_LIST,
	TPF_PERSONA_AVATAR,
	TPF_PERSONA_PRESENCE_TYPE,
	TPF_PERSONA_PRESENCE_MESSAGE,
	TPF_PERSONA_LINKABLE_PROPERTIES,
	TPF_PERSONA_ALIAS,
	TPF_PERSONA_IS_FAVOURITE,
	TPF_PERSONA_IM_ADDRESSES,
	TPF_PERSONA_GROUPS,
	TPF_PERSONA_CONTACT
};
static void tpf_persona_real_change_group_data_free (gpointer _data);
static void tpf_persona_real_change_group (FolksGroupDetails* base, const gchar* group, gboolean is_member, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean tpf_persona_real_change_group_co (TpfPersonaChangeGroupData* data);
static gboolean _tpf_persona_change_group (TpfPersona* self, const gchar* group, gboolean is_member);
GType tpf_persona_store_get_type (void) G_GNUC_CONST;
void _tpf_persona_store_change_group_membership (TpfPersonaStore* self, FolksPersona* persona, const gchar* group, gboolean is_member, GAsyncReadyCallback _callback_, gpointer _user_data_);
void _tpf_persona_store_change_group_membership_finish (TpfPersonaStore* self, GAsyncResult* _res_);
static void tpf_persona_change_group_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
TpfPersona* tpf_persona_new (TpContact* contact, TpfPersonaStore* store);
TpfPersona* tpf_persona_construct (GType object_type, TpContact* contact, TpfPersonaStore* store);
static TpAccount* _tpf_persona_account_for_connection (TpConnection* conn);
static void _lambda15_ (GObject* s, GParamSpec* p, TpfPersona* self);
TpContact* tpf_persona_get_contact (TpfPersona* self);
static void __lambda15__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void _lambda16_ (GObject* s, GParamSpec* p, TpfPersona* self);
static void _tpf_persona_contact_notify_avatar (TpfPersona* self);
static void __lambda16__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void _lambda17_ (GObject* s, GParamSpec* p, TpfPersona* self);
static void _tpf_persona_contact_notify_presence_message (TpfPersona* self);
static void __lambda17__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void _lambda18_ (GObject* s, GParamSpec* p, TpfPersona* self);
static void _tpf_persona_contact_notify_presence_type (TpfPersona* self);
static void __lambda18__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void _lambda19_ (TpfPersonaStore* s, const gchar* group, GList* added, GList* removed, TpfPersona* self);
static void __lambda19__tpf_persona_store_group_members_changed (TpfPersonaStore* _sender, const gchar* group, GList* added, GList* removed, gpointer self);
static void _lambda20_ (TpfPersonaStore* s, const gchar* group, GError* _error_, TpfPersona* self);
static void __lambda20__tpf_persona_store_group_removed (TpfPersonaStore* _sender, const gchar* group, GError* _error_, gpointer self);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (Block1Data* _data1_);
static void _lambda14_ (TpAccount* l, Block1Data* _data1_);
static void __lambda14__gfunc (gconstpointer data, gpointer self);
static FolksPresenceType _tpf_persona_folks_presence_type_from_tp (TpConnectionPresenceType type);
gboolean tpf_persona_get_is_in_contact_list (TpfPersona* self);
void tpf_persona_set_is_in_contact_list (TpfPersona* self, gboolean value);
void tpf_persona_store_change_alias (TpfPersonaStore* self, TpfPersona* persona, const gchar* alias, GAsyncReadyCallback _callback_, gpointer _user_data_);
void tpf_persona_store_change_alias_finish (TpfPersonaStore* self, GAsyncResult* _res_);
void tpf_persona_store_change_is_favourite (TpfPersonaStore* self, FolksPersona* persona, gboolean is_favourite, GAsyncReadyCallback _callback_, gpointer _user_data_);
void tpf_persona_store_change_is_favourite_finish (TpfPersonaStore* self, GAsyncResult* _res_);
static void tpf_persona_set_contact (TpfPersona* self, TpContact* value);
static void tpf_persona_finalize (GObject* obj);
static void _vala_tpf_persona_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_tpf_persona_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);

static const gchar* TPF_PERSONA__linkable_properties[1] = {"im-addresses"};

static void tpf_persona_real_change_group_data_free (gpointer _data) {
	TpfPersonaChangeGroupData* data;
	data = _data;
	_g_free0 (data->group);
	_g_object_unref0 (data->self);
	g_slice_free (TpfPersonaChangeGroupData, data);
}


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


static void tpf_persona_real_change_group (FolksGroupDetails* base, const gchar* group, gboolean is_member, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TpfPersona * self;
	TpfPersonaChangeGroupData* _data_;
	self = (TpfPersona*) base;
	_data_ = g_slice_new0 (TpfPersonaChangeGroupData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, tpf_persona_real_change_group);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, tpf_persona_real_change_group_data_free);
	_data_->self = _g_object_ref0 (self);
	_data_->group = g_strdup (group);
	_data_->is_member = is_member;
	tpf_persona_real_change_group_co (_data_);
}


static void tpf_persona_real_change_group_finish (FolksGroupDetails* base, GAsyncResult* _res_, GError** error) {
	TpfPersonaChangeGroupData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


/**
   * Add or remove the Persona from the specified group.
   *
   * See {@link Folks.GroupDetails.change_group}.
   */
static void tpf_persona_change_group_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TpfPersonaChangeGroupData* data;
	data = _user_data_;
	data->_source_object_ = source_object;
	data->_res_ = _res_;
	tpf_persona_real_change_group_co (data);
}


static gboolean tpf_persona_real_change_group_co (TpfPersonaChangeGroupData* data) {
	switch (data->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	data->_tmp0_ = _tpf_persona_change_group (data->self, data->group, data->is_member);
	if (data->_tmp0_) {
		data->_tmp1_ = NULL;
		data->_tmp1_ = folks_persona_get_store ((FolksPersona*) data->self);
		data->_tmp2_ = _g_object_ref0 (TPF_PERSONA_STORE (data->_tmp1_));
		data->store = data->_tmp2_;
		data->_state_ = 1;
		_tpf_persona_store_change_group_membership (data->store, (FolksPersona*) data->self, data->group, data->is_member, tpf_persona_change_group_ready, data);
		return FALSE;
		_state_1:
		_tpf_persona_store_change_group_membership_finish (data->store, data->_res_);
		_g_object_unref0 (data->store);
	}
	if (data->_state_ == 0) {
		g_simple_async_result_complete_in_idle (data->_async_result);
	} else {
		g_simple_async_result_complete (data->_async_result);
	}
	g_object_unref (data->_async_result);
	return FALSE;
}


static gboolean _tpf_persona_change_group (TpfPersona* self, const gchar* group, gboolean is_member) {
	gboolean result = FALSE;
	gboolean changed;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (group != NULL, FALSE);
	changed = FALSE;
	if (is_member) {
		gboolean _tmp0_;
		_tmp0_ = gee_abstract_collection_contains ((GeeAbstractCollection*) self->priv->_groups, group);
		if (!_tmp0_) {
			gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->_groups, group);
			changed = TRUE;
		}
	} else {
		gboolean _tmp1_;
		_tmp1_ = gee_abstract_collection_remove ((GeeAbstractCollection*) self->priv->_groups, group);
		changed = _tmp1_;
	}
	if (changed == TRUE) {
		g_signal_emit_by_name ((FolksGroupDetails*) self, "group-changed", group, is_member);
	}
	result = changed;
	return result;
}


/**
   * Create a new persona.
   *
   * Create a new persona for the {@link PersonaStore} `store`, representing
   * the Telepathy contact given by `contact`.
   *
   * @param contact the Telepathy contact being represented by the persona
   * @param store the persona store to place the persona in
   */
static void _lambda15_ (GObject* s, GParamSpec* p, TpfPersona* self) {
	const gchar* _tmp0_ = NULL;
	g_return_if_fail (s != NULL);
	g_return_if_fail (p != NULL);
	_tmp0_ = tp_contact_get_alias (self->priv->_contact);
	if (g_strcmp0 (self->priv->_alias, _tmp0_) != 0) {
		const gchar* _tmp1_ = NULL;
		gchar* _tmp2_;
		_tmp1_ = tp_contact_get_alias (self->priv->_contact);
		_tmp2_ = g_strdup (_tmp1_);
		_g_free0 (self->priv->_alias);
		self->priv->_alias = _tmp2_;
		g_object_notify ((GObject*) self, "alias");
	}
}


static void __lambda15__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	_lambda15_ (_sender, pspec, self);
}


static void _lambda16_ (GObject* s, GParamSpec* p, TpfPersona* self) {
	g_return_if_fail (s != NULL);
	g_return_if_fail (p != NULL);
	_tpf_persona_contact_notify_avatar (self);
}


static void __lambda16__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	_lambda16_ (_sender, pspec, self);
}


static void _lambda17_ (GObject* s, GParamSpec* p, TpfPersona* self) {
	g_return_if_fail (s != NULL);
	g_return_if_fail (p != NULL);
	_tpf_persona_contact_notify_presence_message (self);
}


static void __lambda17__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	_lambda17_ (_sender, pspec, self);
}


static void _lambda18_ (GObject* s, GParamSpec* p, TpfPersona* self) {
	g_return_if_fail (s != NULL);
	g_return_if_fail (p != NULL);
	_tpf_persona_contact_notify_presence_type (self);
}


static void __lambda18__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	_lambda18_ (_sender, pspec, self);
}


static void _lambda19_ (TpfPersonaStore* s, const gchar* group, GList* added, GList* removed, TpfPersona* self) {
	GList* _tmp0_ = NULL;
	GList* _tmp1_ = NULL;
	g_return_if_fail (s != NULL);
	g_return_if_fail (group != NULL);
	_tmp0_ = g_list_find (added, self);
	if (_tmp0_ != NULL) {
		_tpf_persona_change_group (self, group, TRUE);
	}
	_tmp1_ = g_list_find (removed, self);
	if (_tmp1_ != NULL) {
		_tpf_persona_change_group (self, group, FALSE);
	}
}


static void __lambda19__tpf_persona_store_group_members_changed (TpfPersonaStore* _sender, const gchar* group, GList* added, GList* removed, gpointer self) {
	_lambda19_ (_sender, group, added, removed, self);
}


static void _lambda20_ (TpfPersonaStore* s, const gchar* group, GError* _error_, TpfPersona* self) {
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (s != NULL);
	g_return_if_fail (group != NULL);
	if (_error_ != NULL) {
		gboolean _tmp1_ = FALSE;
		GQuark _tmp2_;
		_tmp2_ = tp_dbus_errors_quark ();
		if (_error_->domain != _tmp2_) {
			_tmp1_ = TRUE;
		} else {
			_tmp1_ = _error_->code != TP_DBUS_ERROR_OBJECT_REMOVED;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		g_debug ("tpf-persona.vala:311: Group invalidated: %s", _error_->message);
	}
	_tpf_persona_change_group (self, group, FALSE);
}


static void __lambda20__tpf_persona_store_group_removed (TpfPersonaStore* _sender, const gchar* group, GError* _error_, gpointer self) {
	_lambda20_ (_sender, group, _error_, self);
}


TpfPersona* tpf_persona_construct (GType object_type, TpContact* contact, TpfPersonaStore* store) {
	TpfPersona * self = NULL;
	const gchar* _tmp0_ = NULL;
	const gchar* id;
	TpConnection* _tmp1_ = NULL;
	TpConnection* connection;
	TpAccount* _tmp2_ = NULL;
	TpAccount* account;
	const gchar* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	gchar* _tmp5_ = NULL;
	gchar* uid;
	const gchar* _tmp6_ = NULL;
	const gchar* _tmp7_ = NULL;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	guint _tmp12_;
	guint _tmp13_;
	GeeHashMultiMap* _tmp14_ = NULL;
	const gchar* _tmp15_ = NULL;
	gchar* _tmp16_ = NULL;
	gchar* _tmp17_;
	const gchar* _tmp18_ = NULL;
	gchar* _tmp19_;
	GeeHashSet* _tmp20_ = NULL;
	GeeSet* _tmp21_ = NULL;
	FolksPersonaStore* _tmp22_ = NULL;
	FolksPersonaStore* _tmp23_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (contact != NULL, NULL);
	g_return_val_if_fail (store != NULL, NULL);
	_tmp0_ = tp_contact_get_identifier (contact);
	id = _tmp0_;
	_tmp1_ = tp_contact_get_connection (contact);
	connection = _tmp1_;
	_tmp2_ = _tpf_persona_account_for_connection (connection);
	account = _tmp2_;
	_tmp3_ = folks_persona_store_get_type_id ((FolksPersonaStore*) store);
	_tmp4_ = folks_persona_store_get_id ((FolksPersonaStore*) store);
	_tmp5_ = folks_persona_build_uid (_tmp3_, _tmp4_, id);
	uid = _tmp5_;
	_tmp6_ = tp_contact_get_alias (contact);
	_tmp7_ = tp_account_get_protocol (account);
	_tmp8_ = g_strconcat (_tmp7_, ":", NULL);
	_tmp9_ = _tmp8_;
	_tmp10_ = g_strconcat (_tmp9_, id, NULL);
	_tmp11_ = _tmp10_;
	_tmp12_ = tp_contact_get_handle (contact);
	_tmp13_ = tp_connection_get_self_handle (connection);
	self = (TpfPersona*) g_object_new (object_type, "alias", _tmp6_, "contact", contact, "display-id", id, "iid", _tmp11_, "uid", uid, "store", store, "is-user", _tmp12_ == _tmp13_, NULL);
	_g_free0 (_tmp11_);
	_g_free0 (_tmp9_);
	g_signal_connect_object ((GObject*) contact, "notify::alias", (GCallback) __lambda15__g_object_notify, self, 0);
	g_debug ("tpf-persona.vala:252: Creating new Tpf.Persona '%s' for service-specif" \
"ic UID '%s': %p", uid, id, self);
	self->priv->_is_constructed = TRUE;
	_tmp14_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->_im_addresses);
	self->priv->_im_addresses = _tmp14_;
	_tmp15_ = tp_account_get_protocol (account);
	_tmp16_ = folks_im_details_normalise_im_address (id, _tmp15_, &_inner_error_);
	_tmp17_ = _tmp16_;
	if (_inner_error_ != NULL) {
		if (_inner_error_->domain == FOLKS_IM_DETAILS_ERROR) {
			goto __catch0_folks_im_details_error;
		}
		_g_free0 (uid);
		_g_object_unref0 (account);
		g_critical ("file %s: line %d: unexpected 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 NULL;
	}
	_tmp18_ = tp_account_get_protocol (account);
	_tmp19_ = _tmp17_;
	gee_multi_map_set ((GeeMultiMap*) self->priv->_im_addresses, _tmp18_, _tmp19_);
	_g_free0 (_tmp19_);
	goto __finally0;
	__catch0_folks_im_details_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		g_warning ("tpf-persona.vala:267: %s", e->message);
		_g_error_free0 (e);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		_g_free0 (uid);
		_g_object_unref0 (account);
		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 NULL;
	}
	_tmp20_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
	_g_object_unref0 (self->priv->_groups);
	self->priv->_groups = _tmp20_;
	_tmp21_ = gee_abstract_set_get_read_only_view ((GeeAbstractSet*) self->priv->_groups);
	_g_object_unref0 (self->priv->_groups_ro);
	self->priv->_groups_ro = _tmp21_;
	g_signal_connect_object ((GObject*) contact, "notify::avatar-file", (GCallback) __lambda16__g_object_notify, self, 0);
	_tpf_persona_contact_notify_avatar (self);
	g_signal_connect_object ((GObject*) contact, "notify::presence-message", (GCallback) __lambda17__g_object_notify, self, 0);
	g_signal_connect_object ((GObject*) contact, "notify::presence-type", (GCallback) __lambda18__g_object_notify, self, 0);
	_tpf_persona_contact_notify_presence_message (self);
	_tpf_persona_contact_notify_presence_type (self);
	_tmp22_ = folks_persona_get_store ((FolksPersona*) self);
	g_signal_connect_object (TPF_PERSONA_STORE (_tmp22_), "group-members-changed", (GCallback) __lambda19__tpf_persona_store_group_members_changed, self, 0);
	_tmp23_ = folks_persona_get_store ((FolksPersona*) self);
	g_signal_connect_object (TPF_PERSONA_STORE (_tmp23_), "group-removed", (GCallback) __lambda20__tpf_persona_store_group_removed, self, 0);
	_g_free0 (uid);
	_g_object_unref0 (account);
	return self;
}


TpfPersona* tpf_persona_new (TpContact* contact, TpfPersonaStore* store) {
	return tpf_persona_construct (TPF_TYPE_PERSONA, contact, store);
}


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_->account_found);
		_g_object_unref0 (_data1_->conn);
		g_slice_free (Block1Data, _data1_);
	}
}


static void _lambda14_ (TpAccount* l, Block1Data* _data1_) {
	TpAccount* account;
	TpConnection* _tmp0_ = NULL;
	g_return_if_fail (l != NULL);
	account = TP_ACCOUNT (l);
	_tmp0_ = tp_account_get_connection (account);
	if (_tmp0_ == _data1_->conn) {
		TpAccount* _tmp1_;
		_tmp1_ = _g_object_ref0 (account);
		_g_object_unref0 (_data1_->account_found);
		_data1_->account_found = _tmp1_;
		return;
	}
}


static void __lambda14__gfunc (gconstpointer data, gpointer self) {
	_lambda14_ (data, self);
}


static TpAccount* _tpf_persona_account_for_connection (TpConnection* conn) {
	TpAccount* result = NULL;
	Block1Data* _data1_;
	TpAccountManager* _tmp0_ = NULL;
	TpAccountManager* manager;
	GList* _tmp1_ = NULL;
	GList* accounts;
	TpAccount* _tmp2_;
	g_return_val_if_fail (conn != NULL, NULL);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->conn = _g_object_ref0 (conn);
	_tmp0_ = tp_account_manager_dup ();
	manager = _tmp0_;
	_tmp1_ = tp_account_manager_get_valid_accounts (manager);
	accounts = _tmp1_;
	_data1_->account_found = NULL;
	g_list_foreach (accounts, __lambda14__gfunc, _data1_);
	_tmp2_ = _g_object_ref0 (_data1_->account_found);
	result = _tmp2_;
	_g_list_free0 (accounts);
	_g_object_unref0 (manager);
	block1_data_unref (_data1_);
	_data1_ = NULL;
	return result;
}


static void _tpf_persona_contact_notify_presence_message (TpfPersona* self) {
	const gchar* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = tp_contact_get_presence_message (self->priv->_contact);
	folks_presence_details_set_presence_message ((FolksPresenceDetails*) self, _tmp0_);
}


static void _tpf_persona_contact_notify_presence_type (TpfPersona* self) {
	TpConnectionPresenceType _tmp0_;
	FolksPresenceType _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = tp_contact_get_presence_type (self->priv->_contact);
	_tmp1_ = _tpf_persona_folks_presence_type_from_tp (_tmp0_);
	folks_presence_details_set_presence_type ((FolksPresenceDetails*) self, _tmp1_);
}


static FolksPresenceType _tpf_persona_folks_presence_type_from_tp (TpConnectionPresenceType type) {
	FolksPresenceType result = 0;
	switch (type) {
		case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE:
		{
			result = FOLKS_PRESENCE_TYPE_AVAILABLE;
			return result;
		}
		case TP_CONNECTION_PRESENCE_TYPE_AWAY:
		{
			result = FOLKS_PRESENCE_TYPE_AWAY;
			return result;
		}
		case TP_CONNECTION_PRESENCE_TYPE_BUSY:
		{
			result = FOLKS_PRESENCE_TYPE_BUSY;
			return result;
		}
		case TP_CONNECTION_PRESENCE_TYPE_ERROR:
		{
			result = FOLKS_PRESENCE_TYPE_ERROR;
			return result;
		}
		case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY:
		{
			result = FOLKS_PRESENCE_TYPE_EXTENDED_AWAY;
			return result;
		}
		case TP_CONNECTION_PRESENCE_TYPE_HIDDEN:
		{
			result = FOLKS_PRESENCE_TYPE_HIDDEN;
			return result;
		}
		case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
		{
			result = FOLKS_PRESENCE_TYPE_OFFLINE;
			return result;
		}
		case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
		{
			result = FOLKS_PRESENCE_TYPE_UNKNOWN;
			return result;
		}
		case TP_CONNECTION_PRESENCE_TYPE_UNSET:
		{
			result = FOLKS_PRESENCE_TYPE_UNSET;
			return result;
		}
		default:
		{
			result = FOLKS_PRESENCE_TYPE_UNKNOWN;
			return result;
		}
	}
}


static void _tpf_persona_contact_notify_avatar (TpfPersona* self) {
	GFile* _tmp0_ = NULL;
	GFile* _tmp1_;
	GFile* file;
	GFile* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = tp_contact_get_avatar_file (self->priv->_contact);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	file = _tmp1_;
	_tmp2_ = folks_avatar_details_get_avatar ((FolksAvatarDetails*) self);
	if (_tmp2_ != file) {
		folks_avatar_details_set_avatar ((FolksAvatarDetails*) self, file);
	}
	_g_object_unref0 (file);
}


gboolean tpf_persona_get_is_in_contact_list (TpfPersona* self) {
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_in_contact_list;
	return result;
}


void tpf_persona_set_is_in_contact_list (TpfPersona* self, gboolean value) {
	g_return_if_fail (self != NULL);
	self->priv->_is_in_contact_list = value;
	g_object_notify ((GObject *) self, "is-in-contact-list");
}


static GFile* tpf_persona_real_get_avatar (FolksAvatarDetails* base) {
	GFile* result;
	TpfPersona* self;
	self = (TpfPersona*) base;
	result = self->priv->_avatar;
	return result;
}


static void tpf_persona_real_set_avatar (FolksAvatarDetails* base, GFile* value) {
	TpfPersona* self;
	GFile* _tmp0_;
	self = (TpfPersona*) base;
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_avatar);
	self->priv->_avatar = _tmp0_;
	g_object_notify ((GObject *) self, "avatar");
}


static FolksPresenceType tpf_persona_real_get_presence_type (FolksPresenceDetails* base) {
	FolksPresenceType result;
	TpfPersona* self;
	self = (TpfPersona*) base;
	result = self->priv->_presence_type;
	return result;
}


static void tpf_persona_real_set_presence_type (FolksPresenceDetails* base, FolksPresenceType value) {
	TpfPersona* self;
	self = (TpfPersona*) base;
	self->priv->_presence_type = value;
	g_object_notify ((GObject *) self, "presence-type");
}


static const gchar* tpf_persona_real_get_presence_message (FolksPresenceDetails* base) {
	const gchar* result;
	TpfPersona* self;
	self = (TpfPersona*) base;
	result = self->priv->_presence_message;
	return result;
}


static void tpf_persona_real_set_presence_message (FolksPresenceDetails* base, const gchar* value) {
	TpfPersona* self;
	gchar* _tmp0_;
	self = (TpfPersona*) base;
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_presence_message);
	self->priv->_presence_message = _tmp0_;
	g_object_notify ((GObject *) self, "presence-message");
}


static gchar** tpf_persona_real_get_linkable_properties (FolksPersona* base, int* result_length1) {
	gchar** result;
	TpfPersona* self;
	const gchar** _tmp0_;
	self = (TpfPersona*) base;
	_tmp0_ = TPF_PERSONA__linkable_properties;
	*result_length1 = G_N_ELEMENTS (TPF_PERSONA__linkable_properties);
	result = _tmp0_;
	return result;
}


static const gchar* tpf_persona_real_get_alias (FolksAliasDetails* base) {
	const gchar* result;
	TpfPersona* self;
	self = (TpfPersona*) base;
	result = self->priv->_alias;
	return result;
}


static void tpf_persona_real_set_alias (FolksAliasDetails* base, const gchar* value) {
	TpfPersona* self;
	gchar* _tmp1_;
	self = (TpfPersona*) base;
	if (g_strcmp0 (self->priv->_alias, value) == 0) {
		return;
	}
	if (self->priv->_is_constructed) {
		FolksPersonaStore* _tmp0_ = NULL;
		_tmp0_ = folks_persona_get_store ((FolksPersona*) self);
		tpf_persona_store_change_alias (TPF_PERSONA_STORE (_tmp0_), self, value, NULL, NULL);
	}
	_tmp1_ = g_strdup (value);
	_g_free0 (self->priv->_alias);
	self->priv->_alias = _tmp1_;
	g_object_notify ((GObject *) self, "alias");
}


static gboolean tpf_persona_real_get_is_favourite (FolksFavouriteDetails* base) {
	gboolean result;
	TpfPersona* self;
	self = (TpfPersona*) base;
	result = self->priv->_is_favourite;
	return result;
}


static void tpf_persona_real_set_is_favourite (FolksFavouriteDetails* base, gboolean value) {
	TpfPersona* self;
	self = (TpfPersona*) base;
	if (self->priv->_is_favourite == value) {
		return;
	}
	if (self->priv->_is_constructed) {
		FolksPersonaStore* _tmp0_ = NULL;
		_tmp0_ = folks_persona_get_store ((FolksPersona*) self);
		tpf_persona_store_change_is_favourite (TPF_PERSONA_STORE (_tmp0_), (FolksPersona*) self, value, NULL, NULL);
	}
	self->priv->_is_favourite = value;
	g_object_notify ((GObject *) self, "is-favourite");
}


static GeeMultiMap* tpf_persona_real_get_im_addresses (FolksImDetails* base) {
	GeeMultiMap* result;
	TpfPersona* self;
	self = (TpfPersona*) base;
	result = (GeeMultiMap*) self->priv->_im_addresses;
	return result;
}


static void tpf_persona_real_set_im_addresses (FolksImDetails* base, GeeMultiMap* value) {
	TpfPersona* self;
	self = (TpfPersona*) base;
	g_object_notify ((GObject *) self, "im-addresses");
}


static GeeSet* tpf_persona_real_get_groups (FolksGroupDetails* base) {
	GeeSet* result;
	TpfPersona* self;
	self = (TpfPersona*) base;
	result = self->priv->_groups_ro;
	return result;
}


static void tpf_persona_real_set_groups (FolksGroupDetails* base, GeeSet* value) {
	TpfPersona* self;
	self = (TpfPersona*) base;
	{
		GeeIterator* _tmp0_ = NULL;
		GeeIterator* _group_it;
		_tmp0_ = gee_iterable_iterator ((GeeIterable*) value);
		_group_it = _tmp0_;
		while (TRUE) {
			gboolean _tmp1_;
			gpointer _tmp2_ = NULL;
			gchar* group;
			gboolean _tmp3_;
			_tmp1_ = gee_iterator_next (_group_it);
			if (!_tmp1_) {
				break;
			}
			_tmp2_ = gee_iterator_get (_group_it);
			group = (gchar*) _tmp2_;
			_tmp3_ = gee_abstract_collection_contains ((GeeAbstractCollection*) self->priv->_groups, group);
			if (_tmp3_ == FALSE) {
				_tpf_persona_change_group (self, group, TRUE);
			}
			_g_free0 (group);
		}
		_g_object_unref0 (_group_it);
	}
	{
		GeeIterator* _tmp4_ = NULL;
		GeeIterator* _group_it;
		_tmp4_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) self->priv->_groups);
		_group_it = _tmp4_;
		while (TRUE) {
			gboolean _tmp5_;
			gpointer _tmp6_ = NULL;
			gchar* group;
			gboolean _tmp7_;
			_tmp5_ = gee_iterator_next (_group_it);
			if (!_tmp5_) {
				break;
			}
			_tmp6_ = gee_iterator_get (_group_it);
			group = (gchar*) _tmp6_;
			_tmp7_ = gee_collection_contains ((GeeCollection*) value, group);
			if (_tmp7_ == FALSE) {
				_tpf_persona_change_group (self, group, TRUE);
			}
			_g_free0 (group);
		}
		_g_object_unref0 (_group_it);
	}
	g_object_notify ((GObject*) self, "groups");
	g_object_notify ((GObject *) self, "groups");
}


TpContact* tpf_persona_get_contact (TpfPersona* self) {
	TpContact* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_contact;
	return result;
}


static void tpf_persona_set_contact (TpfPersona* self, TpContact* value) {
	TpContact* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_contact);
	self->priv->_contact = _tmp0_;
	g_object_notify ((GObject *) self, "contact");
}


static void tpf_persona_class_init (TpfPersonaClass * klass) {
	tpf_persona_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (TpfPersonaPrivate));
	FOLKS_PERSONA_CLASS (klass)->get_linkable_properties = tpf_persona_real_get_linkable_properties;
	G_OBJECT_CLASS (klass)->get_property = _vala_tpf_persona_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tpf_persona_set_property;
	G_OBJECT_CLASS (klass)->finalize = tpf_persona_finalize;
	/**
	   * Whether the Persona is in the user's contact list.
	   *
	   * This will be true for most {@link Folks.Persona}s, but may not be true for
	   * personas where {@link Folks.Persona.is_user} is true. If it's false in
	   * this case, it means that the persona has been retrieved from the Telepathy
	   * connection, but has not been added to the user's contact list.
	   *
	   * @since 0.3.5
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), TPF_PERSONA_IS_IN_CONTACT_LIST, g_param_spec_boolean ("is-in-contact-list", "is-in-contact-list", "is-in-contact-list", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	   * An avatar for the Persona.
	   *
	   * See {@link Folks.AvatarDetails.avatar}.
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TPF_PERSONA_AVATAR, "avatar");
	/**
	   * The Persona's presence type.
	   *
	   * See {@link Folks.PresenceDetails.presence_type}.
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TPF_PERSONA_PRESENCE_TYPE, "presence-type");
	/**
	   * The Persona's presence message.
	   *
	   * See {@link Folks.PresenceDetails.presence_message}.
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TPF_PERSONA_PRESENCE_MESSAGE, "presence-message");
	/**
	   * The names of the Persona's linkable properties.
	   *
	   * See {@link Folks.Persona.linkable_properties}.
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TPF_PERSONA_LINKABLE_PROPERTIES, "linkable-properties");
	/**
	   * An alias for the Persona.
	   *
	   * See {@link Folks.AliasDetails.alias}.
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TPF_PERSONA_ALIAS, "alias");
	/**
	   * Whether this Persona is a user-defined favourite.
	   *
	   * See {@link Folks.FavouriteDetails.is_favourite}.
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TPF_PERSONA_IS_FAVOURITE, "is-favourite");
	/**
	   * A mapping of IM protocol to an (unordered) set of IM addresses.
	   *
	   * See {@link Folks.ImDetails.im_addresses}.
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TPF_PERSONA_IM_ADDRESSES, "im-addresses");
	/**
	   * A mapping of group ID to whether the contact is a member.
	   *
	   * See {@link Folks.GroupDetails.groups}.
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), TPF_PERSONA_GROUPS, "groups");
	/**
	   * The Telepathy contact represented by this persona.
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), TPF_PERSONA_CONTACT, g_param_spec_object ("contact", "contact", "contact", TP_TYPE_CONTACT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}


static void tpf_persona_folks_alias_details_interface_init (FolksAliasDetailsIface * iface) {
	tpf_persona_folks_alias_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_alias = tpf_persona_real_get_alias;
	iface->set_alias = tpf_persona_real_set_alias;
}


static void tpf_persona_folks_avatar_details_interface_init (FolksAvatarDetailsIface * iface) {
	tpf_persona_folks_avatar_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_avatar = tpf_persona_real_get_avatar;
	iface->set_avatar = tpf_persona_real_set_avatar;
}


static void tpf_persona_folks_favourite_details_interface_init (FolksFavouriteDetailsIface * iface) {
	tpf_persona_folks_favourite_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_is_favourite = tpf_persona_real_get_is_favourite;
	iface->set_is_favourite = tpf_persona_real_set_is_favourite;
}


static void tpf_persona_folks_group_details_interface_init (FolksGroupDetailsIface * iface) {
	tpf_persona_folks_group_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->change_group = (void (*)(FolksGroupDetails* ,const gchar* ,gboolean ,GError**)) tpf_persona_real_change_group;
	iface->change_group_finish = tpf_persona_real_change_group_finish;
	iface->get_groups = tpf_persona_real_get_groups;
	iface->set_groups = tpf_persona_real_set_groups;
}


static void tpf_persona_folks_im_details_interface_init (FolksImDetailsIface * iface) {
	tpf_persona_folks_im_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_im_addresses = tpf_persona_real_get_im_addresses;
	iface->set_im_addresses = tpf_persona_real_set_im_addresses;
}


static void tpf_persona_folks_presence_details_interface_init (FolksPresenceDetailsIface * iface) {
	tpf_persona_folks_presence_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_presence_type = tpf_persona_real_get_presence_type;
	iface->set_presence_type = tpf_persona_real_set_presence_type;
	iface->get_presence_message = tpf_persona_real_get_presence_message;
	iface->set_presence_message = tpf_persona_real_set_presence_message;
}


static void tpf_persona_instance_init (TpfPersona * self) {
	self->priv = TPF_PERSONA_GET_PRIVATE (self);
	self->priv->_is_constructed = FALSE;
}


static void tpf_persona_finalize (GObject* obj) {
	TpfPersona * self;
	const gchar* _tmp0_ = NULL;
	self = TPF_PERSONA (obj);
	_tmp0_ = folks_persona_get_uid ((FolksPersona*) self);
	g_debug ("tpf-persona.vala:320: Destroying Tpf.Persona '%s': %p", _tmp0_, self);
	_g_object_unref0 (self->priv->_groups);
	_g_object_unref0 (self->priv->_groups_ro);
	_g_free0 (self->priv->_alias);
	_g_object_unref0 (self->priv->_im_addresses);
	_g_object_unref0 (self->priv->_avatar);
	_g_free0 (self->priv->_presence_message);
	_g_object_unref0 (self->priv->_contact);
	G_OBJECT_CLASS (tpf_persona_parent_class)->finalize (obj);
}


/**
 * A persona subclass which represents a single instant messaging contact from
 * Telepathy.
 */
GType tpf_persona_get_type (void) {
	static volatile gsize tpf_persona_type_id__volatile = 0;
	if (g_once_init_enter (&tpf_persona_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TpfPersonaClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tpf_persona_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TpfPersona), 0, (GInstanceInitFunc) tpf_persona_instance_init, NULL };
		static const GInterfaceInfo folks_alias_details_info = { (GInterfaceInitFunc) tpf_persona_folks_alias_details_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		static const GInterfaceInfo folks_avatar_details_info = { (GInterfaceInitFunc) tpf_persona_folks_avatar_details_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		static const GInterfaceInfo folks_favourite_details_info = { (GInterfaceInitFunc) tpf_persona_folks_favourite_details_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		static const GInterfaceInfo folks_group_details_info = { (GInterfaceInitFunc) tpf_persona_folks_group_details_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		static const GInterfaceInfo folks_im_details_info = { (GInterfaceInitFunc) tpf_persona_folks_im_details_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		static const GInterfaceInfo folks_presence_details_info = { (GInterfaceInitFunc) tpf_persona_folks_presence_details_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType tpf_persona_type_id;
		tpf_persona_type_id = g_type_register_static (FOLKS_TYPE_PERSONA, "TpfPersona", &g_define_type_info, 0);
		g_type_add_interface_static (tpf_persona_type_id, FOLKS_TYPE_ALIAS_DETAILS, &folks_alias_details_info);
		g_type_add_interface_static (tpf_persona_type_id, FOLKS_TYPE_AVATAR_DETAILS, &folks_avatar_details_info);
		g_type_add_interface_static (tpf_persona_type_id, FOLKS_TYPE_FAVOURITE_DETAILS, &folks_favourite_details_info);
		g_type_add_interface_static (tpf_persona_type_id, FOLKS_TYPE_GROUP_DETAILS, &folks_group_details_info);
		g_type_add_interface_static (tpf_persona_type_id, FOLKS_TYPE_IM_DETAILS, &folks_im_details_info);
		g_type_add_interface_static (tpf_persona_type_id, FOLKS_TYPE_PRESENCE_DETAILS, &folks_presence_details_info);
		g_once_init_leave (&tpf_persona_type_id__volatile, tpf_persona_type_id);
	}
	return tpf_persona_type_id__volatile;
}


static void _vala_tpf_persona_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	TpfPersona * self;
	int length;
	self = TPF_PERSONA (object);
	switch (property_id) {
		case TPF_PERSONA_IS_IN_CONTACT_LIST:
		g_value_set_boolean (value, tpf_persona_get_is_in_contact_list (self));
		break;
		case TPF_PERSONA_AVATAR:
		g_value_set_object (value, folks_avatar_details_get_avatar ((FolksAvatarDetails*) self));
		break;
		case TPF_PERSONA_PRESENCE_TYPE:
		g_value_set_enum (value, folks_presence_details_get_presence_type ((FolksPresenceDetails*) self));
		break;
		case TPF_PERSONA_PRESENCE_MESSAGE:
		g_value_set_string (value, folks_presence_details_get_presence_message ((FolksPresenceDetails*) self));
		break;
		case TPF_PERSONA_LINKABLE_PROPERTIES:
		g_value_set_boxed (value, folks_persona_get_linkable_properties ((FolksPersona*) self, &length));
		break;
		case TPF_PERSONA_ALIAS:
		g_value_set_string (value, folks_alias_details_get_alias ((FolksAliasDetails*) self));
		break;
		case TPF_PERSONA_IS_FAVOURITE:
		g_value_set_boolean (value, folks_favourite_details_get_is_favourite ((FolksFavouriteDetails*) self));
		break;
		case TPF_PERSONA_IM_ADDRESSES:
		g_value_set_object (value, folks_im_details_get_im_addresses ((FolksImDetails*) self));
		break;
		case TPF_PERSONA_GROUPS:
		g_value_set_object (value, folks_group_details_get_groups ((FolksGroupDetails*) self));
		break;
		case TPF_PERSONA_CONTACT:
		g_value_set_object (value, tpf_persona_get_contact (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_tpf_persona_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	TpfPersona * self;
	self = TPF_PERSONA (object);
	switch (property_id) {
		case TPF_PERSONA_IS_IN_CONTACT_LIST:
		tpf_persona_set_is_in_contact_list (self, g_value_get_boolean (value));
		break;
		case TPF_PERSONA_AVATAR:
		folks_avatar_details_set_avatar ((FolksAvatarDetails*) self, g_value_get_object (value));
		break;
		case TPF_PERSONA_PRESENCE_TYPE:
		folks_presence_details_set_presence_type ((FolksPresenceDetails*) self, g_value_get_enum (value));
		break;
		case TPF_PERSONA_PRESENCE_MESSAGE:
		folks_presence_details_set_presence_message ((FolksPresenceDetails*) self, g_value_get_string (value));
		break;
		case TPF_PERSONA_ALIAS:
		folks_alias_details_set_alias ((FolksAliasDetails*) self, g_value_get_string (value));
		break;
		case TPF_PERSONA_IS_FAVOURITE:
		folks_favourite_details_set_is_favourite ((FolksFavouriteDetails*) self, g_value_get_boolean (value));
		break;
		case TPF_PERSONA_IM_ADDRESSES:
		folks_im_details_set_im_addresses ((FolksImDetails*) self, g_value_get_object (value));
		break;
		case TPF_PERSONA_GROUPS:
		folks_group_details_set_groups ((FolksGroupDetails*) self, g_value_get_object (value));
		break;
		case TPF_PERSONA_CONTACT:
		tpf_persona_set_contact (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



