/* kf-persona.c generated by valac 0.13.1.106-1068, the Vala compiler
 * generated from kf-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:
 *       Philip Withnall <philip.withnall@collabora.co.uk>
 */

#include <glib.h>
#include <glib-object.h>
#include <folks/folks.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>


#define FOLKS_BACKENDS_KF_TYPE_PERSONA (folks_backends_kf_persona_get_type ())
#define FOLKS_BACKENDS_KF_PERSONA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_BACKENDS_KF_TYPE_PERSONA, FolksBackendsKfPersona))
#define FOLKS_BACKENDS_KF_PERSONA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_BACKENDS_KF_TYPE_PERSONA, FolksBackendsKfPersonaClass))
#define FOLKS_BACKENDS_KF_IS_PERSONA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_BACKENDS_KF_TYPE_PERSONA))
#define FOLKS_BACKENDS_KF_IS_PERSONA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_BACKENDS_KF_TYPE_PERSONA))
#define FOLKS_BACKENDS_KF_PERSONA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_BACKENDS_KF_TYPE_PERSONA, FolksBackendsKfPersonaClass))

typedef struct _FolksBackendsKfPersona FolksBackendsKfPersona;
typedef struct _FolksBackendsKfPersonaClass FolksBackendsKfPersonaClass;
typedef struct _FolksBackendsKfPersonaPrivate FolksBackendsKfPersonaPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE (folks_backends_kf_persona_store_get_type ())
#define FOLKS_BACKENDS_KF_PERSONA_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStore))
#define FOLKS_BACKENDS_KF_PERSONA_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStoreClass))
#define FOLKS_BACKENDS_KF_IS_PERSONA_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE))
#define FOLKS_BACKENDS_KF_IS_PERSONA_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE))
#define FOLKS_BACKENDS_KF_PERSONA_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_BACKENDS_KF_TYPE_PERSONA_STORE, FolksBackendsKfPersonaStoreClass))

typedef struct _FolksBackendsKfPersonaStore FolksBackendsKfPersonaStore;
typedef struct _FolksBackendsKfPersonaStoreClass FolksBackendsKfPersonaStoreClass;

struct _FolksBackendsKfPersona {
	FolksPersona parent_instance;
	FolksBackendsKfPersonaPrivate * priv;
};

struct _FolksBackendsKfPersonaClass {
	FolksPersonaClass parent_class;
};

struct _FolksBackendsKfPersonaPrivate {
	GKeyFile* _key_file;
	GeeHashMultiMap* _im_addresses;
	GeeHashMultiMap* _web_service_addresses;
	gchar* _alias;
};


static gpointer folks_backends_kf_persona_parent_class = NULL;
static FolksAliasDetailsIface* folks_backends_kf_persona_folks_alias_details_parent_iface = NULL;
static FolksImDetailsIface* folks_backends_kf_persona_folks_im_details_parent_iface = NULL;
static FolksWebServiceDetailsIface* folks_backends_kf_persona_folks_web_service_details_parent_iface = NULL;

GType folks_backends_kf_persona_get_type (void) G_GNUC_CONST;
#define FOLKS_BACKENDS_KF_PERSONA_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FOLKS_BACKENDS_KF_TYPE_PERSONA, FolksBackendsKfPersonaPrivate))
enum  {
	FOLKS_BACKENDS_KF_PERSONA_DUMMY_PROPERTY,
	FOLKS_BACKENDS_KF_PERSONA_LINKABLE_PROPERTIES,
	FOLKS_BACKENDS_KF_PERSONA_WRITEABLE_PROPERTIES,
	FOLKS_BACKENDS_KF_PERSONA_ALIAS,
	FOLKS_BACKENDS_KF_PERSONA_IM_ADDRESSES,
	FOLKS_BACKENDS_KF_PERSONA_WEB_SERVICE_ADDRESSES
};
FolksBackendsKfPersona* folks_backends_kf_persona_new (GKeyFile* key_file, const gchar* id, FolksPersonaStore* store);
FolksBackendsKfPersona* folks_backends_kf_persona_construct (GType object_type, GKeyFile* key_file, const gchar* id, FolksPersonaStore* store);
static guint _folks_abstract_field_details_hash_ghash_func (gconstpointer key);
static void folks_backends_kf_persona_real_linkable_property_to_links (FolksPersona* base, const gchar* prop_name, FolksPersonaLinkablePropertyCallback callback, void* callback_target);
GType folks_backends_kf_persona_store_get_type (void) G_GNUC_CONST;
void folks_backends_kf_persona_store_save_key_file (FolksBackendsKfPersonaStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void folks_backends_kf_persona_store_save_key_file_finish (FolksBackendsKfPersonaStore* self, GAsyncResult* _res_);
static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value);
static void folks_backends_kf_persona_finalize (GObject* obj);
static void _vala_folks_backends_kf_persona_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_folks_backends_kf_persona_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);

static const gchar* FOLKS_BACKENDS_KF_PERSONA__linkable_properties[2] = {"im-addresses", "web-service-addresses"};
static const gchar* FOLKS_BACKENDS_KF_PERSONA__writeable_properties[3] = {"alias", "im-addresses", "web-service-addresses"};

/**
   * Create a new persona.
   *
   * Create a new persona for the {@link PersonaStore} `store`, representing
   * the Persona given by the group `uid` in the key file `key_file`.
   */
static guint _folks_abstract_field_details_hash_ghash_func (gconstpointer key) {
	guint result;
	result = folks_abstract_field_details_hash (key);
	return result;
}


