/* contacts-linking.c generated by valac 0.25.3.8-962c2, the Vala compiler
 * generated from contacts-linking.vala, do not modify */

/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 8 -*- */
/*
 * Copyright (C) 2011 Alexander Larsson <alexl@redhat.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#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 <gtk/gtk.h>
#include <gobject/gvaluecollector.h>


#define CONTACTS_TYPE_LINK_OPERATION (contacts_link_operation_get_type ())
#define CONTACTS_LINK_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_LINK_OPERATION, ContactsLinkOperation))
#define CONTACTS_LINK_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_LINK_OPERATION, ContactsLinkOperationClass))
#define CONTACTS_IS_LINK_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_LINK_OPERATION))
#define CONTACTS_IS_LINK_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_LINK_OPERATION))
#define CONTACTS_LINK_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_LINK_OPERATION, ContactsLinkOperationClass))

typedef struct _ContactsLinkOperation ContactsLinkOperation;
typedef struct _ContactsLinkOperationClass ContactsLinkOperationClass;
typedef struct _ContactsLinkOperationPrivate ContactsLinkOperationPrivate;

#define CONTACTS_TYPE_CONTACT (contacts_contact_get_type ())
#define CONTACTS_CONTACT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_CONTACT, ContactsContact))
#define CONTACTS_CONTACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_CONTACT, ContactsContactClass))
#define CONTACTS_IS_CONTACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_CONTACT))
#define CONTACTS_IS_CONTACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_CONTACT))
#define CONTACTS_CONTACT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_CONTACT, ContactsContactClass))

typedef struct _ContactsContact ContactsContact;
typedef struct _ContactsContactClass ContactsContactClass;

#define CONTACTS_LINK_OPERATION_TYPE_CHANGE (contacts_link_operation_change_get_type ())
#define CONTACTS_LINK_OPERATION_CHANGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_LINK_OPERATION_TYPE_CHANGE, ContactsLinkOperationChange))
#define CONTACTS_LINK_OPERATION_CHANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_LINK_OPERATION_TYPE_CHANGE, ContactsLinkOperationChangeClass))
#define CONTACTS_LINK_OPERATION_IS_CHANGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_LINK_OPERATION_TYPE_CHANGE))
#define CONTACTS_LINK_OPERATION_IS_CHANGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_LINK_OPERATION_TYPE_CHANGE))
#define CONTACTS_LINK_OPERATION_CHANGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_LINK_OPERATION_TYPE_CHANGE, ContactsLinkOperationChangeClass))

typedef struct _ContactsLinkOperationChange ContactsLinkOperationChange;
typedef struct _ContactsLinkOperationChangeClass ContactsLinkOperationChangeClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ContactsContactPrivate ContactsContactPrivate;

#define CONTACTS_TYPE_STORE (contacts_store_get_type ())
#define CONTACTS_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_STORE, ContactsStore))
#define CONTACTS_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_STORE, ContactsStoreClass))
#define CONTACTS_IS_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_STORE))
#define CONTACTS_IS_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_STORE))
#define CONTACTS_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_STORE, ContactsStoreClass))

typedef struct _ContactsStore ContactsStore;
typedef struct _ContactsStoreClass ContactsStoreClass;

#define CONTACTS_TYPE_PERSONA_ATTRIBUTE (contacts_persona_attribute_get_type ())
#define CONTACTS_PERSONA_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_PERSONA_ATTRIBUTE, ContactsPersonaAttribute))
#define CONTACTS_PERSONA_ATTRIBUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_PERSONA_ATTRIBUTE, ContactsPersonaAttributeClass))
#define CONTACTS_IS_PERSONA_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_PERSONA_ATTRIBUTE))
#define CONTACTS_IS_PERSONA_ATTRIBUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_PERSONA_ATTRIBUTE))
#define CONTACTS_PERSONA_ATTRIBUTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_PERSONA_ATTRIBUTE, ContactsPersonaAttributeClass))

typedef struct _ContactsPersonaAttribute ContactsPersonaAttribute;
typedef struct _ContactsPersonaAttributeClass ContactsPersonaAttributeClass;
typedef struct _ContactsLinkOperationChangePrivate ContactsLinkOperationChangePrivate;
#define _contacts_link_operation_change_unref0(var) ((var == NULL) ? NULL : (var = (contacts_link_operation_change_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ContactsLinkOperationUndoData ContactsLinkOperationUndoData;
typedef struct _ContactsLinkOperationParamSpecChange ContactsLinkOperationParamSpecChange;
typedef struct _ContactsPersonaAttributePrivate ContactsPersonaAttributePrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

#define CONTACTS_TYPE_PERSONA_ATTRIBUTE_LOCAL_ID (contacts_persona_attribute_local_id_get_type ())
#define CONTACTS_PERSONA_ATTRIBUTE_LOCAL_ID(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_PERSONA_ATTRIBUTE_LOCAL_ID, ContactsPersonaAttributeLocalId))
#define CONTACTS_PERSONA_ATTRIBUTE_LOCAL_ID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_PERSONA_ATTRIBUTE_LOCAL_ID, ContactsPersonaAttributeLocalIdClass))
#define CONTACTS_IS_PERSONA_ATTRIBUTE_LOCAL_ID(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_PERSONA_ATTRIBUTE_LOCAL_ID))
#define CONTACTS_IS_PERSONA_ATTRIBUTE_LOCAL_ID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_PERSONA_ATTRIBUTE_LOCAL_ID))
#define CONTACTS_PERSONA_ATTRIBUTE_LOCAL_ID_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_PERSONA_ATTRIBUTE_LOCAL_ID, ContactsPersonaAttributeLocalIdClass))

typedef struct _ContactsPersonaAttributeLocalId ContactsPersonaAttributeLocalId;
typedef struct _ContactsPersonaAttributeLocalIdClass ContactsPersonaAttributeLocalIdClass;
typedef struct _ContactsPersonaAttributeLocalIdPrivate ContactsPersonaAttributeLocalIdPrivate;
typedef struct _ContactsPersonaAttributeLocalIdPersonaApplyAttributesData ContactsPersonaAttributeLocalIdPersonaApplyAttributesData;
typedef struct _ContactsPersonaAttributeLocalIdSetValueData ContactsPersonaAttributeLocalIdSetValueData;

#define CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS (contacts_persona_attribute_im_address_get_type ())
#define CONTACTS_PERSONA_ATTRIBUTE_IM_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS, ContactsPersonaAttributeImAddress))
#define CONTACTS_PERSONA_ATTRIBUTE_IM_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS, ContactsPersonaAttributeImAddressClass))
#define CONTACTS_IS_PERSONA_ATTRIBUTE_IM_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS))
#define CONTACTS_IS_PERSONA_ATTRIBUTE_IM_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS))
#define CONTACTS_PERSONA_ATTRIBUTE_IM_ADDRESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS, ContactsPersonaAttributeImAddressClass))

typedef struct _ContactsPersonaAttributeImAddress ContactsPersonaAttributeImAddress;
typedef struct _ContactsPersonaAttributeImAddressClass ContactsPersonaAttributeImAddressClass;
typedef struct _ContactsPersonaAttributeImAddressPrivate ContactsPersonaAttributeImAddressPrivate;
typedef struct _ContactsPersonaAttributeImAddressPersonaApplyAttributesData ContactsPersonaAttributeImAddressPersonaApplyAttributesData;
typedef struct _ContactsPersonaAttributeImAddressSetValueData ContactsPersonaAttributeImAddressSetValueData;

#define CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE (contacts_persona_attribute_web_service_get_type ())
#define CONTACTS_PERSONA_ATTRIBUTE_WEB_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE, ContactsPersonaAttributeWebService))
#define CONTACTS_PERSONA_ATTRIBUTE_WEB_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE, ContactsPersonaAttributeWebServiceClass))
#define CONTACTS_IS_PERSONA_ATTRIBUTE_WEB_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE))
#define CONTACTS_IS_PERSONA_ATTRIBUTE_WEB_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE))
#define CONTACTS_PERSONA_ATTRIBUTE_WEB_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE, ContactsPersonaAttributeWebServiceClass))

typedef struct _ContactsPersonaAttributeWebService ContactsPersonaAttributeWebService;
typedef struct _ContactsPersonaAttributeWebServiceClass ContactsPersonaAttributeWebServiceClass;
typedef struct _ContactsPersonaAttributeWebServicePrivate ContactsPersonaAttributeWebServicePrivate;
typedef struct _ContactsPersonaAttributeWebServicePersonaApplyAttributesData ContactsPersonaAttributeWebServicePersonaApplyAttributesData;
typedef struct _ContactsPersonaAttributeWebServiceSetValueData ContactsPersonaAttributeWebServiceSetValueData;
typedef struct _ContactsPersonaApplyAttributesData ContactsPersonaApplyAttributesData;

#define CONTACTS_TYPE_APP (contacts_app_get_type ())
#define CONTACTS_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_APP, ContactsApp))
#define CONTACTS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_APP, ContactsAppClass))
#define CONTACTS_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_APP))
#define CONTACTS_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_APP))
#define CONTACTS_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_APP, ContactsAppClass))

typedef struct _ContactsApp ContactsApp;
typedef struct _ContactsAppClass ContactsAppClass;
typedef struct _ContactsAppPrivate ContactsAppPrivate;

#define CONTACTS_TYPE_WINDOW (contacts_window_get_type ())
#define CONTACTS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_WINDOW, ContactsWindow))
#define CONTACTS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_WINDOW, ContactsWindowClass))
#define CONTACTS_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_WINDOW))
#define CONTACTS_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_WINDOW))
#define CONTACTS_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_WINDOW, ContactsWindowClass))

typedef struct _ContactsWindow ContactsWindow;
typedef struct _ContactsWindowClass ContactsWindowClass;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _ContactsLinkContactsData ContactsLinkContactsData;
typedef struct _ContactsUnlinkPersonaData ContactsUnlinkPersonaData;

#define CONTACTS_TYPE_LINK_OPERATION2 (contacts_link_operation2_get_type ())
#define CONTACTS_LINK_OPERATION2(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_LINK_OPERATION2, ContactsLinkOperation2))
#define CONTACTS_LINK_OPERATION2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_LINK_OPERATION2, ContactsLinkOperation2Class))
#define CONTACTS_IS_LINK_OPERATION2(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_LINK_OPERATION2))
#define CONTACTS_IS_LINK_OPERATION2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_LINK_OPERATION2))
#define CONTACTS_LINK_OPERATION2_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_LINK_OPERATION2, ContactsLinkOperation2Class))

typedef struct _ContactsLinkOperation2 ContactsLinkOperation2;
typedef struct _ContactsLinkOperation2Class ContactsLinkOperation2Class;
typedef struct _ContactsLinkOperation2Private ContactsLinkOperation2Private;
typedef struct _ContactsLinkOperation2UndoData ContactsLinkOperation2UndoData;
typedef struct _ContactsLinkContactsListData ContactsLinkContactsListData;

struct _ContactsLinkOperation {
	GObject parent_instance;
	ContactsLinkOperationPrivate * priv;
};

struct _ContactsLinkOperationClass {
	GObjectClass parent_class;
};

struct _ContactsLinkOperationPrivate {
	FolksPersona* _added_persona;
	ContactsContact* main_contact;
	GeeArrayList* split_out_personas;
	GeeArrayList* changes;
};

struct _ContactsContact {
	GObject parent_instance;
	ContactsContactPrivate * priv;
	ContactsStore* store;
	gboolean is_main;
	FolksPresenceType presence_type;
	gchar* presence_message;
	gboolean is_phone;
	FolksIndividual* individual;
	FolksPersona* fake_persona;
};

struct _ContactsContactClass {
	GObjectClass parent_class;
};

struct _ContactsLinkOperationChange {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ContactsLinkOperationChangePrivate * priv;
	ContactsPersonaAttribute* attribute;
	FolksPersona* persona;
	GObject* old_value;
};

struct _ContactsLinkOperationChangeClass {
	GTypeClass parent_class;
	void (*finalize) (ContactsLinkOperationChange *self);
};

struct _ContactsLinkOperationUndoData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ContactsLinkOperation* self;
	ContactsContact* _tmp0_;
	ContactsContact* _tmp1_;
	GeeArrayList* _tmp2_;
	GeeArrayList* _p_list;
	GeeArrayList* _tmp3_;
	GeeArrayList* _tmp4_;
	gint _p_size;
	GeeArrayList* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gint _p_index;
	gint _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	FolksPersona* p;
	GeeArrayList* _tmp11_;
	gint _tmp12_;
	gpointer _tmp13_;
	FolksPersona* _tmp14_;
	FolksPersona* _tmp15_;
	FolksPersona* _tmp16_;
	FolksPersonaStore* _tmp17_;
	FolksPersonaStore* _tmp18_;
	FolksPersona* _tmp19_;
	GeeArrayList* _c_list;
	GeeArrayList* _tmp20_;
	GeeArrayList* _tmp21_;
	gint _c_size;
	GeeArrayList* _tmp22_;
	gint _tmp23_;
	gint _tmp24_;
	gint _c_index;
	gint _tmp25_;
	gint _tmp26_;
	gint _tmp27_;
	ContactsLinkOperationChange* c;
	GeeArrayList* _tmp28_;
	gint _tmp29_;
	gpointer _tmp30_;
	ContactsLinkOperationChange* _tmp31_;
	FolksPersona* _tmp32_;
	FolksPersona* _tmp33_;
	ContactsLinkOperationChange* _tmp34_;
	ContactsPersonaAttribute* _tmp35_;
	ContactsLinkOperationChange* _tmp36_;
	FolksPersona* _tmp37_;
	ContactsLinkOperationChange* _tmp38_;
	GObject* _tmp39_;
	GError* e;
	GError* _tmp40_;
	const gchar* _tmp41_;
	ContactsContact* _tmp42_;
	ContactsContact* _tmp43_;
	GeeArrayList* _tmp44_;
	GeeArrayList* _vala1__p_list;
	GeeArrayList* _tmp45_;
	GeeArrayList* _tmp46_;
	gint _vala1__p_size;
	GeeArrayList* _tmp47_;
	gint _tmp48_;
	gint _tmp49_;
	gint _vala1__p_index;
	gint _tmp50_;
	gint _tmp51_;
	gint _tmp52_;
	FolksPersona* _vala1_p;
	GeeArrayList* _tmp53_;
	gint _tmp54_;
	gpointer _tmp55_;
	FolksPersona* _tmp56_;
	GError * _inner_error_;
};

struct _ContactsLinkOperationParamSpecChange {
	GParamSpec parent_instance;
};

struct _ContactsPersonaAttribute {
	GObject parent_instance;
	ContactsPersonaAttributePrivate * priv;
	gchar* property_name;
};

struct _ContactsPersonaAttributeClass {
	GObjectClass parent_class;
	gboolean (*is_removable) (ContactsPersonaAttribute* self, FolksPersona* from_persona);
	gboolean (*is_referenced_by_persona) (ContactsPersonaAttribute* self, FolksPersona* persona);
	gboolean (*equal) (ContactsPersonaAttribute* self, ContactsPersonaAttribute* that);
	guint (*hash) (ContactsPersonaAttribute* self);
	void (*persona_apply_attributes) (ContactsPersonaAttribute* self, FolksPersona* persona, GeeSet* added_attributes, GeeSet* removed_attributes, ContactsLinkOperation* operation, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*persona_apply_attributes_finish) (ContactsPersonaAttribute* self, GAsyncResult* _res_);
	void (*set_value) (ContactsPersonaAttribute* self, FolksPersona* persona, GObject* value, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*set_value_finish) (ContactsPersonaAttribute* self, GAsyncResult* _res_);
};

struct _ContactsPersonaAttributeLocalId {
	ContactsPersonaAttribute parent_instance;
	ContactsPersonaAttributeLocalIdPrivate * priv;
};

struct _ContactsPersonaAttributeLocalIdClass {
	ContactsPersonaAttributeClass parent_class;
};

struct _ContactsPersonaAttributeLocalIdPrivate {
	gchar* value;
};

struct _ContactsPersonaAttributeLocalIdPersonaApplyAttributesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ContactsPersonaAttributeLocalId* self;
	FolksPersona* persona;
	GeeSet* added_attributes;
	GeeSet* removed_attributes;
	ContactsLinkOperation* operation;
	FolksLocalIdDetails* details;
	FolksPersona* _tmp0_;
	FolksLocalIdDetails* _tmp1_;
	FolksLocalIdDetails* _tmp2_;
	GeeHashSet* added_values;
	GeeHashSet* _tmp3_;
	GeeIterator* _added_it;
	GeeSet* _tmp4_;
	GeeIterator* _tmp5_;
	GeeIterator* _tmp6_;
	gboolean _tmp7_;
	ContactsPersonaAttribute* added;
	GeeIterator* _tmp8_;
	gpointer _tmp9_;
	GeeHashSet* _tmp10_;
	ContactsPersonaAttribute* _tmp11_;
	const gchar* _tmp12_;
	GeeHashSet* removed_values;
	GeeHashSet* _tmp13_;
	GeeIterator* _removed_it;
	GeeSet* _tmp14_;
	GeeIterator* _tmp15_;
	GeeIterator* _tmp16_;
	gboolean _tmp17_;
	ContactsPersonaAttribute* removed;
	GeeIterator* _tmp18_;
	gpointer _tmp19_;
	GeeHashSet* _tmp20_;
	ContactsPersonaAttribute* _tmp21_;
	const gchar* _tmp22_;
	GeeHashSet* new_values;
	GeeHashSet* _tmp23_;
	gboolean changed;
	GeeIterator* _v_it;
	FolksLocalIdDetails* _tmp24_;
	GeeSet* _tmp25_;
	GeeSet* _tmp26_;
	GeeIterator* _tmp27_;
	GeeIterator* _tmp28_;
	gboolean _tmp29_;
	gchar* v;
	GeeIterator* _tmp30_;
	gpointer _tmp31_;
	GeeHashSet* _tmp32_;
	const gchar* _tmp33_;
	gboolean _tmp34_;
	GeeHashSet* _tmp35_;
	const gchar* _tmp36_;
	GeeHashSet* _tmp37_;
	const gchar* _tmp38_;
	gboolean _tmp39_;
	GeeHashSet* _tmp40_;
	const gchar* _tmp41_;
	GeeIterator* _v2_it;
	GeeHashSet* _tmp42_;
	GeeIterator* _tmp43_;
	GeeIterator* _tmp44_;
	gboolean _tmp45_;
	gchar* v2;
	GeeIterator* _tmp46_;
	gpointer _tmp47_;
	GeeHashSet* _tmp48_;
	const gchar* _tmp49_;
	gboolean _tmp50_;
	GeeHashSet* old_value;
	GeeHashSet* _tmp51_;
	GeeHashSet* _tmp52_;
	FolksLocalIdDetails* _tmp53_;
	GeeSet* _tmp54_;
	GeeSet* _tmp55_;
	FolksLocalIdDetails* _tmp56_;
	GeeHashSet* _tmp57_;
	ContactsLinkOperation* _tmp58_;
	FolksPersona* _tmp59_;
	GeeHashSet* _tmp60_;
	GError* e;
	GError* _tmp61_;
	const gchar* _tmp62_;
	GError * _inner_error_;
};

struct _ContactsPersonaAttributeLocalIdSetValueData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ContactsPersonaAttributeLocalId* self;
	FolksPersona* persona;
	GObject* value;
	FolksLocalIdDetails* details;
	FolksPersona* _tmp0_;
	FolksLocalIdDetails* _tmp1_;
	FolksLocalIdDetails* _tmp2_;
	GeeHashSet* v;
	GObject* _tmp3_;
	GeeHashSet* _tmp4_;
	FolksLocalIdDetails* _tmp5_;
	GeeHashSet* _tmp6_;
	GError* e;
	GError* _tmp7_;
	const gchar* _tmp8_;
	GError * _inner_error_;
};

struct _ContactsPersonaAttributeImAddress {
	ContactsPersonaAttribute parent_instance;
	ContactsPersonaAttributeImAddressPrivate * priv;
};

struct _ContactsPersonaAttributeImAddressClass {
	ContactsPersonaAttributeClass parent_class;
};

struct _ContactsPersonaAttributeImAddressPrivate {
	gchar* protocol;
	FolksImFieldDetails* detail;
};

struct _ContactsPersonaAttributeImAddressPersonaApplyAttributesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ContactsPersonaAttributeImAddress* self;
	FolksPersona* persona;
	GeeSet* added_attributes;
	GeeSet* removed_attributes;
	ContactsLinkOperation* operation;
	FolksImDetails* details;
	FolksPersona* _tmp0_;
	FolksImDetails* _tmp1_;
	FolksImDetails* _tmp2_;
	GeeHashMultiMap* added_values;
	GeeHashMultiMap* _tmp3_;
	GeeIterator* _added_it;
	GeeSet* _tmp4_;
	GeeIterator* _tmp5_;
	GeeIterator* _tmp6_;
	gboolean _tmp7_;
	ContactsPersonaAttribute* added;
	GeeIterator* _tmp8_;
	gpointer _tmp9_;
	GeeHashMultiMap* _tmp10_;
	ContactsPersonaAttribute* _tmp11_;
	const gchar* _tmp12_;
	ContactsPersonaAttribute* _tmp13_;
	FolksImFieldDetails* _tmp14_;
	GeeHashMultiMap* removed_values;
	GeeHashMultiMap* _tmp15_;
	GeeIterator* _removed_it;
	GeeSet* _tmp16_;
	GeeIterator* _tmp17_;
	GeeIterator* _tmp18_;
	gboolean _tmp19_;
	ContactsPersonaAttribute* removed;
	GeeIterator* _tmp20_;
	gpointer _tmp21_;
	GeeHashMultiMap* _tmp22_;
	ContactsPersonaAttribute* _tmp23_;
	const gchar* _tmp24_;
	ContactsPersonaAttribute* _tmp25_;
	FolksImFieldDetails* _tmp26_;
	GeeHashMultiMap* new_values;
	GeeHashMultiMap* _tmp27_;
	gboolean changed;
	GeeIterator* _proto1_it;
	FolksImDetails* _tmp28_;
	GeeMultiMap* _tmp29_;
	GeeMultiMap* _tmp30_;
	GeeSet* _tmp31_;
	GeeSet* _tmp32_;
	GeeIterator* _tmp33_;
	GeeIterator* _tmp34_;
	GeeIterator* _tmp35_;
	gboolean _tmp36_;
	gchar* proto1;
	GeeIterator* _tmp37_;
	gpointer _tmp38_;
	GeeIterator* _detail1_it;
	FolksImDetails* _tmp39_;
	GeeMultiMap* _tmp40_;
	GeeMultiMap* _tmp41_;
	const gchar* _tmp42_;
	GeeCollection* _tmp43_;
	GeeCollection* _tmp44_;
	GeeIterator* _tmp45_;
	GeeIterator* _tmp46_;
	GeeIterator* _tmp47_;
	gboolean _tmp48_;
	FolksImFieldDetails* detail1;
	GeeIterator* _tmp49_;
	gpointer _tmp50_;
	GeeHashMultiMap* _tmp51_;
	const gchar* _tmp52_;
	GeeCollection* _tmp53_;
	GeeCollection* _tmp54_;
	FolksImFieldDetails* _tmp55_;
	gboolean _tmp56_;
	gboolean _tmp57_;
	GeeHashMultiMap* _tmp58_;
	const gchar* _tmp59_;
	FolksImFieldDetails* _tmp60_;
	GeeHashMultiMap* _tmp61_;
	const gchar* _tmp62_;
	GeeCollection* _tmp63_;
	GeeCollection* _tmp64_;
	FolksImFieldDetails* _tmp65_;
	gboolean _tmp66_;
	gboolean _tmp67_;
	GeeHashMultiMap* _tmp68_;
	const gchar* _tmp69_;
	FolksImFieldDetails* _tmp70_;
	GeeIterator* _proto2_it;
	GeeHashMultiMap* _tmp71_;
	GeeSet* _tmp72_;
	GeeSet* _tmp73_;
	GeeIterator* _tmp74_;
	GeeIterator* _tmp75_;
	GeeIterator* _tmp76_;
	gboolean _tmp77_;
	gchar* proto2;
	GeeIterator* _tmp78_;
	gpointer _tmp79_;
	GeeIterator* _detail2_it;
	GeeHashMultiMap* _tmp80_;
	const gchar* _tmp81_;
	GeeCollection* _tmp82_;
	GeeCollection* _tmp83_;
	GeeIterator* _tmp84_;
	GeeIterator* _tmp85_;
	GeeIterator* _tmp86_;
	gboolean _tmp87_;
	FolksImFieldDetails* detail2;
	GeeIterator* _tmp88_;
	gpointer _tmp89_;
	GeeHashMultiMap* _tmp90_;
	const gchar* _tmp91_;
	FolksImFieldDetails* _tmp92_;
	gboolean _tmp93_;
	GeeMultiMap* old_value;
	FolksImDetails* _tmp94_;
	GeeMultiMap* _tmp95_;
	GeeMultiMap* _tmp96_;
	GeeMultiMap* _tmp97_;
	FolksImDetails* _tmp98_;
	GeeHashMultiMap* _tmp99_;
	ContactsLinkOperation* _tmp100_;
	FolksPersona* _tmp101_;
	GeeMultiMap* _tmp102_;
	GError* e;
	GError* _tmp103_;
	const gchar* _tmp104_;
	GError * _inner_error_;
};

struct _ContactsPersonaAttributeImAddressSetValueData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ContactsPersonaAttributeImAddress* self;
	FolksPersona* persona;
	GObject* value;
	FolksImDetails* details;
	FolksPersona* _tmp0_;
	FolksImDetails* _tmp1_;
	FolksImDetails* _tmp2_;
	GeeHashMultiMap* v;
	GObject* _tmp3_;
	GeeHashMultiMap* _tmp4_;
	FolksImDetails* _tmp5_;
	GeeHashMultiMap* _tmp6_;
	GError* e;
	GError* _tmp7_;
	const gchar* _tmp8_;
	GError * _inner_error_;
};

struct _ContactsPersonaAttributeWebService {
	ContactsPersonaAttribute parent_instance;
	ContactsPersonaAttributeWebServicePrivate * priv;
};

struct _ContactsPersonaAttributeWebServiceClass {
	ContactsPersonaAttributeClass parent_class;
};

struct _ContactsPersonaAttributeWebServicePrivate {
	gchar* service;
	FolksWebServiceFieldDetails* detail;
};

struct _ContactsPersonaAttributeWebServicePersonaApplyAttributesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ContactsPersonaAttributeWebService* self;
	FolksPersona* persona;
	GeeSet* added_attributes;
	GeeSet* removed_attributes;
	ContactsLinkOperation* operation;
	FolksWebServiceDetails* details;
	FolksPersona* _tmp0_;
	FolksWebServiceDetails* _tmp1_;
	FolksWebServiceDetails* _tmp2_;
	GeeHashMultiMap* added_values;
	GeeHashMultiMap* _tmp3_;
	GeeIterator* _added_it;
	GeeSet* _tmp4_;
	GeeIterator* _tmp5_;
	GeeIterator* _tmp6_;
	gboolean _tmp7_;
	ContactsPersonaAttribute* added;
	GeeIterator* _tmp8_;
	gpointer _tmp9_;
	GeeHashMultiMap* _tmp10_;
	ContactsPersonaAttribute* _tmp11_;
	const gchar* _tmp12_;
	ContactsPersonaAttribute* _tmp13_;
	FolksWebServiceFieldDetails* _tmp14_;
	GeeHashMultiMap* removed_values;
	GeeHashMultiMap* _tmp15_;
	GeeIterator* _removed_it;
	GeeSet* _tmp16_;
	GeeIterator* _tmp17_;
	GeeIterator* _tmp18_;
	gboolean _tmp19_;
	ContactsPersonaAttribute* removed;
	GeeIterator* _tmp20_;
	gpointer _tmp21_;
	GeeHashMultiMap* _tmp22_;
	ContactsPersonaAttribute* _tmp23_;
	const gchar* _tmp24_;
	ContactsPersonaAttribute* _tmp25_;
	FolksWebServiceFieldDetails* _tmp26_;
	GeeHashMultiMap* new_values;
	GeeHashMultiMap* _tmp27_;
	gboolean changed;
	GeeIterator* _srv1_it;
	FolksWebServiceDetails* _tmp28_;
	GeeMultiMap* _tmp29_;
	GeeMultiMap* _tmp30_;
	GeeSet* _tmp31_;
	GeeSet* _tmp32_;
	GeeIterator* _tmp33_;
	GeeIterator* _tmp34_;
	GeeIterator* _tmp35_;
	gboolean _tmp36_;
	gchar* srv1;
	GeeIterator* _tmp37_;
	gpointer _tmp38_;
	GeeIterator* _detail1_it;
	FolksWebServiceDetails* _tmp39_;
	GeeMultiMap* _tmp40_;
	GeeMultiMap* _tmp41_;
	const gchar* _tmp42_;
	GeeCollection* _tmp43_;
	GeeCollection* _tmp44_;
	GeeIterator* _tmp45_;
	GeeIterator* _tmp46_;
	GeeIterator* _tmp47_;
	gboolean _tmp48_;
	FolksWebServiceFieldDetails* detail1;
	GeeIterator* _tmp49_;
	gpointer _tmp50_;
	GeeHashMultiMap* _tmp51_;
	const gchar* _tmp52_;
	GeeCollection* _tmp53_;
	GeeCollection* _tmp54_;
	FolksWebServiceFieldDetails* _tmp55_;
	gboolean _tmp56_;
	gboolean _tmp57_;
	GeeHashMultiMap* _tmp58_;
	const gchar* _tmp59_;
	FolksWebServiceFieldDetails* _tmp60_;
	GeeHashMultiMap* _tmp61_;
	const gchar* _tmp62_;
	GeeCollection* _tmp63_;
	GeeCollection* _tmp64_;
	FolksWebServiceFieldDetails* _tmp65_;
	gboolean _tmp66_;
	gboolean _tmp67_;
	GeeHashMultiMap* _tmp68_;
	const gchar* _tmp69_;
	FolksWebServiceFieldDetails* _tmp70_;
	GeeIterator* _srv2_it;
	GeeHashMultiMap* _tmp71_;
	GeeSet* _tmp72_;
	GeeSet* _tmp73_;
	GeeIterator* _tmp74_;
	GeeIterator* _tmp75_;
	GeeIterator* _tmp76_;
	gboolean _tmp77_;
	gchar* srv2;
	GeeIterator* _tmp78_;
	gpointer _tmp79_;
	GeeIterator* _detail2_it;
	GeeHashMultiMap* _tmp80_;
	const gchar* _tmp81_;
	GeeCollection* _tmp82_;
	GeeCollection* _tmp83_;
	GeeIterator* _tmp84_;
	GeeIterator* _tmp85_;
	GeeIterator* _tmp86_;
	gboolean _tmp87_;
	FolksWebServiceFieldDetails* detail2;
	GeeIterator* _tmp88_;
	gpointer _tmp89_;
	GeeHashMultiMap* _tmp90_;
	const gchar* _tmp91_;
	FolksWebServiceFieldDetails* _tmp92_;
	gboolean _tmp93_;
	GeeMultiMap* old_value;
	FolksWebServiceDetails* _tmp94_;
	GeeMultiMap* _tmp95_;
	GeeMultiMap* _tmp96_;
	GeeMultiMap* _tmp97_;
	FolksWebServiceDetails* _tmp98_;
	GeeHashMultiMap* _tmp99_;
	ContactsLinkOperation* _tmp100_;
	FolksPersona* _tmp101_;
	GeeMultiMap* _tmp102_;
	GError* e;
	GError* _tmp103_;
	const gchar* _tmp104_;
	GError * _inner_error_;
};

struct _ContactsPersonaAttributeWebServiceSetValueData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ContactsPersonaAttributeWebService* self;
	FolksPersona* persona;
	GObject* value;
	FolksWebServiceDetails* details;
	FolksPersona* _tmp0_;
	FolksWebServiceDetails* _tmp1_;
	FolksWebServiceDetails* _tmp2_;
	GeeHashMultiMap* v;
	GObject* _tmp3_;
	GeeHashMultiMap* _tmp4_;
	FolksWebServiceDetails* _tmp5_;
	GeeHashMultiMap* _tmp6_;
	GError* e;
	GError* _tmp7_;
	const gchar* _tmp8_;
	GError * _inner_error_;
};

struct _ContactsPersonaApplyAttributesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	FolksPersona* persona;
	GeeSet* added_attributes;
	GeeSet* removed_attributes;
	ContactsLinkOperation* operation;
	GeeHashSet* properties;
	GeeHashSet* _tmp0_;
	GeeSet* _tmp1_;
	GeeIterator* _a1_it;
	GeeSet* _tmp2_;
	GeeIterator* _tmp3_;
	GeeIterator* _tmp4_;
	gboolean _tmp5_;
	ContactsPersonaAttribute* a1;
	GeeIterator* _tmp6_;
	gpointer _tmp7_;
	GeeHashSet* _tmp8_;
	ContactsPersonaAttribute* _tmp9_;
	GeeSet* _tmp10_;
	GeeIterator* _a2_it;
	GeeSet* _tmp11_;
	GeeIterator* _tmp12_;
	GeeIterator* _tmp13_;
	gboolean _tmp14_;
	ContactsPersonaAttribute* a2;
	GeeIterator* _tmp15_;
	gpointer _tmp16_;
	GeeHashSet* _tmp17_;
	ContactsPersonaAttribute* _tmp18_;
	GeeIterator* _property_it;
	GeeHashSet* _tmp19_;
	GeeIterator* _tmp20_;
	GeeIterator* _tmp21_;
	gboolean _tmp22_;
	ContactsPersonaAttribute* property;
	GeeIterator* _tmp23_;
	gpointer _tmp24_;
	GeeHashSet* added;
	GeeHashSet* _tmp25_;
	GeeHashSet* removed;
	GeeHashSet* _tmp26_;
	GeeSet* _tmp27_;
	GeeIterator* _a3_it;
	GeeSet* _tmp28_;
	GeeIterator* _tmp29_;
	GeeIterator* _tmp30_;
	gboolean _tmp31_;
	ContactsPersonaAttribute* a3;
	GeeIterator* _tmp32_;
	gpointer _tmp33_;
	ContactsPersonaAttribute* _tmp34_;
	ContactsPersonaAttribute* _tmp35_;
	gboolean _tmp36_;
	GeeHashSet* _tmp37_;
	ContactsPersonaAttribute* _tmp38_;
	GeeSet* _tmp39_;
	GeeIterator* _a4_it;
	GeeSet* _tmp40_;
	GeeIterator* _tmp41_;
	GeeIterator* _tmp42_;
	gboolean _tmp43_;
	ContactsPersonaAttribute* a4;
	GeeIterator* _tmp44_;
	gpointer _tmp45_;
	ContactsPersonaAttribute* _tmp46_;
	ContactsPersonaAttribute* _tmp47_;
	gboolean _tmp48_;
	GeeHashSet* _tmp49_;
	ContactsPersonaAttribute* _tmp50_;
	ContactsPersonaAttribute* _tmp51_;
	FolksPersona* _tmp52_;
	GeeHashSet* _tmp53_;
	GeeHashSet* _tmp54_;
	ContactsLinkOperation* _tmp55_;
};

struct _ContactsApp {
	GtkApplication parent_instance;
	ContactsAppPrivate * priv;
	GSettings* settings;
	ContactsStore* contacts_store;
	ContactsWindow* window;
};

struct _ContactsAppClass {
	GtkApplicationClass parent_class;
};

struct _ContactsLinkContactsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ContactsContact* main;
	ContactsContact* other;
	ContactsLinkOperation* result;
	ContactsContact* _tmp0_;
	ContactsLinkOperation* operation;
	ContactsLinkOperation* _tmp1_;
	ContactsLinkOperation* _tmp2_;
	ContactsContact* _tmp3_;
	GeeSet* main_linkables;
	ContactsContact* _tmp4_;
	FolksIndividual* _tmp5_;
	GeeSet* _tmp6_;
	GeeSet* other_linkables;
	ContactsContact* _tmp7_;
	ContactsContact* _tmp8_;
	FolksIndividual* _tmp9_;
	GeeSet* _tmp10_;
	GeeSet* linkables;
	GeeSet* _tmp11_;
	GeeSet* _tmp12_;
	GeeSet* _tmp13_;
	GeeSet* _tmp14_;
	GeeSet* _tmp15_;
	FolksPersona* write_persona;
	GeeIterator* _p1_it;
	ContactsContact* _tmp16_;
	FolksIndividual* _tmp17_;
	GeeSet* _tmp18_;
	GeeSet* _tmp19_;
	GeeIterator* _tmp20_;
	GeeIterator* _tmp21_;
	gboolean _tmp22_;
	FolksPersona* p1;
	GeeIterator* _tmp23_;
	gpointer _tmp24_;
	gboolean _tmp25_;
	GeeSet* _tmp26_;
	FolksPersona* _tmp27_;
	GeeSet* _tmp28_;
	gboolean _tmp29_;
	FolksPersona* _tmp30_;
	FolksPersona* _tmp31_;
	GeeSet* _tmp32_;
	GeeSet* _tmp33_;
	FolksPersona* _tmp34_;
	FolksPersonaStore* _tmp35_;
	FolksPersonaStore* _tmp36_;
	gboolean _tmp37_;
	gboolean _tmp38_;
	gboolean _tmp39_;
	ContactsContact* _tmp40_;
	gboolean _tmp41_;
	FolksPersona* _tmp42_;
	FolksPersona* _tmp43_;
	FolksPersonaStore* _tmp44_;
	FolksPersonaStore* _tmp45_;
	gboolean _tmp46_;
	gboolean _tmp47_;
	GeeIterator* _p2_it;
	ContactsContact* _tmp48_;
	FolksIndividual* _tmp49_;
	GeeSet* _tmp50_;
	GeeSet* _tmp51_;
	GeeIterator* _tmp52_;
	GeeIterator* _tmp53_;
	gboolean _tmp54_;
	FolksPersona* p2;
	GeeIterator* _tmp55_;
	gpointer _tmp56_;
	FolksPersona* _tmp57_;
	GeeSet* _tmp58_;
	gboolean _tmp59_;
	gboolean _tmp60_;
	FolksPersona* _tmp61_;
	FolksPersona* _tmp62_;
	FolksPersonaStore* _tmp63_;
	FolksPersonaStore* _tmp64_;
	gboolean _tmp65_;
	gboolean _tmp66_;
	FolksPersona* _tmp67_;
	FolksPersona* _tmp68_;
	GeeSet* _tmp69_;
	GeeSet* _tmp70_;
	FolksPersona* _tmp71_;
	FolksPersonaStore* _tmp72_;
	FolksPersonaStore* _tmp73_;
	gboolean _tmp74_;
	gboolean _tmp75_;
	FolksPersona* _tmp76_;
	GHashTable* details;
	GHashFunc _tmp77_;
	GEqualFunc _tmp78_;
	GHashTable* _tmp79_;
	GValue v;
	GValue _tmp80_;
	ContactsContact* _tmp81_;
	const gchar* _tmp82_;
	const gchar* _tmp83_;
	GHashTable* _tmp84_;
	gchar* _tmp85_;
	GValue _tmp86_;
	GValue _tmp87_;
	GValue* _tmp88_;
	FolksPersona* _tmp89_;
	ContactsApp* _tmp90_;
	ContactsStore* _tmp91_;
	FolksIndividualAggregator* _tmp92_;
	FolksIndividualAggregator* _tmp93_;
	FolksPersonaStore* _tmp94_;
	FolksPersonaStore* _tmp95_;
	GHashTable* _tmp96_;
	FolksPersona* _tmp97_;
	FolksPersona* _tmp98_;
	ContactsLinkOperation* _tmp99_;
	FolksPersona* _tmp100_;
	GeeSet* _tmp101_;
	GeeSet* _tmp102_;
	GeeSet* _tmp103_;
	GeeSet* _tmp104_;
	GeeSet* _tmp105_;
	GError* e;
	ContactsContact* _tmp106_;
	GError* _tmp107_;
	const gchar* _tmp108_;
	FolksPersona* _tmp109_;
	GeeSet* _tmp110_;
	ContactsLinkOperation* _tmp111_;
	ContactsContact* _tmp112_;
	GError * _inner_error_;
};

struct _ContactsUnlinkPersonaData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ContactsContact* contact;
	FolksPersona* persona_to_unlink;
	ContactsLinkOperation* result;
	FolksIndividual* individual;
	ContactsContact* _tmp0_;
	FolksIndividual* _tmp1_;
	FolksIndividual* _tmp2_;
	GeeHashSet* persona_to_unlink_removals;
	GeeHashSet* _tmp3_;
	GeeHashSet* other_personas_removals;
	GeeHashSet* _tmp4_;
	ContactsLinkOperation* operation;
	ContactsLinkOperation* _tmp5_;
	ContactsLinkOperation* _tmp6_;
	ContactsContact* _tmp7_;
	GeeIterator* _a1_it;
	FolksPersona* _tmp8_;
	GeeSet* _tmp9_;
	GeeSet* _tmp10_;
	GeeIterator* _tmp11_;
	GeeIterator* _tmp12_;
	GeeIterator* _tmp13_;
	gboolean _tmp14_;
	ContactsPersonaAttribute* a1;
	GeeIterator* _tmp15_;
	gpointer _tmp16_;
	gboolean used_to_link;
	GeeIterator* _persona_it;
	FolksIndividual* _tmp17_;
	GeeSet* _tmp18_;
	GeeSet* _tmp19_;
	GeeIterator* _tmp20_;
	GeeIterator* _tmp21_;
	gboolean _tmp22_;
	FolksPersona* persona;
	GeeIterator* _tmp23_;
	gpointer _tmp24_;
	gboolean _tmp25_;
	FolksPersona* _tmp26_;
	FolksPersona* _tmp27_;
	ContactsPersonaAttribute* _tmp28_;
	FolksPersona* _tmp29_;
	gboolean _tmp30_;
	gboolean _tmp31_;
	ContactsPersonaAttribute* _tmp32_;
	FolksPersona* _tmp33_;
	gboolean _tmp34_;
	GeeHashSet* _tmp35_;
	ContactsPersonaAttribute* _tmp36_;
	GeeHashSet* _tmp37_;
	ContactsPersonaAttribute* _tmp38_;
	GeeHashSet* main_persona_additions;
	GeeHashSet* _tmp39_;
	GeeIterator* _p1_it;
	FolksIndividual* _tmp40_;
	GeeSet* _tmp41_;
	GeeSet* _tmp42_;
	GeeIterator* _tmp43_;
	GeeIterator* _tmp44_;
	gboolean _tmp45_;
	FolksPersona* p1;
	GeeIterator* _tmp46_;
	gpointer _tmp47_;
	FolksPersona* _tmp48_;
	FolksPersona* _tmp49_;
	GeeIterator* _a2_it;
	FolksPersona* _tmp50_;
	GeeSet* _tmp51_;
	GeeSet* _tmp52_;
	GeeIterator* _tmp53_;
	GeeIterator* _tmp54_;
	GeeIterator* _tmp55_;
	gboolean _tmp56_;
	ContactsPersonaAttribute* a2;
	GeeIterator* _tmp57_;
	gpointer _tmp58_;
	GeeHashSet* _tmp59_;
	ContactsPersonaAttribute* _tmp60_;
	gboolean _tmp61_;
	GeeHashSet* _tmp62_;
	ContactsPersonaAttribute* _tmp63_;
	FolksPersona* main_persona;
	GeeIterator* _p2_it;
	FolksIndividual* _tmp64_;
	GeeSet* _tmp65_;
	GeeSet* _tmp66_;
	GeeIterator* _tmp67_;
	GeeIterator* _tmp68_;
	gboolean _tmp69_;
	FolksPersona* p2;
	GeeIterator* _tmp70_;
	gpointer _tmp71_;
	gboolean _tmp72_;
	FolksPersona* _tmp73_;
	FolksPersona* _tmp74_;
	FolksPersona* _tmp75_;
	GeeHashSet* _tmp76_;
	gboolean _tmp77_;
	FolksPersona* _tmp78_;
	FolksPersona* _tmp79_;
	FolksPersona* _tmp80_;
	FolksPersonaStore* _tmp81_;
	FolksPersonaStore* _tmp82_;
	gboolean _tmp83_;
	gboolean _tmp84_;
	GeeHashSet* other_personas;
	GeeHashSet* _tmp85_;
	GeeIterator* _p3_it;
	FolksIndividual* _tmp86_;
	GeeSet* _tmp87_;
	GeeSet* _tmp88_;
	GeeIterator* _tmp89_;
	GeeIterator* _tmp90_;
	gboolean _tmp91_;
	FolksPersona* p3;
	GeeIterator* _tmp92_;
	gpointer _tmp93_;
	gboolean _tmp94_;
	FolksPersona* _tmp95_;
	FolksPersona* _tmp96_;
	FolksPersona* _tmp97_;
	FolksPersona* _tmp98_;
	GeeHashSet* _tmp99_;
	FolksPersona* _tmp100_;
	gboolean _tmp101_;
	FolksPersona* _tmp102_;
	GeeHashSet* _tmp103_;
	gint _tmp104_;
	gint _tmp105_;
	GHashTable* details;
	GHashFunc _tmp106_;
	GEqualFunc _tmp107_;
	GHashTable* _tmp108_;
	FolksPersona* _tmp109_;
	ContactsContact* _tmp110_;
	ContactsStore* _tmp111_;
	FolksIndividualAggregator* _tmp112_;
	FolksIndividualAggregator* _tmp113_;
	FolksPersonaStore* _tmp114_;
	FolksPersonaStore* _tmp115_;
	GHashTable* _tmp116_;
	FolksPersona* _tmp117_;
	FolksPersona* _tmp118_;
	FolksPersona* _tmp119_;
	ContactsContact* _tmp120_;
	const gchar* _tmp121_;
	const gchar* _tmp122_;
	ContactsLinkOperation* _tmp123_;
	FolksPersona* _tmp124_;
	GError* e;
	GError* _tmp125_;
	const gchar* _tmp126_;
	FolksPersona* _tmp127_;
	FolksPersona* _tmp128_;
	FolksPersona* _tmp129_;
	GeeHashSet* _tmp130_;
	GeeHashSet* _tmp131_;
	ContactsLinkOperation* _tmp132_;
	GeeIterator* _p_it;
	GeeHashSet* _tmp133_;
	GeeIterator* _tmp134_;
	GeeIterator* _tmp135_;
	gboolean _tmp136_;
	FolksPersona* p;
	GeeIterator* _tmp137_;
	gpointer _tmp138_;
	FolksPersona* _tmp139_;
	GeeHashSet* _tmp140_;
	ContactsLinkOperation* _tmp141_;
	FolksPersona* _tmp142_;
	GeeHashSet* _tmp143_;
	ContactsLinkOperation* _tmp144_;
	FolksPersona* _tmp145_;
	GError * _inner_error_;
};

struct _ContactsLinkOperation2 {
	GObject parent_instance;
	ContactsLinkOperation2Private * priv;
};

struct _ContactsLinkOperation2Class {
	GObjectClass parent_class;
};

struct _ContactsLinkOperation2Private {
	GeeLinkedList* old_personas_distribution;
};

struct _ContactsLinkOperation2UndoData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ContactsLinkOperation2* self;
	FolksIndividual* ind;
	GeeLinkedList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	GeeHashSet* ps;
	GeeLinkedList* _tmp3_;
	gpointer _tmp4_;
	GeeIterator* _p_it;
	GeeHashSet* _tmp5_;
	GeeIterator* _tmp6_;
	GeeIterator* _tmp7_;
	gboolean _tmp8_;
	FolksPersona* p;
	GeeIterator* _tmp9_;
	gpointer _tmp10_;
	FolksPersona* _tmp11_;
	FolksIndividual* _tmp12_;
	FolksIndividual* _tmp13_;
	FolksIndividual* _tmp14_;
	FolksIndividual* _tmp15_;
	ContactsApp* _tmp16_;
	ContactsStore* _tmp17_;
	FolksIndividualAggregator* _tmp18_;
	FolksIndividualAggregator* _tmp19_;
	FolksIndividual* _tmp20_;
	GError* e1;
	FolksIndividual* _tmp21_;
	const gchar* _tmp22_;
	const gchar* _tmp23_;
	GError* _tmp24_;
	const gchar* _tmp25_;
	GeeLinkedList* _ps_list;
	GeeLinkedList* _tmp26_;
	GeeLinkedList* _tmp27_;
	gint _ps_size;
	GeeLinkedList* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	gint _ps_index;
	gint _tmp31_;
	gint _tmp32_;
	gint _tmp33_;
	GeeHashSet* _vala1_ps;
	GeeLinkedList* _tmp34_;
	gint _tmp35_;
	gpointer _tmp36_;
	ContactsApp* _tmp37_;
	ContactsStore* _tmp38_;
	FolksIndividualAggregator* _tmp39_;
	FolksIndividualAggregator* _tmp40_;
	GeeHashSet* _tmp41_;
	GError* _vala1_e1;
	GError* _tmp42_;
	const gchar* _tmp43_;
	GError * _inner_error_;
};

struct _ContactsLinkContactsListData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	GeeLinkedList* contact_list;
	ContactsLinkOperation2* result;
	ContactsLinkOperation2* operation;
	ContactsLinkOperation2* _tmp0_;
	GeeHashSet* all_personas;
	GeeHashSet* _tmp1_;
	GeeLinkedList* _c_list;
	GeeLinkedList* _tmp2_;
	GeeLinkedList* _tmp3_;
	gint _c_size;
	GeeLinkedList* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	gint _c_index;
	gint _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	ContactsContact* c;
	GeeLinkedList* _tmp10_;
	gint _tmp11_;
	gpointer _tmp12_;
	GeeSet* ps;
	ContactsContact* _tmp13_;
	FolksIndividual* _tmp14_;
	GeeSet* _tmp15_;
	GeeSet* _tmp16_;
	GeeSet* _tmp17_;
	GeeHashSet* _tmp18_;
	GeeSet* _tmp19_;
	ContactsLinkOperation2* _tmp20_;
	GeeSet* _tmp21_;
	ContactsApp* _tmp22_;
	ContactsStore* _tmp23_;
	FolksIndividualAggregator* _tmp24_;
	FolksIndividualAggregator* _tmp25_;
	GeeHashSet* _tmp26_;
	GError* e1;
	GError* _tmp27_;
	const gchar* _tmp28_;
	GError * _inner_error_;
};


static gpointer contacts_link_operation_parent_class = NULL;
static gpointer contacts_link_operation_change_parent_class = NULL;
static gpointer contacts_persona_attribute_parent_class = NULL;
static gpointer contacts_persona_attribute_local_id_parent_class = NULL;
static gpointer contacts_persona_attribute_im_address_parent_class = NULL;
static gpointer contacts_persona_attribute_web_service_parent_class = NULL;
extern ContactsApp* contacts_app_app;
static gpointer contacts_link_operation2_parent_class = NULL;

GType contacts_link_operation_get_type (void) G_GNUC_CONST;
GType contacts_contact_get_type (void) G_GNUC_CONST;
gpointer contacts_link_operation_change_ref (gpointer instance);
void contacts_link_operation_change_unref (gpointer instance);
GParamSpec* contacts_link_operation_param_spec_change (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void contacts_link_operation_value_set_change (GValue* value, gpointer v_object);
void contacts_link_operation_value_take_change (GValue* value, gpointer v_object);
gpointer contacts_link_operation_value_get_change (const GValue* value);
GType contacts_link_operation_change_get_type (void) G_GNUC_CONST;
#define CONTACTS_LINK_OPERATION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_LINK_OPERATION, ContactsLinkOperationPrivate))
enum  {
	CONTACTS_LINK_OPERATION_DUMMY_PROPERTY
};
ContactsLinkOperation* contacts_link_operation_new (void);
ContactsLinkOperation* contacts_link_operation_construct (GType object_type);
void contacts_link_operation_set_main_contact (ContactsLinkOperation* self, ContactsContact* contact);
void contacts_link_operation_set_split_out_contact (ContactsLinkOperation* self, ContactsContact* contact);
GType contacts_store_get_type (void) G_GNUC_CONST;
void contacts_link_operation_added_persona (ContactsLinkOperation* self, FolksPersona* persona);
GType contacts_persona_attribute_get_type (void) G_GNUC_CONST;
void contacts_link_operation_add_change (ContactsLinkOperation* self, ContactsPersonaAttribute* attribute, FolksPersona* persona, GObject* old_value);
ContactsLinkOperationChange* contacts_link_operation_change_new (void);
ContactsLinkOperationChange* contacts_link_operation_change_construct (GType object_type);
static void contacts_link_operation_undo_data_free (gpointer _data);
void contacts_link_operation_undo (ContactsLinkOperation* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void contacts_link_operation_undo_finish (ContactsLinkOperation* self, GAsyncResult* _res_);
static gboolean contacts_link_operation_undo_co (ContactsLinkOperationUndoData* _data_);
static void contacts_link_operation_undo_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void contacts_persona_attribute_set_value (ContactsPersonaAttribute* self, FolksPersona* persona, GObject* value, GAsyncReadyCallback _callback_, gpointer _user_data_);
void contacts_persona_attribute_set_value_finish (ContactsPersonaAttribute* self, GAsyncResult* _res_);
enum  {
	CONTACTS_LINK_OPERATION_CHANGE_DUMMY_PROPERTY
};
static void contacts_link_operation_change_finalize (ContactsLinkOperationChange* obj);
static void contacts_link_operation_finalize (GObject* obj);
enum  {
	CONTACTS_PERSONA_ATTRIBUTE_DUMMY_PROPERTY
};
GeeHashSet* contacts_persona_attribute_create_set (void);
guint contacts_persona_attribute_hash (ContactsPersonaAttribute* self);
gboolean contacts_persona_attribute_equal (ContactsPersonaAttribute* self, ContactsPersonaAttribute* that);
gboolean contacts_persona_attribute_is_removable (ContactsPersonaAttribute* self, FolksPersona* from_persona);
static gboolean contacts_persona_attribute_real_is_removable (ContactsPersonaAttribute* self, FolksPersona* from_persona);
static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle);
gboolean contacts_persona_attribute_is_referenced_by_persona (ContactsPersonaAttribute* self, FolksPersona* persona);
static gboolean contacts_persona_attribute_real_is_referenced_by_persona (ContactsPersonaAttribute* self, FolksPersona* persona);
static gboolean contacts_persona_attribute_real_equal (ContactsPersonaAttribute* self, ContactsPersonaAttribute* that);
static guint contacts_persona_attribute_real_hash (ContactsPersonaAttribute* self);
void contacts_persona_attribute_persona_apply_attributes (ContactsPersonaAttribute* self, FolksPersona* persona, GeeSet* added_attributes, GeeSet* removed_attributes, ContactsLinkOperation* operation, GAsyncReadyCallback _callback_, gpointer _user_data_);
void contacts_persona_attribute_persona_apply_attributes_finish (ContactsPersonaAttribute* self, GAsyncResult* _res_);
ContactsPersonaAttribute* contacts_persona_attribute_construct (GType object_type);
static void contacts_persona_attribute_finalize (GObject* obj);
GType contacts_persona_attribute_local_id_get_type (void) G_GNUC_CONST;
#define CONTACTS_PERSONA_ATTRIBUTE_LOCAL_ID_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_PERSONA_ATTRIBUTE_LOCAL_ID, ContactsPersonaAttributeLocalIdPrivate))
enum  {
	CONTACTS_PERSONA_ATTRIBUTE_LOCAL_ID_DUMMY_PROPERTY
};
ContactsPersonaAttributeLocalId* contacts_persona_attribute_local_id_new (const gchar* value);
ContactsPersonaAttributeLocalId* contacts_persona_attribute_local_id_construct (GType object_type, const gchar* value);
static gboolean contacts_persona_attribute_local_id_real_is_removable (ContactsPersonaAttribute* base, FolksPersona* from_persona);
static gboolean contacts_persona_attribute_local_id_real_is_referenced_by_persona (ContactsPersonaAttribute* base, FolksPersona* persona);
static void contacts_persona_attribute_local_id_real_persona_apply_attributes_data_free (gpointer _data);
static void contacts_persona_attribute_local_id_real_persona_apply_attributes (ContactsPersonaAttribute* base, FolksPersona* persona, GeeSet* added_attributes, GeeSet* removed_attributes, ContactsLinkOperation* operation, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean contacts_persona_attribute_local_id_real_persona_apply_attributes_co (ContactsPersonaAttributeLocalIdPersonaApplyAttributesData* _data_);
static void contacts_persona_attribute_local_id_persona_apply_attributes_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void contacts_persona_attribute_local_id_real_set_value_data_free (gpointer _data);
static void contacts_persona_attribute_local_id_real_set_value (ContactsPersonaAttribute* base, FolksPersona* persona, GObject* value, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean contacts_persona_attribute_local_id_real_set_value_co (ContactsPersonaAttributeLocalIdSetValueData* _data_);
static void contacts_persona_attribute_local_id_set_value_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static gboolean contacts_persona_attribute_local_id_real_equal (ContactsPersonaAttribute* base, ContactsPersonaAttribute* _that);
static guint contacts_persona_attribute_local_id_real_hash (ContactsPersonaAttribute* base);
static void contacts_persona_attribute_local_id_finalize (GObject* obj);
GType contacts_persona_attribute_im_address_get_type (void) G_GNUC_CONST;
#define CONTACTS_PERSONA_ATTRIBUTE_IM_ADDRESS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS, ContactsPersonaAttributeImAddressPrivate))
enum  {
	CONTACTS_PERSONA_ATTRIBUTE_IM_ADDRESS_DUMMY_PROPERTY
};
ContactsPersonaAttributeImAddress* contacts_persona_attribute_im_address_new (const gchar* protocol, FolksImFieldDetails* detail);
ContactsPersonaAttributeImAddress* contacts_persona_attribute_im_address_construct (GType object_type, const gchar* protocol, FolksImFieldDetails* detail);
static gboolean contacts_persona_attribute_im_address_real_is_referenced_by_persona (ContactsPersonaAttribute* base, FolksPersona* persona);
static void contacts_persona_attribute_im_address_real_persona_apply_attributes_data_free (gpointer _data);
static void contacts_persona_attribute_im_address_real_persona_apply_attributes (ContactsPersonaAttribute* base, FolksPersona* persona, GeeSet* added_attributes, GeeSet* removed_attributes, ContactsLinkOperation* operation, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean contacts_persona_attribute_im_address_real_persona_apply_attributes_co (ContactsPersonaAttributeImAddressPersonaApplyAttributesData* _data_);
static guint _folks_abstract_field_details_hash_static_gee_hash_data_func (gconstpointer v, gpointer self);
static gboolean _folks_abstract_field_details_equal_static_gee_equal_data_func (gconstpointer a, gconstpointer b, gpointer self);
static void contacts_persona_attribute_im_address_persona_apply_attributes_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void contacts_persona_attribute_im_address_real_set_value_data_free (gpointer _data);
static void contacts_persona_attribute_im_address_real_set_value (ContactsPersonaAttribute* base, FolksPersona* persona, GObject* value, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean contacts_persona_attribute_im_address_real_set_value_co (ContactsPersonaAttributeImAddressSetValueData* _data_);
static void contacts_persona_attribute_im_address_set_value_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static gboolean contacts_persona_attribute_im_address_real_equal (ContactsPersonaAttribute* base, ContactsPersonaAttribute* _that);
static guint contacts_persona_attribute_im_address_real_hash (ContactsPersonaAttribute* base);
static void contacts_persona_attribute_im_address_finalize (GObject* obj);
GType contacts_persona_attribute_web_service_get_type (void) G_GNUC_CONST;
#define CONTACTS_PERSONA_ATTRIBUTE_WEB_SERVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE, ContactsPersonaAttributeWebServicePrivate))
enum  {
	CONTACTS_PERSONA_ATTRIBUTE_WEB_SERVICE_DUMMY_PROPERTY
};
ContactsPersonaAttributeWebService* contacts_persona_attribute_web_service_new (const gchar* service, FolksWebServiceFieldDetails* detail);
ContactsPersonaAttributeWebService* contacts_persona_attribute_web_service_construct (GType object_type, const gchar* service, FolksWebServiceFieldDetails* detail);
static gboolean contacts_persona_attribute_web_service_real_is_referenced_by_persona (ContactsPersonaAttribute* base, FolksPersona* persona);
static void contacts_persona_attribute_web_service_real_persona_apply_attributes_data_free (gpointer _data);
static void contacts_persona_attribute_web_service_real_persona_apply_attributes (ContactsPersonaAttribute* base, FolksPersona* persona, GeeSet* added_attributes, GeeSet* removed_attributes, ContactsLinkOperation* operation, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean contacts_persona_attribute_web_service_real_persona_apply_attributes_co (ContactsPersonaAttributeWebServicePersonaApplyAttributesData* _data_);
static void contacts_persona_attribute_web_service_persona_apply_attributes_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void contacts_persona_attribute_web_service_real_set_value_data_free (gpointer _data);
static void contacts_persona_attribute_web_service_real_set_value (ContactsPersonaAttribute* base, FolksPersona* persona, GObject* value, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean contacts_persona_attribute_web_service_real_set_value_co (ContactsPersonaAttributeWebServiceSetValueData* _data_);
static void contacts_persona_attribute_web_service_set_value_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static gboolean contacts_persona_attribute_web_service_real_equal (ContactsPersonaAttribute* base, ContactsPersonaAttribute* _that);
static guint contacts_persona_attribute_web_service_real_hash (ContactsPersonaAttribute* base);
static void contacts_persona_attribute_web_service_finalize (GObject* obj);
void contacts_add_linkable_attributes (GeeHashSet* set, FolksPersona* persona);
GeeSet* contacts_get_linkable_attributes (FolksPersona* persona);
GeeSet* contacts_get_linkable_attributes_for_individual (FolksIndividual* individual);
gboolean contacts_persona_can_link_to (FolksPersona* persona, GeeSet* attributes);
gboolean contacts_attr_type_equal (ContactsPersonaAttribute* a, ContactsPersonaAttribute* b);
static void contacts_persona_apply_attributes_data_free (gpointer _data);
void contacts_persona_apply_attributes (FolksPersona* persona, GeeSet* added_attributes, GeeSet* removed_attributes, ContactsLinkOperation* operation, GAsyncReadyCallback _callback_, gpointer _user_data_);
void contacts_persona_apply_attributes_finish (GAsyncResult* _res_);
static gboolean contacts_persona_apply_attributes_co (ContactsPersonaApplyAttributesData* _data_);
static void contacts_persona_apply_attributes_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void contacts_link_contacts_data_free (gpointer _data);
void contacts_link_contacts (ContactsContact* main, ContactsContact* other, GAsyncReadyCallback _callback_, gpointer _user_data_);
ContactsLinkOperation* contacts_link_contacts_finish (GAsyncResult* _res_);
static gboolean contacts_link_contacts_co (ContactsLinkContactsData* _data_);
static void _g_free0_ (gpointer var);
static void _vala_GValue_free (GValue* self);
static void __vala_GValue_free0_ (gpointer var);
const gchar* contacts_contact_get_display_name (ContactsContact* self);
static GValue* _g_value_dup (GValue* self);
void contacts_contact_create_primary_persona_for_details (FolksPersonaStore* store, GHashTable* details, GAsyncReadyCallback _callback_, gpointer _user_data_);
FolksPersona* contacts_contact_create_primary_persona_for_details_finish (GAsyncResult* _res_, GError** error);
GType contacts_app_get_type (void) G_GNUC_CONST;
GType contacts_window_get_type (void) G_GNUC_CONST;
FolksIndividualAggregator* contacts_store_get_aggregator (ContactsStore* self);
static void contacts_link_contacts_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void contacts_unlink_persona_data_free (gpointer _data);
void contacts_unlink_persona (ContactsContact* contact, FolksPersona* persona_to_unlink, GAsyncReadyCallback _callback_, gpointer _user_data_);
ContactsLinkOperation* contacts_unlink_persona_finish (GAsyncResult* _res_);
static gboolean contacts_unlink_persona_co (ContactsUnlinkPersonaData* _data_);
static void contacts_unlink_persona_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
GType contacts_link_operation2_get_type (void) G_GNUC_CONST;
#define CONTACTS_LINK_OPERATION2_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_LINK_OPERATION2, ContactsLinkOperation2Private))
enum  {
	CONTACTS_LINK_OPERATION2_DUMMY_PROPERTY
};
ContactsLinkOperation2* contacts_link_operation2_new (void);
ContactsLinkOperation2* contacts_link_operation2_construct (GType object_type);
void contacts_link_operation2_add_persona_set (ContactsLinkOperation2* self, GeeSet* persona_set);
static void contacts_link_operation2_undo_data_free (gpointer _data);
void contacts_link_operation2_undo (ContactsLinkOperation2* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void contacts_link_operation2_undo_finish (ContactsLinkOperation2* self, GAsyncResult* _res_);
static gboolean contacts_link_operation2_undo_co (ContactsLinkOperation2UndoData* _data_);
static void contacts_link_operation2_undo_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void contacts_link_operation2_finalize (GObject* obj);
static void contacts_link_contacts_list_data_free (gpointer _data);
void contacts_link_contacts_list (GeeLinkedList* contact_list, GAsyncReadyCallback _callback_, gpointer _user_data_);
ContactsLinkOperation2* contacts_link_contacts_list_finish (GAsyncResult* _res_);
static gboolean contacts_link_contacts_list_co (ContactsLinkContactsListData* _data_);
static void contacts_link_contacts_list_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);


ContactsLinkOperation* contacts_link_operation_construct (GType object_type) {
	ContactsLinkOperation * self = NULL;
	GeeArrayList* _tmp0_ = NULL;
	self = (ContactsLinkOperation*) g_object_new (object_type, NULL);
	_tmp0_ = gee_array_list_new (CONTACTS_LINK_OPERATION_TYPE_CHANGE, (GBoxedCopyFunc) contacts_link_operation_change_ref, contacts_link_operation_change_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->changes);
	self->priv->changes = _tmp0_;
	return self;
}


ContactsLinkOperation* contacts_link_operation_new (void) {
	return contacts_link_operation_construct (CONTACTS_TYPE_LINK_OPERATION);
}


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


void contacts_link_operation_set_main_contact (ContactsLinkOperation* self, ContactsContact* contact) {
	ContactsContact* _tmp0_ = NULL;
	ContactsContact* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = contact;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->main_contact);
	self->priv->main_contact = _tmp1_;
}


void contacts_link_operation_set_split_out_contact (ContactsLinkOperation* self, ContactsContact* contact) {
	ContactsContact* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = contact;
	if (_tmp0_ != NULL) {
		GeeArrayList* _tmp1_ = NULL;
		GeeArrayList* _tmp2_ = NULL;
		ContactsContact* _tmp3_ = NULL;
		FolksIndividual* _tmp4_ = NULL;
		GeeSet* _tmp5_ = NULL;
		GeeSet* _tmp6_ = NULL;
		_tmp1_ = gee_array_list_new (FOLKS_TYPE_PERSONA, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
		_g_object_unref0 (self->priv->split_out_personas);
		self->priv->split_out_personas = _tmp1_;
		_tmp2_ = self->priv->split_out_personas;
		_tmp3_ = contact;
		_tmp4_ = _tmp3_->individual;
		_tmp5_ = folks_individual_get_personas (_tmp4_);
		_tmp6_ = _tmp5_;
		gee_array_list_add_all (_tmp2_, (GeeCollection*) _tmp6_);
	}
}


void contacts_link_operation_added_persona (ContactsLinkOperation* self, FolksPersona* persona) {
	FolksPersona* _tmp0_ = NULL;
	FolksPersona* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (persona != NULL);
	_tmp0_ = persona;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_added_persona);
	self->priv->_added_persona = _tmp1_;
}


void contacts_link_operation_add_change (ContactsLinkOperation* self, ContactsPersonaAttribute* attribute, FolksPersona* persona, GObject* old_value) {
	ContactsLinkOperationChange* c = NULL;
	ContactsLinkOperationChange* _tmp0_ = NULL;
	ContactsPersonaAttribute* _tmp1_ = NULL;
	ContactsPersonaAttribute* _tmp2_ = NULL;
	FolksPersona* _tmp3_ = NULL;
	FolksPersona* _tmp4_ = NULL;
	GObject* _tmp5_ = NULL;
	GObject* _tmp6_ = NULL;
	GeeArrayList* _tmp7_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (attribute != NULL);
	g_return_if_fail (persona != NULL);
	g_return_if_fail (old_value != NULL);
	_tmp0_ = contacts_link_operation_change_new ();
	c = _tmp0_;
	_tmp1_ = attribute;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (c->attribute);
	c->attribute = _tmp2_;
	_tmp3_ = persona;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (c->persona);
	c->persona = _tmp4_;
	_tmp5_ = old_value;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	_g_object_unref0 (c->old_value);
	c->old_value = _tmp6_;
	_tmp7_ = self->priv->changes;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp7_, c);
	_contacts_link_operation_change_unref0 (c);
}


static void contacts_link_operation_undo_data_free (gpointer _data) {
	ContactsLinkOperationUndoData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ContactsLinkOperationUndoData, _data_);
}


void contacts_link_operation_undo (ContactsLinkOperation* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsLinkOperationUndoData* _data_;
	ContactsLinkOperation* _tmp0_ = NULL;
	_data_ = g_slice_new0 (ContactsLinkOperationUndoData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, contacts_link_operation_undo);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, contacts_link_operation_undo_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	contacts_link_operation_undo_co (_data_);
}


void contacts_link_operation_undo_finish (ContactsLinkOperation* self, GAsyncResult* _res_) {
	ContactsLinkOperationUndoData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void contacts_link_operation_undo_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ContactsLinkOperationUndoData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_link_operation_undo_co (_data_);
}


static gboolean contacts_link_operation_undo_co (ContactsLinkOperationUndoData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->self->priv->main_contact;
	if (_data_->_tmp0_ != NULL) {
		_data_->_tmp1_ = NULL;
		_data_->_tmp1_ = _data_->self->priv->main_contact;
		g_object_set_data_full ((GObject*) _data_->_tmp1_, "contacts-master-at-join", (gpointer) ((gintptr) TRUE), NULL);
	}
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->self->priv->split_out_personas;
	if (_data_->_tmp2_ != NULL) {
		{
			_data_->_tmp3_ = NULL;
			_data_->_tmp3_ = _data_->self->priv->split_out_personas;
			_data_->_tmp4_ = NULL;
			_data_->_tmp4_ = _g_object_ref0 (_data_->_tmp3_);
			_data_->_p_list = _data_->_tmp4_;
			_data_->_tmp5_ = NULL;
			_data_->_tmp5_ = _data_->_p_list;
			_data_->_tmp6_ = 0;
			_data_->_tmp6_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp5_);
			_data_->_tmp7_ = 0;
			_data_->_tmp7_ = _data_->_tmp6_;
			_data_->_p_size = _data_->_tmp7_;
			_data_->_p_index = -1;
			while (TRUE) {
				_data_->_tmp8_ = 0;
				_data_->_tmp8_ = _data_->_p_index;
				_data_->_p_index = _data_->_tmp8_ + 1;
				_data_->_tmp9_ = 0;
				_data_->_tmp9_ = _data_->_p_index;
				_data_->_tmp10_ = 0;
				_data_->_tmp10_ = _data_->_p_size;
				if (!(_data_->_tmp9_ < _data_->_tmp10_)) {
					break;
				}
				_data_->_tmp11_ = NULL;
				_data_->_tmp11_ = _data_->_p_list;
				_data_->_tmp12_ = 0;
				_data_->_tmp12_ = _data_->_p_index;
				_data_->_tmp13_ = NULL;
				_data_->_tmp13_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp11_, _data_->_tmp12_);
				_data_->p = (FolksPersona*) _data_->_tmp13_;
				_data_->_tmp14_ = NULL;
				_data_->_tmp14_ = _data_->p;
				g_object_set_data_full ((GObject*) _data_->_tmp14_, "contacts-new-contact", (gpointer) ((gintptr) TRUE), NULL);
				_g_object_unref0 (_data_->p);
			}
			_g_object_unref0 (_data_->_p_list);
		}
	}
	{
		_data_->_tmp15_ = NULL;
		_data_->_tmp15_ = _data_->self->priv->_added_persona;
		if (_data_->_tmp15_ != NULL) {
			_data_->_tmp16_ = NULL;
			_data_->_tmp16_ = _data_->self->priv->_added_persona;
			_data_->_tmp17_ = NULL;
			_data_->_tmp17_ = folks_persona_get_store (_data_->_tmp16_);
			_data_->_tmp18_ = NULL;
			_data_->_tmp18_ = _data_->_tmp17_;
			_data_->_tmp19_ = NULL;
			_data_->_tmp19_ = _data_->self->priv->_added_persona;
			_data_->_state_ = 1;
			folks_persona_store_remove_persona (_data_->_tmp18_, _data_->_tmp19_, contacts_link_operation_undo_ready, _data_);
			return FALSE;
			_state_1:
			folks_persona_store_remove_persona_finish (_data_->_tmp18_, _data_->_res_, &_data_->_inner_error_);
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				goto __catch10_g_error;
			}
		}
		{
			_data_->_tmp20_ = NULL;
			_data_->_tmp20_ = _data_->self->priv->changes;
			_data_->_tmp21_ = NULL;
			_data_->_tmp21_ = _g_object_ref0 (_data_->_tmp20_);
			_data_->_c_list = _data_->_tmp21_;
			_data_->_tmp22_ = NULL;
			_data_->_tmp22_ = _data_->_c_list;
			_data_->_tmp23_ = 0;
			_data_->_tmp23_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp22_);
			_data_->_tmp24_ = 0;
			_data_->_tmp24_ = _data_->_tmp23_;
			_data_->_c_size = _data_->_tmp24_;
			_data_->_c_index = -1;
			while (TRUE) {
				_data_->_tmp25_ = 0;
				_data_->_tmp25_ = _data_->_c_index;
				_data_->_c_index = _data_->_tmp25_ + 1;
				_data_->_tmp26_ = 0;
				_data_->_tmp26_ = _data_->_c_index;
				_data_->_tmp27_ = 0;
				_data_->_tmp27_ = _data_->_c_size;
				if (!(_data_->_tmp26_ < _data_->_tmp27_)) {
					break;
				}
				_data_->_tmp28_ = NULL;
				_data_->_tmp28_ = _data_->_c_list;
				_data_->_tmp29_ = 0;
				_data_->_tmp29_ = _data_->_c_index;
				_data_->_tmp30_ = NULL;
				_data_->_tmp30_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp28_, _data_->_tmp29_);
				_data_->c = (ContactsLinkOperationChange*) _data_->_tmp30_;
				_data_->_tmp31_ = NULL;
				_data_->_tmp31_ = _data_->c;
				_data_->_tmp32_ = NULL;
				_data_->_tmp32_ = _data_->_tmp31_->persona;
				_data_->_tmp33_ = NULL;
				_data_->_tmp33_ = _data_->self->priv->_added_persona;
				if (_data_->_tmp32_ != _data_->_tmp33_) {
					_data_->_tmp34_ = NULL;
					_data_->_tmp34_ = _data_->c;
					_data_->_tmp35_ = NULL;
					_data_->_tmp35_ = _data_->_tmp34_->attribute;
					_data_->_tmp36_ = NULL;
					_data_->_tmp36_ = _data_->c;
					_data_->_tmp37_ = NULL;
					_data_->_tmp37_ = _data_->_tmp36_->persona;
					_data_->_tmp38_ = NULL;
					_data_->_tmp38_ = _data_->c;
					_data_->_tmp39_ = NULL;
					_data_->_tmp39_ = _data_->_tmp38_->old_value;
					_data_->_state_ = 2;
					contacts_persona_attribute_set_value (_data_->_tmp35_, _data_->_tmp37_, _data_->_tmp39_, contacts_link_operation_undo_ready, _data_);
					return FALSE;
					_state_2:
					contacts_persona_attribute_set_value_finish (_data_->_tmp35_, _data_->_res_);
				}
				_contacts_link_operation_change_unref0 (_data_->c);
			}
			_g_object_unref0 (_data_->_c_list);
		}
	}
	goto __finally10;
	__catch10_g_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp40_ = NULL;
		_data_->_tmp40_ = _data_->e;
		_data_->_tmp41_ = NULL;
		_data_->_tmp41_ = _data_->_tmp40_->message;
		g_warning ("contacts-linking.vala:80: Error when undoing linking: %s\n", _data_->_tmp41_);
		_g_error_free0 (_data_->e);
	}
	__finally10:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	_data_->_tmp42_ = NULL;
	_data_->_tmp42_ = _data_->self->priv->main_contact;
	if (_data_->_tmp42_ != NULL) {
		_data_->_tmp43_ = NULL;
		_data_->_tmp43_ = _data_->self->priv->main_contact;
		g_object_set_data_full ((GObject*) _data_->_tmp43_, "contacts-master-at-join", (gpointer) ((gintptr) FALSE), NULL);
	}
	_data_->_tmp44_ = NULL;
	_data_->_tmp44_ = _data_->self->priv->split_out_personas;
	if (_data_->_tmp44_ != NULL) {
		{
			_data_->_tmp45_ = NULL;
			_data_->_tmp45_ = _data_->self->priv->split_out_personas;
			_data_->_tmp46_ = NULL;
			_data_->_tmp46_ = _g_object_ref0 (_data_->_tmp45_);
			_data_->_vala1__p_list = _data_->_tmp46_;
			_data_->_tmp47_ = NULL;
			_data_->_tmp47_ = _data_->_vala1__p_list;
			_data_->_tmp48_ = 0;
			_data_->_tmp48_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp47_);
			_data_->_tmp49_ = 0;
			_data_->_tmp49_ = _data_->_tmp48_;
			_data_->_vala1__p_size = _data_->_tmp49_;
			_data_->_vala1__p_index = -1;
			while (TRUE) {
				_data_->_tmp50_ = 0;
				_data_->_tmp50_ = _data_->_vala1__p_index;
				_data_->_vala1__p_index = _data_->_tmp50_ + 1;
				_data_->_tmp51_ = 0;
				_data_->_tmp51_ = _data_->_vala1__p_index;
				_data_->_tmp52_ = 0;
				_data_->_tmp52_ = _data_->_vala1__p_size;
				if (!(_data_->_tmp51_ < _data_->_tmp52_)) {
					break;
				}
				_data_->_tmp53_ = NULL;
				_data_->_tmp53_ = _data_->_vala1__p_list;
				_data_->_tmp54_ = 0;
				_data_->_tmp54_ = _data_->_vala1__p_index;
				_data_->_tmp55_ = NULL;
				_data_->_tmp55_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp53_, _data_->_tmp54_);
				_data_->_vala1_p = (FolksPersona*) _data_->_tmp55_;
				_data_->_tmp56_ = NULL;
				_data_->_tmp56_ = _data_->_vala1_p;
				g_object_set_data_full ((GObject*) _data_->_tmp56_, "contacts-new-contact", (gpointer) ((gintptr) FALSE), NULL);
				_g_object_unref0 (_data_->_vala1_p);
			}
			_g_object_unref0 (_data_->_vala1__p_list);
		}
	}
	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;
}


ContactsLinkOperationChange* contacts_link_operation_change_construct (GType object_type) {
	ContactsLinkOperationChange* self = NULL;
	self = (ContactsLinkOperationChange*) g_type_create_instance (object_type);
	return self;
}


ContactsLinkOperationChange* contacts_link_operation_change_new (void) {
	return contacts_link_operation_change_construct (CONTACTS_LINK_OPERATION_TYPE_CHANGE);
}


static void contacts_link_operation_value_change_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void contacts_link_operation_value_change_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		contacts_link_operation_change_unref (value->data[0].v_pointer);
	}
}


static void contacts_link_operation_value_change_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = contacts_link_operation_change_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer contacts_link_operation_value_change_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* contacts_link_operation_value_change_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		ContactsLinkOperationChange* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = contacts_link_operation_change_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* contacts_link_operation_value_change_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	ContactsLinkOperationChange** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = contacts_link_operation_change_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* contacts_link_operation_param_spec_change (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ContactsLinkOperationParamSpecChange* spec;
	g_return_val_if_fail (g_type_is_a (object_type, CONTACTS_LINK_OPERATION_TYPE_CHANGE), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer contacts_link_operation_value_get_change (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CONTACTS_LINK_OPERATION_TYPE_CHANGE), NULL);
	return value->data[0].v_pointer;
}


void contacts_link_operation_value_set_change (GValue* value, gpointer v_object) {
	ContactsLinkOperationChange* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CONTACTS_LINK_OPERATION_TYPE_CHANGE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, CONTACTS_LINK_OPERATION_TYPE_CHANGE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		contacts_link_operation_change_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		contacts_link_operation_change_unref (old);
	}
}


void contacts_link_operation_value_take_change (GValue* value, gpointer v_object) {
	ContactsLinkOperationChange* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CONTACTS_LINK_OPERATION_TYPE_CHANGE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, CONTACTS_LINK_OPERATION_TYPE_CHANGE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		contacts_link_operation_change_unref (old);
	}
}


static void contacts_link_operation_change_class_init (ContactsLinkOperationChangeClass * klass) {
	contacts_link_operation_change_parent_class = g_type_class_peek_parent (klass);
	((ContactsLinkOperationChangeClass *) klass)->finalize = contacts_link_operation_change_finalize;
}


static void contacts_link_operation_change_instance_init (ContactsLinkOperationChange * self) {
	self->ref_count = 1;
}


static void contacts_link_operation_change_finalize (ContactsLinkOperationChange* obj) {
	ContactsLinkOperationChange * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_LINK_OPERATION_TYPE_CHANGE, ContactsLinkOperationChange);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->attribute);
	_g_object_unref0 (self->persona);
	_g_object_unref0 (self->old_value);
}


GType contacts_link_operation_change_get_type (void) {
	static volatile gsize contacts_link_operation_change_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_link_operation_change_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { contacts_link_operation_value_change_init, contacts_link_operation_value_change_free_value, contacts_link_operation_value_change_copy_value, contacts_link_operation_value_change_peek_pointer, "p", contacts_link_operation_value_change_collect_value, "p", contacts_link_operation_value_change_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (ContactsLinkOperationChangeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_link_operation_change_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsLinkOperationChange), 0, (GInstanceInitFunc) contacts_link_operation_change_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType contacts_link_operation_change_type_id;
		contacts_link_operation_change_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ContactsLinkOperationChange", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&contacts_link_operation_change_type_id__volatile, contacts_link_operation_change_type_id);
	}
	return contacts_link_operation_change_type_id__volatile;
}


gpointer contacts_link_operation_change_ref (gpointer instance) {
	ContactsLinkOperationChange* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void contacts_link_operation_change_unref (gpointer instance) {
	ContactsLinkOperationChange* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		CONTACTS_LINK_OPERATION_CHANGE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


static void contacts_link_operation_class_init (ContactsLinkOperationClass * klass) {
	contacts_link_operation_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ContactsLinkOperationPrivate));
	G_OBJECT_CLASS (klass)->finalize = contacts_link_operation_finalize;
}


static void contacts_link_operation_instance_init (ContactsLinkOperation * self) {
	self->priv = CONTACTS_LINK_OPERATION_GET_PRIVATE (self);
}


static void contacts_link_operation_finalize (GObject* obj) {
	ContactsLinkOperation * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_LINK_OPERATION, ContactsLinkOperation);
	_g_object_unref0 (self->priv->_added_persona);
	_g_object_unref0 (self->priv->main_contact);
	_g_object_unref0 (self->priv->split_out_personas);
	_g_object_unref0 (self->priv->changes);
	G_OBJECT_CLASS (contacts_link_operation_parent_class)->finalize (obj);
}


GType contacts_link_operation_get_type (void) {
	static volatile gsize contacts_link_operation_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_link_operation_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsLinkOperationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_link_operation_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsLinkOperation), 0, (GInstanceInitFunc) contacts_link_operation_instance_init, NULL };
		GType contacts_link_operation_type_id;
		contacts_link_operation_type_id = g_type_register_static (G_TYPE_OBJECT, "ContactsLinkOperation", &g_define_type_info, 0);
		g_once_init_leave (&contacts_link_operation_type_id__volatile, contacts_link_operation_type_id);
	}
	return contacts_link_operation_type_id__volatile;
}


GeeHashSet* contacts_persona_attribute_create_set (void) {
	GeeHashSet* result = NULL;
	GeeHashSet* _tmp0_ = NULL;
	_tmp0_ = gee_hash_set_new (CONTACTS_TYPE_PERSONA_ATTRIBUTE, (GBoxedCopyFunc) g_object_ref, g_object_unref, (GeeHashDataFunc) contacts_persona_attribute_hash, NULL, NULL, (GeeEqualDataFunc) contacts_persona_attribute_equal, NULL, NULL);
	result = _tmp0_;
	return result;
}


static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle) {
	int i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}


static gboolean contacts_persona_attribute_real_is_removable (ContactsPersonaAttribute* self, FolksPersona* from_persona) {
	gboolean result = FALSE;
	const gchar* _tmp0_ = NULL;
	FolksPersona* _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	gchar** _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	g_return_val_if_fail (from_persona != NULL, FALSE);
	_tmp0_ = self->property_name;
	_tmp1_ = from_persona;
	_tmp2_ = folks_persona_get_writeable_properties (_tmp1_, &_tmp2__length1);
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _tmp2__length1;
	result = _vala_string_array_contains (_tmp3_, _tmp3__length1, _tmp0_);
	return result;
}


gboolean contacts_persona_attribute_is_removable (ContactsPersonaAttribute* self, FolksPersona* from_persona) {
	g_return_val_if_fail (self != NULL, FALSE);
	return CONTACTS_PERSONA_ATTRIBUTE_GET_CLASS (self)->is_removable (self, from_persona);
}


static gboolean contacts_persona_attribute_real_is_referenced_by_persona (ContactsPersonaAttribute* self, FolksPersona* persona) {
	g_critical ("Type `%s' does not implement abstract method `contacts_persona_attribute_is_referenced_by_persona'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return FALSE;
}


gboolean contacts_persona_attribute_is_referenced_by_persona (ContactsPersonaAttribute* self, FolksPersona* persona) {
	g_return_val_if_fail (self != NULL, FALSE);
	return CONTACTS_PERSONA_ATTRIBUTE_GET_CLASS (self)->is_referenced_by_persona (self, persona);
}


static gboolean contacts_persona_attribute_real_equal (ContactsPersonaAttribute* self, ContactsPersonaAttribute* that) {
	gboolean result = FALSE;
	const gchar* _tmp0_ = NULL;
	ContactsPersonaAttribute* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	g_return_val_if_fail (that != NULL, FALSE);
	_tmp0_ = self->property_name;
	_tmp1_ = that;
	_tmp2_ = _tmp1_->property_name;
	result = g_strcmp0 (_tmp0_, _tmp2_) == 0;
	return result;
}


gboolean contacts_persona_attribute_equal (ContactsPersonaAttribute* self, ContactsPersonaAttribute* that) {
	g_return_val_if_fail (self != NULL, FALSE);
	return CONTACTS_PERSONA_ATTRIBUTE_GET_CLASS (self)->equal (self, that);
}


static guint contacts_persona_attribute_real_hash (ContactsPersonaAttribute* self) {
	guint result = 0U;
	const gchar* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	_tmp0_ = self->property_name;
	_tmp1_ = g_str_hash (_tmp0_);
	result = _tmp1_;
	return result;
}


guint contacts_persona_attribute_hash (ContactsPersonaAttribute* self) {
	g_return_val_if_fail (self != NULL, 0U);
	return CONTACTS_PERSONA_ATTRIBUTE_GET_CLASS (self)->hash (self);
}


void contacts_persona_attribute_persona_apply_attributes (ContactsPersonaAttribute* self, FolksPersona* persona, GeeSet* added_attributes, GeeSet* removed_attributes, ContactsLinkOperation* operation, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	CONTACTS_PERSONA_ATTRIBUTE_GET_CLASS (self)->persona_apply_attributes (self, persona, added_attributes, removed_attributes, operation, _callback_, _user_data_);
}


void contacts_persona_attribute_persona_apply_attributes_finish (ContactsPersonaAttribute* self, GAsyncResult* _res_) {
	CONTACTS_PERSONA_ATTRIBUTE_GET_CLASS (self)->persona_apply_attributes_finish (self, _res_);
}


void contacts_persona_attribute_set_value (ContactsPersonaAttribute* self, FolksPersona* persona, GObject* value, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	CONTACTS_PERSONA_ATTRIBUTE_GET_CLASS (self)->set_value (self, persona, value, _callback_, _user_data_);
}


void contacts_persona_attribute_set_value_finish (ContactsPersonaAttribute* self, GAsyncResult* _res_) {
	CONTACTS_PERSONA_ATTRIBUTE_GET_CLASS (self)->set_value_finish (self, _res_);
}


ContactsPersonaAttribute* contacts_persona_attribute_construct (GType object_type) {
	ContactsPersonaAttribute * self = NULL;
	self = (ContactsPersonaAttribute*) g_object_new (object_type, NULL);
	return self;
}


static void contacts_persona_attribute_class_init (ContactsPersonaAttributeClass * klass) {
	contacts_persona_attribute_parent_class = g_type_class_peek_parent (klass);
	((ContactsPersonaAttributeClass *) klass)->is_removable = contacts_persona_attribute_real_is_removable;
	((ContactsPersonaAttributeClass *) klass)->is_referenced_by_persona = contacts_persona_attribute_real_is_referenced_by_persona;
	((ContactsPersonaAttributeClass *) klass)->equal = contacts_persona_attribute_real_equal;
	((ContactsPersonaAttributeClass *) klass)->hash = contacts_persona_attribute_real_hash;
	G_OBJECT_CLASS (klass)->finalize = contacts_persona_attribute_finalize;
}


static void contacts_persona_attribute_instance_init (ContactsPersonaAttribute * self) {
}


static void contacts_persona_attribute_finalize (GObject* obj) {
	ContactsPersonaAttribute * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_PERSONA_ATTRIBUTE, ContactsPersonaAttribute);
	_g_free0 (self->property_name);
	G_OBJECT_CLASS (contacts_persona_attribute_parent_class)->finalize (obj);
}


GType contacts_persona_attribute_get_type (void) {
	static volatile gsize contacts_persona_attribute_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_persona_attribute_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsPersonaAttributeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_persona_attribute_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsPersonaAttribute), 0, (GInstanceInitFunc) contacts_persona_attribute_instance_init, NULL };
		GType contacts_persona_attribute_type_id;
		contacts_persona_attribute_type_id = g_type_register_static (G_TYPE_OBJECT, "ContactsPersonaAttribute", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&contacts_persona_attribute_type_id__volatile, contacts_persona_attribute_type_id);
	}
	return contacts_persona_attribute_type_id__volatile;
}


ContactsPersonaAttributeLocalId* contacts_persona_attribute_local_id_construct (GType object_type, const gchar* value) {
	ContactsPersonaAttributeLocalId * self = NULL;
	gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	g_return_val_if_fail (value != NULL, NULL);
	self = (ContactsPersonaAttributeLocalId*) contacts_persona_attribute_construct (object_type);
	_tmp0_ = g_strdup ("local-ids");
	_g_free0 (((ContactsPersonaAttribute*) self)->property_name);
	((ContactsPersonaAttribute*) self)->property_name = _tmp0_;
	_tmp1_ = value;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (self->priv->value);
	self->priv->value = _tmp2_;
	return self;
}


ContactsPersonaAttributeLocalId* contacts_persona_attribute_local_id_new (const gchar* value) {
	return contacts_persona_attribute_local_id_construct (CONTACTS_TYPE_PERSONA_ATTRIBUTE_LOCAL_ID, value);
}


static gboolean contacts_persona_attribute_local_id_real_is_removable (ContactsPersonaAttribute* base, FolksPersona* from_persona) {
	ContactsPersonaAttributeLocalId * self;
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	FolksPersona* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	self = (ContactsPersonaAttributeLocalId*) base;
	g_return_val_if_fail (from_persona != NULL, FALSE);
	_tmp1_ = from_persona;
	_tmp2_ = CONTACTS_PERSONA_ATTRIBUTE_CLASS (contacts_persona_attribute_local_id_parent_class)->is_removable (G_TYPE_CHECK_INSTANCE_CAST (self, CONTACTS_TYPE_PERSONA_ATTRIBUTE, ContactsPersonaAttribute), _tmp1_);
	if (_tmp2_) {
		const gchar* _tmp3_ = NULL;
		FolksPersona* _tmp4_ = NULL;
		const gchar* _tmp5_ = NULL;
		const gchar* _tmp6_ = NULL;
		_tmp3_ = self->priv->value;
		_tmp4_ = from_persona;
		_tmp5_ = folks_persona_get_iid (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = g_strcmp0 (_tmp3_, _tmp6_) != 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}


static gboolean contacts_persona_attribute_local_id_real_is_referenced_by_persona (ContactsPersonaAttribute* base, FolksPersona* persona) {
	ContactsPersonaAttributeLocalId * self;
	gboolean result = FALSE;
	FolksLocalIdDetails* details = NULL;
	FolksPersona* _tmp0_ = NULL;
	FolksLocalIdDetails* _tmp1_ = NULL;
	FolksLocalIdDetails* _tmp2_ = NULL;
	FolksLocalIdDetails* _tmp3_ = NULL;
	GeeSet* _tmp4_ = NULL;
	GeeSet* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	gboolean _tmp7_ = FALSE;
	self = (ContactsPersonaAttributeLocalId*) base;
	g_return_val_if_fail (persona != NULL, FALSE);
	_tmp0_ = persona;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, FOLKS_TYPE_LOCAL_ID_DETAILS) ? ((FolksLocalIdDetails*) _tmp0_) : NULL);
	details = _tmp1_;
	_tmp2_ = details;
	if (_tmp2_ == NULL) {
		result = FALSE;
		_g_object_unref0 (details);
		return result;
	}
	_tmp3_ = details;
	_tmp4_ = folks_local_id_details_get_local_ids (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->value;
	_tmp7_ = gee_collection_contains ((GeeCollection*) _tmp5_, _tmp6_);
	result = _tmp7_;
	_g_object_unref0 (details);
	return result;
}


static void contacts_persona_attribute_local_id_real_persona_apply_attributes_data_free (gpointer _data) {
	ContactsPersonaAttributeLocalIdPersonaApplyAttributesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->persona);
	_g_object_unref0 (_data_->added_attributes);
	_g_object_unref0 (_data_->removed_attributes);
	_g_object_unref0 (_data_->operation);
	_g_object_unref0 (_data_->self);
	g_slice_free (ContactsPersonaAttributeLocalIdPersonaApplyAttributesData, _data_);
}


static void contacts_persona_attribute_local_id_real_persona_apply_attributes (ContactsPersonaAttribute* base, FolksPersona* persona, GeeSet* added_attributes, GeeSet* removed_attributes, ContactsLinkOperation* operation, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsPersonaAttributeLocalId * self;
	ContactsPersonaAttributeLocalIdPersonaApplyAttributesData* _data_;
	ContactsPersonaAttributeLocalId* _tmp0_ = NULL;
	FolksPersona* _tmp1_ = NULL;
	FolksPersona* _tmp2_ = NULL;
	GeeSet* _tmp3_ = NULL;
	GeeSet* _tmp4_ = NULL;
	GeeSet* _tmp5_ = NULL;
	GeeSet* _tmp6_ = NULL;
	ContactsLinkOperation* _tmp7_ = NULL;
	ContactsLinkOperation* _tmp8_ = NULL;
	self = (ContactsPersonaAttributeLocalId*) base;
	_data_ = g_slice_new0 (ContactsPersonaAttributeLocalIdPersonaApplyAttributesData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, contacts_persona_attribute_local_id_real_persona_apply_attributes);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, contacts_persona_attribute_local_id_real_persona_apply_attributes_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = persona;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->persona);
	_data_->persona = _tmp2_;
	_tmp3_ = added_attributes;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (_data_->added_attributes);
	_data_->added_attributes = _tmp4_;
	_tmp5_ = removed_attributes;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	_g_object_unref0 (_data_->removed_attributes);
	_data_->removed_attributes = _tmp6_;
	_tmp7_ = operation;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	_g_object_unref0 (_data_->operation);
	_data_->operation = _tmp8_;
	contacts_persona_attribute_local_id_real_persona_apply_attributes_co (_data_);
}


static void contacts_persona_attribute_local_id_real_persona_apply_attributes_finish (ContactsPersonaAttribute* base, GAsyncResult* _res_) {
	ContactsPersonaAttributeLocalIdPersonaApplyAttributesData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void contacts_persona_attribute_local_id_persona_apply_attributes_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ContactsPersonaAttributeLocalIdPersonaApplyAttributesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_persona_attribute_local_id_real_persona_apply_attributes_co (_data_);
}


static gboolean contacts_persona_attribute_local_id_real_persona_apply_attributes_co (ContactsPersonaAttributeLocalIdPersonaApplyAttributesData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->persona;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp0_, FOLKS_TYPE_LOCAL_ID_DETAILS) ? ((FolksLocalIdDetails*) _data_->_tmp0_) : NULL);
	_data_->details = _data_->_tmp1_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->details;
	if (_data_->_tmp2_ == NULL) {
		_g_object_unref0 (_data_->details);
		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;
	}
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->added_values = _data_->_tmp3_;
	{
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = _data_->added_attributes;
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp4_);
		_data_->_added_it = _data_->_tmp5_;
		while (TRUE) {
			_data_->_tmp6_ = NULL;
			_data_->_tmp6_ = _data_->_added_it;
			_data_->_tmp7_ = FALSE;
			_data_->_tmp7_ = gee_iterator_next (_data_->_tmp6_);
			if (!_data_->_tmp7_) {
				break;
			}
			_data_->_tmp8_ = NULL;
			_data_->_tmp8_ = _data_->_added_it;
			_data_->_tmp9_ = NULL;
			_data_->_tmp9_ = gee_iterator_get (_data_->_tmp8_);
			_data_->added = (ContactsPersonaAttribute*) _data_->_tmp9_;
			_data_->_tmp10_ = NULL;
			_data_->_tmp10_ = _data_->added_values;
			_data_->_tmp11_ = NULL;
			_data_->_tmp11_ = _data_->added;
			_data_->_tmp12_ = NULL;
			_data_->_tmp12_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp11_, CONTACTS_TYPE_PERSONA_ATTRIBUTE_LOCAL_ID, ContactsPersonaAttributeLocalId)->priv->value;
			gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp10_, _data_->_tmp12_);
			_g_object_unref0 (_data_->added);
		}
		_g_object_unref0 (_data_->_added_it);
	}
	_data_->_tmp13_ = NULL;
	_data_->_tmp13_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->removed_values = _data_->_tmp13_;
	{
		_data_->_tmp14_ = NULL;
		_data_->_tmp14_ = _data_->removed_attributes;
		_data_->_tmp15_ = NULL;
		_data_->_tmp15_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp14_);
		_data_->_removed_it = _data_->_tmp15_;
		while (TRUE) {
			_data_->_tmp16_ = NULL;
			_data_->_tmp16_ = _data_->_removed_it;
			_data_->_tmp17_ = FALSE;
			_data_->_tmp17_ = gee_iterator_next (_data_->_tmp16_);
			if (!_data_->_tmp17_) {
				break;
			}
			_data_->_tmp18_ = NULL;
			_data_->_tmp18_ = _data_->_removed_it;
			_data_->_tmp19_ = NULL;
			_data_->_tmp19_ = gee_iterator_get (_data_->_tmp18_);
			_data_->removed = (ContactsPersonaAttribute*) _data_->_tmp19_;
			_data_->_tmp20_ = NULL;
			_data_->_tmp20_ = _data_->removed_values;
			_data_->_tmp21_ = NULL;
			_data_->_tmp21_ = _data_->removed;
			_data_->_tmp22_ = NULL;
			_data_->_tmp22_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp21_, CONTACTS_TYPE_PERSONA_ATTRIBUTE_LOCAL_ID, ContactsPersonaAttributeLocalId)->priv->value;
			gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp20_, _data_->_tmp22_);
			_g_object_unref0 (_data_->removed);
		}
		_g_object_unref0 (_data_->_removed_it);
	}
	_data_->_tmp23_ = NULL;
	_data_->_tmp23_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->new_values = _data_->_tmp23_;
	_data_->changed = FALSE;
	{
		_data_->_tmp24_ = NULL;
		_data_->_tmp24_ = _data_->details;
		_data_->_tmp25_ = NULL;
		_data_->_tmp25_ = folks_local_id_details_get_local_ids (_data_->_tmp24_);
		_data_->_tmp26_ = NULL;
		_data_->_tmp26_ = _data_->_tmp25_;
		_data_->_tmp27_ = NULL;
		_data_->_tmp27_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp26_);
		_data_->_v_it = _data_->_tmp27_;
		while (TRUE) {
			_data_->_tmp28_ = NULL;
			_data_->_tmp28_ = _data_->_v_it;
			_data_->_tmp29_ = FALSE;
			_data_->_tmp29_ = gee_iterator_next (_data_->_tmp28_);
			if (!_data_->_tmp29_) {
				break;
			}
			_data_->_tmp30_ = NULL;
			_data_->_tmp30_ = _data_->_v_it;
			_data_->_tmp31_ = NULL;
			_data_->_tmp31_ = gee_iterator_get (_data_->_tmp30_);
			_data_->v = (gchar*) _data_->_tmp31_;
			_data_->_tmp32_ = NULL;
			_data_->_tmp32_ = _data_->removed_values;
			_data_->_tmp33_ = NULL;
			_data_->_tmp33_ = _data_->v;
			_data_->_tmp34_ = FALSE;
			_data_->_tmp34_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _data_->_tmp32_, _data_->_tmp33_);
			if (_data_->_tmp34_) {
				_data_->changed = TRUE;
				_g_free0 (_data_->v);
				continue;
			}
			_data_->_tmp35_ = NULL;
			_data_->_tmp35_ = _data_->new_values;
			_data_->_tmp36_ = NULL;
			_data_->_tmp36_ = _data_->v;
			gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp35_, _data_->_tmp36_);
			_data_->_tmp37_ = NULL;
			_data_->_tmp37_ = _data_->added_values;
			_data_->_tmp38_ = NULL;
			_data_->_tmp38_ = _data_->v;
			_data_->_tmp39_ = FALSE;
			_data_->_tmp39_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _data_->_tmp37_, _data_->_tmp38_);
			if (_data_->_tmp39_) {
				_data_->_tmp40_ = NULL;
				_data_->_tmp40_ = _data_->added_values;
				_data_->_tmp41_ = NULL;
				_data_->_tmp41_ = _data_->v;
				gee_abstract_collection_remove ((GeeAbstractCollection*) _data_->_tmp40_, _data_->_tmp41_);
			}
			_g_free0 (_data_->v);
		}
		_g_object_unref0 (_data_->_v_it);
	}
	{
		_data_->_tmp42_ = NULL;
		_data_->_tmp42_ = _data_->added_values;
		_data_->_tmp43_ = NULL;
		_data_->_tmp43_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) _data_->_tmp42_);
		_data_->_v2_it = _data_->_tmp43_;
		while (TRUE) {
			_data_->_tmp44_ = NULL;
			_data_->_tmp44_ = _data_->_v2_it;
			_data_->_tmp45_ = FALSE;
			_data_->_tmp45_ = gee_iterator_next (_data_->_tmp44_);
			if (!_data_->_tmp45_) {
				break;
			}
			_data_->_tmp46_ = NULL;
			_data_->_tmp46_ = _data_->_v2_it;
			_data_->_tmp47_ = NULL;
			_data_->_tmp47_ = gee_iterator_get (_data_->_tmp46_);
			_data_->v2 = (gchar*) _data_->_tmp47_;
			_data_->changed = TRUE;
			_data_->_tmp48_ = NULL;
			_data_->_tmp48_ = _data_->new_values;
			_data_->_tmp49_ = NULL;
			_data_->_tmp49_ = _data_->v2;
			gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp48_, _data_->_tmp49_);
			_g_free0 (_data_->v2);
		}
		_g_object_unref0 (_data_->_v2_it);
	}
	_data_->_tmp50_ = FALSE;
	_data_->_tmp50_ = _data_->changed;
	if (_data_->_tmp50_) {
		{
			_data_->_tmp51_ = NULL;
			_data_->_tmp51_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL, NULL, NULL);
			_data_->old_value = _data_->_tmp51_;
			_data_->_tmp52_ = NULL;
			_data_->_tmp52_ = _data_->old_value;
			_data_->_tmp53_ = NULL;
			_data_->_tmp53_ = _data_->details;
			_data_->_tmp54_ = NULL;
			_data_->_tmp54_ = folks_local_id_details_get_local_ids (_data_->_tmp53_);
			_data_->_tmp55_ = NULL;
			_data_->_tmp55_ = _data_->_tmp54_;
			gee_collection_add_all ((GeeCollection*) _data_->_tmp52_, (GeeCollection*) _data_->_tmp55_);
			_data_->_tmp56_ = NULL;
			_data_->_tmp56_ = _data_->details;
			_data_->_tmp57_ = NULL;
			_data_->_tmp57_ = _data_->new_values;
			_data_->_state_ = 1;
			folks_local_id_details_change_local_ids (_data_->_tmp56_, (GeeSet*) _data_->_tmp57_, contacts_persona_attribute_local_id_persona_apply_attributes_ready, _data_);
			return FALSE;
			_state_1:
			folks_local_id_details_change_local_ids_finish (_data_->_tmp56_, _data_->_res_, &_data_->_inner_error_);
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				_g_object_unref0 (_data_->old_value);
				goto __catch11_g_error;
			}
			_data_->_tmp58_ = NULL;
			_data_->_tmp58_ = _data_->operation;
			_data_->_tmp59_ = NULL;
			_data_->_tmp59_ = _data_->persona;
			_data_->_tmp60_ = NULL;
			_data_->_tmp60_ = _data_->old_value;
			contacts_link_operation_add_change (_data_->_tmp58_, (ContactsPersonaAttribute*) _data_->self, _data_->_tmp59_, (GObject*) _data_->_tmp60_);
			_g_object_unref0 (_data_->old_value);
		}
		goto __finally11;
		__catch11_g_error:
		{
			_data_->e = _data_->_inner_error_;
			_data_->_inner_error_ = NULL;
			_data_->_tmp61_ = NULL;
			_data_->_tmp61_ = _data_->e;
			_data_->_tmp62_ = NULL;
			_data_->_tmp62_ = _data_->_tmp61_->message;
			g_warning ("contacts-linking.vala:193: Unable to set local ids when linking: %s\n", _data_->_tmp62_);
			_g_error_free0 (_data_->e);
		}
		__finally11:
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_object_unref0 (_data_->new_values);
			_g_object_unref0 (_data_->removed_values);
			_g_object_unref0 (_data_->added_values);
			_g_object_unref0 (_data_->details);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
	}
	_g_object_unref0 (_data_->new_values);
	_g_object_unref0 (_data_->removed_values);
	_g_object_unref0 (_data_->added_values);
	_g_object_unref0 (_data_->details);
	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 void contacts_persona_attribute_local_id_real_set_value_data_free (gpointer _data) {
	ContactsPersonaAttributeLocalIdSetValueData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->persona);
	_g_object_unref0 (_data_->value);
	_g_object_unref0 (_data_->self);
	g_slice_free (ContactsPersonaAttributeLocalIdSetValueData, _data_);
}


static void contacts_persona_attribute_local_id_real_set_value (ContactsPersonaAttribute* base, FolksPersona* persona, GObject* value, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsPersonaAttributeLocalId * self;
	ContactsPersonaAttributeLocalIdSetValueData* _data_;
	ContactsPersonaAttributeLocalId* _tmp0_ = NULL;
	FolksPersona* _tmp1_ = NULL;
	FolksPersona* _tmp2_ = NULL;
	GObject* _tmp3_ = NULL;
	GObject* _tmp4_ = NULL;
	self = (ContactsPersonaAttributeLocalId*) base;
	_data_ = g_slice_new0 (ContactsPersonaAttributeLocalIdSetValueData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, contacts_persona_attribute_local_id_real_set_value);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, contacts_persona_attribute_local_id_real_set_value_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = persona;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->persona);
	_data_->persona = _tmp2_;
	_tmp3_ = value;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (_data_->value);
	_data_->value = _tmp4_;
	contacts_persona_attribute_local_id_real_set_value_co (_data_);
}


static void contacts_persona_attribute_local_id_real_set_value_finish (ContactsPersonaAttribute* base, GAsyncResult* _res_) {
	ContactsPersonaAttributeLocalIdSetValueData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void contacts_persona_attribute_local_id_set_value_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ContactsPersonaAttributeLocalIdSetValueData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_persona_attribute_local_id_real_set_value_co (_data_);
}


static gboolean contacts_persona_attribute_local_id_real_set_value_co (ContactsPersonaAttributeLocalIdSetValueData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->persona;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp0_, FOLKS_TYPE_LOCAL_ID_DETAILS) ? ((FolksLocalIdDetails*) _data_->_tmp0_) : NULL);
	_data_->details = _data_->_tmp1_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->details;
	if (_data_->_tmp2_ == NULL) {
		_g_object_unref0 (_data_->details);
		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;
	}
	{
		_data_->_tmp3_ = NULL;
		_data_->_tmp3_ = _data_->value;
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp3_, GEE_TYPE_HASH_SET) ? ((GeeHashSet*) _data_->_tmp3_) : NULL);
		_data_->v = _data_->_tmp4_;
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = _data_->details;
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = _data_->v;
		_data_->_state_ = 1;
		folks_local_id_details_change_local_ids (_data_->_tmp5_, (GeeSet*) _data_->_tmp6_, contacts_persona_attribute_local_id_set_value_ready, _data_);
		return FALSE;
		_state_1:
		folks_local_id_details_change_local_ids_finish (_data_->_tmp5_, _data_->_res_, &_data_->_inner_error_);
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_object_unref0 (_data_->v);
			goto __catch12_g_error;
		}
		_g_object_unref0 (_data_->v);
	}
	goto __finally12;
	__catch12_g_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp7_ = NULL;
		_data_->_tmp7_ = _data_->e;
		_data_->_tmp8_ = NULL;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		g_warning ("contacts-linking.vala:207: Unable to set local ids when undoing link: " \
"%s\n", _data_->_tmp8_);
		_g_error_free0 (_data_->e);
	}
	__finally12:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_object_unref0 (_data_->details);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	_g_object_unref0 (_data_->details);
	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 contacts_persona_attribute_local_id_real_equal (ContactsPersonaAttribute* base, ContactsPersonaAttribute* _that) {
	ContactsPersonaAttributeLocalId * self;
	gboolean result = FALSE;
	ContactsPersonaAttributeLocalId* that = NULL;
	ContactsPersonaAttribute* _tmp0_ = NULL;
	ContactsPersonaAttributeLocalId* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	ContactsPersonaAttributeLocalId* _tmp4_ = NULL;
	self = (ContactsPersonaAttributeLocalId*) base;
	g_return_val_if_fail (_that != NULL, FALSE);
	_tmp0_ = _that;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, CONTACTS_TYPE_PERSONA_ATTRIBUTE_LOCAL_ID) ? ((ContactsPersonaAttributeLocalId*) _tmp0_) : NULL);
	that = _tmp1_;
	_tmp4_ = that;
	if (_tmp4_ != NULL) {
		ContactsPersonaAttributeLocalId* _tmp5_ = NULL;
		gboolean _tmp6_ = FALSE;
		_tmp5_ = that;
		_tmp6_ = CONTACTS_PERSONA_ATTRIBUTE_CLASS (contacts_persona_attribute_local_id_parent_class)->equal (G_TYPE_CHECK_INSTANCE_CAST (self, CONTACTS_TYPE_PERSONA_ATTRIBUTE, ContactsPersonaAttribute), (ContactsPersonaAttribute*) _tmp5_);
		_tmp3_ = _tmp6_;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		const gchar* _tmp7_ = NULL;
		ContactsPersonaAttributeLocalId* _tmp8_ = NULL;
		const gchar* _tmp9_ = NULL;
		_tmp7_ = self->priv->value;
		_tmp8_ = that;
		_tmp9_ = _tmp8_->priv->value;
		_tmp2_ = g_strcmp0 (_tmp7_, _tmp9_) == 0;
	} else {
		_tmp2_ = FALSE;
	}
	result = _tmp2_;
	_g_object_unref0 (that);
	return result;
}


static guint contacts_persona_attribute_local_id_real_hash (ContactsPersonaAttribute* base) {
	ContactsPersonaAttributeLocalId * self;
	guint result = 0U;
	const gchar* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	guint _tmp2_ = 0U;
	self = (ContactsPersonaAttributeLocalId*) base;
	_tmp0_ = self->priv->value;
	_tmp1_ = g_str_hash (_tmp0_);
	_tmp2_ = CONTACTS_PERSONA_ATTRIBUTE_CLASS (contacts_persona_attribute_local_id_parent_class)->hash (G_TYPE_CHECK_INSTANCE_CAST (self, CONTACTS_TYPE_PERSONA_ATTRIBUTE, ContactsPersonaAttribute));
	result = _tmp1_ ^ _tmp2_;
	return result;
}


static void contacts_persona_attribute_local_id_class_init (ContactsPersonaAttributeLocalIdClass * klass) {
	contacts_persona_attribute_local_id_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ContactsPersonaAttributeLocalIdPrivate));
	((ContactsPersonaAttributeClass *) klass)->is_removable = contacts_persona_attribute_local_id_real_is_removable;
	((ContactsPersonaAttributeClass *) klass)->is_referenced_by_persona = contacts_persona_attribute_local_id_real_is_referenced_by_persona;
	((ContactsPersonaAttributeClass *) klass)->persona_apply_attributes = contacts_persona_attribute_local_id_real_persona_apply_attributes;
	((ContactsPersonaAttributeClass *) klass)->persona_apply_attributes_finish = contacts_persona_attribute_local_id_real_persona_apply_attributes_finish;
	((ContactsPersonaAttributeClass *) klass)->set_value = contacts_persona_attribute_local_id_real_set_value;
	((ContactsPersonaAttributeClass *) klass)->set_value_finish = contacts_persona_attribute_local_id_real_set_value_finish;
	((ContactsPersonaAttributeClass *) klass)->equal = contacts_persona_attribute_local_id_real_equal;
	((ContactsPersonaAttributeClass *) klass)->hash = contacts_persona_attribute_local_id_real_hash;
	G_OBJECT_CLASS (klass)->finalize = contacts_persona_attribute_local_id_finalize;
}


static void contacts_persona_attribute_local_id_instance_init (ContactsPersonaAttributeLocalId * self) {
	self->priv = CONTACTS_PERSONA_ATTRIBUTE_LOCAL_ID_GET_PRIVATE (self);
}


static void contacts_persona_attribute_local_id_finalize (GObject* obj) {
	ContactsPersonaAttributeLocalId * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_PERSONA_ATTRIBUTE_LOCAL_ID, ContactsPersonaAttributeLocalId);
	_g_free0 (self->priv->value);
	G_OBJECT_CLASS (contacts_persona_attribute_local_id_parent_class)->finalize (obj);
}


GType contacts_persona_attribute_local_id_get_type (void) {
	static volatile gsize contacts_persona_attribute_local_id_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_persona_attribute_local_id_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsPersonaAttributeLocalIdClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_persona_attribute_local_id_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsPersonaAttributeLocalId), 0, (GInstanceInitFunc) contacts_persona_attribute_local_id_instance_init, NULL };
		GType contacts_persona_attribute_local_id_type_id;
		contacts_persona_attribute_local_id_type_id = g_type_register_static (CONTACTS_TYPE_PERSONA_ATTRIBUTE, "ContactsPersonaAttributeLocalId", &g_define_type_info, 0);
		g_once_init_leave (&contacts_persona_attribute_local_id_type_id__volatile, contacts_persona_attribute_local_id_type_id);
	}
	return contacts_persona_attribute_local_id_type_id__volatile;
}


ContactsPersonaAttributeImAddress* contacts_persona_attribute_im_address_construct (GType object_type, const gchar* protocol, FolksImFieldDetails* detail) {
	ContactsPersonaAttributeImAddress * self = NULL;
	gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	FolksImFieldDetails* _tmp3_ = NULL;
	FolksImFieldDetails* _tmp4_ = NULL;
	g_return_val_if_fail (protocol != NULL, NULL);
	g_return_val_if_fail (detail != NULL, NULL);
	self = (ContactsPersonaAttributeImAddress*) contacts_persona_attribute_construct (object_type);
	_tmp0_ = g_strdup ("im-addresses");
	_g_free0 (((ContactsPersonaAttribute*) self)->property_name);
	((ContactsPersonaAttribute*) self)->property_name = _tmp0_;
	_tmp1_ = protocol;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (self->priv->protocol);
	self->priv->protocol = _tmp2_;
	_tmp3_ = detail;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (self->priv->detail);
	self->priv->detail = _tmp4_;
	return self;
}


ContactsPersonaAttributeImAddress* contacts_persona_attribute_im_address_new (const gchar* protocol, FolksImFieldDetails* detail) {
	return contacts_persona_attribute_im_address_construct (CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS, protocol, detail);
}


static gboolean contacts_persona_attribute_im_address_real_is_referenced_by_persona (ContactsPersonaAttribute* base, FolksPersona* persona) {
	ContactsPersonaAttributeImAddress * self;
	gboolean result = FALSE;
	FolksImDetails* details = NULL;
	FolksPersona* _tmp0_ = NULL;
	FolksImDetails* _tmp1_ = NULL;
	FolksImDetails* _tmp2_ = NULL;
	FolksImDetails* _tmp3_ = NULL;
	GeeMultiMap* _tmp4_ = NULL;
	GeeMultiMap* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	GeeCollection* _tmp7_ = NULL;
	GeeCollection* _tmp8_ = NULL;
	FolksImFieldDetails* _tmp9_ = NULL;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp11_ = FALSE;
	self = (ContactsPersonaAttributeImAddress*) base;
	g_return_val_if_fail (persona != NULL, FALSE);
	_tmp0_ = persona;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, FOLKS_TYPE_IM_DETAILS) ? ((FolksImDetails*) _tmp0_) : NULL);
	details = _tmp1_;
	_tmp2_ = details;
	if (_tmp2_ == NULL) {
		result = FALSE;
		_g_object_unref0 (details);
		return result;
	}
	_tmp3_ = details;
	_tmp4_ = folks_im_details_get_im_addresses (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->protocol;
	_tmp7_ = gee_multi_map_get (_tmp5_, _tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = self->priv->detail;
	_tmp10_ = gee_collection_contains (_tmp8_, _tmp9_);
	_tmp11_ = _tmp10_;
	_g_object_unref0 (_tmp8_);
	result = _tmp11_;
	_g_object_unref0 (details);
	return result;
}


static void contacts_persona_attribute_im_address_real_persona_apply_attributes_data_free (gpointer _data) {
	ContactsPersonaAttributeImAddressPersonaApplyAttributesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->persona);
	_g_object_unref0 (_data_->added_attributes);
	_g_object_unref0 (_data_->removed_attributes);
	_g_object_unref0 (_data_->operation);
	_g_object_unref0 (_data_->self);
	g_slice_free (ContactsPersonaAttributeImAddressPersonaApplyAttributesData, _data_);
}


static void contacts_persona_attribute_im_address_real_persona_apply_attributes (ContactsPersonaAttribute* base, FolksPersona* persona, GeeSet* added_attributes, GeeSet* removed_attributes, ContactsLinkOperation* operation, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsPersonaAttributeImAddress * self;
	ContactsPersonaAttributeImAddressPersonaApplyAttributesData* _data_;
	ContactsPersonaAttributeImAddress* _tmp0_ = NULL;
	FolksPersona* _tmp1_ = NULL;
	FolksPersona* _tmp2_ = NULL;
	GeeSet* _tmp3_ = NULL;
	GeeSet* _tmp4_ = NULL;
	GeeSet* _tmp5_ = NULL;
	GeeSet* _tmp6_ = NULL;
	ContactsLinkOperation* _tmp7_ = NULL;
	ContactsLinkOperation* _tmp8_ = NULL;
	self = (ContactsPersonaAttributeImAddress*) base;
	_data_ = g_slice_new0 (ContactsPersonaAttributeImAddressPersonaApplyAttributesData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, contacts_persona_attribute_im_address_real_persona_apply_attributes);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, contacts_persona_attribute_im_address_real_persona_apply_attributes_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = persona;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->persona);
	_data_->persona = _tmp2_;
	_tmp3_ = added_attributes;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (_data_->added_attributes);
	_data_->added_attributes = _tmp4_;
	_tmp5_ = removed_attributes;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	_g_object_unref0 (_data_->removed_attributes);
	_data_->removed_attributes = _tmp6_;
	_tmp7_ = operation;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	_g_object_unref0 (_data_->operation);
	_data_->operation = _tmp8_;
	contacts_persona_attribute_im_address_real_persona_apply_attributes_co (_data_);
}


static void contacts_persona_attribute_im_address_real_persona_apply_attributes_finish (ContactsPersonaAttribute* base, GAsyncResult* _res_) {
	ContactsPersonaAttributeImAddressPersonaApplyAttributesData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static guint _folks_abstract_field_details_hash_static_gee_hash_data_func (gconstpointer v, gpointer self) {
	guint result;
	result = folks_abstract_field_details_hash_static ((FolksAbstractFieldDetails*) v);
	return result;
}


static gboolean _folks_abstract_field_details_equal_static_gee_equal_data_func (gconstpointer a, gconstpointer b, gpointer self) {
	gboolean result;
	result = folks_abstract_field_details_equal_static ((FolksAbstractFieldDetails*) a, (FolksAbstractFieldDetails*) b);
	return result;
}


static void contacts_persona_attribute_im_address_persona_apply_attributes_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ContactsPersonaAttributeImAddressPersonaApplyAttributesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_persona_attribute_im_address_real_persona_apply_attributes_co (_data_);
}


static gboolean contacts_persona_attribute_im_address_real_persona_apply_attributes_co (ContactsPersonaAttributeImAddressPersonaApplyAttributesData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->persona;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp0_, FOLKS_TYPE_IM_DETAILS) ? ((FolksImDetails*) _data_->_tmp0_) : NULL);
	_data_->details = _data_->_tmp1_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->details;
	if (_data_->_tmp2_ == NULL) {
		_g_object_unref0 (_data_->details);
		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;
	}
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = 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, NULL, NULL, NULL, NULL, _folks_abstract_field_details_hash_static_gee_hash_data_func, NULL, NULL, _folks_abstract_field_details_equal_static_gee_equal_data_func, NULL, NULL);
	_data_->added_values = _data_->_tmp3_;
	{
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = _data_->added_attributes;
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp4_);
		_data_->_added_it = _data_->_tmp5_;
		while (TRUE) {
			_data_->_tmp6_ = NULL;
			_data_->_tmp6_ = _data_->_added_it;
			_data_->_tmp7_ = FALSE;
			_data_->_tmp7_ = gee_iterator_next (_data_->_tmp6_);
			if (!_data_->_tmp7_) {
				break;
			}
			_data_->_tmp8_ = NULL;
			_data_->_tmp8_ = _data_->_added_it;
			_data_->_tmp9_ = NULL;
			_data_->_tmp9_ = gee_iterator_get (_data_->_tmp8_);
			_data_->added = (ContactsPersonaAttribute*) _data_->_tmp9_;
			_data_->_tmp10_ = NULL;
			_data_->_tmp10_ = _data_->added_values;
			_data_->_tmp11_ = NULL;
			_data_->_tmp11_ = _data_->added;
			_data_->_tmp12_ = NULL;
			_data_->_tmp12_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp11_, CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS, ContactsPersonaAttributeImAddress)->priv->protocol;
			_data_->_tmp13_ = NULL;
			_data_->_tmp13_ = _data_->added;
			_data_->_tmp14_ = NULL;
			_data_->_tmp14_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp13_, CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS, ContactsPersonaAttributeImAddress)->priv->detail;
			gee_multi_map_set ((GeeMultiMap*) _data_->_tmp10_, _data_->_tmp12_, _data_->_tmp14_);
			_g_object_unref0 (_data_->added);
		}
		_g_object_unref0 (_data_->_added_it);
	}
	_data_->_tmp15_ = NULL;
	_data_->_tmp15_ = 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, NULL, NULL, NULL, NULL, _folks_abstract_field_details_hash_static_gee_hash_data_func, NULL, NULL, _folks_abstract_field_details_equal_static_gee_equal_data_func, NULL, NULL);
	_data_->removed_values = _data_->_tmp15_;
	{
		_data_->_tmp16_ = NULL;
		_data_->_tmp16_ = _data_->removed_attributes;
		_data_->_tmp17_ = NULL;
		_data_->_tmp17_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp16_);
		_data_->_removed_it = _data_->_tmp17_;
		while (TRUE) {
			_data_->_tmp18_ = NULL;
			_data_->_tmp18_ = _data_->_removed_it;
			_data_->_tmp19_ = FALSE;
			_data_->_tmp19_ = gee_iterator_next (_data_->_tmp18_);
			if (!_data_->_tmp19_) {
				break;
			}
			_data_->_tmp20_ = NULL;
			_data_->_tmp20_ = _data_->_removed_it;
			_data_->_tmp21_ = NULL;
			_data_->_tmp21_ = gee_iterator_get (_data_->_tmp20_);
			_data_->removed = (ContactsPersonaAttribute*) _data_->_tmp21_;
			_data_->_tmp22_ = NULL;
			_data_->_tmp22_ = _data_->removed_values;
			_data_->_tmp23_ = NULL;
			_data_->_tmp23_ = _data_->removed;
			_data_->_tmp24_ = NULL;
			_data_->_tmp24_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp23_, CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS, ContactsPersonaAttributeImAddress)->priv->protocol;
			_data_->_tmp25_ = NULL;
			_data_->_tmp25_ = _data_->removed;
			_data_->_tmp26_ = NULL;
			_data_->_tmp26_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp25_, CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS, ContactsPersonaAttributeImAddress)->priv->detail;
			gee_multi_map_set ((GeeMultiMap*) _data_->_tmp22_, _data_->_tmp24_, _data_->_tmp26_);
			_g_object_unref0 (_data_->removed);
		}
		_g_object_unref0 (_data_->_removed_it);
	}
	_data_->_tmp27_ = NULL;
	_data_->_tmp27_ = 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, NULL, NULL, NULL, NULL, _folks_abstract_field_details_hash_static_gee_hash_data_func, NULL, NULL, _folks_abstract_field_details_equal_static_gee_equal_data_func, NULL, NULL);
	_data_->new_values = _data_->_tmp27_;
	_data_->changed = FALSE;
	{
		_data_->_tmp28_ = NULL;
		_data_->_tmp28_ = _data_->details;
		_data_->_tmp29_ = NULL;
		_data_->_tmp29_ = folks_im_details_get_im_addresses (_data_->_tmp28_);
		_data_->_tmp30_ = NULL;
		_data_->_tmp30_ = _data_->_tmp29_;
		_data_->_tmp31_ = NULL;
		_data_->_tmp31_ = gee_multi_map_get_keys (_data_->_tmp30_);
		_data_->_tmp32_ = NULL;
		_data_->_tmp32_ = _data_->_tmp31_;
		_data_->_tmp33_ = NULL;
		_data_->_tmp33_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp32_);
		_data_->_tmp34_ = NULL;
		_data_->_tmp34_ = _data_->_tmp33_;
		_g_object_unref0 (_data_->_tmp32_);
		_data_->_proto1_it = _data_->_tmp34_;
		while (TRUE) {
			_data_->_tmp35_ = NULL;
			_data_->_tmp35_ = _data_->_proto1_it;
			_data_->_tmp36_ = FALSE;
			_data_->_tmp36_ = gee_iterator_next (_data_->_tmp35_);
			if (!_data_->_tmp36_) {
				break;
			}
			_data_->_tmp37_ = NULL;
			_data_->_tmp37_ = _data_->_proto1_it;
			_data_->_tmp38_ = NULL;
			_data_->_tmp38_ = gee_iterator_get (_data_->_tmp37_);
			_data_->proto1 = (gchar*) _data_->_tmp38_;
			{
				_data_->_tmp39_ = NULL;
				_data_->_tmp39_ = _data_->details;
				_data_->_tmp40_ = NULL;
				_data_->_tmp40_ = folks_im_details_get_im_addresses (_data_->_tmp39_);
				_data_->_tmp41_ = NULL;
				_data_->_tmp41_ = _data_->_tmp40_;
				_data_->_tmp42_ = NULL;
				_data_->_tmp42_ = _data_->proto1;
				_data_->_tmp43_ = NULL;
				_data_->_tmp43_ = gee_multi_map_get (_data_->_tmp41_, _data_->_tmp42_);
				_data_->_tmp44_ = NULL;
				_data_->_tmp44_ = _data_->_tmp43_;
				_data_->_tmp45_ = NULL;
				_data_->_tmp45_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp44_);
				_data_->_tmp46_ = NULL;
				_data_->_tmp46_ = _data_->_tmp45_;
				_g_object_unref0 (_data_->_tmp44_);
				_data_->_detail1_it = _data_->_tmp46_;
				while (TRUE) {
					_data_->_tmp47_ = NULL;
					_data_->_tmp47_ = _data_->_detail1_it;
					_data_->_tmp48_ = FALSE;
					_data_->_tmp48_ = gee_iterator_next (_data_->_tmp47_);
					if (!_data_->_tmp48_) {
						break;
					}
					_data_->_tmp49_ = NULL;
					_data_->_tmp49_ = _data_->_detail1_it;
					_data_->_tmp50_ = NULL;
					_data_->_tmp50_ = gee_iterator_get (_data_->_tmp49_);
					_data_->detail1 = (FolksImFieldDetails*) _data_->_tmp50_;
					_data_->_tmp51_ = NULL;
					_data_->_tmp51_ = _data_->removed_values;
					_data_->_tmp52_ = NULL;
					_data_->_tmp52_ = _data_->proto1;
					_data_->_tmp53_ = NULL;
					_data_->_tmp53_ = gee_multi_map_get ((GeeMultiMap*) _data_->_tmp51_, _data_->_tmp52_);
					_data_->_tmp54_ = NULL;
					_data_->_tmp54_ = _data_->_tmp53_;
					_data_->_tmp55_ = NULL;
					_data_->_tmp55_ = _data_->detail1;
					_data_->_tmp56_ = FALSE;
					_data_->_tmp56_ = gee_collection_contains (_data_->_tmp54_, _data_->_tmp55_);
					_data_->_tmp57_ = FALSE;
					_data_->_tmp57_ = _data_->_tmp56_;
					_g_object_unref0 (_data_->_tmp54_);
					if (_data_->_tmp57_) {
						_data_->changed = TRUE;
						_g_object_unref0 (_data_->detail1);
						continue;
					}
					_data_->_tmp58_ = NULL;
					_data_->_tmp58_ = _data_->new_values;
					_data_->_tmp59_ = NULL;
					_data_->_tmp59_ = _data_->proto1;
					_data_->_tmp60_ = NULL;
					_data_->_tmp60_ = _data_->detail1;
					gee_multi_map_set ((GeeMultiMap*) _data_->_tmp58_, _data_->_tmp59_, _data_->_tmp60_);
					_data_->_tmp61_ = NULL;
					_data_->_tmp61_ = _data_->added_values;
					_data_->_tmp62_ = NULL;
					_data_->_tmp62_ = _data_->proto1;
					_data_->_tmp63_ = NULL;
					_data_->_tmp63_ = gee_multi_map_get ((GeeMultiMap*) _data_->_tmp61_, _data_->_tmp62_);
					_data_->_tmp64_ = NULL;
					_data_->_tmp64_ = _data_->_tmp63_;
					_data_->_tmp65_ = NULL;
					_data_->_tmp65_ = _data_->detail1;
					_data_->_tmp66_ = FALSE;
					_data_->_tmp66_ = gee_collection_contains (_data_->_tmp64_, _data_->_tmp65_);
					_data_->_tmp67_ = FALSE;
					_data_->_tmp67_ = _data_->_tmp66_;
					_g_object_unref0 (_data_->_tmp64_);
					if (_data_->_tmp67_) {
						_data_->_tmp68_ = NULL;
						_data_->_tmp68_ = _data_->added_values;
						_data_->_tmp69_ = NULL;
						_data_->_tmp69_ = _data_->proto1;
						_data_->_tmp70_ = NULL;
						_data_->_tmp70_ = _data_->detail1;
						gee_multi_map_remove ((GeeMultiMap*) _data_->_tmp68_, _data_->_tmp69_, _data_->_tmp70_);
					}
					_g_object_unref0 (_data_->detail1);
				}
				_g_object_unref0 (_data_->_detail1_it);
			}
			_g_free0 (_data_->proto1);
		}
		_g_object_unref0 (_data_->_proto1_it);
	}
	{
		_data_->_tmp71_ = NULL;
		_data_->_tmp71_ = _data_->added_values;
		_data_->_tmp72_ = NULL;
		_data_->_tmp72_ = gee_multi_map_get_keys ((GeeMultiMap*) _data_->_tmp71_);
		_data_->_tmp73_ = NULL;
		_data_->_tmp73_ = _data_->_tmp72_;
		_data_->_tmp74_ = NULL;
		_data_->_tmp74_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp73_);
		_data_->_tmp75_ = NULL;
		_data_->_tmp75_ = _data_->_tmp74_;
		_g_object_unref0 (_data_->_tmp73_);
		_data_->_proto2_it = _data_->_tmp75_;
		while (TRUE) {
			_data_->_tmp76_ = NULL;
			_data_->_tmp76_ = _data_->_proto2_it;
			_data_->_tmp77_ = FALSE;
			_data_->_tmp77_ = gee_iterator_next (_data_->_tmp76_);
			if (!_data_->_tmp77_) {
				break;
			}
			_data_->_tmp78_ = NULL;
			_data_->_tmp78_ = _data_->_proto2_it;
			_data_->_tmp79_ = NULL;
			_data_->_tmp79_ = gee_iterator_get (_data_->_tmp78_);
			_data_->proto2 = (gchar*) _data_->_tmp79_;
			{
				_data_->_tmp80_ = NULL;
				_data_->_tmp80_ = _data_->added_values;
				_data_->_tmp81_ = NULL;
				_data_->_tmp81_ = _data_->proto2;
				_data_->_tmp82_ = NULL;
				_data_->_tmp82_ = gee_multi_map_get ((GeeMultiMap*) _data_->_tmp80_, _data_->_tmp81_);
				_data_->_tmp83_ = NULL;
				_data_->_tmp83_ = _data_->_tmp82_;
				_data_->_tmp84_ = NULL;
				_data_->_tmp84_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp83_);
				_data_->_tmp85_ = NULL;
				_data_->_tmp85_ = _data_->_tmp84_;
				_g_object_unref0 (_data_->_tmp83_);
				_data_->_detail2_it = _data_->_tmp85_;
				while (TRUE) {
					_data_->_tmp86_ = NULL;
					_data_->_tmp86_ = _data_->_detail2_it;
					_data_->_tmp87_ = FALSE;
					_data_->_tmp87_ = gee_iterator_next (_data_->_tmp86_);
					if (!_data_->_tmp87_) {
						break;
					}
					_data_->_tmp88_ = NULL;
					_data_->_tmp88_ = _data_->_detail2_it;
					_data_->_tmp89_ = NULL;
					_data_->_tmp89_ = gee_iterator_get (_data_->_tmp88_);
					_data_->detail2 = (FolksImFieldDetails*) _data_->_tmp89_;
					_data_->changed = TRUE;
					_data_->_tmp90_ = NULL;
					_data_->_tmp90_ = _data_->new_values;
					_data_->_tmp91_ = NULL;
					_data_->_tmp91_ = _data_->proto2;
					_data_->_tmp92_ = NULL;
					_data_->_tmp92_ = _data_->detail2;
					gee_multi_map_set ((GeeMultiMap*) _data_->_tmp90_, _data_->_tmp91_, _data_->_tmp92_);
					_g_object_unref0 (_data_->detail2);
				}
				_g_object_unref0 (_data_->_detail2_it);
			}
			_g_free0 (_data_->proto2);
		}
		_g_object_unref0 (_data_->_proto2_it);
	}
	_data_->_tmp93_ = FALSE;
	_data_->_tmp93_ = _data_->changed;
	if (_data_->_tmp93_) {
		{
			_data_->_tmp94_ = NULL;
			_data_->_tmp94_ = _data_->details;
			_data_->_tmp95_ = NULL;
			_data_->_tmp95_ = folks_im_details_get_im_addresses (_data_->_tmp94_);
			_data_->_tmp96_ = NULL;
			_data_->_tmp96_ = _data_->_tmp95_;
			_data_->_tmp97_ = NULL;
			_data_->_tmp97_ = _g_object_ref0 (_data_->_tmp96_);
			_data_->old_value = _data_->_tmp97_;
			_data_->_tmp98_ = NULL;
			_data_->_tmp98_ = _data_->details;
			_data_->_tmp99_ = NULL;
			_data_->_tmp99_ = _data_->new_values;
			_data_->_state_ = 1;
			folks_im_details_change_im_addresses (_data_->_tmp98_, (GeeMultiMap*) _data_->_tmp99_, contacts_persona_attribute_im_address_persona_apply_attributes_ready, _data_);
			return FALSE;
			_state_1:
			folks_im_details_change_im_addresses_finish (_data_->_tmp98_, _data_->_res_, &_data_->_inner_error_);
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				_g_object_unref0 (_data_->old_value);
				goto __catch13_g_error;
			}
			_data_->_tmp100_ = NULL;
			_data_->_tmp100_ = _data_->operation;
			_data_->_tmp101_ = NULL;
			_data_->_tmp101_ = _data_->persona;
			_data_->_tmp102_ = NULL;
			_data_->_tmp102_ = _data_->old_value;
			contacts_link_operation_add_change (_data_->_tmp100_, (ContactsPersonaAttribute*) _data_->self, _data_->_tmp101_, (GObject*) _data_->_tmp102_);
			_g_object_unref0 (_data_->old_value);
		}
		goto __finally13;
		__catch13_g_error:
		{
			_data_->e = _data_->_inner_error_;
			_data_->_inner_error_ = NULL;
			_data_->_tmp103_ = NULL;
			_data_->_tmp103_ = _data_->e;
			_data_->_tmp104_ = NULL;
			_data_->_tmp104_ = _data_->_tmp103_->message;
			g_warning ("contacts-linking.vala:301: Unable to set im address when linking: %s\n", _data_->_tmp104_);
			_g_error_free0 (_data_->e);
		}
		__finally13:
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_object_unref0 (_data_->new_values);
			_g_object_unref0 (_data_->removed_values);
			_g_object_unref0 (_data_->added_values);
			_g_object_unref0 (_data_->details);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
	}
	_g_object_unref0 (_data_->new_values);
	_g_object_unref0 (_data_->removed_values);
	_g_object_unref0 (_data_->added_values);
	_g_object_unref0 (_data_->details);
	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 void contacts_persona_attribute_im_address_real_set_value_data_free (gpointer _data) {
	ContactsPersonaAttributeImAddressSetValueData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->persona);
	_g_object_unref0 (_data_->value);
	_g_object_unref0 (_data_->self);
	g_slice_free (ContactsPersonaAttributeImAddressSetValueData, _data_);
}


static void contacts_persona_attribute_im_address_real_set_value (ContactsPersonaAttribute* base, FolksPersona* persona, GObject* value, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsPersonaAttributeImAddress * self;
	ContactsPersonaAttributeImAddressSetValueData* _data_;
	ContactsPersonaAttributeImAddress* _tmp0_ = NULL;
	FolksPersona* _tmp1_ = NULL;
	FolksPersona* _tmp2_ = NULL;
	GObject* _tmp3_ = NULL;
	GObject* _tmp4_ = NULL;
	self = (ContactsPersonaAttributeImAddress*) base;
	_data_ = g_slice_new0 (ContactsPersonaAttributeImAddressSetValueData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, contacts_persona_attribute_im_address_real_set_value);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, contacts_persona_attribute_im_address_real_set_value_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = persona;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->persona);
	_data_->persona = _tmp2_;
	_tmp3_ = value;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (_data_->value);
	_data_->value = _tmp4_;
	contacts_persona_attribute_im_address_real_set_value_co (_data_);
}


static void contacts_persona_attribute_im_address_real_set_value_finish (ContactsPersonaAttribute* base, GAsyncResult* _res_) {
	ContactsPersonaAttributeImAddressSetValueData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void contacts_persona_attribute_im_address_set_value_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ContactsPersonaAttributeImAddressSetValueData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_persona_attribute_im_address_real_set_value_co (_data_);
}


static gboolean contacts_persona_attribute_im_address_real_set_value_co (ContactsPersonaAttributeImAddressSetValueData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->persona;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp0_, FOLKS_TYPE_IM_DETAILS) ? ((FolksImDetails*) _data_->_tmp0_) : NULL);
	_data_->details = _data_->_tmp1_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->details;
	if (_data_->_tmp2_ == NULL) {
		_g_object_unref0 (_data_->details);
		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;
	}
	{
		_data_->_tmp3_ = NULL;
		_data_->_tmp3_ = _data_->value;
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp3_, GEE_TYPE_HASH_MULTI_MAP) ? ((GeeHashMultiMap*) _data_->_tmp3_) : NULL);
		_data_->v = _data_->_tmp4_;
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = _data_->details;
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = _data_->v;
		_data_->_state_ = 1;
		folks_im_details_change_im_addresses (_data_->_tmp5_, (GeeMultiMap*) _data_->_tmp6_, contacts_persona_attribute_im_address_set_value_ready, _data_);
		return FALSE;
		_state_1:
		folks_im_details_change_im_addresses_finish (_data_->_tmp5_, _data_->_res_, &_data_->_inner_error_);
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_object_unref0 (_data_->v);
			goto __catch14_g_error;
		}
		_g_object_unref0 (_data_->v);
	}
	goto __finally14;
	__catch14_g_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp7_ = NULL;
		_data_->_tmp7_ = _data_->e;
		_data_->_tmp8_ = NULL;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		g_warning ("contacts-linking.vala:315: Unable to set local ids when undoing link: " \
"%s\n", _data_->_tmp8_);
		_g_error_free0 (_data_->e);
	}
	__finally14:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_object_unref0 (_data_->details);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	_g_object_unref0 (_data_->details);
	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 contacts_persona_attribute_im_address_real_equal (ContactsPersonaAttribute* base, ContactsPersonaAttribute* _that) {
	ContactsPersonaAttributeImAddress * self;
	gboolean result = FALSE;
	ContactsPersonaAttributeImAddress* that = NULL;
	ContactsPersonaAttribute* _tmp0_ = NULL;
	ContactsPersonaAttributeImAddress* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	ContactsPersonaAttributeImAddress* _tmp5_ = NULL;
	self = (ContactsPersonaAttributeImAddress*) base;
	g_return_val_if_fail (_that != NULL, FALSE);
	_tmp0_ = _that;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS) ? ((ContactsPersonaAttributeImAddress*) _tmp0_) : NULL);
	that = _tmp1_;
	_tmp5_ = that;
	if (_tmp5_ != NULL) {
		ContactsPersonaAttributeImAddress* _tmp6_ = NULL;
		gboolean _tmp7_ = FALSE;
		_tmp6_ = that;
		_tmp7_ = CONTACTS_PERSONA_ATTRIBUTE_CLASS (contacts_persona_attribute_im_address_parent_class)->equal (G_TYPE_CHECK_INSTANCE_CAST (self, CONTACTS_TYPE_PERSONA_ATTRIBUTE, ContactsPersonaAttribute), (ContactsPersonaAttribute*) _tmp6_);
		_tmp4_ = _tmp7_;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		const gchar* _tmp8_ = NULL;
		ContactsPersonaAttributeImAddress* _tmp9_ = NULL;
		const gchar* _tmp10_ = NULL;
		_tmp8_ = self->priv->protocol;
		_tmp9_ = that;
		_tmp10_ = _tmp9_->priv->protocol;
		_tmp3_ = g_strcmp0 (_tmp8_, _tmp10_) == 0;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		FolksImFieldDetails* _tmp11_ = NULL;
		ContactsPersonaAttributeImAddress* _tmp12_ = NULL;
		FolksImFieldDetails* _tmp13_ = NULL;
		gboolean _tmp14_ = FALSE;
		_tmp11_ = self->priv->detail;
		_tmp12_ = that;
		_tmp13_ = _tmp12_->priv->detail;
		_tmp14_ = folks_abstract_field_details_equal ((FolksAbstractFieldDetails*) _tmp11_, (FolksAbstractFieldDetails*) _tmp13_);
		_tmp2_ = _tmp14_;
	} else {
		_tmp2_ = FALSE;
	}
	result = _tmp2_;
	_g_object_unref0 (that);
	return result;
}


static guint contacts_persona_attribute_im_address_real_hash (ContactsPersonaAttribute* base) {
	ContactsPersonaAttributeImAddress * self;
	guint result = 0U;
	const gchar* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	FolksImFieldDetails* _tmp2_ = NULL;
	guint _tmp3_ = 0U;
	guint _tmp4_ = 0U;
	self = (ContactsPersonaAttributeImAddress*) base;
	_tmp0_ = self->priv->protocol;
	_tmp1_ = g_str_hash (_tmp0_);
	_tmp2_ = self->priv->detail;
	_tmp3_ = folks_abstract_field_details_hash ((FolksAbstractFieldDetails*) _tmp2_);
	_tmp4_ = CONTACTS_PERSONA_ATTRIBUTE_CLASS (contacts_persona_attribute_im_address_parent_class)->hash (G_TYPE_CHECK_INSTANCE_CAST (self, CONTACTS_TYPE_PERSONA_ATTRIBUTE, ContactsPersonaAttribute));
	result = (_tmp1_ ^ _tmp3_) ^ _tmp4_;
	return result;
}


static void contacts_persona_attribute_im_address_class_init (ContactsPersonaAttributeImAddressClass * klass) {
	contacts_persona_attribute_im_address_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ContactsPersonaAttributeImAddressPrivate));
	((ContactsPersonaAttributeClass *) klass)->is_referenced_by_persona = contacts_persona_attribute_im_address_real_is_referenced_by_persona;
	((ContactsPersonaAttributeClass *) klass)->persona_apply_attributes = contacts_persona_attribute_im_address_real_persona_apply_attributes;
	((ContactsPersonaAttributeClass *) klass)->persona_apply_attributes_finish = contacts_persona_attribute_im_address_real_persona_apply_attributes_finish;
	((ContactsPersonaAttributeClass *) klass)->set_value = contacts_persona_attribute_im_address_real_set_value;
	((ContactsPersonaAttributeClass *) klass)->set_value_finish = contacts_persona_attribute_im_address_real_set_value_finish;
	((ContactsPersonaAttributeClass *) klass)->equal = contacts_persona_attribute_im_address_real_equal;
	((ContactsPersonaAttributeClass *) klass)->hash = contacts_persona_attribute_im_address_real_hash;
	G_OBJECT_CLASS (klass)->finalize = contacts_persona_attribute_im_address_finalize;
}


static void contacts_persona_attribute_im_address_instance_init (ContactsPersonaAttributeImAddress * self) {
	self->priv = CONTACTS_PERSONA_ATTRIBUTE_IM_ADDRESS_GET_PRIVATE (self);
}


static void contacts_persona_attribute_im_address_finalize (GObject* obj) {
	ContactsPersonaAttributeImAddress * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_PERSONA_ATTRIBUTE_IM_ADDRESS, ContactsPersonaAttributeImAddress);
	_g_free0 (self->priv->protocol);
	_g_object_unref0 (self->priv->detail);
	G_OBJECT_CLASS (contacts_persona_attribute_im_address_parent_class)->finalize (obj);
}


GType contacts_persona_attribute_im_address_get_type (void) {
	static volatile gsize contacts_persona_attribute_im_address_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_persona_attribute_im_address_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsPersonaAttributeImAddressClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_persona_attribute_im_address_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsPersonaAttributeImAddress), 0, (GInstanceInitFunc) contacts_persona_attribute_im_address_instance_init, NULL };
		GType contacts_persona_attribute_im_address_type_id;
		contacts_persona_attribute_im_address_type_id = g_type_register_static (CONTACTS_TYPE_PERSONA_ATTRIBUTE, "ContactsPersonaAttributeImAddress", &g_define_type_info, 0);
		g_once_init_leave (&contacts_persona_attribute_im_address_type_id__volatile, contacts_persona_attribute_im_address_type_id);
	}
	return contacts_persona_attribute_im_address_type_id__volatile;
}


ContactsPersonaAttributeWebService* contacts_persona_attribute_web_service_construct (GType object_type, const gchar* service, FolksWebServiceFieldDetails* detail) {
	ContactsPersonaAttributeWebService * self = NULL;
	gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	FolksWebServiceFieldDetails* _tmp3_ = NULL;
	FolksWebServiceFieldDetails* _tmp4_ = NULL;
	g_return_val_if_fail (service != NULL, NULL);
	g_return_val_if_fail (detail != NULL, NULL);
	self = (ContactsPersonaAttributeWebService*) contacts_persona_attribute_construct (object_type);
	_tmp0_ = g_strdup ("web-service-addresses");
	_g_free0 (((ContactsPersonaAttribute*) self)->property_name);
	((ContactsPersonaAttribute*) self)->property_name = _tmp0_;
	_tmp1_ = service;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (self->priv->service);
	self->priv->service = _tmp2_;
	_tmp3_ = detail;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (self->priv->detail);
	self->priv->detail = _tmp4_;
	return self;
}


ContactsPersonaAttributeWebService* contacts_persona_attribute_web_service_new (const gchar* service, FolksWebServiceFieldDetails* detail) {
	return contacts_persona_attribute_web_service_construct (CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE, service, detail);
}


static gboolean contacts_persona_attribute_web_service_real_is_referenced_by_persona (ContactsPersonaAttribute* base, FolksPersona* persona) {
	ContactsPersonaAttributeWebService * self;
	gboolean result = FALSE;
	FolksWebServiceDetails* details = NULL;
	FolksPersona* _tmp0_ = NULL;
	FolksWebServiceDetails* _tmp1_ = NULL;
	FolksWebServiceDetails* _tmp2_ = NULL;
	FolksWebServiceDetails* _tmp3_ = NULL;
	GeeMultiMap* _tmp4_ = NULL;
	GeeMultiMap* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	GeeCollection* _tmp7_ = NULL;
	GeeCollection* _tmp8_ = NULL;
	FolksWebServiceFieldDetails* _tmp9_ = NULL;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp11_ = FALSE;
	self = (ContactsPersonaAttributeWebService*) base;
	g_return_val_if_fail (persona != NULL, FALSE);
	_tmp0_ = persona;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, FOLKS_TYPE_WEB_SERVICE_DETAILS) ? ((FolksWebServiceDetails*) _tmp0_) : NULL);
	details = _tmp1_;
	_tmp2_ = details;
	if (_tmp2_ == NULL) {
		result = FALSE;
		_g_object_unref0 (details);
		return result;
	}
	_tmp3_ = details;
	_tmp4_ = folks_web_service_details_get_web_service_addresses (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = self->priv->service;
	_tmp7_ = gee_multi_map_get (_tmp5_, _tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = self->priv->detail;
	_tmp10_ = gee_collection_contains (_tmp8_, _tmp9_);
	_tmp11_ = _tmp10_;
	_g_object_unref0 (_tmp8_);
	result = _tmp11_;
	_g_object_unref0 (details);
	return result;
}


static void contacts_persona_attribute_web_service_real_persona_apply_attributes_data_free (gpointer _data) {
	ContactsPersonaAttributeWebServicePersonaApplyAttributesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->persona);
	_g_object_unref0 (_data_->added_attributes);
	_g_object_unref0 (_data_->removed_attributes);
	_g_object_unref0 (_data_->operation);
	_g_object_unref0 (_data_->self);
	g_slice_free (ContactsPersonaAttributeWebServicePersonaApplyAttributesData, _data_);
}


static void contacts_persona_attribute_web_service_real_persona_apply_attributes (ContactsPersonaAttribute* base, FolksPersona* persona, GeeSet* added_attributes, GeeSet* removed_attributes, ContactsLinkOperation* operation, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsPersonaAttributeWebService * self;
	ContactsPersonaAttributeWebServicePersonaApplyAttributesData* _data_;
	ContactsPersonaAttributeWebService* _tmp0_ = NULL;
	FolksPersona* _tmp1_ = NULL;
	FolksPersona* _tmp2_ = NULL;
	GeeSet* _tmp3_ = NULL;
	GeeSet* _tmp4_ = NULL;
	GeeSet* _tmp5_ = NULL;
	GeeSet* _tmp6_ = NULL;
	ContactsLinkOperation* _tmp7_ = NULL;
	ContactsLinkOperation* _tmp8_ = NULL;
	self = (ContactsPersonaAttributeWebService*) base;
	_data_ = g_slice_new0 (ContactsPersonaAttributeWebServicePersonaApplyAttributesData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, contacts_persona_attribute_web_service_real_persona_apply_attributes);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, contacts_persona_attribute_web_service_real_persona_apply_attributes_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = persona;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->persona);
	_data_->persona = _tmp2_;
	_tmp3_ = added_attributes;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (_data_->added_attributes);
	_data_->added_attributes = _tmp4_;
	_tmp5_ = removed_attributes;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	_g_object_unref0 (_data_->removed_attributes);
	_data_->removed_attributes = _tmp6_;
	_tmp7_ = operation;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	_g_object_unref0 (_data_->operation);
	_data_->operation = _tmp8_;
	contacts_persona_attribute_web_service_real_persona_apply_attributes_co (_data_);
}


static void contacts_persona_attribute_web_service_real_persona_apply_attributes_finish (ContactsPersonaAttribute* base, GAsyncResult* _res_) {
	ContactsPersonaAttributeWebServicePersonaApplyAttributesData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void contacts_persona_attribute_web_service_persona_apply_attributes_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ContactsPersonaAttributeWebServicePersonaApplyAttributesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_persona_attribute_web_service_real_persona_apply_attributes_co (_data_);
}


static gboolean contacts_persona_attribute_web_service_real_persona_apply_attributes_co (ContactsPersonaAttributeWebServicePersonaApplyAttributesData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->persona;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp0_, FOLKS_TYPE_WEB_SERVICE_DETAILS) ? ((FolksWebServiceDetails*) _data_->_tmp0_) : NULL);
	_data_->details = _data_->_tmp1_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->details;
	if (_data_->_tmp2_ == NULL) {
		_g_object_unref0 (_data_->details);
		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;
	}
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = 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, NULL, NULL, NULL, NULL, _folks_abstract_field_details_hash_static_gee_hash_data_func, NULL, NULL, _folks_abstract_field_details_equal_static_gee_equal_data_func, NULL, NULL);
	_data_->added_values = _data_->_tmp3_;
	{
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = _data_->added_attributes;
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp4_);
		_data_->_added_it = _data_->_tmp5_;
		while (TRUE) {
			_data_->_tmp6_ = NULL;
			_data_->_tmp6_ = _data_->_added_it;
			_data_->_tmp7_ = FALSE;
			_data_->_tmp7_ = gee_iterator_next (_data_->_tmp6_);
			if (!_data_->_tmp7_) {
				break;
			}
			_data_->_tmp8_ = NULL;
			_data_->_tmp8_ = _data_->_added_it;
			_data_->_tmp9_ = NULL;
			_data_->_tmp9_ = gee_iterator_get (_data_->_tmp8_);
			_data_->added = (ContactsPersonaAttribute*) _data_->_tmp9_;
			_data_->_tmp10_ = NULL;
			_data_->_tmp10_ = _data_->added_values;
			_data_->_tmp11_ = NULL;
			_data_->_tmp11_ = _data_->added;
			_data_->_tmp12_ = NULL;
			_data_->_tmp12_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp11_, CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE, ContactsPersonaAttributeWebService)->priv->service;
			_data_->_tmp13_ = NULL;
			_data_->_tmp13_ = _data_->added;
			_data_->_tmp14_ = NULL;
			_data_->_tmp14_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp13_, CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE, ContactsPersonaAttributeWebService)->priv->detail;
			gee_multi_map_set ((GeeMultiMap*) _data_->_tmp10_, _data_->_tmp12_, _data_->_tmp14_);
			_g_object_unref0 (_data_->added);
		}
		_g_object_unref0 (_data_->_added_it);
	}
	_data_->_tmp15_ = NULL;
	_data_->_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, NULL, NULL, NULL, NULL, _folks_abstract_field_details_hash_static_gee_hash_data_func, NULL, NULL, _folks_abstract_field_details_equal_static_gee_equal_data_func, NULL, NULL);
	_data_->removed_values = _data_->_tmp15_;
	{
		_data_->_tmp16_ = NULL;
		_data_->_tmp16_ = _data_->removed_attributes;
		_data_->_tmp17_ = NULL;
		_data_->_tmp17_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp16_);
		_data_->_removed_it = _data_->_tmp17_;
		while (TRUE) {
			_data_->_tmp18_ = NULL;
			_data_->_tmp18_ = _data_->_removed_it;
			_data_->_tmp19_ = FALSE;
			_data_->_tmp19_ = gee_iterator_next (_data_->_tmp18_);
			if (!_data_->_tmp19_) {
				break;
			}
			_data_->_tmp20_ = NULL;
			_data_->_tmp20_ = _data_->_removed_it;
			_data_->_tmp21_ = NULL;
			_data_->_tmp21_ = gee_iterator_get (_data_->_tmp20_);
			_data_->removed = (ContactsPersonaAttribute*) _data_->_tmp21_;
			_data_->_tmp22_ = NULL;
			_data_->_tmp22_ = _data_->removed_values;
			_data_->_tmp23_ = NULL;
			_data_->_tmp23_ = _data_->removed;
			_data_->_tmp24_ = NULL;
			_data_->_tmp24_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp23_, CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE, ContactsPersonaAttributeWebService)->priv->service;
			_data_->_tmp25_ = NULL;
			_data_->_tmp25_ = _data_->removed;
			_data_->_tmp26_ = NULL;
			_data_->_tmp26_ = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp25_, CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE, ContactsPersonaAttributeWebService)->priv->detail;
			gee_multi_map_set ((GeeMultiMap*) _data_->_tmp22_, _data_->_tmp24_, _data_->_tmp26_);
			_g_object_unref0 (_data_->removed);
		}
		_g_object_unref0 (_data_->_removed_it);
	}
	_data_->_tmp27_ = NULL;
	_data_->_tmp27_ = 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, NULL, NULL, NULL, NULL, _folks_abstract_field_details_hash_static_gee_hash_data_func, NULL, NULL, _folks_abstract_field_details_equal_static_gee_equal_data_func, NULL, NULL);
	_data_->new_values = _data_->_tmp27_;
	_data_->changed = FALSE;
	{
		_data_->_tmp28_ = NULL;
		_data_->_tmp28_ = _data_->details;
		_data_->_tmp29_ = NULL;
		_data_->_tmp29_ = folks_web_service_details_get_web_service_addresses (_data_->_tmp28_);
		_data_->_tmp30_ = NULL;
		_data_->_tmp30_ = _data_->_tmp29_;
		_data_->_tmp31_ = NULL;
		_data_->_tmp31_ = gee_multi_map_get_keys (_data_->_tmp30_);
		_data_->_tmp32_ = NULL;
		_data_->_tmp32_ = _data_->_tmp31_;
		_data_->_tmp33_ = NULL;
		_data_->_tmp33_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp32_);
		_data_->_tmp34_ = NULL;
		_data_->_tmp34_ = _data_->_tmp33_;
		_g_object_unref0 (_data_->_tmp32_);
		_data_->_srv1_it = _data_->_tmp34_;
		while (TRUE) {
			_data_->_tmp35_ = NULL;
			_data_->_tmp35_ = _data_->_srv1_it;
			_data_->_tmp36_ = FALSE;
			_data_->_tmp36_ = gee_iterator_next (_data_->_tmp35_);
			if (!_data_->_tmp36_) {
				break;
			}
			_data_->_tmp37_ = NULL;
			_data_->_tmp37_ = _data_->_srv1_it;
			_data_->_tmp38_ = NULL;
			_data_->_tmp38_ = gee_iterator_get (_data_->_tmp37_);
			_data_->srv1 = (gchar*) _data_->_tmp38_;
			{
				_data_->_tmp39_ = NULL;
				_data_->_tmp39_ = _data_->details;
				_data_->_tmp40_ = NULL;
				_data_->_tmp40_ = folks_web_service_details_get_web_service_addresses (_data_->_tmp39_);
				_data_->_tmp41_ = NULL;
				_data_->_tmp41_ = _data_->_tmp40_;
				_data_->_tmp42_ = NULL;
				_data_->_tmp42_ = _data_->srv1;
				_data_->_tmp43_ = NULL;
				_data_->_tmp43_ = gee_multi_map_get (_data_->_tmp41_, _data_->_tmp42_);
				_data_->_tmp44_ = NULL;
				_data_->_tmp44_ = _data_->_tmp43_;
				_data_->_tmp45_ = NULL;
				_data_->_tmp45_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp44_);
				_data_->_tmp46_ = NULL;
				_data_->_tmp46_ = _data_->_tmp45_;
				_g_object_unref0 (_data_->_tmp44_);
				_data_->_detail1_it = _data_->_tmp46_;
				while (TRUE) {
					_data_->_tmp47_ = NULL;
					_data_->_tmp47_ = _data_->_detail1_it;
					_data_->_tmp48_ = FALSE;
					_data_->_tmp48_ = gee_iterator_next (_data_->_tmp47_);
					if (!_data_->_tmp48_) {
						break;
					}
					_data_->_tmp49_ = NULL;
					_data_->_tmp49_ = _data_->_detail1_it;
					_data_->_tmp50_ = NULL;
					_data_->_tmp50_ = gee_iterator_get (_data_->_tmp49_);
					_data_->detail1 = (FolksWebServiceFieldDetails*) _data_->_tmp50_;
					_data_->_tmp51_ = NULL;
					_data_->_tmp51_ = _data_->removed_values;
					_data_->_tmp52_ = NULL;
					_data_->_tmp52_ = _data_->srv1;
					_data_->_tmp53_ = NULL;
					_data_->_tmp53_ = gee_multi_map_get ((GeeMultiMap*) _data_->_tmp51_, _data_->_tmp52_);
					_data_->_tmp54_ = NULL;
					_data_->_tmp54_ = _data_->_tmp53_;
					_data_->_tmp55_ = NULL;
					_data_->_tmp55_ = _data_->detail1;
					_data_->_tmp56_ = FALSE;
					_data_->_tmp56_ = gee_collection_contains (_data_->_tmp54_, _data_->_tmp55_);
					_data_->_tmp57_ = FALSE;
					_data_->_tmp57_ = _data_->_tmp56_;
					_g_object_unref0 (_data_->_tmp54_);
					if (_data_->_tmp57_) {
						_data_->changed = TRUE;
						_g_object_unref0 (_data_->detail1);
						continue;
					}
					_data_->_tmp58_ = NULL;
					_data_->_tmp58_ = _data_->new_values;
					_data_->_tmp59_ = NULL;
					_data_->_tmp59_ = _data_->srv1;
					_data_->_tmp60_ = NULL;
					_data_->_tmp60_ = _data_->detail1;
					gee_multi_map_set ((GeeMultiMap*) _data_->_tmp58_, _data_->_tmp59_, _data_->_tmp60_);
					_data_->_tmp61_ = NULL;
					_data_->_tmp61_ = _data_->added_values;
					_data_->_tmp62_ = NULL;
					_data_->_tmp62_ = _data_->srv1;
					_data_->_tmp63_ = NULL;
					_data_->_tmp63_ = gee_multi_map_get ((GeeMultiMap*) _data_->_tmp61_, _data_->_tmp62_);
					_data_->_tmp64_ = NULL;
					_data_->_tmp64_ = _data_->_tmp63_;
					_data_->_tmp65_ = NULL;
					_data_->_tmp65_ = _data_->detail1;
					_data_->_tmp66_ = FALSE;
					_data_->_tmp66_ = gee_collection_contains (_data_->_tmp64_, _data_->_tmp65_);
					_data_->_tmp67_ = FALSE;
					_data_->_tmp67_ = _data_->_tmp66_;
					_g_object_unref0 (_data_->_tmp64_);
					if (_data_->_tmp67_) {
						_data_->_tmp68_ = NULL;
						_data_->_tmp68_ = _data_->added_values;
						_data_->_tmp69_ = NULL;
						_data_->_tmp69_ = _data_->srv1;
						_data_->_tmp70_ = NULL;
						_data_->_tmp70_ = _data_->detail1;
						gee_multi_map_remove ((GeeMultiMap*) _data_->_tmp68_, _data_->_tmp69_, _data_->_tmp70_);
					}
					_g_object_unref0 (_data_->detail1);
				}
				_g_object_unref0 (_data_->_detail1_it);
			}
			_g_free0 (_data_->srv1);
		}
		_g_object_unref0 (_data_->_srv1_it);
	}
	{
		_data_->_tmp71_ = NULL;
		_data_->_tmp71_ = _data_->added_values;
		_data_->_tmp72_ = NULL;
		_data_->_tmp72_ = gee_multi_map_get_keys ((GeeMultiMap*) _data_->_tmp71_);
		_data_->_tmp73_ = NULL;
		_data_->_tmp73_ = _data_->_tmp72_;
		_data_->_tmp74_ = NULL;
		_data_->_tmp74_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp73_);
		_data_->_tmp75_ = NULL;
		_data_->_tmp75_ = _data_->_tmp74_;
		_g_object_unref0 (_data_->_tmp73_);
		_data_->_srv2_it = _data_->_tmp75_;
		while (TRUE) {
			_data_->_tmp76_ = NULL;
			_data_->_tmp76_ = _data_->_srv2_it;
			_data_->_tmp77_ = FALSE;
			_data_->_tmp77_ = gee_iterator_next (_data_->_tmp76_);
			if (!_data_->_tmp77_) {
				break;
			}
			_data_->_tmp78_ = NULL;
			_data_->_tmp78_ = _data_->_srv2_it;
			_data_->_tmp79_ = NULL;
			_data_->_tmp79_ = gee_iterator_get (_data_->_tmp78_);
			_data_->srv2 = (gchar*) _data_->_tmp79_;
			{
				_data_->_tmp80_ = NULL;
				_data_->_tmp80_ = _data_->added_values;
				_data_->_tmp81_ = NULL;
				_data_->_tmp81_ = _data_->srv2;
				_data_->_tmp82_ = NULL;
				_data_->_tmp82_ = gee_multi_map_get ((GeeMultiMap*) _data_->_tmp80_, _data_->_tmp81_);
				_data_->_tmp83_ = NULL;
				_data_->_tmp83_ = _data_->_tmp82_;
				_data_->_tmp84_ = NULL;
				_data_->_tmp84_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp83_);
				_data_->_tmp85_ = NULL;
				_data_->_tmp85_ = _data_->_tmp84_;
				_g_object_unref0 (_data_->_tmp83_);
				_data_->_detail2_it = _data_->_tmp85_;
				while (TRUE) {
					_data_->_tmp86_ = NULL;
					_data_->_tmp86_ = _data_->_detail2_it;
					_data_->_tmp87_ = FALSE;
					_data_->_tmp87_ = gee_iterator_next (_data_->_tmp86_);
					if (!_data_->_tmp87_) {
						break;
					}
					_data_->_tmp88_ = NULL;
					_data_->_tmp88_ = _data_->_detail2_it;
					_data_->_tmp89_ = NULL;
					_data_->_tmp89_ = gee_iterator_get (_data_->_tmp88_);
					_data_->detail2 = (FolksWebServiceFieldDetails*) _data_->_tmp89_;
					_data_->changed = TRUE;
					_data_->_tmp90_ = NULL;
					_data_->_tmp90_ = _data_->new_values;
					_data_->_tmp91_ = NULL;
					_data_->_tmp91_ = _data_->srv2;
					_data_->_tmp92_ = NULL;
					_data_->_tmp92_ = _data_->detail2;
					gee_multi_map_set ((GeeMultiMap*) _data_->_tmp90_, _data_->_tmp91_, _data_->_tmp92_);
					_g_object_unref0 (_data_->detail2);
				}
				_g_object_unref0 (_data_->_detail2_it);
			}
			_g_free0 (_data_->srv2);
		}
		_g_object_unref0 (_data_->_srv2_it);
	}
	_data_->_tmp93_ = FALSE;
	_data_->_tmp93_ = _data_->changed;
	if (_data_->_tmp93_) {
		{
			_data_->_tmp94_ = NULL;
			_data_->_tmp94_ = _data_->details;
			_data_->_tmp95_ = NULL;
			_data_->_tmp95_ = folks_web_service_details_get_web_service_addresses (_data_->_tmp94_);
			_data_->_tmp96_ = NULL;
			_data_->_tmp96_ = _data_->_tmp95_;
			_data_->_tmp97_ = NULL;
			_data_->_tmp97_ = _g_object_ref0 (_data_->_tmp96_);
			_data_->old_value = _data_->_tmp97_;
			_data_->_tmp98_ = NULL;
			_data_->_tmp98_ = _data_->details;
			_data_->_tmp99_ = NULL;
			_data_->_tmp99_ = _data_->new_values;
			_data_->_state_ = 1;
			folks_web_service_details_change_web_service_addresses (_data_->_tmp98_, (GeeMultiMap*) _data_->_tmp99_, contacts_persona_attribute_web_service_persona_apply_attributes_ready, _data_);
			return FALSE;
			_state_1:
			folks_web_service_details_change_web_service_addresses_finish (_data_->_tmp98_, _data_->_res_, &_data_->_inner_error_);
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				_g_object_unref0 (_data_->old_value);
				goto __catch15_g_error;
			}
			_data_->_tmp100_ = NULL;
			_data_->_tmp100_ = _data_->operation;
			_data_->_tmp101_ = NULL;
			_data_->_tmp101_ = _data_->persona;
			_data_->_tmp102_ = NULL;
			_data_->_tmp102_ = _data_->old_value;
			contacts_link_operation_add_change (_data_->_tmp100_, (ContactsPersonaAttribute*) _data_->self, _data_->_tmp101_, (GObject*) _data_->_tmp102_);
			_g_object_unref0 (_data_->old_value);
		}
		goto __finally15;
		__catch15_g_error:
		{
			_data_->e = _data_->_inner_error_;
			_data_->_inner_error_ = NULL;
			_data_->_tmp103_ = NULL;
			_data_->_tmp103_ = _data_->e;
			_data_->_tmp104_ = NULL;
			_data_->_tmp104_ = _data_->_tmp103_->message;
			g_warning ("contacts-linking.vala:409: Unable to set web service when linking: %s\n", _data_->_tmp104_);
			_g_error_free0 (_data_->e);
		}
		__finally15:
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_object_unref0 (_data_->new_values);
			_g_object_unref0 (_data_->removed_values);
			_g_object_unref0 (_data_->added_values);
			_g_object_unref0 (_data_->details);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
	}
	_g_object_unref0 (_data_->new_values);
	_g_object_unref0 (_data_->removed_values);
	_g_object_unref0 (_data_->added_values);
	_g_object_unref0 (_data_->details);
	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 void contacts_persona_attribute_web_service_real_set_value_data_free (gpointer _data) {
	ContactsPersonaAttributeWebServiceSetValueData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->persona);
	_g_object_unref0 (_data_->value);
	_g_object_unref0 (_data_->self);
	g_slice_free (ContactsPersonaAttributeWebServiceSetValueData, _data_);
}


static void contacts_persona_attribute_web_service_real_set_value (ContactsPersonaAttribute* base, FolksPersona* persona, GObject* value, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsPersonaAttributeWebService * self;
	ContactsPersonaAttributeWebServiceSetValueData* _data_;
	ContactsPersonaAttributeWebService* _tmp0_ = NULL;
	FolksPersona* _tmp1_ = NULL;
	FolksPersona* _tmp2_ = NULL;
	GObject* _tmp3_ = NULL;
	GObject* _tmp4_ = NULL;
	self = (ContactsPersonaAttributeWebService*) base;
	_data_ = g_slice_new0 (ContactsPersonaAttributeWebServiceSetValueData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, contacts_persona_attribute_web_service_real_set_value);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, contacts_persona_attribute_web_service_real_set_value_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = persona;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->persona);
	_data_->persona = _tmp2_;
	_tmp3_ = value;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (_data_->value);
	_data_->value = _tmp4_;
	contacts_persona_attribute_web_service_real_set_value_co (_data_);
}


static void contacts_persona_attribute_web_service_real_set_value_finish (ContactsPersonaAttribute* base, GAsyncResult* _res_) {
	ContactsPersonaAttributeWebServiceSetValueData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void contacts_persona_attribute_web_service_set_value_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ContactsPersonaAttributeWebServiceSetValueData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_persona_attribute_web_service_real_set_value_co (_data_);
}


static gboolean contacts_persona_attribute_web_service_real_set_value_co (ContactsPersonaAttributeWebServiceSetValueData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->persona;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp0_, FOLKS_TYPE_WEB_SERVICE_DETAILS) ? ((FolksWebServiceDetails*) _data_->_tmp0_) : NULL);
	_data_->details = _data_->_tmp1_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->details;
	if (_data_->_tmp2_ == NULL) {
		_g_object_unref0 (_data_->details);
		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;
	}
	{
		_data_->_tmp3_ = NULL;
		_data_->_tmp3_ = _data_->value;
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp3_, GEE_TYPE_HASH_MULTI_MAP) ? ((GeeHashMultiMap*) _data_->_tmp3_) : NULL);
		_data_->v = _data_->_tmp4_;
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = _data_->details;
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = _data_->v;
		_data_->_state_ = 1;
		folks_web_service_details_change_web_service_addresses (_data_->_tmp5_, (GeeMultiMap*) _data_->_tmp6_, contacts_persona_attribute_web_service_set_value_ready, _data_);
		return FALSE;
		_state_1:
		folks_web_service_details_change_web_service_addresses_finish (_data_->_tmp5_, _data_->_res_, &_data_->_inner_error_);
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_object_unref0 (_data_->v);
			goto __catch16_g_error;
		}
		_g_object_unref0 (_data_->v);
	}
	goto __finally16;
	__catch16_g_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp7_ = NULL;
		_data_->_tmp7_ = _data_->e;
		_data_->_tmp8_ = NULL;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		g_warning ("contacts-linking.vala:423: Unable to set local ids when undoing link: " \
"%s\n", _data_->_tmp8_);
		_g_error_free0 (_data_->e);
	}
	__finally16:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_object_unref0 (_data_->details);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	_g_object_unref0 (_data_->details);
	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 contacts_persona_attribute_web_service_real_equal (ContactsPersonaAttribute* base, ContactsPersonaAttribute* _that) {
	ContactsPersonaAttributeWebService * self;
	gboolean result = FALSE;
	ContactsPersonaAttributeWebService* that = NULL;
	ContactsPersonaAttribute* _tmp0_ = NULL;
	ContactsPersonaAttributeWebService* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	ContactsPersonaAttributeWebService* _tmp5_ = NULL;
	self = (ContactsPersonaAttributeWebService*) base;
	g_return_val_if_fail (_that != NULL, FALSE);
	_tmp0_ = _that;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE) ? ((ContactsPersonaAttributeWebService*) _tmp0_) : NULL);
	that = _tmp1_;
	_tmp5_ = that;
	if (_tmp5_ != NULL) {
		ContactsPersonaAttributeWebService* _tmp6_ = NULL;
		gboolean _tmp7_ = FALSE;
		_tmp6_ = that;
		_tmp7_ = CONTACTS_PERSONA_ATTRIBUTE_CLASS (contacts_persona_attribute_web_service_parent_class)->equal (G_TYPE_CHECK_INSTANCE_CAST (self, CONTACTS_TYPE_PERSONA_ATTRIBUTE, ContactsPersonaAttribute), (ContactsPersonaAttribute*) _tmp6_);
		_tmp4_ = _tmp7_;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		const gchar* _tmp8_ = NULL;
		ContactsPersonaAttributeWebService* _tmp9_ = NULL;
		const gchar* _tmp10_ = NULL;
		_tmp8_ = self->priv->service;
		_tmp9_ = that;
		_tmp10_ = _tmp9_->priv->service;
		_tmp3_ = g_strcmp0 (_tmp8_, _tmp10_) == 0;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		FolksWebServiceFieldDetails* _tmp11_ = NULL;
		ContactsPersonaAttributeWebService* _tmp12_ = NULL;
		FolksWebServiceFieldDetails* _tmp13_ = NULL;
		gboolean _tmp14_ = FALSE;
		_tmp11_ = self->priv->detail;
		_tmp12_ = that;
		_tmp13_ = _tmp12_->priv->detail;
		_tmp14_ = folks_abstract_field_details_equal ((FolksAbstractFieldDetails*) _tmp11_, (FolksAbstractFieldDetails*) _tmp13_);
		_tmp2_ = _tmp14_;
	} else {
		_tmp2_ = FALSE;
	}
	result = _tmp2_;
	_g_object_unref0 (that);
	return result;
}


static guint contacts_persona_attribute_web_service_real_hash (ContactsPersonaAttribute* base) {
	ContactsPersonaAttributeWebService * self;
	guint result = 0U;
	const gchar* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	FolksWebServiceFieldDetails* _tmp2_ = NULL;
	guint _tmp3_ = 0U;
	guint _tmp4_ = 0U;
	self = (ContactsPersonaAttributeWebService*) base;
	_tmp0_ = self->priv->service;
	_tmp1_ = g_str_hash (_tmp0_);
	_tmp2_ = self->priv->detail;
	_tmp3_ = folks_abstract_field_details_hash ((FolksAbstractFieldDetails*) _tmp2_);
	_tmp4_ = CONTACTS_PERSONA_ATTRIBUTE_CLASS (contacts_persona_attribute_web_service_parent_class)->hash (G_TYPE_CHECK_INSTANCE_CAST (self, CONTACTS_TYPE_PERSONA_ATTRIBUTE, ContactsPersonaAttribute));
	result = (_tmp1_ ^ _tmp3_) ^ _tmp4_;
	return result;
}


static void contacts_persona_attribute_web_service_class_init (ContactsPersonaAttributeWebServiceClass * klass) {
	contacts_persona_attribute_web_service_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ContactsPersonaAttributeWebServicePrivate));
	((ContactsPersonaAttributeClass *) klass)->is_referenced_by_persona = contacts_persona_attribute_web_service_real_is_referenced_by_persona;
	((ContactsPersonaAttributeClass *) klass)->persona_apply_attributes = contacts_persona_attribute_web_service_real_persona_apply_attributes;
	((ContactsPersonaAttributeClass *) klass)->persona_apply_attributes_finish = contacts_persona_attribute_web_service_real_persona_apply_attributes_finish;
	((ContactsPersonaAttributeClass *) klass)->set_value = contacts_persona_attribute_web_service_real_set_value;
	((ContactsPersonaAttributeClass *) klass)->set_value_finish = contacts_persona_attribute_web_service_real_set_value_finish;
	((ContactsPersonaAttributeClass *) klass)->equal = contacts_persona_attribute_web_service_real_equal;
	((ContactsPersonaAttributeClass *) klass)->hash = contacts_persona_attribute_web_service_real_hash;
	G_OBJECT_CLASS (klass)->finalize = contacts_persona_attribute_web_service_finalize;
}


static void contacts_persona_attribute_web_service_instance_init (ContactsPersonaAttributeWebService * self) {
	self->priv = CONTACTS_PERSONA_ATTRIBUTE_WEB_SERVICE_GET_PRIVATE (self);
}


static void contacts_persona_attribute_web_service_finalize (GObject* obj) {
	ContactsPersonaAttributeWebService * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_PERSONA_ATTRIBUTE_WEB_SERVICE, ContactsPersonaAttributeWebService);
	_g_free0 (self->priv->service);
	_g_object_unref0 (self->priv->detail);
	G_OBJECT_CLASS (contacts_persona_attribute_web_service_parent_class)->finalize (obj);
}


GType contacts_persona_attribute_web_service_get_type (void) {
	static volatile gsize contacts_persona_attribute_web_service_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_persona_attribute_web_service_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsPersonaAttributeWebServiceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_persona_attribute_web_service_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsPersonaAttributeWebService), 0, (GInstanceInitFunc) contacts_persona_attribute_web_service_instance_init, NULL };
		GType contacts_persona_attribute_web_service_type_id;
		contacts_persona_attribute_web_service_type_id = g_type_register_static (CONTACTS_TYPE_PERSONA_ATTRIBUTE, "ContactsPersonaAttributeWebService", &g_define_type_info, 0);
		g_once_init_leave (&contacts_persona_attribute_web_service_type_id__volatile, contacts_persona_attribute_web_service_type_id);
	}
	return contacts_persona_attribute_web_service_type_id__volatile;
}


void contacts_add_linkable_attributes (GeeHashSet* set, FolksPersona* persona) {
	FolksPersona* _tmp0_ = NULL;
	FolksPersona* _tmp13_ = NULL;
	FolksPersona* _tmp42_ = NULL;
	g_return_if_fail (set != NULL);
	g_return_if_fail (persona != NULL);
	_tmp0_ = persona;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, FOLKS_TYPE_LOCAL_ID_DETAILS)) {
		{
			GeeIterator* _id_it = NULL;
			FolksPersona* _tmp1_ = NULL;
			GeeSet* _tmp2_ = NULL;
			GeeSet* _tmp3_ = NULL;
			GeeIterator* _tmp4_ = NULL;
			_tmp1_ = persona;
			_tmp2_ = folks_local_id_details_get_local_ids (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, FOLKS_TYPE_LOCAL_ID_DETAILS, FolksLocalIdDetails));
			_tmp3_ = _tmp2_;
			_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
			_id_it = _tmp4_;
			while (TRUE) {
				GeeIterator* _tmp5_ = NULL;
				gboolean _tmp6_ = FALSE;
				gchar* id = NULL;
				GeeIterator* _tmp7_ = NULL;
				gpointer _tmp8_ = NULL;
				GeeHashSet* _tmp9_ = NULL;
				const gchar* _tmp10_ = NULL;
				ContactsPersonaAttributeLocalId* _tmp11_ = NULL;
				ContactsPersonaAttributeLocalId* _tmp12_ = NULL;
				_tmp5_ = _id_it;
				_tmp6_ = gee_iterator_next (_tmp5_);
				if (!_tmp6_) {
					break;
				}
				_tmp7_ = _id_it;
				_tmp8_ = gee_iterator_get (_tmp7_);
				id = (gchar*) _tmp8_;
				_tmp9_ = set;
				_tmp10_ = id;
				_tmp11_ = contacts_persona_attribute_local_id_new (_tmp10_);
				_tmp12_ = _tmp11_;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp9_, (ContactsPersonaAttribute*) _tmp12_);
				_g_object_unref0 (_tmp12_);
				_g_free0 (id);
			}
			_g_object_unref0 (_id_it);
		}
	}
	_tmp13_ = persona;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp13_, FOLKS_TYPE_IM_DETAILS)) {
		{
			GeeIterator* _proto_it = NULL;
			FolksPersona* _tmp14_ = NULL;
			GeeMultiMap* _tmp15_ = NULL;
			GeeMultiMap* _tmp16_ = NULL;
			GeeSet* _tmp17_ = NULL;
			GeeSet* _tmp18_ = NULL;
			GeeIterator* _tmp19_ = NULL;
			GeeIterator* _tmp20_ = NULL;
			_tmp14_ = persona;
			_tmp15_ = folks_im_details_get_im_addresses (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, FOLKS_TYPE_IM_DETAILS, FolksImDetails));
			_tmp16_ = _tmp15_;
			_tmp17_ = gee_multi_map_get_keys (_tmp16_);
			_tmp18_ = _tmp17_;
			_tmp19_ = gee_iterable_iterator ((GeeIterable*) _tmp18_);
			_tmp20_ = _tmp19_;
			_g_object_unref0 (_tmp18_);
			_proto_it = _tmp20_;
			while (TRUE) {
				GeeIterator* _tmp21_ = NULL;
				gboolean _tmp22_ = FALSE;
				gchar* proto = NULL;
				GeeIterator* _tmp23_ = NULL;
				gpointer _tmp24_ = NULL;
				_tmp21_ = _proto_it;
				_tmp22_ = gee_iterator_next (_tmp21_);
				if (!_tmp22_) {
					break;
				}
				_tmp23_ = _proto_it;
				_tmp24_ = gee_iterator_get (_tmp23_);
				proto = (gchar*) _tmp24_;
				{
					GeeIterator* _im_it = NULL;
					FolksPersona* _tmp25_ = NULL;
					GeeMultiMap* _tmp26_ = NULL;
					GeeMultiMap* _tmp27_ = NULL;
					const gchar* _tmp28_ = NULL;
					GeeCollection* _tmp29_ = NULL;
					GeeCollection* _tmp30_ = NULL;
					GeeIterator* _tmp31_ = NULL;
					GeeIterator* _tmp32_ = NULL;
					_tmp25_ = persona;
					_tmp26_ = folks_im_details_get_im_addresses (G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, FOLKS_TYPE_IM_DETAILS, FolksImDetails));
					_tmp27_ = _tmp26_;
					_tmp28_ = proto;
					_tmp29_ = gee_multi_map_get (_tmp27_, _tmp28_);
					_tmp30_ = _tmp29_;
					_tmp31_ = gee_iterable_iterator ((GeeIterable*) _tmp30_);
					_tmp32_ = _tmp31_;
					_g_object_unref0 (_tmp30_);
					_im_it = _tmp32_;
					while (TRUE) {
						GeeIterator* _tmp33_ = NULL;
						gboolean _tmp34_ = FALSE;
						FolksImFieldDetails* im = NULL;
						GeeIterator* _tmp35_ = NULL;
						gpointer _tmp36_ = NULL;
						GeeHashSet* _tmp37_ = NULL;
						const gchar* _tmp38_ = NULL;
						FolksImFieldDetails* _tmp39_ = NULL;
						ContactsPersonaAttributeImAddress* _tmp40_ = NULL;
						ContactsPersonaAttributeImAddress* _tmp41_ = NULL;
						_tmp33_ = _im_it;
						_tmp34_ = gee_iterator_next (_tmp33_);
						if (!_tmp34_) {
							break;
						}
						_tmp35_ = _im_it;
						_tmp36_ = gee_iterator_get (_tmp35_);
						im = (FolksImFieldDetails*) _tmp36_;
						_tmp37_ = set;
						_tmp38_ = proto;
						_tmp39_ = im;
						_tmp40_ = contacts_persona_attribute_im_address_new (_tmp38_, _tmp39_);
						_tmp41_ = _tmp40_;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp37_, (ContactsPersonaAttribute*) _tmp41_);
						_g_object_unref0 (_tmp41_);
						_g_object_unref0 (im);
					}
					_g_object_unref0 (_im_it);
				}
				_g_free0 (proto);
			}
			_g_object_unref0 (_proto_it);
		}
	}
	_tmp42_ = persona;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp42_, FOLKS_TYPE_WEB_SERVICE_DETAILS)) {
		{
			GeeIterator* _srv_it = NULL;
			FolksPersona* _tmp43_ = NULL;
			GeeMultiMap* _tmp44_ = NULL;
			GeeMultiMap* _tmp45_ = NULL;
			GeeSet* _tmp46_ = NULL;
			GeeSet* _tmp47_ = NULL;
			GeeIterator* _tmp48_ = NULL;
			GeeIterator* _tmp49_ = NULL;
			_tmp43_ = persona;
			_tmp44_ = folks_web_service_details_get_web_service_addresses (G_TYPE_CHECK_INSTANCE_CAST (_tmp43_, FOLKS_TYPE_WEB_SERVICE_DETAILS, FolksWebServiceDetails));
			_tmp45_ = _tmp44_;
			_tmp46_ = gee_multi_map_get_keys (_tmp45_);
			_tmp47_ = _tmp46_;
			_tmp48_ = gee_iterable_iterator ((GeeIterable*) _tmp47_);
			_tmp49_ = _tmp48_;
			_g_object_unref0 (_tmp47_);
			_srv_it = _tmp49_;
			while (TRUE) {
				GeeIterator* _tmp50_ = NULL;
				gboolean _tmp51_ = FALSE;
				gchar* srv = NULL;
				GeeIterator* _tmp52_ = NULL;
				gpointer _tmp53_ = NULL;
				_tmp50_ = _srv_it;
				_tmp51_ = gee_iterator_next (_tmp50_);
				if (!_tmp51_) {
					break;
				}
				_tmp52_ = _srv_it;
				_tmp53_ = gee_iterator_get (_tmp52_);
				srv = (gchar*) _tmp53_;
				{
					GeeIterator* _web_it = NULL;
					FolksPersona* _tmp54_ = NULL;
					GeeMultiMap* _tmp55_ = NULL;
					GeeMultiMap* _tmp56_ = NULL;
					const gchar* _tmp57_ = NULL;
					GeeCollection* _tmp58_ = NULL;
					GeeCollection* _tmp59_ = NULL;
					GeeIterator* _tmp60_ = NULL;
					GeeIterator* _tmp61_ = NULL;
					_tmp54_ = persona;
					_tmp55_ = folks_web_service_details_get_web_service_addresses (G_TYPE_CHECK_INSTANCE_CAST (_tmp54_, FOLKS_TYPE_WEB_SERVICE_DETAILS, FolksWebServiceDetails));
					_tmp56_ = _tmp55_;
					_tmp57_ = srv;
					_tmp58_ = gee_multi_map_get (_tmp56_, _tmp57_);
					_tmp59_ = _tmp58_;
					_tmp60_ = gee_iterable_iterator ((GeeIterable*) _tmp59_);
					_tmp61_ = _tmp60_;
					_g_object_unref0 (_tmp59_);
					_web_it = _tmp61_;
					while (TRUE) {
						GeeIterator* _tmp62_ = NULL;
						gboolean _tmp63_ = FALSE;
						FolksWebServiceFieldDetails* web = NULL;
						GeeIterator* _tmp64_ = NULL;
						gpointer _tmp65_ = NULL;
						GeeHashSet* _tmp66_ = NULL;
						const gchar* _tmp67_ = NULL;
						FolksWebServiceFieldDetails* _tmp68_ = NULL;
						ContactsPersonaAttributeWebService* _tmp69_ = NULL;
						ContactsPersonaAttributeWebService* _tmp70_ = NULL;
						_tmp62_ = _web_it;
						_tmp63_ = gee_iterator_next (_tmp62_);
						if (!_tmp63_) {
							break;
						}
						_tmp64_ = _web_it;
						_tmp65_ = gee_iterator_get (_tmp64_);
						web = (FolksWebServiceFieldDetails*) _tmp65_;
						_tmp66_ = set;
						_tmp67_ = srv;
						_tmp68_ = web;
						_tmp69_ = contacts_persona_attribute_web_service_new (_tmp67_, _tmp68_);
						_tmp70_ = _tmp69_;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp66_, (ContactsPersonaAttribute*) _tmp70_);
						_g_object_unref0 (_tmp70_);
						_g_object_unref0 (web);
					}
					_g_object_unref0 (_web_it);
				}
				_g_free0 (srv);
			}
			_g_object_unref0 (_srv_it);
		}
	}
}


GeeSet* contacts_get_linkable_attributes (FolksPersona* persona) {
	GeeSet* result = NULL;
	GeeHashSet* res = NULL;
	GeeHashSet* _tmp0_ = NULL;
	FolksPersona* _tmp1_ = NULL;
	g_return_val_if_fail (persona != NULL, NULL);
	_tmp0_ = contacts_persona_attribute_create_set ();
	res = _tmp0_;
	_tmp1_ = persona;
	contacts_add_linkable_attributes (res, _tmp1_);
	result = (GeeSet*) res;
	return result;
}


GeeSet* contacts_get_linkable_attributes_for_individual (FolksIndividual* individual) {
	GeeSet* result = NULL;
	GeeHashSet* res = NULL;
	GeeHashSet* _tmp0_ = NULL;
	g_return_val_if_fail (individual != NULL, NULL);
	_tmp0_ = contacts_persona_attribute_create_set ();
	res = _tmp0_;
	{
		GeeIterator* _persona_it = NULL;
		FolksIndividual* _tmp1_ = NULL;
		GeeSet* _tmp2_ = NULL;
		GeeSet* _tmp3_ = NULL;
		GeeIterator* _tmp4_ = NULL;
		_tmp1_ = individual;
		_tmp2_ = folks_individual_get_personas (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_persona_it = _tmp4_;
		while (TRUE) {
			GeeIterator* _tmp5_ = NULL;
			gboolean _tmp6_ = FALSE;
			FolksPersona* persona = NULL;
			GeeIterator* _tmp7_ = NULL;
			gpointer _tmp8_ = NULL;
			GeeHashSet* _tmp9_ = NULL;
			FolksPersona* _tmp10_ = NULL;
			_tmp5_ = _persona_it;
			_tmp6_ = gee_iterator_next (_tmp5_);
			if (!_tmp6_) {
				break;
			}
			_tmp7_ = _persona_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			persona = (FolksPersona*) _tmp8_;
			_tmp9_ = res;
			_tmp10_ = persona;
			contacts_add_linkable_attributes (_tmp9_, _tmp10_);
			_g_object_unref0 (persona);
		}
		_g_object_unref0 (_persona_it);
	}
	result = (GeeSet*) res;
	return result;
}


gboolean contacts_persona_can_link_to (FolksPersona* persona, GeeSet* attributes) {
	gboolean result = FALSE;
	GeeHashSet* property_names = NULL;
	GeeHashSet* _tmp0_ = NULL;
	g_return_val_if_fail (persona != NULL, FALSE);
	g_return_val_if_fail (attributes != NULL, FALSE);
	_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	property_names = _tmp0_;
	{
		GeeIterator* _a_it = NULL;
		GeeSet* _tmp1_ = NULL;
		GeeIterator* _tmp2_ = NULL;
		_tmp1_ = attributes;
		_tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_);
		_a_it = _tmp2_;
		while (TRUE) {
			GeeIterator* _tmp3_ = NULL;
			gboolean _tmp4_ = FALSE;
			ContactsPersonaAttribute* a = NULL;
			GeeIterator* _tmp5_ = NULL;
			gpointer _tmp6_ = NULL;
			GeeHashSet* _tmp7_ = NULL;
			ContactsPersonaAttribute* _tmp8_ = NULL;
			const gchar* _tmp9_ = NULL;
			_tmp3_ = _a_it;
			_tmp4_ = gee_iterator_next (_tmp3_);
			if (!_tmp4_) {
				break;
			}
			_tmp5_ = _a_it;
			_tmp6_ = gee_iterator_get (_tmp5_);
			a = (ContactsPersonaAttribute*) _tmp6_;
			_tmp7_ = property_names;
			_tmp8_ = a;
			_tmp9_ = _tmp8_->property_name;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp7_, _tmp9_);
			_g_object_unref0 (a);
		}
		_g_object_unref0 (_a_it);
	}
	{
		GeeIterator* _p_it = NULL;
		GeeHashSet* _tmp10_ = NULL;
		GeeIterator* _tmp11_ = NULL;
		_tmp10_ = property_names;
		_tmp11_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) _tmp10_);
		_p_it = _tmp11_;
		while (TRUE) {
			GeeIterator* _tmp12_ = NULL;
			gboolean _tmp13_ = FALSE;
			gchar* p = NULL;
			GeeIterator* _tmp14_ = NULL;
			gpointer _tmp15_ = NULL;
			const gchar* _tmp16_ = NULL;
			FolksPersona* _tmp17_ = NULL;
			gchar** _tmp18_ = NULL;
			gint _tmp18__length1 = 0;
			gchar** _tmp19_ = NULL;
			gint _tmp19__length1 = 0;
			_tmp12_ = _p_it;
			_tmp13_ = gee_iterator_next (_tmp12_);
			if (!_tmp13_) {
				break;
			}
			_tmp14_ = _p_it;
			_tmp15_ = gee_iterator_get (_tmp14_);
			p = (gchar*) _tmp15_;
			_tmp16_ = p;
			_tmp17_ = persona;
			_tmp18_ = folks_persona_get_writeable_properties (_tmp17_, &_tmp18__length1);
			_tmp19_ = _tmp18_;
			_tmp19__length1 = _tmp18__length1;
			if (!_vala_string_array_contains (_tmp19_, _tmp19__length1, _tmp16_)) {
				result = FALSE;
				_g_free0 (p);
				_g_object_unref0 (_p_it);
				_g_object_unref0 (property_names);
				return result;
			}
			_g_free0 (p);
		}
		_g_object_unref0 (_p_it);
	}
	result = TRUE;
	_g_object_unref0 (property_names);
	return result;
}


gboolean contacts_attr_type_equal (ContactsPersonaAttribute* a, ContactsPersonaAttribute* b) {
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	ContactsPersonaAttribute* _tmp1_ = NULL;
	GType _tmp2_ = 0UL;
	ContactsPersonaAttribute* _tmp3_ = NULL;
	GType _tmp4_ = 0UL;
	g_return_val_if_fail (a != NULL, FALSE);
	g_return_val_if_fail (b != NULL, FALSE);
	_tmp1_ = a;
	_tmp2_ = G_TYPE_FROM_INSTANCE ((GObject*) _tmp1_);
	_tmp3_ = b;
	_tmp4_ = G_TYPE_FROM_INSTANCE ((GObject*) _tmp3_);
	if (_tmp2_ == _tmp4_) {
		ContactsPersonaAttribute* _tmp5_ = NULL;
		const gchar* _tmp6_ = NULL;
		ContactsPersonaAttribute* _tmp7_ = NULL;
		const gchar* _tmp8_ = NULL;
		_tmp5_ = a;
		_tmp6_ = _tmp5_->property_name;
		_tmp7_ = b;
		_tmp8_ = _tmp7_->property_name;
		_tmp0_ = g_strcmp0 (_tmp6_, _tmp8_) == 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}


static void contacts_persona_apply_attributes_data_free (gpointer _data) {
	ContactsPersonaApplyAttributesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->persona);
	_g_object_unref0 (_data_->added_attributes);
	_g_object_unref0 (_data_->removed_attributes);
	_g_object_unref0 (_data_->operation);
	g_slice_free (ContactsPersonaApplyAttributesData, _data_);
}


void contacts_persona_apply_attributes (FolksPersona* persona, GeeSet* added_attributes, GeeSet* removed_attributes, ContactsLinkOperation* operation, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsPersonaApplyAttributesData* _data_;
	FolksPersona* _tmp0_ = NULL;
	FolksPersona* _tmp1_ = NULL;
	GeeSet* _tmp2_ = NULL;
	GeeSet* _tmp3_ = NULL;
	GeeSet* _tmp4_ = NULL;
	GeeSet* _tmp5_ = NULL;
	ContactsLinkOperation* _tmp6_ = NULL;
	ContactsLinkOperation* _tmp7_ = NULL;
	_data_ = g_slice_new0 (ContactsPersonaApplyAttributesData);
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, contacts_persona_apply_attributes);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, contacts_persona_apply_attributes_data_free);
	_tmp0_ = persona;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data_->persona);
	_data_->persona = _tmp1_;
	_tmp2_ = added_attributes;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (_data_->added_attributes);
	_data_->added_attributes = _tmp3_;
	_tmp4_ = removed_attributes;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	_g_object_unref0 (_data_->removed_attributes);
	_data_->removed_attributes = _tmp5_;
	_tmp6_ = operation;
	_tmp7_ = _g_object_ref0 (_tmp6_);
	_g_object_unref0 (_data_->operation);
	_data_->operation = _tmp7_;
	contacts_persona_apply_attributes_co (_data_);
}


void contacts_persona_apply_attributes_finish (GAsyncResult* _res_) {
	ContactsPersonaApplyAttributesData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void contacts_persona_apply_attributes_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ContactsPersonaApplyAttributesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_persona_apply_attributes_co (_data_);
}


static gboolean contacts_persona_apply_attributes_co (ContactsPersonaApplyAttributesData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = gee_hash_set_new (CONTACTS_TYPE_PERSONA_ATTRIBUTE, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->properties = _data_->_tmp0_;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _data_->added_attributes;
	if (_data_->_tmp1_ != NULL) {
		{
			_data_->_tmp2_ = NULL;
			_data_->_tmp2_ = _data_->added_attributes;
			_data_->_tmp3_ = NULL;
			_data_->_tmp3_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp2_);
			_data_->_a1_it = _data_->_tmp3_;
			while (TRUE) {
				_data_->_tmp4_ = NULL;
				_data_->_tmp4_ = _data_->_a1_it;
				_data_->_tmp5_ = FALSE;
				_data_->_tmp5_ = gee_iterator_next (_data_->_tmp4_);
				if (!_data_->_tmp5_) {
					break;
				}
				_data_->_tmp6_ = NULL;
				_data_->_tmp6_ = _data_->_a1_it;
				_data_->_tmp7_ = NULL;
				_data_->_tmp7_ = gee_iterator_get (_data_->_tmp6_);
				_data_->a1 = (ContactsPersonaAttribute*) _data_->_tmp7_;
				_data_->_tmp8_ = NULL;
				_data_->_tmp8_ = _data_->properties;
				_data_->_tmp9_ = NULL;
				_data_->_tmp9_ = _data_->a1;
				gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp8_, _data_->_tmp9_);
				_g_object_unref0 (_data_->a1);
			}
			_g_object_unref0 (_data_->_a1_it);
		}
	}
	_data_->_tmp10_ = NULL;
	_data_->_tmp10_ = _data_->removed_attributes;
	if (_data_->_tmp10_ != NULL) {
		{
			_data_->_tmp11_ = NULL;
			_data_->_tmp11_ = _data_->removed_attributes;
			_data_->_tmp12_ = NULL;
			_data_->_tmp12_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp11_);
			_data_->_a2_it = _data_->_tmp12_;
			while (TRUE) {
				_data_->_tmp13_ = NULL;
				_data_->_tmp13_ = _data_->_a2_it;
				_data_->_tmp14_ = FALSE;
				_data_->_tmp14_ = gee_iterator_next (_data_->_tmp13_);
				if (!_data_->_tmp14_) {
					break;
				}
				_data_->_tmp15_ = NULL;
				_data_->_tmp15_ = _data_->_a2_it;
				_data_->_tmp16_ = NULL;
				_data_->_tmp16_ = gee_iterator_get (_data_->_tmp15_);
				_data_->a2 = (ContactsPersonaAttribute*) _data_->_tmp16_;
				_data_->_tmp17_ = NULL;
				_data_->_tmp17_ = _data_->properties;
				_data_->_tmp18_ = NULL;
				_data_->_tmp18_ = _data_->a2;
				gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp17_, _data_->_tmp18_);
				_g_object_unref0 (_data_->a2);
			}
			_g_object_unref0 (_data_->_a2_it);
		}
	}
	{
		_data_->_tmp19_ = NULL;
		_data_->_tmp19_ = _data_->properties;
		_data_->_tmp20_ = NULL;
		_data_->_tmp20_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) _data_->_tmp19_);
		_data_->_property_it = _data_->_tmp20_;
		while (TRUE) {
			_data_->_tmp21_ = NULL;
			_data_->_tmp21_ = _data_->_property_it;
			_data_->_tmp22_ = FALSE;
			_data_->_tmp22_ = gee_iterator_next (_data_->_tmp21_);
			if (!_data_->_tmp22_) {
				break;
			}
			_data_->_tmp23_ = NULL;
			_data_->_tmp23_ = _data_->_property_it;
			_data_->_tmp24_ = NULL;
			_data_->_tmp24_ = gee_iterator_get (_data_->_tmp23_);
			_data_->property = (ContactsPersonaAttribute*) _data_->_tmp24_;
			_data_->_tmp25_ = NULL;
			_data_->_tmp25_ = contacts_persona_attribute_create_set ();
			_data_->added = _data_->_tmp25_;
			_data_->_tmp26_ = NULL;
			_data_->_tmp26_ = contacts_persona_attribute_create_set ();
			_data_->removed = _data_->_tmp26_;
			_data_->_tmp27_ = NULL;
			_data_->_tmp27_ = _data_->added_attributes;
			if (_data_->_tmp27_ != NULL) {
				{
					_data_->_tmp28_ = NULL;
					_data_->_tmp28_ = _data_->added_attributes;
					_data_->_tmp29_ = NULL;
					_data_->_tmp29_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp28_);
					_data_->_a3_it = _data_->_tmp29_;
					while (TRUE) {
						_data_->_tmp30_ = NULL;
						_data_->_tmp30_ = _data_->_a3_it;
						_data_->_tmp31_ = FALSE;
						_data_->_tmp31_ = gee_iterator_next (_data_->_tmp30_);
						if (!_data_->_tmp31_) {
							break;
						}
						_data_->_tmp32_ = NULL;
						_data_->_tmp32_ = _data_->_a3_it;
						_data_->_tmp33_ = NULL;
						_data_->_tmp33_ = gee_iterator_get (_data_->_tmp32_);
						_data_->a3 = (ContactsPersonaAttribute*) _data_->_tmp33_;
						_data_->_tmp34_ = NULL;
						_data_->_tmp34_ = _data_->a3;
						_data_->_tmp35_ = NULL;
						_data_->_tmp35_ = _data_->property;
						_data_->_tmp36_ = FALSE;
						_data_->_tmp36_ = contacts_attr_type_equal (_data_->_tmp34_, _data_->_tmp35_);
						if (_data_->_tmp36_) {
							_data_->_tmp37_ = NULL;
							_data_->_tmp37_ = _data_->added;
							_data_->_tmp38_ = NULL;
							_data_->_tmp38_ = _data_->a3;
							gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp37_, _data_->_tmp38_);
						}
						_g_object_unref0 (_data_->a3);
					}
					_g_object_unref0 (_data_->_a3_it);
				}
			}
			_data_->_tmp39_ = NULL;
			_data_->_tmp39_ = _data_->removed_attributes;
			if (_data_->_tmp39_ != NULL) {
				{
					_data_->_tmp40_ = NULL;
					_data_->_tmp40_ = _data_->removed_attributes;
					_data_->_tmp41_ = NULL;
					_data_->_tmp41_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp40_);
					_data_->_a4_it = _data_->_tmp41_;
					while (TRUE) {
						_data_->_tmp42_ = NULL;
						_data_->_tmp42_ = _data_->_a4_it;
						_data_->_tmp43_ = FALSE;
						_data_->_tmp43_ = gee_iterator_next (_data_->_tmp42_);
						if (!_data_->_tmp43_) {
							break;
						}
						_data_->_tmp44_ = NULL;
						_data_->_tmp44_ = _data_->_a4_it;
						_data_->_tmp45_ = NULL;
						_data_->_tmp45_ = gee_iterator_get (_data_->_tmp44_);
						_data_->a4 = (ContactsPersonaAttribute*) _data_->_tmp45_;
						_data_->_tmp46_ = NULL;
						_data_->_tmp46_ = _data_->a4;
						_data_->_tmp47_ = NULL;
						_data_->_tmp47_ = _data_->property;
						_data_->_tmp48_ = FALSE;
						_data_->_tmp48_ = contacts_attr_type_equal (_data_->_tmp46_, _data_->_tmp47_);
						if (_data_->_tmp48_) {
							_data_->_tmp49_ = NULL;
							_data_->_tmp49_ = _data_->removed;
							_data_->_tmp50_ = NULL;
							_data_->_tmp50_ = _data_->a4;
							gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp49_, _data_->_tmp50_);
						}
						_g_object_unref0 (_data_->a4);
					}
					_g_object_unref0 (_data_->_a4_it);
				}
			}
			_data_->_tmp51_ = NULL;
			_data_->_tmp51_ = _data_->property;
			_data_->_tmp52_ = NULL;
			_data_->_tmp52_ = _data_->persona;
			_data_->_tmp53_ = NULL;
			_data_->_tmp53_ = _data_->added;
			_data_->_tmp54_ = NULL;
			_data_->_tmp54_ = _data_->removed;
			_data_->_tmp55_ = NULL;
			_data_->_tmp55_ = _data_->operation;
			_data_->_state_ = 1;
			contacts_persona_attribute_persona_apply_attributes (_data_->_tmp51_, _data_->_tmp52_, (GeeSet*) _data_->_tmp53_, (GeeSet*) _data_->_tmp54_, _data_->_tmp55_, contacts_persona_apply_attributes_ready, _data_);
			return FALSE;
			_state_1:
			contacts_persona_attribute_persona_apply_attributes_finish (_data_->_tmp51_, _data_->_res_);
			_g_object_unref0 (_data_->removed);
			_g_object_unref0 (_data_->added);
			_g_object_unref0 (_data_->property);
		}
		_g_object_unref0 (_data_->_property_it);
	}
	_g_object_unref0 (_data_->properties);
	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 void contacts_link_contacts_data_free (gpointer _data) {
	ContactsLinkContactsData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->main);
	_g_object_unref0 (_data_->other);
	_g_object_unref0 (_data_->result);
	g_slice_free (ContactsLinkContactsData, _data_);
}


void contacts_link_contacts (ContactsContact* main, ContactsContact* other, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsLinkContactsData* _data_;
	ContactsContact* _tmp0_ = NULL;
	ContactsContact* _tmp1_ = NULL;
	ContactsContact* _tmp2_ = NULL;
	ContactsContact* _tmp3_ = NULL;
	_data_ = g_slice_new0 (ContactsLinkContactsData);
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, contacts_link_contacts);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, contacts_link_contacts_data_free);
	_tmp0_ = main;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data_->main);
	_data_->main = _tmp1_;
	_tmp2_ = other;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (_data_->other);
	_data_->other = _tmp3_;
	contacts_link_contacts_co (_data_);
}


ContactsLinkOperation* contacts_link_contacts_finish (GAsyncResult* _res_) {
	ContactsLinkOperation* result;
	ContactsLinkContactsData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _g_free0_ (gpointer var) {
	var = (g_free (var), NULL);
}


static void _vala_GValue_free (GValue* self) {
	g_value_unset (self);
	g_free (self);
}


static void __vala_GValue_free0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL));
}


static GValue* _g_value_dup (GValue* self) {
	return g_boxed_copy (G_TYPE_VALUE, self);
}


static gpointer __g_value_dup0 (gpointer self) {
	return self ? _g_value_dup (self) : NULL;
}


static void contacts_link_contacts_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ContactsLinkContactsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_link_contacts_co (_data_);
}


static gboolean contacts_link_contacts_co (ContactsLinkContactsData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->main;
	g_object_set_data_full ((GObject*) _data_->_tmp0_, "contacts-master-at-join", (gpointer) ((gintptr) TRUE), NULL);
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = contacts_link_operation_new ();
	_data_->operation = _data_->_tmp1_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->operation;
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = _data_->other;
	contacts_link_operation_set_split_out_contact (_data_->_tmp2_, _data_->_tmp3_);
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = _data_->main;
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = _data_->_tmp4_->individual;
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = contacts_get_linkable_attributes_for_individual (_data_->_tmp5_);
	_data_->main_linkables = _data_->_tmp6_;
	_data_->other_linkables = NULL;
	_data_->_tmp7_ = NULL;
	_data_->_tmp7_ = _data_->other;
	if (_data_->_tmp7_ != NULL) {
		_data_->_tmp8_ = NULL;
		_data_->_tmp8_ = _data_->other;
		_data_->_tmp9_ = NULL;
		_data_->_tmp9_ = _data_->_tmp8_->individual;
		_data_->_tmp10_ = NULL;
		_data_->_tmp10_ = contacts_get_linkable_attributes_for_individual (_data_->_tmp9_);
		_g_object_unref0 (_data_->other_linkables);
		_data_->other_linkables = _data_->_tmp10_;
	}
	_data_->linkables = NULL;
	_data_->_tmp11_ = NULL;
	_data_->_tmp11_ = _data_->other_linkables;
	if (_data_->_tmp11_ != NULL) {
		_data_->_tmp12_ = NULL;
		_data_->_tmp12_ = _data_->main_linkables;
		_data_->_tmp13_ = NULL;
		_data_->_tmp13_ = _data_->other_linkables;
		gee_collection_remove_all ((GeeCollection*) _data_->_tmp12_, (GeeCollection*) _data_->_tmp13_);
		_data_->_tmp14_ = NULL;
		_data_->_tmp14_ = _data_->other_linkables;
		_data_->_tmp15_ = NULL;
		_data_->_tmp15_ = _data_->main_linkables;
		gee_collection_remove_all ((GeeCollection*) _data_->_tmp14_, (GeeCollection*) _data_->_tmp15_);
	}
	_data_->write_persona = NULL;
	{
		_data_->_tmp16_ = NULL;
		_data_->_tmp16_ = _data_->main;
		_data_->_tmp17_ = NULL;
		_data_->_tmp17_ = _data_->_tmp16_->individual;
		_data_->_tmp18_ = NULL;
		_data_->_tmp18_ = folks_individual_get_personas (_data_->_tmp17_);
		_data_->_tmp19_ = NULL;
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp20_ = NULL;
		_data_->_tmp20_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp19_);
		_data_->_p1_it = _data_->_tmp20_;
		while (TRUE) {
			_data_->_tmp21_ = NULL;
			_data_->_tmp21_ = _data_->_p1_it;
			_data_->_tmp22_ = FALSE;
			_data_->_tmp22_ = gee_iterator_next (_data_->_tmp21_);
			if (!_data_->_tmp22_) {
				break;
			}
			_data_->_tmp23_ = NULL;
			_data_->_tmp23_ = _data_->_p1_it;
			_data_->_tmp24_ = NULL;
			_data_->_tmp24_ = gee_iterator_get (_data_->_tmp23_);
			_data_->p1 = (FolksPersona*) _data_->_tmp24_;
			_data_->_tmp26_ = NULL;
			_data_->_tmp26_ = _data_->other_linkables;
			if (_data_->_tmp26_ != NULL) {
				_data_->_tmp27_ = NULL;
				_data_->_tmp27_ = _data_->p1;
				_data_->_tmp28_ = NULL;
				_data_->_tmp28_ = _data_->other_linkables;
				_data_->_tmp29_ = FALSE;
				_data_->_tmp29_ = contacts_persona_can_link_to (_data_->_tmp27_, _data_->_tmp28_);
				_data_->_tmp25_ = _data_->_tmp29_;
			} else {
				_data_->_tmp25_ = FALSE;
			}
			if (_data_->_tmp25_) {
				_data_->_tmp30_ = NULL;
				_data_->_tmp30_ = _data_->p1;
				_data_->_tmp31_ = NULL;
				_data_->_tmp31_ = _g_object_ref0 (_data_->_tmp30_);
				_g_object_unref0 (_data_->write_persona);
				_data_->write_persona = _data_->_tmp31_;
				_data_->_tmp32_ = NULL;
				_data_->_tmp32_ = _data_->other_linkables;
				_data_->_tmp33_ = NULL;
				_data_->_tmp33_ = _g_object_ref0 (_data_->_tmp32_);
				_g_object_unref0 (_data_->linkables);
				_data_->linkables = _data_->_tmp33_;
				_data_->_tmp34_ = NULL;
				_data_->_tmp34_ = _data_->write_persona;
				_data_->_tmp35_ = NULL;
				_data_->_tmp35_ = folks_persona_get_store (_data_->_tmp34_);
				_data_->_tmp36_ = NULL;
				_data_->_tmp36_ = _data_->_tmp35_;
				_data_->_tmp37_ = FALSE;
				_data_->_tmp37_ = folks_persona_store_get_is_primary_store (_data_->_tmp36_);
				_data_->_tmp38_ = FALSE;
				_data_->_tmp38_ = _data_->_tmp37_;
				if (_data_->_tmp38_) {
					_g_object_unref0 (_data_->p1);
					break;
				}
			}
			_g_object_unref0 (_data_->p1);
		}
		_g_object_unref0 (_data_->_p1_it);
	}
	_data_->_tmp40_ = NULL;
	_data_->_tmp40_ = _data_->other;
	if (_data_->_tmp40_ != NULL) {
		_data_->_tmp42_ = NULL;
		_data_->_tmp42_ = _data_->write_persona;
		if (_data_->_tmp42_ == NULL) {
			_data_->_tmp41_ = TRUE;
		} else {
			_data_->_tmp43_ = NULL;
			_data_->_tmp43_ = _data_->write_persona;
			_data_->_tmp44_ = NULL;
			_data_->_tmp44_ = folks_persona_get_store (_data_->_tmp43_);
			_data_->_tmp45_ = NULL;
			_data_->_tmp45_ = _data_->_tmp44_;
			_data_->_tmp46_ = FALSE;
			_data_->_tmp46_ = folks_persona_store_get_is_primary_store (_data_->_tmp45_);
			_data_->_tmp47_ = FALSE;
			_data_->_tmp47_ = _data_->_tmp46_;
			_data_->_tmp41_ = !_data_->_tmp47_;
		}
		_data_->_tmp39_ = _data_->_tmp41_;
	} else {
		_data_->_tmp39_ = FALSE;
	}
	if (_data_->_tmp39_) {
		{
			_data_->_tmp48_ = NULL;
			_data_->_tmp48_ = _data_->other;
			_data_->_tmp49_ = NULL;
			_data_->_tmp49_ = _data_->_tmp48_->individual;
			_data_->_tmp50_ = NULL;
			_data_->_tmp50_ = folks_individual_get_personas (_data_->_tmp49_);
			_data_->_tmp51_ = NULL;
			_data_->_tmp51_ = _data_->_tmp50_;
			_data_->_tmp52_ = NULL;
			_data_->_tmp52_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp51_);
			_data_->_p2_it = _data_->_tmp52_;
			while (TRUE) {
				_data_->_tmp53_ = NULL;
				_data_->_tmp53_ = _data_->_p2_it;
				_data_->_tmp54_ = FALSE;
				_data_->_tmp54_ = gee_iterator_next (_data_->_tmp53_);
				if (!_data_->_tmp54_) {
					break;
				}
				_data_->_tmp55_ = NULL;
				_data_->_tmp55_ = _data_->_p2_it;
				_data_->_tmp56_ = NULL;
				_data_->_tmp56_ = gee_iterator_get (_data_->_tmp55_);
				_data_->p2 = (FolksPersona*) _data_->_tmp56_;
				_data_->_tmp57_ = NULL;
				_data_->_tmp57_ = _data_->p2;
				_data_->_tmp58_ = NULL;
				_data_->_tmp58_ = _data_->main_linkables;
				_data_->_tmp59_ = FALSE;
				_data_->_tmp59_ = contacts_persona_can_link_to (_data_->_tmp57_, _data_->_tmp58_);
				if (_data_->_tmp59_) {
					_data_->_tmp61_ = NULL;
					_data_->_tmp61_ = _data_->write_persona;
					if (_data_->_tmp61_ == NULL) {
						_data_->_tmp60_ = TRUE;
					} else {
						_data_->_tmp62_ = NULL;
						_data_->_tmp62_ = _data_->p2;
						_data_->_tmp63_ = NULL;
						_data_->_tmp63_ = folks_persona_get_store (_data_->_tmp62_);
						_data_->_tmp64_ = NULL;
						_data_->_tmp64_ = _data_->_tmp63_;
						_data_->_tmp65_ = FALSE;
						_data_->_tmp65_ = folks_persona_store_get_is_primary_store (_data_->_tmp64_);
						_data_->_tmp66_ = FALSE;
						_data_->_tmp66_ = _data_->_tmp65_;
						_data_->_tmp60_ = _data_->_tmp66_;
					}
					if (_data_->_tmp60_) {
						_data_->_tmp67_ = NULL;
						_data_->_tmp67_ = _data_->p2;
						_data_->_tmp68_ = NULL;
						_data_->_tmp68_ = _g_object_ref0 (_data_->_tmp67_);
						_g_object_unref0 (_data_->write_persona);
						_data_->write_persona = _data_->_tmp68_;
						_data_->_tmp69_ = NULL;
						_data_->_tmp69_ = _data_->main_linkables;
						_data_->_tmp70_ = NULL;
						_data_->_tmp70_ = _g_object_ref0 (_data_->_tmp69_);
						_g_object_unref0 (_data_->linkables);
						_data_->linkables = _data_->_tmp70_;
						_data_->_tmp71_ = NULL;
						_data_->_tmp71_ = _data_->write_persona;
						_data_->_tmp72_ = NULL;
						_data_->_tmp72_ = folks_persona_get_store (_data_->_tmp71_);
						_data_->_tmp73_ = NULL;
						_data_->_tmp73_ = _data_->_tmp72_;
						_data_->_tmp74_ = FALSE;
						_data_->_tmp74_ = folks_persona_store_get_is_primary_store (_data_->_tmp73_);
						_data_->_tmp75_ = FALSE;
						_data_->_tmp75_ = _data_->_tmp74_;
						if (_data_->_tmp75_) {
							_g_object_unref0 (_data_->p2);
							break;
						}
					}
				}
				_g_object_unref0 (_data_->p2);
			}
			_g_object_unref0 (_data_->_p2_it);
		}
	}
	_data_->_tmp76_ = NULL;
	_data_->_tmp76_ = _data_->write_persona;
	if (_data_->_tmp76_ == NULL) {
		_data_->_tmp77_ = NULL;
		_data_->_tmp77_ = g_str_hash;
		_data_->_tmp78_ = NULL;
		_data_->_tmp78_ = g_str_equal;
		_data_->_tmp79_ = NULL;
		_data_->_tmp79_ = g_hash_table_new_full (_data_->_tmp77_, _data_->_tmp78_, _g_free0_, __vala_GValue_free0_);
		_data_->details = _data_->_tmp79_;
		{
			memset (&_data_->_tmp80_, 0, sizeof (GValue));
			g_value_init (&_data_->_tmp80_, G_TYPE_STRING);
			_data_->v = _data_->_tmp80_;
			_data_->_tmp81_ = NULL;
			_data_->_tmp81_ = _data_->main;
			_data_->_tmp82_ = NULL;
			_data_->_tmp82_ = contacts_contact_get_display_name (_data_->_tmp81_);
			_data_->_tmp83_ = NULL;
			_data_->_tmp83_ = _data_->_tmp82_;
			g_value_set_string (&_data_->v, _data_->_tmp83_);
			_data_->_tmp84_ = NULL;
			_data_->_tmp84_ = _data_->details;
			_data_->_tmp85_ = NULL;
			_data_->_tmp85_ = g_strdup ("full-name");
			memset (&_data_->_tmp86_, 0, sizeof (GValue));
			_data_->_tmp86_ = _data_->v;
			memset (&_data_->_tmp87_, 0, sizeof (GValue));
			_data_->_tmp87_ = _data_->_tmp86_;
			_data_->_tmp88_ = NULL;
			_data_->_tmp88_ = __g_value_dup0 (&_data_->_tmp87_);
			g_hash_table_insert (_data_->_tmp84_, _data_->_tmp85_, _data_->_tmp88_);
			_data_->_tmp90_ = NULL;
			_data_->_tmp90_ = contacts_app_app;
			_data_->_tmp91_ = NULL;
			_data_->_tmp91_ = _data_->_tmp90_->contacts_store;
			_data_->_tmp92_ = NULL;
			_data_->_tmp92_ = contacts_store_get_aggregator (_data_->_tmp91_);
			_data_->_tmp93_ = NULL;
			_data_->_tmp93_ = _data_->_tmp92_;
			_data_->_tmp94_ = NULL;
			_data_->_tmp94_ = folks_individual_aggregator_get_primary_store (_data_->_tmp93_);
			_data_->_tmp95_ = NULL;
			_data_->_tmp95_ = _data_->_tmp94_;
			_data_->_tmp96_ = NULL;
			_data_->_tmp96_ = _data_->details;
			_data_->_state_ = 1;
			contacts_contact_create_primary_persona_for_details (_data_->_tmp95_, _data_->_tmp96_, contacts_link_contacts_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp97_ = NULL;
			_data_->_tmp97_ = contacts_contact_create_primary_persona_for_details_finish (_data_->_res_, &_data_->_inner_error_);
			_data_->_tmp89_ = _data_->_tmp97_;
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				G_IS_VALUE (&_data_->v) ? (g_value_unset (&_data_->v), NULL) : NULL;
				goto __catch17_g_error;
			}
			_data_->_tmp98_ = NULL;
			_data_->_tmp98_ = _data_->_tmp89_;
			_data_->_tmp89_ = NULL;
			_g_object_unref0 (_data_->write_persona);
			_data_->write_persona = _data_->_tmp98_;
			_data_->_tmp99_ = NULL;
			_data_->_tmp99_ = _data_->operation;
			_data_->_tmp100_ = NULL;
			_data_->_tmp100_ = _data_->write_persona;
			contacts_link_operation_added_persona (_data_->_tmp99_, _data_->_tmp100_);
			_data_->_tmp101_ = NULL;
			_data_->_tmp101_ = _data_->main_linkables;
			_data_->_tmp102_ = NULL;
			_data_->_tmp102_ = _g_object_ref0 (_data_->_tmp101_);
			_g_object_unref0 (_data_->linkables);
			_data_->linkables = _data_->_tmp102_;
			_data_->_tmp103_ = NULL;
			_data_->_tmp103_ = _data_->other_linkables;
			if (_data_->_tmp103_ != NULL) {
				_data_->_tmp104_ = NULL;
				_data_->_tmp104_ = _data_->linkables;
				_data_->_tmp105_ = NULL;
				_data_->_tmp105_ = _data_->other_linkables;
				gee_collection_add_all ((GeeCollection*) _data_->_tmp104_, (GeeCollection*) _data_->_tmp105_);
			}
			_g_object_unref0 (_data_->_tmp89_);
			G_IS_VALUE (&_data_->v) ? (g_value_unset (&_data_->v), NULL) : NULL;
		}
		goto __finally17;
		__catch17_g_error:
		{
			_data_->e = _data_->_inner_error_;
			_data_->_inner_error_ = NULL;
			_data_->_tmp106_ = NULL;
			_data_->_tmp106_ = _data_->main;
			g_object_set_data_full ((GObject*) _data_->_tmp106_, "contacts-master-at-join", (gpointer) ((gintptr) FALSE), NULL);
			_data_->_tmp107_ = NULL;
			_data_->_tmp107_ = _data_->e;
			_data_->_tmp108_ = NULL;
			_data_->_tmp108_ = _data_->_tmp107_->message;
			g_warning ("contacts-linking.vala:591: Unable to create new persona when linking: " \
"%s\n", _data_->_tmp108_);
			_data_->result = _data_->operation;
			_g_error_free0 (_data_->e);
			_g_hash_table_unref0 (_data_->details);
			_g_object_unref0 (_data_->write_persona);
			_g_object_unref0 (_data_->linkables);
			_g_object_unref0 (_data_->other_linkables);
			_g_object_unref0 (_data_->main_linkables);
			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;
		}
		__finally17:
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_hash_table_unref0 (_data_->details);
			_g_object_unref0 (_data_->write_persona);
			_g_object_unref0 (_data_->linkables);
			_g_object_unref0 (_data_->other_linkables);
			_g_object_unref0 (_data_->main_linkables);
			_g_object_unref0 (_data_->operation);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
		_g_hash_table_unref0 (_data_->details);
	}
	_data_->_tmp109_ = NULL;
	_data_->_tmp109_ = _data_->write_persona;
	_data_->_tmp110_ = NULL;
	_data_->_tmp110_ = _data_->linkables;
	_data_->_tmp111_ = NULL;
	_data_->_tmp111_ = _data_->operation;
	_data_->_state_ = 2;
	contacts_persona_apply_attributes (_data_->_tmp109_, _data_->_tmp110_, NULL, _data_->_tmp111_, contacts_link_contacts_ready, _data_);
	return FALSE;
	_state_2:
	contacts_persona_apply_attributes_finish (_data_->_res_);
	_data_->_tmp112_ = NULL;
	_data_->_tmp112_ = _data_->main;
	g_object_set_data_full ((GObject*) _data_->_tmp112_, "contacts-master-at-join", (gpointer) ((gintptr) FALSE), NULL);
	_data_->result = _data_->operation;
	_g_object_unref0 (_data_->write_persona);
	_g_object_unref0 (_data_->linkables);
	_g_object_unref0 (_data_->other_linkables);
	_g_object_unref0 (_data_->main_linkables);
	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;
	_g_object_unref0 (_data_->write_persona);
	_g_object_unref0 (_data_->linkables);
	_g_object_unref0 (_data_->other_linkables);
	_g_object_unref0 (_data_->main_linkables);
	_g_object_unref0 (_data_->operation);
	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 void contacts_unlink_persona_data_free (gpointer _data) {
	ContactsUnlinkPersonaData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->contact);
	_g_object_unref0 (_data_->persona_to_unlink);
	_g_object_unref0 (_data_->result);
	g_slice_free (ContactsUnlinkPersonaData, _data_);
}


void contacts_unlink_persona (ContactsContact* contact, FolksPersona* persona_to_unlink, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsUnlinkPersonaData* _data_;
	ContactsContact* _tmp0_ = NULL;
	ContactsContact* _tmp1_ = NULL;
	FolksPersona* _tmp2_ = NULL;
	FolksPersona* _tmp3_ = NULL;
	_data_ = g_slice_new0 (ContactsUnlinkPersonaData);
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, contacts_unlink_persona);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, contacts_unlink_persona_data_free);
	_tmp0_ = contact;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data_->contact);
	_data_->contact = _tmp1_;
	_tmp2_ = persona_to_unlink;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (_data_->persona_to_unlink);
	_data_->persona_to_unlink = _tmp3_;
	contacts_unlink_persona_co (_data_);
}


ContactsLinkOperation* contacts_unlink_persona_finish (GAsyncResult* _res_) {
	ContactsLinkOperation* result;
	ContactsUnlinkPersonaData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void contacts_unlink_persona_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ContactsUnlinkPersonaData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_unlink_persona_co (_data_);
}


static gboolean contacts_unlink_persona_co (ContactsUnlinkPersonaData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->contact;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _data_->_tmp0_->individual;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _g_object_ref0 (_data_->_tmp1_);
	_data_->individual = _data_->_tmp2_;
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = contacts_persona_attribute_create_set ();
	_data_->persona_to_unlink_removals = _data_->_tmp3_;
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = contacts_persona_attribute_create_set ();
	_data_->other_personas_removals = _data_->_tmp4_;
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = contacts_link_operation_new ();
	_data_->operation = _data_->_tmp5_;
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = _data_->operation;
	_data_->_tmp7_ = NULL;
	_data_->_tmp7_ = _data_->contact;
	contacts_link_operation_set_main_contact (_data_->_tmp6_, _data_->_tmp7_);
	{
		_data_->_tmp8_ = NULL;
		_data_->_tmp8_ = _data_->persona_to_unlink;
		_data_->_tmp9_ = NULL;
		_data_->_tmp9_ = contacts_get_linkable_attributes (_data_->_tmp8_);
		_data_->_tmp10_ = NULL;
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp11_ = NULL;
		_data_->_tmp11_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp10_);
		_data_->_tmp12_ = NULL;
		_data_->_tmp12_ = _data_->_tmp11_;
		_g_object_unref0 (_data_->_tmp10_);
		_data_->_a1_it = _data_->_tmp12_;
		while (TRUE) {
			_data_->_tmp13_ = NULL;
			_data_->_tmp13_ = _data_->_a1_it;
			_data_->_tmp14_ = FALSE;
			_data_->_tmp14_ = gee_iterator_next (_data_->_tmp13_);
			if (!_data_->_tmp14_) {
				break;
			}
			_data_->_tmp15_ = NULL;
			_data_->_tmp15_ = _data_->_a1_it;
			_data_->_tmp16_ = NULL;
			_data_->_tmp16_ = gee_iterator_get (_data_->_tmp15_);
			_data_->a1 = (ContactsPersonaAttribute*) _data_->_tmp16_;
			_data_->used_to_link = FALSE;
			{
				_data_->_tmp17_ = NULL;
				_data_->_tmp17_ = _data_->individual;
				_data_->_tmp18_ = NULL;
				_data_->_tmp18_ = folks_individual_get_personas (_data_->_tmp17_);
				_data_->_tmp19_ = NULL;
				_data_->_tmp19_ = _data_->_tmp18_;
				_data_->_tmp20_ = NULL;
				_data_->_tmp20_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp19_);
				_data_->_persona_it = _data_->_tmp20_;
				while (TRUE) {
					_data_->_tmp21_ = NULL;
					_data_->_tmp21_ = _data_->_persona_it;
					_data_->_tmp22_ = FALSE;
					_data_->_tmp22_ = gee_iterator_next (_data_->_tmp21_);
					if (!_data_->_tmp22_) {
						break;
					}
					_data_->_tmp23_ = NULL;
					_data_->_tmp23_ = _data_->_persona_it;
					_data_->_tmp24_ = NULL;
					_data_->_tmp24_ = gee_iterator_get (_data_->_tmp23_);
					_data_->persona = (FolksPersona*) _data_->_tmp24_;
					_data_->_tmp26_ = NULL;
					_data_->_tmp26_ = _data_->persona;
					_data_->_tmp27_ = NULL;
					_data_->_tmp27_ = _data_->persona_to_unlink;
					if (_data_->_tmp26_ != _data_->_tmp27_) {
						_data_->_tmp28_ = NULL;
						_data_->_tmp28_ = _data_->a1;
						_data_->_tmp29_ = NULL;
						_data_->_tmp29_ = _data_->persona;
						_data_->_tmp30_ = FALSE;
						_data_->_tmp30_ = contacts_persona_attribute_is_referenced_by_persona (_data_->_tmp28_, _data_->_tmp29_);
						_data_->_tmp25_ = _data_->_tmp30_;
					} else {
						_data_->_tmp25_ = FALSE;
					}
					if (_data_->_tmp25_) {
						_data_->used_to_link = TRUE;
						_g_object_unref0 (_data_->persona);
						break;
					}
					_g_object_unref0 (_data_->persona);
				}
				_g_object_unref0 (_data_->_persona_it);
			}
			_data_->_tmp31_ = FALSE;
			_data_->_tmp31_ = _data_->used_to_link;
			if (!_data_->_tmp31_) {
				_g_object_unref0 (_data_->a1);
				continue;
			}
			_data_->_tmp32_ = NULL;
			_data_->_tmp32_ = _data_->a1;
			_data_->_tmp33_ = NULL;
			_data_->_tmp33_ = _data_->persona_to_unlink;
			_data_->_tmp34_ = FALSE;
			_data_->_tmp34_ = contacts_persona_attribute_is_removable (_data_->_tmp32_, _data_->_tmp33_);
			if (_data_->_tmp34_) {
				_data_->_tmp35_ = NULL;
				_data_->_tmp35_ = _data_->persona_to_unlink_removals;
				_data_->_tmp36_ = NULL;
				_data_->_tmp36_ = _data_->a1;
				gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp35_, _data_->_tmp36_);
			} else {
				_data_->_tmp37_ = NULL;
				_data_->_tmp37_ = _data_->other_personas_removals;
				_data_->_tmp38_ = NULL;
				_data_->_tmp38_ = _data_->a1;
				gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp37_, _data_->_tmp38_);
			}
			_g_object_unref0 (_data_->a1);
		}
		_g_object_unref0 (_data_->_a1_it);
	}
	_data_->_tmp39_ = NULL;
	_data_->_tmp39_ = contacts_persona_attribute_create_set ();
	_data_->main_persona_additions = _data_->_tmp39_;
	{
		_data_->_tmp40_ = NULL;
		_data_->_tmp40_ = _data_->individual;
		_data_->_tmp41_ = NULL;
		_data_->_tmp41_ = folks_individual_get_personas (_data_->_tmp40_);
		_data_->_tmp42_ = NULL;
		_data_->_tmp42_ = _data_->_tmp41_;
		_data_->_tmp43_ = NULL;
		_data_->_tmp43_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp42_);
		_data_->_p1_it = _data_->_tmp43_;
		while (TRUE) {
			_data_->_tmp44_ = NULL;
			_data_->_tmp44_ = _data_->_p1_it;
			_data_->_tmp45_ = FALSE;
			_data_->_tmp45_ = gee_iterator_next (_data_->_tmp44_);
			if (!_data_->_tmp45_) {
				break;
			}
			_data_->_tmp46_ = NULL;
			_data_->_tmp46_ = _data_->_p1_it;
			_data_->_tmp47_ = NULL;
			_data_->_tmp47_ = gee_iterator_get (_data_->_tmp46_);
			_data_->p1 = (FolksPersona*) _data_->_tmp47_;
			_data_->_tmp48_ = NULL;
			_data_->_tmp48_ = _data_->p1;
			_data_->_tmp49_ = NULL;
			_data_->_tmp49_ = _data_->persona_to_unlink;
			if (_data_->_tmp48_ == _data_->_tmp49_) {
				_g_object_unref0 (_data_->p1);
				continue;
			}
			{
				_data_->_tmp50_ = NULL;
				_data_->_tmp50_ = _data_->p1;
				_data_->_tmp51_ = NULL;
				_data_->_tmp51_ = contacts_get_linkable_attributes (_data_->_tmp50_);
				_data_->_tmp52_ = NULL;
				_data_->_tmp52_ = _data_->_tmp51_;
				_data_->_tmp53_ = NULL;
				_data_->_tmp53_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp52_);
				_data_->_tmp54_ = NULL;
				_data_->_tmp54_ = _data_->_tmp53_;
				_g_object_unref0 (_data_->_tmp52_);
				_data_->_a2_it = _data_->_tmp54_;
				while (TRUE) {
					_data_->_tmp55_ = NULL;
					_data_->_tmp55_ = _data_->_a2_it;
					_data_->_tmp56_ = FALSE;
					_data_->_tmp56_ = gee_iterator_next (_data_->_tmp55_);
					if (!_data_->_tmp56_) {
						break;
					}
					_data_->_tmp57_ = NULL;
					_data_->_tmp57_ = _data_->_a2_it;
					_data_->_tmp58_ = NULL;
					_data_->_tmp58_ = gee_iterator_get (_data_->_tmp57_);
					_data_->a2 = (ContactsPersonaAttribute*) _data_->_tmp58_;
					_data_->_tmp59_ = NULL;
					_data_->_tmp59_ = _data_->other_personas_removals;
					_data_->_tmp60_ = NULL;
					_data_->_tmp60_ = _data_->a2;
					_data_->_tmp61_ = FALSE;
					_data_->_tmp61_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _data_->_tmp59_, _data_->_tmp60_);
					if (_data_->_tmp61_) {
						_g_object_unref0 (_data_->a2);
						continue;
					}
					_data_->_tmp62_ = NULL;
					_data_->_tmp62_ = _data_->main_persona_additions;
					_data_->_tmp63_ = NULL;
					_data_->_tmp63_ = _data_->a2;
					gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp62_, _data_->_tmp63_);
					_g_object_unref0 (_data_->a2);
				}
				_g_object_unref0 (_data_->_a2_it);
			}
			_g_object_unref0 (_data_->p1);
		}
		_g_object_unref0 (_data_->_p1_it);
	}
	_data_->main_persona = NULL;
	{
		_data_->_tmp64_ = NULL;
		_data_->_tmp64_ = _data_->individual;
		_data_->_tmp65_ = NULL;
		_data_->_tmp65_ = folks_individual_get_personas (_data_->_tmp64_);
		_data_->_tmp66_ = NULL;
		_data_->_tmp66_ = _data_->_tmp65_;
		_data_->_tmp67_ = NULL;
		_data_->_tmp67_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp66_);
		_data_->_p2_it = _data_->_tmp67_;
		while (TRUE) {
			_data_->_tmp68_ = NULL;
			_data_->_tmp68_ = _data_->_p2_it;
			_data_->_tmp69_ = FALSE;
			_data_->_tmp69_ = gee_iterator_next (_data_->_tmp68_);
			if (!_data_->_tmp69_) {
				break;
			}
			_data_->_tmp70_ = NULL;
			_data_->_tmp70_ = _data_->_p2_it;
			_data_->_tmp71_ = NULL;
			_data_->_tmp71_ = gee_iterator_get (_data_->_tmp70_);
			_data_->p2 = (FolksPersona*) _data_->_tmp71_;
			_data_->_tmp73_ = NULL;
			_data_->_tmp73_ = _data_->p2;
			_data_->_tmp74_ = NULL;
			_data_->_tmp74_ = _data_->persona_to_unlink;
			if (_data_->_tmp73_ != _data_->_tmp74_) {
				_data_->_tmp75_ = NULL;
				_data_->_tmp75_ = _data_->p2;
				_data_->_tmp76_ = NULL;
				_data_->_tmp76_ = _data_->main_persona_additions;
				_data_->_tmp77_ = FALSE;
				_data_->_tmp77_ = contacts_persona_can_link_to (_data_->_tmp75_, (GeeSet*) _data_->_tmp76_);
				_data_->_tmp72_ = _data_->_tmp77_;
			} else {
				_data_->_tmp72_ = FALSE;
			}
			if (_data_->_tmp72_) {
				_data_->_tmp78_ = NULL;
				_data_->_tmp78_ = _data_->p2;
				_data_->_tmp79_ = NULL;
				_data_->_tmp79_ = _g_object_ref0 (_data_->_tmp78_);
				_g_object_unref0 (_data_->main_persona);
				_data_->main_persona = _data_->_tmp79_;
				_data_->_tmp80_ = NULL;
				_data_->_tmp80_ = _data_->main_persona;
				_data_->_tmp81_ = NULL;
				_data_->_tmp81_ = folks_persona_get_store (_data_->_tmp80_);
				_data_->_tmp82_ = NULL;
				_data_->_tmp82_ = _data_->_tmp81_;
				_data_->_tmp83_ = FALSE;
				_data_->_tmp83_ = folks_persona_store_get_is_primary_store (_data_->_tmp82_);
				_data_->_tmp84_ = FALSE;
				_data_->_tmp84_ = _data_->_tmp83_;
				if (_data_->_tmp84_) {
					_g_object_unref0 (_data_->p2);
					break;
				}
			}
			_g_object_unref0 (_data_->p2);
		}
		_g_object_unref0 (_data_->_p2_it);
	}
	_data_->_tmp85_ = NULL;
	_data_->_tmp85_ = gee_hash_set_new (FOLKS_TYPE_PERSONA, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->other_personas = _data_->_tmp85_;
	{
		_data_->_tmp86_ = NULL;
		_data_->_tmp86_ = _data_->individual;
		_data_->_tmp87_ = NULL;
		_data_->_tmp87_ = folks_individual_get_personas (_data_->_tmp86_);
		_data_->_tmp88_ = NULL;
		_data_->_tmp88_ = _data_->_tmp87_;
		_data_->_tmp89_ = NULL;
		_data_->_tmp89_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp88_);
		_data_->_p3_it = _data_->_tmp89_;
		while (TRUE) {
			_data_->_tmp90_ = NULL;
			_data_->_tmp90_ = _data_->_p3_it;
			_data_->_tmp91_ = FALSE;
			_data_->_tmp91_ = gee_iterator_next (_data_->_tmp90_);
			if (!_data_->_tmp91_) {
				break;
			}
			_data_->_tmp92_ = NULL;
			_data_->_tmp92_ = _data_->_p3_it;
			_data_->_tmp93_ = NULL;
			_data_->_tmp93_ = gee_iterator_get (_data_->_tmp92_);
			_data_->p3 = (FolksPersona*) _data_->_tmp93_;
			_data_->_tmp95_ = NULL;
			_data_->_tmp95_ = _data_->p3;
			_data_->_tmp96_ = NULL;
			_data_->_tmp96_ = _data_->persona_to_unlink;
			if (_data_->_tmp95_ != _data_->_tmp96_) {
				_data_->_tmp97_ = NULL;
				_data_->_tmp97_ = _data_->p3;
				_data_->_tmp98_ = NULL;
				_data_->_tmp98_ = _data_->main_persona;
				_data_->_tmp94_ = _data_->_tmp97_ != _data_->_tmp98_;
			} else {
				_data_->_tmp94_ = FALSE;
			}
			if (_data_->_tmp94_) {
				_data_->_tmp99_ = NULL;
				_data_->_tmp99_ = _data_->other_personas;
				_data_->_tmp100_ = NULL;
				_data_->_tmp100_ = _data_->p3;
				gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp99_, _data_->_tmp100_);
			}
			_g_object_unref0 (_data_->p3);
		}
		_g_object_unref0 (_data_->_p3_it);
	}
	_data_->_tmp102_ = NULL;
	_data_->_tmp102_ = _data_->main_persona;
	if (_data_->_tmp102_ == NULL) {
		_data_->_tmp103_ = NULL;
		_data_->_tmp103_ = _data_->other_personas;
		_data_->_tmp104_ = 0;
		_data_->_tmp104_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp103_);
		_data_->_tmp105_ = 0;
		_data_->_tmp105_ = _data_->_tmp104_;
		_data_->_tmp101_ = _data_->_tmp105_ > 1;
	} else {
		_data_->_tmp101_ = FALSE;
	}
	if (_data_->_tmp101_) {
		_data_->_tmp106_ = NULL;
		_data_->_tmp106_ = g_str_hash;
		_data_->_tmp107_ = NULL;
		_data_->_tmp107_ = g_str_equal;
		_data_->_tmp108_ = NULL;
		_data_->_tmp108_ = g_hash_table_new_full (_data_->_tmp106_, _data_->_tmp107_, _g_free0_, __vala_GValue_free0_);
		_data_->details = _data_->_tmp108_;
		{
			_data_->_tmp110_ = NULL;
			_data_->_tmp110_ = _data_->contact;
			_data_->_tmp111_ = NULL;
			_data_->_tmp111_ = _data_->_tmp110_->store;
			_data_->_tmp112_ = NULL;
			_data_->_tmp112_ = contacts_store_get_aggregator (_data_->_tmp111_);
			_data_->_tmp113_ = NULL;
			_data_->_tmp113_ = _data_->_tmp112_;
			_data_->_tmp114_ = NULL;
			_data_->_tmp114_ = folks_individual_aggregator_get_primary_store (_data_->_tmp113_);
			_data_->_tmp115_ = NULL;
			_data_->_tmp115_ = _data_->_tmp114_;
			_data_->_tmp116_ = NULL;
			_data_->_tmp116_ = _data_->details;
			_data_->_state_ = 1;
			folks_persona_store_add_persona_from_details (_data_->_tmp115_, _data_->_tmp116_, contacts_unlink_persona_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp117_ = NULL;
			_data_->_tmp117_ = folks_persona_store_add_persona_from_details_finish (_data_->_tmp115_, _data_->_res_, &_data_->_inner_error_);
			_data_->_tmp109_ = _data_->_tmp117_;
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				goto __catch18_g_error;
			}
			_data_->_tmp118_ = NULL;
			_data_->_tmp118_ = _data_->_tmp109_;
			_data_->_tmp109_ = NULL;
			_g_object_unref0 (_data_->main_persona);
			_data_->main_persona = _data_->_tmp118_;
			_data_->_tmp119_ = NULL;
			_data_->_tmp119_ = _data_->main_persona;
			_data_->_tmp120_ = NULL;
			_data_->_tmp120_ = _data_->contact;
			_data_->_tmp121_ = NULL;
			_data_->_tmp121_ = contacts_contact_get_display_name (_data_->_tmp120_);
			_data_->_tmp122_ = NULL;
			_data_->_tmp122_ = _data_->_tmp121_;
			_data_->_state_ = 2;
			folks_name_details_change_full_name (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp119_, FOLKS_TYPE_NAME_DETAILS) ? ((FolksNameDetails*) _data_->_tmp119_) : NULL, _data_->_tmp122_, contacts_unlink_persona_ready, _data_);
			return FALSE;
			_state_2:
			folks_name_details_change_full_name_finish (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp119_, FOLKS_TYPE_NAME_DETAILS) ? ((FolksNameDetails*) _data_->_tmp119_) : NULL, _data_->_res_, &_data_->_inner_error_);
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				_g_object_unref0 (_data_->_tmp109_);
				goto __catch18_g_error;
			}
			_data_->_tmp123_ = NULL;
			_data_->_tmp123_ = _data_->operation;
			_data_->_tmp124_ = NULL;
			_data_->_tmp124_ = _data_->main_persona;
			contacts_link_operation_added_persona (_data_->_tmp123_, _data_->_tmp124_);
			_g_object_unref0 (_data_->_tmp109_);
		}
		goto __finally18;
		__catch18_g_error:
		{
			_data_->e = _data_->_inner_error_;
			_data_->_inner_error_ = NULL;
			_data_->_tmp125_ = NULL;
			_data_->_tmp125_ = _data_->e;
			_data_->_tmp126_ = NULL;
			_data_->_tmp126_ = _data_->_tmp125_->message;
			g_warning ("contacts-linking.vala:691: Unable to create new persona when unlinking" \
": %s\n", _data_->_tmp126_);
			_data_->result = _data_->operation;
			_g_error_free0 (_data_->e);
			_g_hash_table_unref0 (_data_->details);
			_g_object_unref0 (_data_->other_personas);
			_g_object_unref0 (_data_->main_persona);
			_g_object_unref0 (_data_->main_persona_additions);
			_g_object_unref0 (_data_->other_personas_removals);
			_g_object_unref0 (_data_->persona_to_unlink_removals);
			_g_object_unref0 (_data_->individual);
			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;
		}
		__finally18:
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_hash_table_unref0 (_data_->details);
			_g_object_unref0 (_data_->other_personas);
			_g_object_unref0 (_data_->main_persona);
			_g_object_unref0 (_data_->main_persona_additions);
			_g_object_unref0 (_data_->operation);
			_g_object_unref0 (_data_->other_personas_removals);
			_g_object_unref0 (_data_->persona_to_unlink_removals);
			_g_object_unref0 (_data_->individual);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
		_g_hash_table_unref0 (_data_->details);
	}
	_data_->_tmp127_ = NULL;
	_data_->_tmp127_ = _data_->persona_to_unlink;
	g_object_set_data_full ((GObject*) _data_->_tmp127_, "contacts-new-contact", (gpointer) ((gintptr) TRUE), NULL);
	_data_->_tmp128_ = NULL;
	_data_->_tmp128_ = _data_->main_persona;
	if (_data_->_tmp128_ != NULL) {
		_data_->_tmp129_ = NULL;
		_data_->_tmp129_ = _data_->main_persona;
		_data_->_tmp130_ = NULL;
		_data_->_tmp130_ = _data_->main_persona_additions;
		_data_->_tmp131_ = NULL;
		_data_->_tmp131_ = _data_->other_personas_removals;
		_data_->_tmp132_ = NULL;
		_data_->_tmp132_ = _data_->operation;
		_data_->_state_ = 3;
		contacts_persona_apply_attributes (_data_->_tmp129_, (GeeSet*) _data_->_tmp130_, (GeeSet*) _data_->_tmp131_, _data_->_tmp132_, contacts_unlink_persona_ready, _data_);
		return FALSE;
		_state_3:
		contacts_persona_apply_attributes_finish (_data_->_res_);
	}
	{
		_data_->_tmp133_ = NULL;
		_data_->_tmp133_ = _data_->other_personas;
		_data_->_tmp134_ = NULL;
		_data_->_tmp134_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) _data_->_tmp133_);
		_data_->_p_it = _data_->_tmp134_;
		while (TRUE) {
			_data_->_tmp135_ = NULL;
			_data_->_tmp135_ = _data_->_p_it;
			_data_->_tmp136_ = FALSE;
			_data_->_tmp136_ = gee_iterator_next (_data_->_tmp135_);
			if (!_data_->_tmp136_) {
				break;
			}
			_data_->_tmp137_ = NULL;
			_data_->_tmp137_ = _data_->_p_it;
			_data_->_tmp138_ = NULL;
			_data_->_tmp138_ = gee_iterator_get (_data_->_tmp137_);
			_data_->p = (FolksPersona*) _data_->_tmp138_;
			_data_->_tmp139_ = NULL;
			_data_->_tmp139_ = _data_->p;
			_data_->_tmp140_ = NULL;
			_data_->_tmp140_ = _data_->other_personas_removals;
			_data_->_tmp141_ = NULL;
			_data_->_tmp141_ = _data_->operation;
			_data_->_state_ = 4;
			contacts_persona_apply_attributes (_data_->_tmp139_, NULL, (GeeSet*) _data_->_tmp140_, _data_->_tmp141_, contacts_unlink_persona_ready, _data_);
			return FALSE;
			_state_4:
			contacts_persona_apply_attributes_finish (_data_->_res_);
			_g_object_unref0 (_data_->p);
		}
		_g_object_unref0 (_data_->_p_it);
	}
	_data_->_tmp142_ = NULL;
	_data_->_tmp142_ = _data_->persona_to_unlink;
	_data_->_tmp143_ = NULL;
	_data_->_tmp143_ = _data_->persona_to_unlink_removals;
	_data_->_tmp144_ = NULL;
	_data_->_tmp144_ = _data_->operation;
	_data_->_state_ = 5;
	contacts_persona_apply_attributes (_data_->_tmp142_, NULL, (GeeSet*) _data_->_tmp143_, _data_->_tmp144_, contacts_unlink_persona_ready, _data_);
	return FALSE;
	_state_5:
	contacts_persona_apply_attributes_finish (_data_->_res_);
	_data_->_tmp145_ = NULL;
	_data_->_tmp145_ = _data_->persona_to_unlink;
	g_object_set_data_full ((GObject*) _data_->_tmp145_, "contacts-new-contact", (gpointer) ((gintptr) FALSE), NULL);
	_data_->result = _data_->operation;
	_g_object_unref0 (_data_->other_personas);
	_g_object_unref0 (_data_->main_persona);
	_g_object_unref0 (_data_->main_persona_additions);
	_g_object_unref0 (_data_->other_personas_removals);
	_g_object_unref0 (_data_->persona_to_unlink_removals);
	_g_object_unref0 (_data_->individual);
	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;
	_g_object_unref0 (_data_->other_personas);
	_g_object_unref0 (_data_->main_persona);
	_g_object_unref0 (_data_->main_persona_additions);
	_g_object_unref0 (_data_->operation);
	_g_object_unref0 (_data_->other_personas_removals);
	_g_object_unref0 (_data_->persona_to_unlink_removals);
	_g_object_unref0 (_data_->individual);
	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;
}


ContactsLinkOperation2* contacts_link_operation2_construct (GType object_type) {
	ContactsLinkOperation2 * self = NULL;
	GeeLinkedList* _tmp0_ = NULL;
	self = (ContactsLinkOperation2*) g_object_new (object_type, NULL);
	_tmp0_ = gee_linked_list_new (GEE_TYPE_HASH_SET, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->old_personas_distribution);
	self->priv->old_personas_distribution = _tmp0_;
	return self;
}


ContactsLinkOperation2* contacts_link_operation2_new (void) {
	return contacts_link_operation2_construct (CONTACTS_TYPE_LINK_OPERATION2);
}


void contacts_link_operation2_add_persona_set (ContactsLinkOperation2* self, GeeSet* persona_set) {
	GeeSet* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (persona_set != NULL);
	_tmp0_ = persona_set;
	_tmp1_ = gee_collection_get_size ((GeeCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_ > 0) {
		GeeHashSet* s = NULL;
		GeeHashSet* _tmp3_ = NULL;
		GeeLinkedList* _tmp12_ = NULL;
		GeeHashSet* _tmp13_ = NULL;
		_tmp3_ = gee_hash_set_new (FOLKS_TYPE_PERSONA, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
		s = _tmp3_;
		{
			GeeIterator* _p_it = NULL;
			GeeSet* _tmp4_ = NULL;
			GeeIterator* _tmp5_ = NULL;
			_tmp4_ = persona_set;
			_tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
			_p_it = _tmp5_;
			while (TRUE) {
				GeeIterator* _tmp6_ = NULL;
				gboolean _tmp7_ = FALSE;
				FolksPersona* p = NULL;
				GeeIterator* _tmp8_ = NULL;
				gpointer _tmp9_ = NULL;
				GeeHashSet* _tmp10_ = NULL;
				FolksPersona* _tmp11_ = NULL;
				_tmp6_ = _p_it;
				_tmp7_ = gee_iterator_next (_tmp6_);
				if (!_tmp7_) {
					break;
				}
				_tmp8_ = _p_it;
				_tmp9_ = gee_iterator_get (_tmp8_);
				p = (FolksPersona*) _tmp9_;
				_tmp10_ = s;
				_tmp11_ = p;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp10_, _tmp11_);
				_g_object_unref0 (p);
			}
			_g_object_unref0 (_p_it);
		}
		_tmp12_ = self->priv->old_personas_distribution;
		_tmp13_ = s;
		gee_abstract_collection_add ((GeeAbstractCollection*) _tmp12_, _tmp13_);
		_g_object_unref0 (s);
	}
}


static void contacts_link_operation2_undo_data_free (gpointer _data) {
	ContactsLinkOperation2UndoData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ContactsLinkOperation2UndoData, _data_);
}


void contacts_link_operation2_undo (ContactsLinkOperation2* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsLinkOperation2UndoData* _data_;
	ContactsLinkOperation2* _tmp0_ = NULL;
	_data_ = g_slice_new0 (ContactsLinkOperation2UndoData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, contacts_link_operation2_undo);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, contacts_link_operation2_undo_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	contacts_link_operation2_undo_co (_data_);
}


void contacts_link_operation2_undo_finish (ContactsLinkOperation2* self, GAsyncResult* _res_) {
	ContactsLinkOperation2UndoData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void contacts_link_operation2_undo_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ContactsLinkOperation2UndoData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_link_operation2_undo_co (_data_);
}


static gboolean contacts_link_operation2_undo_co (ContactsLinkOperation2UndoData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->ind = NULL;
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->self->priv->old_personas_distribution;
	_data_->_tmp1_ = 0;
	_data_->_tmp1_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp0_);
	_data_->_tmp2_ = 0;
	_data_->_tmp2_ = _data_->_tmp1_;
	if (_data_->_tmp2_ > 0) {
		_data_->_tmp3_ = NULL;
		_data_->_tmp3_ = _data_->self->priv->old_personas_distribution;
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = gee_linked_list_first (_data_->_tmp3_);
		_data_->ps = (GeeHashSet*) _data_->_tmp4_;
		{
			_data_->_tmp5_ = NULL;
			_data_->_tmp5_ = _data_->ps;
			_data_->_tmp6_ = NULL;
			_data_->_tmp6_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) _data_->_tmp5_);
			_data_->_p_it = _data_->_tmp6_;
			while (TRUE) {
				_data_->_tmp7_ = NULL;
				_data_->_tmp7_ = _data_->_p_it;
				_data_->_tmp8_ = FALSE;
				_data_->_tmp8_ = gee_iterator_next (_data_->_tmp7_);
				if (!_data_->_tmp8_) {
					break;
				}
				_data_->_tmp9_ = NULL;
				_data_->_tmp9_ = _data_->_p_it;
				_data_->_tmp10_ = NULL;
				_data_->_tmp10_ = gee_iterator_get (_data_->_tmp9_);
				_data_->p = (FolksPersona*) _data_->_tmp10_;
				_data_->_tmp11_ = NULL;
				_data_->_tmp11_ = _data_->p;
				_data_->_tmp12_ = NULL;
				_data_->_tmp12_ = folks_persona_get_individual (_data_->_tmp11_);
				_data_->_tmp13_ = NULL;
				_data_->_tmp13_ = _data_->_tmp12_;
				_data_->_tmp14_ = NULL;
				_data_->_tmp14_ = _g_object_ref0 (_data_->_tmp13_);
				_g_object_unref0 (_data_->ind);
				_data_->ind = _data_->_tmp14_;
				_g_object_unref0 (_data_->p);
				break;
			}
			_g_object_unref0 (_data_->_p_it);
		}
		_g_object_unref0 (_data_->ps);
	}
	_data_->_tmp15_ = NULL;
	_data_->_tmp15_ = _data_->ind;
	if (_data_->_tmp15_ != NULL) {
		{
			_data_->_tmp16_ = NULL;
			_data_->_tmp16_ = contacts_app_app;
			_data_->_tmp17_ = NULL;
			_data_->_tmp17_ = _data_->_tmp16_->contacts_store;
			_data_->_tmp18_ = NULL;
			_data_->_tmp18_ = contacts_store_get_aggregator (_data_->_tmp17_);
			_data_->_tmp19_ = NULL;
			_data_->_tmp19_ = _data_->_tmp18_;
			_data_->_tmp20_ = NULL;
			_data_->_tmp20_ = _data_->ind;
			_data_->_state_ = 1;
			folks_individual_aggregator_unlink_individual (_data_->_tmp19_, _data_->_tmp20_, contacts_link_operation2_undo_ready, _data_);
			return FALSE;
			_state_1:
			folks_individual_aggregator_unlink_individual_finish (_data_->_tmp19_, _data_->_res_, &_data_->_inner_error_);
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				goto __catch19_g_error;
			}
		}
		goto __finally19;
		__catch19_g_error:
		{
			_data_->e1 = _data_->_inner_error_;
			_data_->_inner_error_ = NULL;
			_data_->_tmp21_ = NULL;
			_data_->_tmp21_ = _data_->ind;
			_data_->_tmp22_ = NULL;
			_data_->_tmp22_ = folks_individual_get_id (_data_->_tmp21_);
			_data_->_tmp23_ = NULL;
			_data_->_tmp23_ = _data_->_tmp22_;
			_data_->_tmp24_ = NULL;
			_data_->_tmp24_ = _data_->e1;
			_data_->_tmp25_ = NULL;
			_data_->_tmp25_ = _data_->_tmp24_->message;
			g_warning ("contacts-linking.vala:745: Error unlinking individual ‘%s’: %s", _data_->_tmp23_, _data_->_tmp25_);
			_g_error_free0 (_data_->e1);
		}
		__finally19:
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_object_unref0 (_data_->ind);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
	}
	{
		_data_->_tmp26_ = NULL;
		_data_->_tmp26_ = _data_->self->priv->old_personas_distribution;
		_data_->_tmp27_ = NULL;
		_data_->_tmp27_ = _g_object_ref0 (_data_->_tmp26_);
		_data_->_ps_list = _data_->_tmp27_;
		_data_->_tmp28_ = NULL;
		_data_->_tmp28_ = _data_->_ps_list;
		_data_->_tmp29_ = 0;
		_data_->_tmp29_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp28_);
		_data_->_tmp30_ = 0;
		_data_->_tmp30_ = _data_->_tmp29_;
		_data_->_ps_size = _data_->_tmp30_;
		_data_->_ps_index = -1;
		while (TRUE) {
			_data_->_tmp31_ = 0;
			_data_->_tmp31_ = _data_->_ps_index;
			_data_->_ps_index = _data_->_tmp31_ + 1;
			_data_->_tmp32_ = 0;
			_data_->_tmp32_ = _data_->_ps_index;
			_data_->_tmp33_ = 0;
			_data_->_tmp33_ = _data_->_ps_size;
			if (!(_data_->_tmp32_ < _data_->_tmp33_)) {
				break;
			}
			_data_->_tmp34_ = NULL;
			_data_->_tmp34_ = _data_->_ps_list;
			_data_->_tmp35_ = 0;
			_data_->_tmp35_ = _data_->_ps_index;
			_data_->_tmp36_ = NULL;
			_data_->_tmp36_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp34_, _data_->_tmp35_);
			_data_->_vala1_ps = (GeeHashSet*) _data_->_tmp36_;
			{
				_data_->_tmp37_ = NULL;
				_data_->_tmp37_ = contacts_app_app;
				_data_->_tmp38_ = NULL;
				_data_->_tmp38_ = _data_->_tmp37_->contacts_store;
				_data_->_tmp39_ = NULL;
				_data_->_tmp39_ = contacts_store_get_aggregator (_data_->_tmp38_);
				_data_->_tmp40_ = NULL;
				_data_->_tmp40_ = _data_->_tmp39_;
				_data_->_tmp41_ = NULL;
				_data_->_tmp41_ = _data_->_vala1_ps;
				_data_->_state_ = 2;
				folks_individual_aggregator_link_personas (_data_->_tmp40_, (GeeSet*) _data_->_tmp41_, contacts_link_operation2_undo_ready, _data_);
				return FALSE;
				_state_2:
				folks_individual_aggregator_link_personas_finish (_data_->_tmp40_, _data_->_res_, &_data_->_inner_error_);
				if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
					goto __catch20_g_error;
				}
			}
			goto __finally20;
			__catch20_g_error:
			{
				_data_->_vala1_e1 = _data_->_inner_error_;
				_data_->_inner_error_ = NULL;
				_data_->_tmp42_ = NULL;
				_data_->_tmp42_ = _data_->_vala1_e1;
				_data_->_tmp43_ = NULL;
				_data_->_tmp43_ = _data_->_tmp42_->message;
				g_warning ("contacts-linking.vala:753: Error linking personas: %s", _data_->_tmp43_);
				_g_error_free0 (_data_->_vala1_e1);
			}
			__finally20:
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				_g_object_unref0 (_data_->_vala1_ps);
				_g_object_unref0 (_data_->_ps_list);
				_g_object_unref0 (_data_->ind);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
				g_clear_error (&_data_->_inner_error_);
				return FALSE;
			}
			_g_object_unref0 (_data_->_vala1_ps);
		}
		_g_object_unref0 (_data_->_ps_list);
	}
	_g_object_unref0 (_data_->ind);
	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 void contacts_link_operation2_class_init (ContactsLinkOperation2Class * klass) {
	contacts_link_operation2_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ContactsLinkOperation2Private));
	G_OBJECT_CLASS (klass)->finalize = contacts_link_operation2_finalize;
}


static void contacts_link_operation2_instance_init (ContactsLinkOperation2 * self) {
	self->priv = CONTACTS_LINK_OPERATION2_GET_PRIVATE (self);
}


static void contacts_link_operation2_finalize (GObject* obj) {
	ContactsLinkOperation2 * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_LINK_OPERATION2, ContactsLinkOperation2);
	_g_object_unref0 (self->priv->old_personas_distribution);
	G_OBJECT_CLASS (contacts_link_operation2_parent_class)->finalize (obj);
}


GType contacts_link_operation2_get_type (void) {
	static volatile gsize contacts_link_operation2_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_link_operation2_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsLinkOperation2Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_link_operation2_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsLinkOperation2), 0, (GInstanceInitFunc) contacts_link_operation2_instance_init, NULL };
		GType contacts_link_operation2_type_id;
		contacts_link_operation2_type_id = g_type_register_static (G_TYPE_OBJECT, "ContactsLinkOperation2", &g_define_type_info, 0);
		g_once_init_leave (&contacts_link_operation2_type_id__volatile, contacts_link_operation2_type_id);
	}
	return contacts_link_operation2_type_id__volatile;
}


static void contacts_link_contacts_list_data_free (gpointer _data) {
	ContactsLinkContactsListData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->contact_list);
	_g_object_unref0 (_data_->result);
	g_slice_free (ContactsLinkContactsListData, _data_);
}


void contacts_link_contacts_list (GeeLinkedList* contact_list, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsLinkContactsListData* _data_;
	GeeLinkedList* _tmp0_ = NULL;
	GeeLinkedList* _tmp1_ = NULL;
	_data_ = g_slice_new0 (ContactsLinkContactsListData);
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, contacts_link_contacts_list);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, contacts_link_contacts_list_data_free);
	_tmp0_ = contact_list;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data_->contact_list);
	_data_->contact_list = _tmp1_;
	contacts_link_contacts_list_co (_data_);
}


ContactsLinkOperation2* contacts_link_contacts_list_finish (GAsyncResult* _res_) {
	ContactsLinkOperation2* result;
	ContactsLinkContactsListData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void contacts_link_contacts_list_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ContactsLinkContactsListData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_link_contacts_list_co (_data_);
}


static gboolean contacts_link_contacts_list_co (ContactsLinkContactsListData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = contacts_link_operation2_new ();
	_data_->operation = _data_->_tmp0_;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = gee_hash_set_new (FOLKS_TYPE_PERSONA, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->all_personas = _data_->_tmp1_;
	{
		_data_->_tmp2_ = NULL;
		_data_->_tmp2_ = _data_->contact_list;
		_data_->_tmp3_ = NULL;
		_data_->_tmp3_ = _g_object_ref0 (_data_->_tmp2_);
		_data_->_c_list = _data_->_tmp3_;
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = _data_->_c_list;
		_data_->_tmp5_ = 0;
		_data_->_tmp5_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp4_);
		_data_->_tmp6_ = 0;
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_c_size = _data_->_tmp6_;
		_data_->_c_index = -1;
		while (TRUE) {
			_data_->_tmp7_ = 0;
			_data_->_tmp7_ = _data_->_c_index;
			_data_->_c_index = _data_->_tmp7_ + 1;
			_data_->_tmp8_ = 0;
			_data_->_tmp8_ = _data_->_c_index;
			_data_->_tmp9_ = 0;
			_data_->_tmp9_ = _data_->_c_size;
			if (!(_data_->_tmp8_ < _data_->_tmp9_)) {
				break;
			}
			_data_->_tmp10_ = NULL;
			_data_->_tmp10_ = _data_->_c_list;
			_data_->_tmp11_ = 0;
			_data_->_tmp11_ = _data_->_c_index;
			_data_->_tmp12_ = NULL;
			_data_->_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp10_, _data_->_tmp11_);
			_data_->c = (ContactsContact*) _data_->_tmp12_;
			_data_->_tmp13_ = NULL;
			_data_->_tmp13_ = _data_->c;
			_data_->_tmp14_ = NULL;
			_data_->_tmp14_ = _data_->_tmp13_->individual;
			_data_->_tmp15_ = NULL;
			_data_->_tmp15_ = folks_individual_get_personas (_data_->_tmp14_);
			_data_->_tmp16_ = NULL;
			_data_->_tmp16_ = _data_->_tmp15_;
			_data_->_tmp17_ = NULL;
			_data_->_tmp17_ = _g_object_ref0 (_data_->_tmp16_);
			_data_->ps = _data_->_tmp17_;
			_data_->_tmp18_ = NULL;
			_data_->_tmp18_ = _data_->all_personas;
			_data_->_tmp19_ = NULL;
			_data_->_tmp19_ = _data_->ps;
			gee_collection_add_all ((GeeCollection*) _data_->_tmp18_, (GeeCollection*) _data_->_tmp19_);
			_data_->_tmp20_ = NULL;
			_data_->_tmp20_ = _data_->operation;
			_data_->_tmp21_ = NULL;
			_data_->_tmp21_ = _data_->ps;
			contacts_link_operation2_add_persona_set (_data_->_tmp20_, _data_->_tmp21_);
			_g_object_unref0 (_data_->ps);
			_g_object_unref0 (_data_->c);
		}
		_g_object_unref0 (_data_->_c_list);
	}
	{
		_data_->_tmp22_ = NULL;
		_data_->_tmp22_ = contacts_app_app;
		_data_->_tmp23_ = NULL;
		_data_->_tmp23_ = _data_->_tmp22_->contacts_store;
		_data_->_tmp24_ = NULL;
		_data_->_tmp24_ = contacts_store_get_aggregator (_data_->_tmp23_);
		_data_->_tmp25_ = NULL;
		_data_->_tmp25_ = _data_->_tmp24_;
		_data_->_tmp26_ = NULL;
		_data_->_tmp26_ = _data_->all_personas;
		_data_->_state_ = 1;
		folks_individual_aggregator_link_personas (_data_->_tmp25_, (GeeSet*) _data_->_tmp26_, contacts_link_contacts_list_ready, _data_);
		return FALSE;
		_state_1:
		folks_individual_aggregator_link_personas_finish (_data_->_tmp25_, _data_->_res_, &_data_->_inner_error_);
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch21_g_error;
		}
	}
	goto __finally21;
	__catch21_g_error:
	{
		_data_->e1 = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp27_ = NULL;
		_data_->_tmp27_ = _data_->e1;
		_data_->_tmp28_ = NULL;
		_data_->_tmp28_ = _data_->_tmp27_->message;
		g_warning ("contacts-linking.vala:772: Error linking personas: %s", _data_->_tmp28_);
		_g_error_free0 (_data_->e1);
	}
	__finally21:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_object_unref0 (_data_->all_personas);
		_g_object_unref0 (_data_->operation);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		return FALSE;
	}
	_data_->result = _data_->operation;
	_g_object_unref0 (_data_->all_personas);
	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;
	_g_object_unref0 (_data_->all_personas);
	_g_object_unref0 (_data_->operation);
	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;
}