FolksBackendsKfPersona* folks_backends_kf_persona_construct (GType object_type, GKeyFile* key_file, const gchar* id, FolksPersonaStore* store) {
	FolksBackendsKfPersona * self = NULL;
	FolksPersonaStore* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* iid;
	FolksPersonaStore* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_ = NULL;
	gchar* uid;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	FolksPersonaStore* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	GKeyFile* _tmp20_;
	GeeHashMultiMap* _tmp21_;
	GeeHashMultiMap* _tmp22_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (key_file != NULL, NULL);
	g_return_val_if_fail (id != NULL, NULL);
	g_return_val_if_fail (store != NULL, NULL);
	_tmp0_ = store;
	_tmp1_ = folks_persona_store_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strconcat (_tmp2_, ":", NULL);
	_tmp4_ = _tmp3_;
	_tmp5_ = id;
	_tmp6_ = g_strconcat (_tmp4_, _tmp5_, NULL);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp4_);
	iid = _tmp7_;
	_tmp8_ = store;
	_tmp9_ = folks_persona_store_get_id (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = id;
	_tmp12_ = folks_persona_build_uid ("key-file", _tmp10_, _tmp11_);
	uid = _tmp12_;
	_tmp13_ = id;
	_tmp14_ = iid;
	_tmp15_ = uid;
	_tmp16_ = store;
	self = (FolksBackendsKfPersona*) g_object_new (object_type, "display-id", _tmp13_, "iid", _tmp14_, "uid", _tmp15_, "store", _tmp16_, "is-user", FALSE, NULL);
	_tmp17_ = uid;
	_tmp18_ = iid;
	_tmp19_ = id;
	g_debug ("kf-persona.vala:236: Adding key-file Persona '%s' (IID '%s', group '%s" \
"')", _tmp17_, _tmp18_, _tmp19_);
	_tmp20_ = key_file;
	self->priv->_key_file = _tmp20_;
	_tmp21_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, FOLKS_TYPE_IM_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, _folks_abstract_field_details_hash_ghash_func, (GEqualFunc) folks_abstract_field_details_equal);
	_g_object_unref0 (self->priv->_im_addresses);
	self->priv->_im_addresses = _tmp21_;
	_tmp22_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, FOLKS_TYPE_WEB_SERVICE_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, (GHashFunc) folks_abstract_field_details_hash, (GEqualFunc) folks_abstract_field_details_equal);
	_g_object_unref0 (self->priv->_web_service_addresses);
	self->priv->_web_service_addresses = _tmp22_;
	{
		GKeyFile* _tmp23_;
		const gchar* _tmp24_;
		const gchar* _tmp25_;
		gsize _tmp26_;
		gchar** _tmp27_ = NULL;
		gchar** keys;
		gint keys_length1;
		gint _keys_size_;
		gchar** _tmp28_;
		gint _tmp28__length1;
		_tmp23_ = self->priv->_key_file;
		_tmp24_ = folks_persona_get_display_id ((FolksPersona*) self);
		_tmp25_ = _tmp24_;
		_tmp27_ = g_key_file_get_keys (_tmp23_, _tmp25_, &_tmp26_, &_inner_error_);
		keys = _tmp27_;
		keys_length1 = _tmp26_;
		_keys_size_ = keys_length1;
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_KEY_FILE_ERROR) {
				goto __catch1_g_key_file_error;
			}
			_g_free0 (uid);
			_g_free0 (iid);
			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;
		}
		_tmp28_ = keys;
		_tmp28__length1 = keys_length1;
		{
			gchar** key_collection = NULL;
			gint key_collection_length1 = 0;
			gint _key_collection_size_ = 0;
			gint key_it = 0;
			key_collection = _tmp28_;
			key_collection_length1 = _tmp28__length1;
			for (key_it = 0; key_it < _tmp28__length1; key_it = key_it + 1) {
				const gchar* key = NULL;
				key = key_collection[key_it];
				{
					const gchar* _tmp29_;
					const gchar* _tmp38_;
					gchar** _tmp39_;
					gchar** _tmp40_ = NULL;
					gchar** decomposed_key;
					gint decomposed_key_length1;
					gint _decomposed_key_size_;
					gboolean _tmp41_ = FALSE;
					gchar** _tmp42_;
					gint _tmp42__length1;
					gboolean _tmp45_;
					const gchar* _tmp61_;
					const gchar* protocol;
					GKeyFile* _tmp62_;
					const gchar* _tmp63_;
					const gchar* _tmp64_;
					const gchar* _tmp65_;
					gsize _tmp66_;
					gchar** _tmp67_ = NULL;
					gchar** im_addresses;
					gint im_addresses_length1;
					gint _im_addresses_size_;
					gchar** _tmp68_;
					gint _tmp68__length1;
					_tmp29_ = key;
					if (g_strcmp0 (_tmp29_, "__alias") == 0) {
						GKeyFile* _tmp30_;
						const gchar* _tmp31_;
						const gchar* _tmp32_;
						const gchar* _tmp33_;
						gchar* _tmp34_ = NULL;
						gchar* _tmp35_;
						const gchar* _tmp36_;
						const gchar* _tmp37_;
						_tmp30_ = self->priv->_key_file;
						_tmp31_ = folks_persona_get_display_id ((FolksPersona*) self);
						_tmp32_ = _tmp31_;
						_tmp33_ = key;
						_tmp34_ = g_key_file_get_string (_tmp30_, _tmp32_, _tmp33_, &_inner_error_);
						_tmp35_ = _tmp34_;
						if (_inner_error_ != NULL) {
							keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
							if (_inner_error_->domain == G_KEY_FILE_ERROR) {
								goto __catch1_g_key_file_error;
							}
							keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
							_g_free0 (uid);
							_g_free0 (iid);
							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;
						}
						_tmp36_ = _tmp35_;
						_g_free0 (self->priv->_alias);
						self->priv->_alias = _tmp36_;
						_tmp37_ = self->priv->_alias;
						g_debug ("kf-persona.vala:259:     Loaded alias '%s'.", _tmp37_);
						continue;
					}
					_tmp38_ = key;
					_tmp40_ = _tmp39_ = g_strsplit (_tmp38_, ".", 2);
					decomposed_key = _tmp40_;
					decomposed_key_length1 = _vala_array_length (_tmp39_);
					_decomposed_key_size_ = decomposed_key_length1;
					_tmp42_ = decomposed_key;
					_tmp42__length1 = decomposed_key_length1;
					if (_tmp42__length1 == 2) {
						gchar** _tmp43_;
						gint _tmp43__length1;
						const gchar* _tmp44_;
						_tmp43_ = decomposed_key;
						_tmp43__length1 = decomposed_key_length1;
						_tmp44_ = _tmp43_[0];
						_tmp41_ = g_strcmp0 (_tmp44_, "web-service") == 0;
					} else {
						_tmp41_ = FALSE;
					}
					_tmp45_ = _tmp41_;
					if (_tmp45_) {
						gchar** _tmp46_;
						gint _tmp46__length1;
						const gchar* _tmp47_;
						const gchar* web_service;
						GKeyFile* _tmp48_;
						const gchar* _tmp49_;
						const gchar* _tmp50_;
						const gchar* _tmp51_;
						gsize _tmp52_;
						gchar** _tmp53_ = NULL;
						gchar** web_service_addresses;
						gint web_service_addresses_length1;
						gint _web_service_addresses_size_;
						gchar** _tmp54_;
						gint _tmp54__length1;
						_tmp46_ = decomposed_key;
						_tmp46__length1 = decomposed_key_length1;
						_tmp47_ = _tmp46_[1];
						web_service = _tmp47_;
						_tmp48_ = self->priv->_key_file;
						_tmp49_ = folks_persona_get_display_id ((FolksPersona*) self);
						_tmp50_ = _tmp49_;
						_tmp51_ = web_service;
						_tmp53_ = g_key_file_get_string_list (_tmp48_, _tmp50_, _tmp51_, &_tmp52_, &_inner_error_);
						web_service_addresses = _tmp53_;
						web_service_addresses_length1 = _tmp52_;
						_web_service_addresses_size_ = web_service_addresses_length1;
						if (_inner_error_ != NULL) {
							decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
							keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
							if (_inner_error_->domain == G_KEY_FILE_ERROR) {
								goto __catch1_g_key_file_error;
							}
							decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
							keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
							_g_free0 (uid);
							_g_free0 (iid);
							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;
						}
						_tmp54_ = web_service_addresses;
						_tmp54__length1 = web_service_addresses_length1;
						{
							gchar** web_service_address_collection = NULL;
							gint web_service_address_collection_length1 = 0;
							gint _web_service_address_collection_size_ = 0;
							gint web_service_address_it = 0;
							web_service_address_collection = _tmp54_;
							web_service_address_collection_length1 = _tmp54__length1;
							for (web_service_address_it = 0; web_service_address_it < _tmp54__length1; web_service_address_it = web_service_address_it + 1) {
								gchar* _tmp55_;
								gchar* web_service_address = NULL;
								_tmp55_ = g_strdup (web_service_address_collection[web_service_address_it]);
								web_service_address = _tmp55_;
								{
									GeeHashMultiMap* _tmp56_;
									const gchar* _tmp57_;
									const gchar* _tmp58_;
									FolksWebServiceFieldDetails* _tmp59_;
									FolksWebServiceFieldDetails* _tmp60_;
									_tmp56_ = self->priv->_web_service_addresses;
									_tmp57_ = web_service;
									_tmp58_ = web_service_address;
									_tmp59_ = folks_web_service_field_details_new (_tmp58_, NULL);
									_tmp60_ = _tmp59_;
									gee_multi_map_set ((GeeMultiMap*) _tmp56_, _tmp57_, _tmp60_);
									_g_object_unref0 (_tmp60_);
									_g_free0 (web_service_address);
								}
							}
						}
						web_service_addresses = (_vala_array_free (web_service_addresses, web_service_addresses_length1, (GDestroyNotify) g_free), NULL);
						decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
						continue;
					}
					_tmp61_ = key;
					protocol = _tmp61_;
					_tmp62_ = self->priv->_key_file;
					_tmp63_ = folks_persona_get_display_id ((FolksPersona*) self);
					_tmp64_ = _tmp63_;
					_tmp65_ = protocol;
					_tmp67_ = g_key_file_get_string_list (_tmp62_, _tmp64_, _tmp65_, &_tmp66_, &_inner_error_);
					im_addresses = _tmp67_;
					im_addresses_length1 = _tmp66_;
					_im_addresses_size_ = im_addresses_length1;
					if (_inner_error_ != NULL) {
						decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
						keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
						if (_inner_error_->domain == G_KEY_FILE_ERROR) {
							goto __catch1_g_key_file_error;
						}
						decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
						keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
						_g_free0 (uid);
						_g_free0 (iid);
						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;
					}
					_tmp68_ = im_addresses;
					_tmp68__length1 = im_addresses_length1;
					{
						gchar** im_address_collection = NULL;
						gint im_address_collection_length1 = 0;
						gint _im_address_collection_size_ = 0;
						gint im_address_it = 0;
						im_address_collection = _tmp68_;
						im_address_collection_length1 = _tmp68__length1;
						for (im_address_it = 0; im_address_it < _tmp68__length1; im_address_it = im_address_it + 1) {
							gchar* _tmp69_;
							gchar* im_address = NULL;
							_tmp69_ = g_strdup (im_address_collection[im_address_it]);
							im_address = _tmp69_;
							{
								gchar* address = NULL;
								const gchar* _tmp77_;
								FolksImFieldDetails* _tmp78_;
								FolksImFieldDetails* im_fd;
								GeeHashMultiMap* _tmp79_;
								const gchar* _tmp80_;
								FolksImFieldDetails* _tmp81_;
								{
									const gchar* _tmp70_;
									const gchar* _tmp71_;
									gchar* _tmp72_ = NULL;
									gchar* _tmp73_;
									const gchar* _tmp74_;
									_tmp70_ = im_address;
									_tmp71_ = protocol;
									_tmp72_ = folks_im_details_normalise_im_address (_tmp70_, _tmp71_, &_inner_error_);
									_tmp73_ = _tmp72_;
									if (_inner_error_ != NULL) {
										if (_inner_error_->domain == FOLKS_IM_DETAILS_ERROR) {
											goto __catch2_folks_im_details_error;
										}
										_g_free0 (address);
										_g_free0 (im_address);
										im_addresses = (_vala_array_free (im_addresses, im_addresses_length1, (GDestroyNotify) g_free), NULL);
										decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
										keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
										_g_free0 (uid);
										_g_free0 (iid);
										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;
									}
									_tmp74_ = _tmp73_;
									_g_free0 (address);
									address = _tmp74_;
								}
								goto __finally2;
								__catch2_folks_im_details_error:
								{
									GError* e = NULL;
									GError* _tmp75_;
									const gchar* _tmp76_;
									e = _inner_error_;
									_inner_error_ = NULL;
									_tmp75_ = e;
									_tmp76_ = _tmp75_->message;
									g_warning ("kf-persona.vala:297: %s", _tmp76_);
									_g_error_free0 (e);
									_g_free0 (address);
									_g_free0 (im_address);
									continue;
								}
								__finally2:
								if (_inner_error_ != NULL) {
									_g_free0 (address);
									_g_free0 (im_address);
									im_addresses = (_vala_array_free (im_addresses, im_addresses_length1, (GDestroyNotify) g_free), NULL);
									decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
									keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
									if (_inner_error_->domain == G_KEY_FILE_ERROR) {
										goto __catch1_g_key_file_error;
									}
									_g_free0 (address);
									_g_free0 (im_address);
									im_addresses = (_vala_array_free (im_addresses, im_addresses_length1, (GDestroyNotify) g_free), NULL);
									decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
									keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
									_g_free0 (uid);
									_g_free0 (iid);
									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;
								}
								_tmp77_ = address;
								_tmp78_ = folks_im_field_details_new (_tmp77_, NULL);
								im_fd = _tmp78_;
								_tmp79_ = self->priv->_im_addresses;
								_tmp80_ = protocol;
								_tmp81_ = im_fd;
								gee_multi_map_set ((GeeMultiMap*) _tmp79_, _tmp80_, _tmp81_);
								_g_object_unref0 (im_fd);
								_g_free0 (address);
								_g_free0 (im_address);
							}
						}
					}
					im_addresses = (_vala_array_free (im_addresses, im_addresses_length1, (GDestroyNotify) g_free), NULL);
					decomposed_key = (_vala_array_free (decomposed_key, decomposed_key_length1, (GDestroyNotify) g_free), NULL);
				}
			}
		}
		keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
	}
	goto __finally1;
	__catch1_g_key_file_error:
	{
		GError* e = NULL;
		GError* _tmp82_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp82_ = e;
		if (!g_error_matches (_tmp82_, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
			const gchar* _tmp83_ = NULL;
			GError* _tmp84_;
			const gchar* _tmp85_;
			_tmp83_ = _ ("Couldn't load data from key file: %s");
			_tmp84_ = e;
			_tmp85_ = _tmp84_->message;
			g_warning (_tmp83_, _tmp85_);
		}
		_g_error_free0 (e);
	}
	__finally1:
	if (_inner_error_ != NULL) {
		_g_free0 (uid);
		_g_free0 (iid);
		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;
	}
	_g_free0 (uid);
	_g_free0 (iid);
	return self;
}


FolksBackendsKfPersona* folks_backends_kf_persona_new (GKeyFile* key_file, const gchar* id, FolksPersonaStore* store) {
	return folks_backends_kf_persona_construct (FOLKS_BACKENDS_KF_TYPE_PERSONA, key_file, id, store);
}


/**
   * {@inheritDoc}
   */
static void folks_backends_kf_persona_real_linkable_property_to_links (FolksPersona* base, const gchar* prop_name, FolksPersonaLinkablePropertyCallback callback, void* callback_target) {
	FolksBackendsKfPersona * self;
	const gchar* _tmp0_;
	self = (FolksBackendsKfPersona*) base;
	g_return_if_fail (prop_name != NULL);
	_tmp0_ = prop_name;
	if (g_strcmp0 (_tmp0_, "im-addresses") == 0) {
		{
			GeeHashMultiMap* _tmp1_;
			GeeSet* _tmp2_ = NULL;
			GeeSet* _tmp3_;
			GeeIterator* _tmp4_ = NULL;
			GeeIterator* _tmp5_;
			GeeIterator* _protocol_it;
			_tmp1_ = self->priv->_im_addresses;
			_tmp2_ = gee_multi_map_get_keys ((GeeMultiMap*) _tmp1_);
			_tmp3_ = _tmp2_;
			_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
			_tmp5_ = _tmp4_;
			_g_object_unref0 (_tmp3_);
			_protocol_it = _tmp5_;
			while (TRUE) {
				GeeIterator* _tmp6_;
				gboolean _tmp7_ = FALSE;
				GeeIterator* _tmp8_;
				gpointer _tmp9_ = NULL;
				gchar* protocol;
				GeeHashMultiMap* _tmp10_;
				const gchar* _tmp11_;
				GeeCollection* _tmp12_ = NULL;
				GeeCollection* im_addresses;
				_tmp6_ = _protocol_it;
				_tmp7_ = gee_iterator_next (_tmp6_);
				if (!_tmp7_) {
					break;
				}
				_tmp8_ = _protocol_it;
				_tmp9_ = gee_iterator_get (_tmp8_);
				protocol = (gchar*) _tmp9_;
				_tmp10_ = self->priv->_im_addresses;
				_tmp11_ = protocol;
				_tmp12_ = gee_multi_map_get ((GeeMultiMap*) _tmp10_, _tmp11_);
				im_addresses = _tmp12_;
				{
					GeeCollection* _tmp13_;
					GeeIterator* _tmp14_ = NULL;
					GeeIterator* _im_fd_it;
					_tmp13_ = im_addresses;
					_tmp14_ = gee_iterable_iterator ((GeeIterable*) _tmp13_);
					_im_fd_it = _tmp14_;
					while (TRUE) {
						GeeIterator* _tmp15_;
						gboolean _tmp16_ = FALSE;
						GeeIterator* _tmp17_;
						gpointer _tmp18_ = NULL;
						FolksImFieldDetails* im_fd;
						FolksPersonaLinkablePropertyCallback _tmp19_;
						void* _tmp19__target;
						const gchar* _tmp20_;
						gchar* _tmp21_;
						gchar* _tmp22_;
						FolksImFieldDetails* _tmp23_;
						gconstpointer _tmp24_;
						const gchar* _tmp25_;
						gchar* _tmp26_;
						gchar* _tmp27_;
						_tmp15_ = _im_fd_it;
						_tmp16_ = gee_iterator_next (_tmp15_);
						if (!_tmp16_) {
							break;
						}
						_tmp17_ = _im_fd_it;
						_tmp18_ = gee_iterator_get (_tmp17_);
						im_fd = (FolksImFieldDetails*) _tmp18_;
						_tmp19_ = callback;
						_tmp19__target = callback_target;
						_tmp20_ = protocol;
						_tmp21_ = g_strconcat (_tmp20_, ":", NULL);
						_tmp22_ = _tmp21_;
						_tmp23_ = im_fd;
						_tmp24_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp23_);
						_tmp25_ = _tmp24_;
						_tmp26_ = g_strconcat (_tmp22_, (const gchar*) _tmp25_, NULL);
						_tmp27_ = _tmp26_;
						_tmp19_ (_tmp27_, _tmp19__target);
						_g_free0 (_tmp27_);
						_g_free0 (_tmp22_);
						_g_object_unref0 (im_fd);
					}
					_g_object_unref0 (_im_fd_it);
				}
				_g_object_unref0 (im_addresses);
				_g_free0 (protocol);
			}
			_g_object_unref0 (_protocol_it);
		}
	} else {
		const gchar* _tmp28_;
		_tmp28_ = prop_name;
		if (g_strcmp0 (_tmp28_, "web-service-addresses") == 0) {
			{
				GeeMultiMap* _tmp29_;
				GeeMultiMap* _tmp30_;
				GeeSet* _tmp31_ = NULL;
				GeeSet* _tmp32_;
				GeeIterator* _tmp33_ = NULL;
				GeeIterator* _tmp34_;
				GeeIterator* _web_service_it;
				_tmp29_ = folks_web_service_details_get_web_service_addresses ((FolksWebServiceDetails*) self);
				_tmp30_ = _tmp29_;
				_tmp31_ = gee_multi_map_get_keys (_tmp30_);
				_tmp32_ = _tmp31_;
				_tmp33_ = gee_iterable_iterator ((GeeIterable*) _tmp32_);
				_tmp34_ = _tmp33_;
				_g_object_unref0 (_tmp32_);
				_web_service_it = _tmp34_;
				while (TRUE) {
					GeeIterator* _tmp35_;
					gboolean _tmp36_ = FALSE;
					GeeIterator* _tmp37_;
					gpointer _tmp38_ = NULL;
					gchar* web_service;
					GeeHashMultiMap* _tmp39_;
					const gchar* _tmp40_;
					GeeCollection* _tmp41_ = NULL;
					GeeCollection* web_service_addresses;
					_tmp35_ = _web_service_it;
					_tmp36_ = gee_iterator_next (_tmp35_);
					if (!_tmp36_) {
						break;
					}
					_tmp37_ = _web_service_it;
					_tmp38_ = gee_iterator_get (_tmp37_);
					web_service = (gchar*) _tmp38_;
					_tmp39_ = self->priv->_web_service_addresses;
					_tmp40_ = web_service;
					_tmp41_ = gee_multi_map_get ((GeeMultiMap*) _tmp39_, _tmp40_);
					web_service_addresses = _tmp41_;
					{
						GeeCollection* _tmp42_;
						GeeIterator* _tmp43_ = NULL;
						GeeIterator* _ws_fd_it;
						_tmp42_ = web_service_addresses;
						_tmp43_ = gee_iterable_iterator ((GeeIterable*) _tmp42_);
						_ws_fd_it = _tmp43_;
						while (TRUE) {
							GeeIterator* _tmp44_;
							gboolean _tmp45_ = FALSE;
							GeeIterator* _tmp46_;
							gpointer _tmp47_ = NULL;
							FolksWebServiceFieldDetails* ws_fd;
							FolksPersonaLinkablePropertyCallback _tmp48_;
							void* _tmp48__target;
							const gchar* _tmp49_;
							gchar* _tmp50_;
							gchar* _tmp51_;
							FolksWebServiceFieldDetails* _tmp52_;
							gconstpointer _tmp53_;
							const gchar* _tmp54_;
							gchar* _tmp55_;
							gchar* _tmp56_;
							_tmp44_ = _ws_fd_it;
							_tmp45_ = gee_iterator_next (_tmp44_);
							if (!_tmp45_) {
								break;
							}
							_tmp46_ = _ws_fd_it;
							_tmp47_ = gee_iterator_get (_tmp46_);
							ws_fd = (FolksWebServiceFieldDetails*) _tmp47_;
							_tmp48_ = callback;
							_tmp48__target = callback_target;
							_tmp49_ = web_service;
							_tmp50_ = g_strconcat (_tmp49_, ":", NULL);
							_tmp51_ = _tmp50_;
							_tmp52_ = ws_fd;
							_tmp53_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp52_);
							_tmp54_ = _tmp53_;
							_tmp55_ = g_strconcat (_tmp51_, (const gchar*) _tmp54_, NULL);
							_tmp56_ = _tmp55_;
							_tmp48_ (_tmp56_, _tmp48__target);
							_g_free0 (_tmp56_);
							_g_free0 (_tmp51_);
							_g_object_unref0 (ws_fd);
						}
						_g_object_unref0 (_ws_fd_it);
					}
					_g_object_unref0 (web_service_addresses);
					_g_free0 (web_service);
				}
				_g_object_unref0 (_web_service_it);
			}
		} else {
			const gchar* _tmp57_;
			FolksPersonaLinkablePropertyCallback _tmp58_;
			void* _tmp58__target;
			_tmp57_ = prop_name;
			_tmp58_ = callback;
			_tmp58__target = callback_target;
			FOLKS_PERSONA_CLASS (folks_backends_kf_persona_parent_class)->linkable_property_to_links (FOLKS_PERSONA (self), _tmp57_, _tmp58_, _tmp58__target);
		}
	}
}


static gchar** folks_backends_kf_persona_real_get_linkable_properties (FolksPersona* base, int* result_length1) {
	gchar** result;
	FolksBackendsKfPersona* self;
	gchar** _tmp0_;
	gint _tmp0__length1;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = FOLKS_BACKENDS_KF_PERSONA__linkable_properties;
	_tmp0__length1 = G_N_ELEMENTS (FOLKS_BACKENDS_KF_PERSONA__linkable_properties);
	if (result_length1) {
		*result_length1 = _tmp0__length1;
	}
	result = _tmp0_;
	return result;
}


static gchar** folks_backends_kf_persona_real_get_writeable_properties (FolksPersona* base, int* result_length1) {
	gchar** result;
	FolksBackendsKfPersona* self;
	gchar** _tmp0_;
	gint _tmp0__length1;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = FOLKS_BACKENDS_KF_PERSONA__writeable_properties;
	_tmp0__length1 = G_N_ELEMENTS (FOLKS_BACKENDS_KF_PERSONA__writeable_properties);
	if (result_length1) {
		*result_length1 = _tmp0__length1;
	}
	result = _tmp0_;
	return result;
}


static const gchar* folks_backends_kf_persona_real_get_alias (FolksAliasDetails* base) {
	const gchar* result;
	FolksBackendsKfPersona* self;
	const gchar* _tmp0_;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = self->priv->_alias;
	result = _tmp0_;
	return result;
}


static void folks_backends_kf_persona_real_set_alias (FolksAliasDetails* base, const gchar* value) {
	FolksBackendsKfPersona* self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	GKeyFile* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	FolksPersonaStore* _tmp11_;
	FolksPersonaStore* _tmp12_;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = self->priv->_alias;
	_tmp1_ = value;
	if (g_strcmp0 (_tmp0_, _tmp1_) == 0) {
		return;
	}
	_tmp2_ = folks_persona_get_uid ((FolksPersona*) self);
	_tmp3_ = _tmp2_;
	_tmp4_ = value;
	g_debug ("kf-persona.vala:84: Setting alias of Kf.Persona '%s' to '%s'.", _tmp3_, _tmp4_);
	_tmp5_ = value;
	_tmp6_ = g_strdup (_tmp5_);
	_g_free0 (self->priv->_alias);
	self->priv->_alias = _tmp6_;
	_tmp7_ = self->priv->_key_file;
	_tmp8_ = folks_persona_get_display_id ((FolksPersona*) self);
	_tmp9_ = _tmp8_;
	_tmp10_ = value;
	g_key_file_set_string (_tmp7_, _tmp9_, "__alias", _tmp10_);
	_tmp11_ = folks_persona_get_store ((FolksPersona*) self);
	_tmp12_ = _tmp11_;
	folks_backends_kf_persona_store_save_key_file (FOLKS_BACKENDS_KF_PERSONA_STORE (_tmp12_), NULL, NULL);
	g_object_notify ((GObject *) self, "alias");
}


static GeeMultiMap* folks_backends_kf_persona_real_get_im_addresses (FolksImDetails* base) {
	GeeMultiMap* result;
	FolksBackendsKfPersona* self;
	GeeHashMultiMap* _tmp0_;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = self->priv->_im_addresses;
	result = (GeeMultiMap*) _tmp0_;
	return result;
}


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


static void folks_backends_kf_persona_real_set_im_addresses (FolksImDetails* base, GeeMultiMap* value) {
	FolksBackendsKfPersona* self;
	GeeHashMultiMap* _tmp13_;
	GeeHashMultiMap* im_addresses;
	GeeHashMultiMap* _tmp61_;
	GeeHashMultiMap* _tmp62_;
	FolksPersonaStore* _tmp63_;
	FolksPersonaStore* _tmp64_;
	GError * _inner_error_ = NULL;
	self = (FolksBackendsKfPersona*) base;
	{
		GeeHashMultiMap* _tmp0_;
		GeeSet* _tmp1_ = NULL;
		GeeSet* _tmp2_;
		GeeIterator* _tmp3_ = NULL;
		GeeIterator* _tmp4_;
		GeeIterator* _protocol_it;
		_tmp0_ = self->priv->_im_addresses;
		_tmp1_ = gee_multi_map_get_keys ((GeeMultiMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_);
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp2_);
		_protocol_it = _tmp4_;
		while (TRUE) {
			GeeIterator* _tmp5_;
			gboolean _tmp6_ = FALSE;
			GeeIterator* _tmp7_;
			gpointer _tmp8_ = NULL;
			gchar* protocol;
			_tmp5_ = _protocol_it;
			_tmp6_ = gee_iterator_next (_tmp5_);
			if (!_tmp6_) {
				break;
			}
			_tmp7_ = _protocol_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			protocol = (gchar*) _tmp8_;
			{
				GKeyFile* _tmp9_;
				const gchar* _tmp10_;
				const gchar* _tmp11_;
				const gchar* _tmp12_;
				_tmp9_ = self->priv->_key_file;
				_tmp10_ = folks_persona_get_display_id ((FolksPersona*) self);
				_tmp11_ = _tmp10_;
				_tmp12_ = protocol;
				g_key_file_remove_key (_tmp9_, _tmp11_, _tmp12_, &_inner_error_);
				if (_inner_error_ != NULL) {
					if (_inner_error_->domain == G_KEY_FILE_ERROR) {
						goto __catch3_g_key_file_error;
					}
					_g_free0 (protocol);
					_g_object_unref0 (_protocol_it);
					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;
				}
			}
			goto __finally3;
			__catch3_g_key_file_error:
			{
				GError* e = NULL;
				e = _inner_error_;
				_inner_error_ = NULL;
				_g_error_free0 (e);
			}
			__finally3:
			if (_inner_error_ != NULL) {
				_g_free0 (protocol);
				_g_object_unref0 (_protocol_it);
				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;
			}
			_g_free0 (protocol);
		}
		_g_object_unref0 (_protocol_it);
	}
	_tmp13_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, FOLKS_TYPE_IM_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, (GHashFunc) folks_abstract_field_details_hash, (GEqualFunc) folks_abstract_field_details_equal);
	im_addresses = _tmp13_;
	{
		GeeMultiMap* _tmp14_;
		GeeSet* _tmp15_ = NULL;
		GeeSet* _tmp16_;
		GeeIterator* _tmp17_ = NULL;
		GeeIterator* _tmp18_;
		GeeIterator* _protocol_it;
		_tmp14_ = value;
		_tmp15_ = gee_multi_map_get_keys (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = gee_iterable_iterator ((GeeIterable*) _tmp16_);
		_tmp18_ = _tmp17_;
		_g_object_unref0 (_tmp16_);
		_protocol_it = _tmp18_;
		while (TRUE) {
			GeeIterator* _tmp19_;
			gboolean _tmp20_ = FALSE;
			GeeIterator* _tmp21_;
			gpointer _tmp22_ = NULL;
			gchar* protocol;
			GeeMultiMap* _tmp23_;
			const gchar* _tmp24_;
			GeeCollection* _tmp25_ = NULL;
			GeeCollection* addresses;
			GeeHashSet* _tmp26_;
			GeeHashSet* normalised_addresses;
			GeeHashSet* _tmp49_;
			gint _tmp50_ = 0;
			gpointer* _tmp51_ = NULL;
			gchar** addrs;
			gint addrs_length1;
			gint _addrs_size_;
			GeeHashSet* _tmp52_;
			gint _tmp53_;
			gint _tmp54_;
			gint _tmp55_;
			GKeyFile* _tmp56_;
			const gchar* _tmp57_;
			const gchar* _tmp58_;
			const gchar* _tmp59_;
			gchar** _tmp60_;
			gint _tmp60__length1;
			_tmp19_ = _protocol_it;
			_tmp20_ = gee_iterator_next (_tmp19_);
			if (!_tmp20_) {
				break;
			}
			_tmp21_ = _protocol_it;
			_tmp22_ = gee_iterator_get (_tmp21_);
			protocol = (gchar*) _tmp22_;
			_tmp23_ = value;
			_tmp24_ = protocol;
			_tmp25_ = gee_multi_map_get (_tmp23_, _tmp24_);
			addresses = _tmp25_;
			_tmp26_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
			normalised_addresses = _tmp26_;
			{
				GeeCollection* _tmp27_;
				GeeIterator* _tmp28_ = NULL;
				GeeIterator* _im_fd_it;
				_tmp27_ = addresses;
				_tmp28_ = gee_iterable_iterator ((GeeIterable*) _tmp27_);
				_im_fd_it = _tmp28_;
				while (TRUE) {
					GeeIterator* _tmp29_;
					gboolean _tmp30_ = FALSE;
					GeeIterator* _tmp31_;
					gpointer _tmp32_ = NULL;
					FolksImFieldDetails* im_fd;
					gchar* normalised_address = NULL;
					GeeHashSet* _tmp42_;
					const gchar* _tmp43_;
					const gchar* _tmp44_;
					FolksImFieldDetails* _tmp45_;
					FolksImFieldDetails* new_im_fd;
					GeeHashMultiMap* _tmp46_;
					const gchar* _tmp47_;
					FolksImFieldDetails* _tmp48_;
					_tmp29_ = _im_fd_it;
					_tmp30_ = gee_iterator_next (_tmp29_);
					if (!_tmp30_) {
						break;
					}
					_tmp31_ = _im_fd_it;
					_tmp32_ = gee_iterator_get (_tmp31_);
					im_fd = (FolksImFieldDetails*) _tmp32_;
					{
						FolksImFieldDetails* _tmp33_;
						gconstpointer _tmp34_;
						const gchar* _tmp35_;
						const gchar* _tmp36_;
						gchar* _tmp37_ = NULL;
						gchar* _tmp38_;
						const gchar* _tmp39_;
						_tmp33_ = im_fd;
						_tmp34_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp33_);
						_tmp35_ = _tmp34_;
						_tmp36_ = protocol;
						_tmp37_ = folks_im_details_normalise_im_address ((const gchar*) _tmp35_, _tmp36_, &_inner_error_);
						_tmp38_ = _tmp37_;
						if (_inner_error_ != NULL) {
							if (_inner_error_->domain == FOLKS_IM_DETAILS_ERROR) {
								goto __catch4_folks_im_details_error;
							}
							_g_free0 (normalised_address);
							_g_object_unref0 (im_fd);
							_g_object_unref0 (_im_fd_it);
							_g_object_unref0 (normalised_addresses);
							_g_object_unref0 (addresses);
							_g_free0 (protocol);
							_g_object_unref0 (_protocol_it);
							_g_object_unref0 (im_addresses);
							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;
						}
						_tmp39_ = _tmp38_;
						_g_free0 (normalised_address);
						normalised_address = _tmp39_;
					}
					goto __finally4;
					__catch4_folks_im_details_error:
					{
						GError* e = NULL;
						GError* _tmp40_;
						const gchar* _tmp41_;
						e = _inner_error_;
						_inner_error_ = NULL;
						_tmp40_ = e;
						_tmp41_ = _tmp40_->message;
						g_warning ("kf-persona.vala:142: %s", _tmp41_);
						_g_error_free0 (e);
						_g_free0 (normalised_address);
						_g_object_unref0 (im_fd);
						continue;
					}
					__finally4:
					if (_inner_error_ != NULL) {
						_g_free0 (normalised_address);
						_g_object_unref0 (im_fd);
						_g_object_unref0 (_im_fd_it);
						_g_object_unref0 (normalised_addresses);
						_g_object_unref0 (addresses);
						_g_free0 (protocol);
						_g_object_unref0 (_protocol_it);
						_g_object_unref0 (im_addresses);
						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;
					}
					_tmp42_ = normalised_addresses;
					_tmp43_ = normalised_address;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp42_, _tmp43_);
					_tmp44_ = normalised_address;
					_tmp45_ = folks_im_field_details_new (_tmp44_, NULL);
					new_im_fd = _tmp45_;
					_tmp46_ = im_addresses;
					_tmp47_ = protocol;
					_tmp48_ = new_im_fd;
					gee_multi_map_set ((GeeMultiMap*) _tmp46_, _tmp47_, _tmp48_);
					_g_object_unref0 (new_im_fd);
					_g_free0 (normalised_address);
					_g_object_unref0 (im_fd);
				}
				_g_object_unref0 (_im_fd_it);
			}
			_tmp49_ = normalised_addresses;
			_tmp51_ = gee_abstract_collection_to_array ((GeeAbstractCollection*) _tmp49_, &_tmp50_);
			addrs = (gchar**) _tmp51_;
			addrs_length1 = _tmp50_;
			_addrs_size_ = addrs_length1;
			_tmp52_ = normalised_addresses;
			_tmp53_ = gee_collection_get_size ((GeeCollection*) _tmp52_);
			_tmp54_ = _tmp53_;
			addrs_length1 = _tmp54_;
			_tmp55_ = addrs_length1;
			_tmp56_ = self->priv->_key_file;
			_tmp57_ = folks_persona_get_display_id ((FolksPersona*) self);
			_tmp58_ = _tmp57_;
			_tmp59_ = protocol;
			_tmp60_ = addrs;
			_tmp60__length1 = addrs_length1;
			g_key_file_set_string_list (_tmp56_, _tmp58_, _tmp59_, (const gchar* const*) _tmp60_, _tmp60__length1);
			addrs = (_vala_array_free (addrs, addrs_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (normalised_addresses);
			_g_object_unref0 (addresses);
			_g_free0 (protocol);
		}
		_g_object_unref0 (_protocol_it);
	}
	_tmp61_ = im_addresses;
	_tmp62_ = _g_object_ref0 (_tmp61_);
	_g_object_unref0 (self->priv->_im_addresses);
	self->priv->_im_addresses = _tmp62_;
	_tmp63_ = folks_persona_get_store ((FolksPersona*) self);
	_tmp64_ = _tmp63_;
	folks_backends_kf_persona_store_save_key_file (FOLKS_BACKENDS_KF_PERSONA_STORE (_tmp64_), NULL, NULL);
	_g_object_unref0 (im_addresses);
	g_object_notify ((GObject *) self, "im-addresses");
}


static GeeMultiMap* folks_backends_kf_persona_real_get_web_service_addresses (FolksWebServiceDetails* base) {
	GeeMultiMap* result;
	FolksBackendsKfPersona* self;
	GeeHashMultiMap* _tmp0_;
	self = (FolksBackendsKfPersona*) base;
	_tmp0_ = self->priv->_web_service_addresses;
	result = (GeeMultiMap*) _tmp0_;
	return result;
}


static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


static void folks_backends_kf_persona_real_set_web_service_addresses (FolksWebServiceDetails* base, GeeMultiMap* value) {
	FolksBackendsKfPersona* self;
	GeeHashMultiMap* _tmp15_;
	GeeHashMultiMap* web_service_addresses;
	GeeHashMultiMap* _tmp56_;
	GeeHashMultiMap* _tmp57_;
	FolksPersonaStore* _tmp58_;
	FolksPersonaStore* _tmp59_;
	GError * _inner_error_ = NULL;
	self = (FolksBackendsKfPersona*) base;
	{
		GeeHashMultiMap* _tmp0_;
		GeeSet* _tmp1_ = NULL;
		GeeSet* _tmp2_;
		GeeIterator* _tmp3_ = NULL;
		GeeIterator* _tmp4_;
		GeeIterator* _web_service_it;
		_tmp0_ = self->priv->_web_service_addresses;
		_tmp1_ = gee_multi_map_get_keys ((GeeMultiMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_iterable_iterator ((GeeIterable*) _tmp2_);
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp2_);
		_web_service_it = _tmp4_;
		while (TRUE) {
			GeeIterator* _tmp5_;
			gboolean _tmp6_ = FALSE;
			GeeIterator* _tmp7_;
			gpointer _tmp8_ = NULL;
			gchar* web_service;
			_tmp5_ = _web_service_it;
			_tmp6_ = gee_iterator_next (_tmp5_);
			if (!_tmp6_) {
				break;
			}
			_tmp7_ = _web_service_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			web_service = (gchar*) _tmp8_;
			{
				GKeyFile* _tmp9_;
				const gchar* _tmp10_;
				const gchar* _tmp11_;
				const gchar* _tmp12_;
				gchar* _tmp13_;
				gchar* _tmp14_;
				_tmp9_ = self->priv->_key_file;
				_tmp10_ = folks_persona_get_display_id ((FolksPersona*) self);
				_tmp11_ = _tmp10_;
				_tmp12_ = web_service;
				_tmp13_ = g_strconcat ("web-service.", _tmp12_, NULL);
				_tmp14_ = _tmp13_;
				g_key_file_remove_key (_tmp9_, _tmp11_, _tmp14_, &_inner_error_);
				_g_free0 (_tmp14_);
				if (_inner_error_ != NULL) {
					if (_inner_error_->domain == G_KEY_FILE_ERROR) {
						goto __catch5_g_key_file_error;
					}
					_g_free0 (web_service);
					_g_object_unref0 (_web_service_it);
					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;
				}
			}
			goto __finally5;
			__catch5_g_key_file_error:
			{
				GError* e = NULL;
				e = _inner_error_;
				_inner_error_ = NULL;
				_g_error_free0 (e);
			}
			__finally5:
			if (_inner_error_ != NULL) {
				_g_free0 (web_service);
				_g_object_unref0 (_web_service_it);
				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;
			}
			_g_free0 (web_service);
		}
		_g_object_unref0 (_web_service_it);
	}
	_tmp15_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, FOLKS_TYPE_WEB_SERVICE_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, (GHashFunc) folks_abstract_field_details_hash, (GEqualFunc) folks_abstract_field_details_equal);
	web_service_addresses = _tmp15_;
	{
		GeeMultiMap* _tmp16_;
		GeeSet* _tmp17_ = NULL;
		GeeSet* _tmp18_;
		GeeIterator* _tmp19_ = NULL;
		GeeIterator* _tmp20_;
		GeeIterator* _web_service_it;
		_tmp16_ = value;
		_tmp17_ = gee_multi_map_get_keys (_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = gee_iterable_iterator ((GeeIterable*) _tmp18_);
		_tmp20_ = _tmp19_;
		_g_object_unref0 (_tmp18_);
		_web_service_it = _tmp20_;
		while (TRUE) {
			GeeIterator* _tmp21_;
			gboolean _tmp22_ = FALSE;
			GeeIterator* _tmp23_;
			gpointer _tmp24_ = NULL;
			gchar* web_service;
			GeeMultiMap* _tmp25_;
			const gchar* _tmp26_;
			GeeCollection* _tmp27_ = NULL;
			GeeCollection* ws_fds;
			gchar** _tmp28_ = NULL;
			gchar** addrs;
			gint addrs_length1;
			gint _addrs_size_;
			GKeyFile* _tmp40_;
			const gchar* _tmp41_;
			const gchar* _tmp42_;
			const gchar* _tmp43_;
			gchar* _tmp44_;
			gchar* _tmp45_;
			gchar** _tmp46_;
			gint _tmp46__length1;
			_tmp21_ = _web_service_it;
			_tmp22_ = gee_iterator_next (_tmp21_);
			if (!_tmp22_) {
				break;
			}
			_tmp23_ = _web_service_it;
			_tmp24_ = gee_iterator_get (_tmp23_);
			web_service = (gchar*) _tmp24_;
			_tmp25_ = value;
			_tmp26_ = web_service;
			_tmp27_ = gee_multi_map_get (_tmp25_, _tmp26_);
			ws_fds = _tmp27_;
			_tmp28_ = g_new0 (gchar*, 0 + 1);
			addrs = _tmp28_;
			addrs_length1 = 0;
			_addrs_size_ = addrs_length1;
			{
				GeeCollection* _tmp29_;
				GeeIterator* _tmp30_ = NULL;
				GeeIterator* _ws_fd_it;
				_tmp29_ = ws_fds;
				_tmp30_ = gee_iterable_iterator ((GeeIterable*) _tmp29_);
				_ws_fd_it = _tmp30_;
				while (TRUE) {
					GeeIterator* _tmp31_;
					gboolean _tmp32_ = FALSE;
					GeeIterator* _tmp33_;
					gpointer _tmp34_ = NULL;
					FolksWebServiceFieldDetails* ws_fd;
					gchar** _tmp35_;
					gint _tmp35__length1;
					FolksWebServiceFieldDetails* _tmp36_;
					gconstpointer _tmp37_;
					const gchar* _tmp38_;
					gchar* _tmp39_;
					_tmp31_ = _ws_fd_it;
					_tmp32_ = gee_iterator_next (_tmp31_);
					if (!_tmp32_) {
						break;
					}
					_tmp33_ = _ws_fd_it;
					_tmp34_ = gee_iterator_get (_tmp33_);
					ws_fd = (FolksWebServiceFieldDetails*) _tmp34_;
					_tmp35_ = addrs;
					_tmp35__length1 = addrs_length1;
					_tmp36_ = ws_fd;
					_tmp37_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp36_);
					_tmp38_ = _tmp37_;
					_tmp39_ = g_strdup ((const gchar*) _tmp38_);
					_vala_array_add1 (&addrs, &addrs_length1, &_addrs_size_, _tmp39_);
					_g_object_unref0 (ws_fd);
				}
				_g_object_unref0 (_ws_fd_it);
			}
			_tmp40_ = self->priv->_key_file;
			_tmp41_ = folks_persona_get_display_id ((FolksPersona*) self);
			_tmp42_ = _tmp41_;
			_tmp43_ = web_service;
			_tmp44_ = g_strconcat ("web-service.", _tmp43_, NULL);
			_tmp45_ = _tmp44_;
			_tmp46_ = addrs;
			_tmp46__length1 = addrs_length1;
			g_key_file_set_string_list (_tmp40_, _tmp42_, _tmp45_, (const gchar* const*) _tmp46_, _tmp46__length1);
			_g_free0 (_tmp45_);
			{
				GeeCollection* _tmp47_;
				GeeIterator* _tmp48_ = NULL;
				GeeIterator* _ws_fd_it;
				_tmp47_ = ws_fds;
				_tmp48_ = gee_iterable_iterator ((GeeIterable*) _tmp47_);
				_ws_fd_it = _tmp48_;
				while (TRUE) {
					GeeIterator* _tmp49_;
					gboolean _tmp50_ = FALSE;
					GeeIterator* _tmp51_;
					gpointer _tmp52_ = NULL;
					FolksWebServiceFieldDetails* ws_fd;
					GeeHashMultiMap* _tmp53_;
					const gchar* _tmp54_;
					FolksWebServiceFieldDetails* _tmp55_;
					_tmp49_ = _ws_fd_it;
					_tmp50_ = gee_iterator_next (_tmp49_);
					if (!_tmp50_) {
						break;
					}
					_tmp51_ = _ws_fd_it;
					_tmp52_ = gee_iterator_get (_tmp51_);
					ws_fd = (FolksWebServiceFieldDetails*) _tmp52_;
					_tmp53_ = web_service_addresses;
					_tmp54_ = web_service;
					_tmp55_ = ws_fd;
					gee_multi_map_set ((GeeMultiMap*) _tmp53_, _tmp54_, _tmp55_);
					_g_object_unref0 (ws_fd);
				}
				_g_object_unref0 (_ws_fd_it);
			}
			addrs = (_vala_array_free (addrs, addrs_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (ws_fds);
			_g_free0 (web_service);
		}
		_g_object_unref0 (_web_service_it);
	}
	_tmp56_ = web_service_addresses;
	_tmp57_ = _g_object_ref0 (_tmp56_);
	_g_object_unref0 (self->priv->_web_service_addresses);
	self->priv->_web_service_addresses = _tmp57_;
	_tmp58_ = folks_persona_get_store ((FolksPersona*) self);
	_tmp59_ = _tmp58_;
	folks_backends_kf_persona_store_save_key_file (FOLKS_BACKENDS_KF_PERSONA_STORE (_tmp59_), NULL, NULL);
	_g_object_unref0 (web_service_addresses);
	g_object_notify ((GObject *) self, "web-service-addresses");
}


static void folks_backends_kf_persona_class_init (FolksBackendsKfPersonaClass * klass) {
	folks_backends_kf_persona_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (FolksBackendsKfPersonaPrivate));
	FOLKS_PERSONA_CLASS (klass)->linkable_property_to_links = folks_backends_kf_persona_real_linkable_property_to_links;
	FOLKS_PERSONA_CLASS (klass)->get_linkable_properties = folks_backends_kf_persona_real_get_linkable_properties;
	FOLKS_PERSONA_CLASS (klass)->get_writeable_properties = folks_backends_kf_persona_real_get_writeable_properties;
	G_OBJECT_CLASS (klass)->get_property = _vala_folks_backends_kf_persona_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_folks_backends_kf_persona_set_property;
	G_OBJECT_CLASS (klass)->finalize = folks_backends_kf_persona_finalize;
	/**
	   * {@inheritDoc}
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_LINKABLE_PROPERTIES, "linkable-properties");
	/**
	   * {@inheritDoc}
	   *
	   * @since 0.6.0
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_WRITEABLE_PROPERTIES, "writeable-properties");
	/**
	   * {@inheritDoc}
	   *
	   * @since 0.1.15
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_ALIAS, "alias");
	/**
	   * {@inheritDoc}
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_IM_ADDRESSES, "im-addresses");
	/**
	   * {@inheritDoc}
	   */
	g_object_class_override_property (G_OBJECT_CLASS (klass), FOLKS_BACKENDS_KF_PERSONA_WEB_SERVICE_ADDRESSES, "web-service-addresses");
}


static void folks_backends_kf_persona_folks_alias_details_interface_init (FolksAliasDetailsIface * iface) {
	folks_backends_kf_persona_folks_alias_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_alias = folks_backends_kf_persona_real_get_alias;
	iface->set_alias = folks_backends_kf_persona_real_set_alias;
}


static void folks_backends_kf_persona_folks_im_details_interface_init (FolksImDetailsIface * iface) {
	folks_backends_kf_persona_folks_im_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_im_addresses = folks_backends_kf_persona_real_get_im_addresses;
	iface->set_im_addresses = folks_backends_kf_persona_real_set_im_addresses;
}


static void folks_backends_kf_persona_folks_web_service_details_interface_init (FolksWebServiceDetailsIface * iface) {
	folks_backends_kf_persona_folks_web_service_details_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_web_service_addresses = folks_backends_kf_persona_real_get_web_service_addresses;
	iface->set_web_service_addresses = folks_backends_kf_persona_real_set_web_service_addresses;
}


static void folks_backends_kf_persona_instance_init (FolksBackendsKfPersona * self) {
	self->priv = FOLKS_BACKENDS_KF_PERSONA_GET_PRIVATE (self);
}


static void folks_backends_kf_persona_finalize (GObject* obj) {
	FolksBackendsKfPersona * self;
	self = FOLKS_BACKENDS_KF_PERSONA (obj);
	_g_object_unref0 (self->priv->_im_addresses);
	_g_object_unref0 (self->priv->_web_service_addresses);
	_g_free0 (self->priv->_alias);
	G_OBJECT_CLASS (folks_backends_kf_persona_parent_class)->finalize (obj);
}


/**
 * A persona subclass which represents a single persona from a simple key file.
 *
 * @since 0.1.13
 */
GType folks_backends_kf_persona_get_type (void) {
	static volatile gsize folks_backends_kf_persona_type_id__volatile = 0;
	if (g_once_init_enter (&folks_backends_kf_persona_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FolksBackendsKfPersonaClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folks_backends_kf_persona_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolksBackendsKfPersona), 0, (GInstanceInitFunc) folks_backends_kf_persona_instance_init, NULL };
		static const GInterfaceInfo folks_alias_details_info = { (GInterfaceInitFunc) folks_backends_kf_persona_folks_alias_details_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		static const GInterfaceInfo folks_im_details_info = { (GInterfaceInitFunc) folks_backends_kf_persona_folks_im_details_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		static const GInterfaceInfo folks_web_service_details_info = { (GInterfaceInitFunc) folks_backends_kf_persona_folks_web_service_details_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType folks_backends_kf_persona_type_id;
		folks_backends_kf_persona_type_id = g_type_register_static (FOLKS_TYPE_PERSONA, "FolksBackendsKfPersona", &g_define_type_info, 0);
		g_type_add_interface_static (folks_backends_kf_persona_type_id, FOLKS_TYPE_ALIAS_DETAILS, &folks_alias_details_info);
		g_type_add_interface_static (folks_backends_kf_persona_type_id, FOLKS_TYPE_IM_DETAILS, &folks_im_details_info);
		g_type_add_interface_static (folks_backends_kf_persona_type_id, FOLKS_TYPE_WEB_SERVICE_DETAILS, &folks_web_service_details_info);
		g_once_init_leave (&folks_backends_kf_persona_type_id__volatile, folks_backends_kf_persona_type_id);
	}
	return folks_backends_kf_persona_type_id__volatile;
}


static void _vala_folks_backends_kf_persona_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	FolksBackendsKfPersona * self;
	self = FOLKS_BACKENDS_KF_PERSONA (object);
	switch (property_id) {
		case FOLKS_BACKENDS_KF_PERSONA_LINKABLE_PROPERTIES:
		{
			int length;
			g_value_set_boxed (value, folks_persona_get_linkable_properties ((FolksPersona*) self, &length));
		}
		break;
		case FOLKS_BACKENDS_KF_PERSONA_WRITEABLE_PROPERTIES:
		{
			int length;
			g_value_set_boxed (value, folks_persona_get_writeable_properties ((FolksPersona*) self, &length));
		}
		break;
		case FOLKS_BACKENDS_KF_PERSONA_ALIAS:
		g_value_set_string (value, folks_alias_details_get_alias ((FolksAliasDetails*) self));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_IM_ADDRESSES:
		g_value_set_object (value, folks_im_details_get_im_addresses ((FolksImDetails*) self));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_WEB_SERVICE_ADDRESSES:
		g_value_set_object (value, folks_web_service_details_get_web_service_addresses ((FolksWebServiceDetails*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_folks_backends_kf_persona_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	FolksBackendsKfPersona * self;
	self = FOLKS_BACKENDS_KF_PERSONA (object);
	switch (property_id) {
		case FOLKS_BACKENDS_KF_PERSONA_ALIAS:
		folks_alias_details_set_alias ((FolksAliasDetails*) self, g_value_get_string (value));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_IM_ADDRESSES:
		folks_im_details_set_im_addresses ((FolksImDetails*) self, g_value_get_object (value));
		break;
		case FOLKS_BACKENDS_KF_PERSONA_WEB_SERVICE_ADDRESSES:
		folks_web_service_details_set_web_service_addresses ((FolksWebServiceDetails*) self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


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


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


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



