/* contacts-contact-pane.c generated by valac 0.38.7, the Vala compiler
 * generated from contacts-contact-pane.vala, do not modify */

/*
 * 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 <gtk/gtk.h>
#include <gio/gio.h>
#include <gee.h>
#include <folks/folks.h>
#include <cairo.h>
#include <float.h>
#include <math.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <pango/pango.h>


#define CONTACTS_TYPE_CONTACT_PANE (contacts_contact_pane_get_type ())
#define CONTACTS_CONTACT_PANE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_CONTACT_PANE, ContactsContactPane))
#define CONTACTS_CONTACT_PANE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_CONTACT_PANE, ContactsContactPaneClass))
#define CONTACTS_IS_CONTACT_PANE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_CONTACT_PANE))
#define CONTACTS_IS_CONTACT_PANE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_CONTACT_PANE))
#define CONTACTS_CONTACT_PANE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_CONTACT_PANE, ContactsContactPaneClass))

typedef struct _ContactsContactPane ContactsContactPane;
typedef struct _ContactsContactPaneClass ContactsContactPaneClass;
typedef struct _ContactsContactPanePrivate ContactsContactPanePrivate;

#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_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 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_CONTACT_SHEET (contacts_contact_sheet_get_type ())
#define CONTACTS_CONTACT_SHEET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_CONTACT_SHEET, ContactsContactSheet))
#define CONTACTS_CONTACT_SHEET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_CONTACT_SHEET, ContactsContactSheetClass))
#define CONTACTS_IS_CONTACT_SHEET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_CONTACT_SHEET))
#define CONTACTS_IS_CONTACT_SHEET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_CONTACT_SHEET))
#define CONTACTS_CONTACT_SHEET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_CONTACT_SHEET, ContactsContactSheetClass))

typedef struct _ContactsContactSheet ContactsContactSheet;
typedef struct _ContactsContactSheetClass ContactsContactSheetClass;

#define CONTACTS_TYPE_CONTACT_EDITOR (contacts_contact_editor_get_type ())
#define CONTACTS_CONTACT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_CONTACT_EDITOR, ContactsContactEditor))
#define CONTACTS_CONTACT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_CONTACT_EDITOR, ContactsContactEditorClass))
#define CONTACTS_IS_CONTACT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_CONTACT_EDITOR))
#define CONTACTS_IS_CONTACT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_CONTACT_EDITOR))
#define CONTACTS_CONTACT_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_CONTACT_EDITOR, ContactsContactEditorClass))

typedef struct _ContactsContactEditor ContactsContactEditor;
typedef struct _ContactsContactEditorClass ContactsContactEditorClass;
enum  {
	CONTACTS_CONTACT_PANE_0_PROPERTY,
	CONTACTS_CONTACT_PANE_NUM_PROPERTIES
};
static GParamSpec* contacts_contact_pane_properties[CONTACTS_CONTACT_PANE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ContactsContactPrivate ContactsContactPrivate;
typedef struct _Block24Data Block24Data;

#define CONTACTS_TYPE_CONTACT_FRAME (contacts_contact_frame_get_type ())
#define CONTACTS_CONTACT_FRAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_CONTACT_FRAME, ContactsContactFrame))
#define CONTACTS_CONTACT_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_CONTACT_FRAME, ContactsContactFrameClass))
#define CONTACTS_IS_CONTACT_FRAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_CONTACT_FRAME))
#define CONTACTS_IS_CONTACT_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_CONTACT_FRAME))
#define CONTACTS_CONTACT_FRAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_CONTACT_FRAME, ContactsContactFrameClass))

typedef struct _ContactsContactFrame ContactsContactFrame;
typedef struct _ContactsContactFrameClass ContactsContactFrameClass;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block25Data Block25Data;

#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 _ContactsContactEditorPrivate ContactsContactEditorPrivate;

#define TYPE_CENTER (center_get_type ())
#define CENTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CENTER, Center))
#define CENTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CENTER, CenterClass))
#define IS_CENTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CENTER))
#define IS_CENTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CENTER))
#define CENTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CENTER, CenterClass))

typedef struct _Center Center;
typedef struct _CenterClass CenterClass;

#define CONTACTS_TYPE_LINKED_ACCOUNTS_DIALOG (contacts_linked_accounts_dialog_get_type ())
#define CONTACTS_LINKED_ACCOUNTS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_LINKED_ACCOUNTS_DIALOG, ContactsLinkedAccountsDialog))
#define CONTACTS_LINKED_ACCOUNTS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_LINKED_ACCOUNTS_DIALOG, ContactsLinkedAccountsDialogClass))
#define CONTACTS_IS_LINKED_ACCOUNTS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_LINKED_ACCOUNTS_DIALOG))
#define CONTACTS_IS_LINKED_ACCOUNTS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_LINKED_ACCOUNTS_DIALOG))
#define CONTACTS_LINKED_ACCOUNTS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_LINKED_ACCOUNTS_DIALOG, ContactsLinkedAccountsDialogClass))

typedef struct _ContactsLinkedAccountsDialog ContactsLinkedAccountsDialog;
typedef struct _ContactsLinkedAccountsDialogClass ContactsLinkedAccountsDialogClass;
typedef struct _ContactsLinkedAccountsDialogPrivate ContactsLinkedAccountsDialogPrivate;

#define CONTACTS_CONTACT_EDITOR_TYPE_PROPERTY_DATA (contacts_contact_editor_property_data_get_type ())
typedef struct _ContactsContactEditorPropertyData ContactsContactEditorPropertyData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _ContactsContactPaneCreateContactData ContactsContactPaneCreateContactData;

#define CONTACTS_TYPE_IN_APP_NOTIFICATION (contacts_in_app_notification_get_type ())
#define CONTACTS_IN_APP_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_IN_APP_NOTIFICATION, ContactsInAppNotification))
#define CONTACTS_IN_APP_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_IN_APP_NOTIFICATION, ContactsInAppNotificationClass))
#define CONTACTS_IS_IN_APP_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_IN_APP_NOTIFICATION))
#define CONTACTS_IS_IN_APP_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_IN_APP_NOTIFICATION))
#define CONTACTS_IN_APP_NOTIFICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_IN_APP_NOTIFICATION, ContactsInAppNotificationClass))

typedef struct _ContactsInAppNotification ContactsInAppNotification;
typedef struct _ContactsInAppNotificationClass ContactsInAppNotificationClass;
enum  {
	CONTACTS_CONTACT_PANE_CONTACTS_LINKED_SIGNAL,
	CONTACTS_CONTACT_PANE_WILL_DELETE_SIGNAL,
	CONTACTS_CONTACT_PANE_NUM_SIGNALS
};
static guint contacts_contact_pane_signals[CONTACTS_CONTACT_PANE_NUM_SIGNALS] = {0};

struct _ContactsContactPane {
	GtkStack parent_instance;
	ContactsContactPanePrivate * priv;
	ContactsContact* contact;
	gboolean on_edit_mode;
	GtkGrid* suggestion_grid;
};

struct _ContactsContactPaneClass {
	GtkStackClass parent_class;
};

struct _ContactsContactPanePrivate {
	ContactsWindow* parent_window;
	ContactsStore* store;
	GtkGrid* none_selected_page;
	GtkScrolledWindow* contact_sheet_page;
	ContactsContactSheet* sheet;
	GtkBox* contact_editor_page;
	ContactsContactEditor* editor;
	GSimpleActionGroup* edit_contact_actions;
};

struct _ContactsContact {
	GObject parent_instance;
	ContactsContactPrivate * priv;
	ContactsStore* store;
	gboolean is_main;
	FolksIndividual* individual;
	FolksPersona* fake_persona;
};

struct _ContactsContactClass {
	GObjectClass parent_class;
};

struct _Block24Data {
	int _ref_count_;
	ContactsContactPane* self;
	ContactsContact* c;
};

struct _Block25Data {
	int _ref_count_;
	Block24Data * _data24_;
	gchar* linked_contact;
};

struct _ContactsContactEditor {
	GtkGrid parent_instance;
	ContactsContactEditorPrivate * priv;
	GtkButton* linked_button;
	GtkButton* remove_button;
};

struct _ContactsContactEditorClass {
	GtkGridClass parent_class;
};

struct _ContactsLinkedAccountsDialog {
	GtkDialog parent_instance;
	ContactsLinkedAccountsDialogPrivate * priv;
	gboolean any_unlinked;
};

struct _ContactsLinkedAccountsDialogClass {
	GtkDialogClass parent_class;
};

struct _ContactsContactEditorPropertyData {
	FolksPersona* persona;
	GValue value;
};

typedef enum  {
	CONTACT_ERROR_NOT_IMPLEMENTED,
	CONTACT_ERROR_NO_PRIMARY
} ContactError;
#define CONTACT_ERROR contact_error_quark ()
struct _ContactsContactPaneCreateContactData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ContactsContactPane* self;
	GHashTable* details;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	ContactsContactEditor* _tmp3_;
	gboolean _tmp4_;
	GHashTable* _tmp5_;
	gchar* _tmp6_;
	ContactsContactEditor* _tmp7_;
	GValue _tmp8_;
	GValue _tmp9_;
	GValue* _tmp10_;
	ContactsContactEditor* _tmp11_;
	gboolean _tmp12_;
	GHashTable* _tmp13_;
	gchar* _tmp14_;
	ContactsContactEditor* _tmp15_;
	GValue _tmp16_;
	GValue _tmp17_;
	GValue* _tmp18_;
	GeeIterator* _prop_it;
	ContactsContactEditor* _tmp19_;
	GeeHashMap* _tmp20_;
	GeeHashMap* _tmp21_;
	GeeSet* _tmp22_;
	GeeSet* _tmp23_;
	GeeSet* _tmp24_;
	GeeIterator* _tmp25_;
	GeeIterator* _tmp26_;
	GeeIterator* _tmp27_;
	gboolean _tmp28_;
	GeeMapEntry* prop;
	GeeIterator* _tmp29_;
	gpointer _tmp30_;
	GHashTable* _tmp31_;
	GeeMapEntry* _tmp32_;
	gconstpointer _tmp33_;
	const gchar* _tmp34_;
	gchar* _tmp35_;
	GeeMapEntry* _tmp36_;
	gconstpointer _tmp37_;
	ContactsContactEditorPropertyData* _tmp38_;
	GValue _tmp39_;
	GValue _tmp40_;
	GValue* _tmp41_;
	GHashTable* _tmp42_;
	guint _tmp43_;
	ContactsStore* _tmp44_;
	FolksIndividualAggregator* _tmp45_;
	FolksIndividualAggregator* _tmp46_;
	FolksPersonaStore* _tmp47_;
	FolksPersonaStore* _tmp48_;
	FolksPersonaStore* primary_store;
	ContactsStore* _tmp49_;
	FolksIndividualAggregator* _tmp50_;
	FolksIndividualAggregator* _tmp51_;
	FolksPersonaStore* _tmp52_;
	FolksPersonaStore* _tmp53_;
	FolksPersonaStore* _tmp54_;
	FolksPersona* persona;
	FolksPersona* _tmp55_;
	FolksPersonaStore* _tmp56_;
	GHashTable* _tmp57_;
	FolksPersona* _tmp58_;
	FolksPersona* _tmp59_;
	GError* e;
	GError* _tmp60_;
	const gchar* _tmp61_;
	gchar* _tmp62_;
	gchar* _tmp63_;
	ContactsContact* contact;
	ContactsStore* _tmp64_;
	FolksPersona* _tmp65_;
	ContactsContact* _tmp66_;
	ContactsContact* _tmp67_;
	ContactsWindow* _tmp68_;
	ContactsContact* _tmp69_;
	GError * _inner_error_;
};


static gpointer contacts_contact_pane_parent_class = NULL;

#define PROFILE_SIZE 96
GType contacts_contact_pane_get_type (void) G_GNUC_CONST;
GType contacts_contact_get_type (void) G_GNUC_CONST;
GType contacts_window_get_type (void) G_GNUC_CONST;
GType contacts_store_get_type (void) G_GNUC_CONST;
GType contacts_contact_sheet_get_type (void) G_GNUC_CONST;
GType contacts_contact_editor_get_type (void) G_GNUC_CONST;
#define CONTACTS_CONTACT_PANE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_CONTACT_PANE, ContactsContactPanePrivate))
static void contacts_contact_pane_on_add_detail (ContactsContactPane* self, GSimpleAction* action, GVariant* parameter);
static void _contacts_contact_pane_on_add_detail_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self);
void contacts_contact_pane_update_sheet (ContactsContactPane* self);
void contacts_contact_sheet_clear (ContactsContactSheet* self);
void contacts_contact_sheet_update (ContactsContactSheet* self, ContactsContact* c);
FolksIndividualAggregator* contacts_store_get_aggregator (ContactsStore* self);
ContactsContact* contacts_contact_from_individual (FolksIndividual* i);
gboolean contacts_contact_suggest_link_to (ContactsContact* self, ContactsContact* other);
void contacts_contact_pane_add_suggestion (ContactsContactPane* self, ContactsContact* c);
static Block24Data* block24_data_ref (Block24Data* _data24_);
static void block24_data_unref (void * _userdata_);
static gboolean __lambda62_ (ContactsContactPane* self, cairo_t* cr);
static gboolean ___lambda62__gtk_widget_draw (GtkWidget* _sender, cairo_t* cr, gpointer self);
GType contacts_contact_frame_get_type (void) G_GNUC_CONST;
#define CONTACTS_CONTACT_SMALL_AVATAR_SIZE 54
ContactsContactFrame* contacts_contact_frame_new (gint size, gboolean with_button);
ContactsContactFrame* contacts_contact_frame_construct (GType object_type, gint size, gboolean with_button);
void contacts_contact_keep_widget_uptodate (ContactsContact* self, GtkWidget* w, GtkCallback callback, void* callback_target, GDestroyNotify callback_target_destroy_notify);
static void __lambda63_ (Block24Data* _data24_, GtkWidget* w);
void contacts_contact_frame_set_image (ContactsContactFrame* self, FolksAvatarDetails* details, ContactsContact* contact);
static void ___lambda63__gtk_callback (GtkWidget* widget, gpointer self);
const gchar* contacts_contact_get_display_name (ContactsContact* self);
gchar* contacts_contact_format_persona_stores (ContactsContact* self);
static void __lambda64_ (Block24Data* _data24_);
static Block25Data* block25_data_ref (Block25Data* _data25_);
static void block25_data_unref (void * _userdata_);
void contacts_link_contacts (ContactsContact* main, ContactsContact* other, ContactsStore* contacts_store, GAsyncReadyCallback _callback_, gpointer _user_data_);
GType contacts_link_operation_get_type (void) G_GNUC_CONST;
ContactsLinkOperation* contacts_link_contacts_finish (GAsyncResult* _res_);
static void __lambda65_ (Block25Data* _data25_, GObject* obj, GAsyncResult* _result_);
static void ___lambda65__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
static void ___lambda64__gtk_button_clicked (GtkButton* _sender, gpointer self);
static void __lambda66_ (Block24Data* _data24_);
void contacts_store_add_no_suggest_link (ContactsStore* self, ContactsContact* a, ContactsContact* b);
static void ___lambda66__gtk_button_clicked (GtkButton* _sender, gpointer self);
void contacts_contact_pane_show_contact (ContactsContactPane* self, ContactsContact* new_contact, gboolean show_matches);
static void _contacts_contact_pane_update_sheet_contacts_contact_personas_changed (ContactsContact* _sender, gpointer self);
static void _contacts_contact_pane_update_sheet_contacts_contact_changed (ContactsContact* _sender, gpointer self);
ContactsContactPane* contacts_contact_pane_new (ContactsWindow* parent_window, ContactsStore* contacts_store);
ContactsContactPane* contacts_contact_pane_construct (GType object_type, ContactsWindow* parent_window, ContactsStore* contacts_store);
static void _contacts_contact_pane_update_sheet_contacts_store_quiescent (ContactsStore* _sender, gpointer self);
static void contacts_contact_pane_create_contact_sheet (ContactsContactPane* self);
ContactsContactEditor* contacts_contact_editor_new (GSimpleActionGroup* editor_actions);
ContactsContactEditor* contacts_contact_editor_construct (GType object_type, GSimpleActionGroup* editor_actions);
static void contacts_contact_pane_linked_accounts (ContactsContactPane* self);
static void _contacts_contact_pane_linked_accounts_gtk_button_clicked (GtkButton* _sender, gpointer self);
static void contacts_contact_pane_delete_contact (ContactsContactPane* self);
static void _contacts_contact_pane_delete_contact_gtk_button_clicked (GtkButton* _sender, gpointer self);
ContactsContactSheet* contacts_contact_sheet_new (ContactsStore* contacts_store);
ContactsContactSheet* contacts_contact_sheet_construct (GType object_type, ContactsStore* contacts_store);
GType center_get_type (void) G_GNUC_CONST;
Center* center_new (void);
Center* center_construct (GType object_type);
void center_set_max_width (Center* self, gint value);
void center_set_xalign (Center* self, gdouble value);
void contacts_contact_editor_add_new_row_for_property (ContactsContactEditor* self, FolksPersona* p, const gchar* prop_name, const gchar* type);
FolksPersona* contacts_contact_find_primary_persona (ContactsContact* self);
GType contacts_linked_accounts_dialog_get_type (void) G_GNUC_CONST;
ContactsLinkedAccountsDialog* contacts_linked_accounts_dialog_new (ContactsWindow* main_win, ContactsContact* contact);
ContactsLinkedAccountsDialog* contacts_linked_accounts_dialog_construct (GType object_type, ContactsWindow* main_win, ContactsContact* contact);
void contacts_contact_pane_set_edit_mode (ContactsContactPane* self, gboolean on_edit, gboolean drop_changes);
void contacts_contact_hide (ContactsContact* self);
void contacts_contact_editor_clear (ContactsContactEditor* self);
void contacts_contact_editor_edit (ContactsContactEditor* self, ContactsContact* c);
GType contacts_contact_editor_property_data_get_type (void) G_GNUC_CONST;
ContactsContactEditorPropertyData* contacts_contact_editor_property_data_dup (const ContactsContactEditorPropertyData* self);
void contacts_contact_editor_property_data_free (ContactsContactEditorPropertyData* self);
void contacts_contact_editor_property_data_copy (const ContactsContactEditorPropertyData* self, ContactsContactEditorPropertyData* dest);
void contacts_contact_editor_property_data_destroy (ContactsContactEditorPropertyData* self);
GeeHashMap* contacts_contact_editor_properties_changed (ContactsContactEditor* self);
void contacts_contact_set_persona_property (FolksPersona* persona, const gchar* property_name, GValue* new_value, GAsyncReadyCallback _callback_, gpointer _user_data_);
GQuark contact_error_quark (void);
void contacts_contact_set_persona_property_finish (GAsyncResult* _res_, GError** error);
static void ______lambda70_ (ContactsContactPane* self, GObject* obj, GAsyncResult* _result_);
static void contacts_contact_pane_show_message (ContactsContactPane* self, const gchar* message);
static void _______lambda70__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
gboolean contacts_contact_editor_name_changed (ContactsContactEditor* self);
void contacts_contact_editor_get_full_name_value (ContactsContactEditor* self, GValue* result);
void contacts_contact_set_individual_property (ContactsContact* contact, const gchar* property_name, GValue* value, GAsyncReadyCallback _callback_, gpointer _user_data_);
FolksPersona* contacts_contact_set_individual_property_finish (GAsyncResult* _res_, GError** error);
static void _____lambda72_ (ContactsContactPane* self, GObject* obj, GAsyncResult* _result_);
static void ______lambda72__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
gboolean contacts_contact_editor_avatar_changed (ContactsContactEditor* self);
void contacts_contact_editor_get_avatar_value (ContactsContactEditor* self, GValue* result);
static void _____lambda73_ (ContactsContactPane* self, GObject* obj, GAsyncResult* _result_);
static void ______lambda73__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
void contacts_contact_pane_new_contact (ContactsContactPane* self);
void contacts_contact_editor_set_new_contact (ContactsContactEditor* self);
static void contacts_contact_pane_create_contact_data_free (gpointer _data);
void contacts_contact_pane_create_contact (ContactsContactPane* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void contacts_contact_pane_create_contact_finish (ContactsContactPane* self, GAsyncResult* _res_);
static gboolean contacts_contact_pane_create_contact_co (ContactsContactPaneCreateContactData* _data_);
static void _g_free0_ (gpointer var);
static void _vala_GValue_free (GValue* self);
static void __vala_GValue_free0_ (gpointer var);
static GValue* _g_value_dup (GValue* self);
static void contacts_contact_pane_show_message_dialog (ContactsContactPane* self, const gchar* message);
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);
static void contacts_contact_pane_create_contact_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
ContactsContact* contacts_store_find_contact_with_persona (ContactsStore* self, FolksPersona* persona);
void contacts_window_set_shown_contact (ContactsWindow* self, ContactsContact* c);
GType contacts_in_app_notification_get_type (void) G_GNUC_CONST;
ContactsInAppNotification* contacts_in_app_notification_new (const gchar* message, GtkButton* button);
ContactsInAppNotification* contacts_in_app_notification_construct (GType object_type, const gchar* message, GtkButton* button);
void contacts_in_app_notification_show (ContactsInAppNotification* self);
void contacts_window_add_notification (ContactsWindow* self, ContactsInAppNotification* notification);
static void g_cclosure_user_marshal_VOID__STRING_STRING_OBJECT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
static void contacts_contact_pane_finalize (GObject * obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);

static const GActionEntry CONTACTS_CONTACT_PANE_action_entries[11] = {{"add.email-addresses.home", _contacts_contact_pane_on_add_detail_gsimple_action_activate_callback}, {"add.email-addresses.work", _contacts_contact_pane_on_add_detail_gsimple_action_activate_callback}, {"add.phone-numbers.cell", _contacts_contact_pane_on_add_detail_gsimple_action_activate_callback}, {"add.phone-numbers.home", _contacts_contact_pane_on_add_detail_gsimple_action_activate_callback}, {"add.phone-numbers.work", _contacts_contact_pane_on_add_detail_gsimple_action_activate_callback}, {"add.urls", _contacts_contact_pane_on_add_detail_gsimple_action_activate_callback}, {"add.nickname", _contacts_contact_pane_on_add_detail_gsimple_action_activate_callback}, {"add.birthday", _contacts_contact_pane_on_add_detail_gsimple_action_activate_callback}, {"add.postal-addresses.home", _contacts_contact_pane_on_add_detail_gsimple_action_activate_callback}, {"add.postal-addresses.work", _contacts_contact_pane_on_add_detail_gsimple_action_activate_callback}, {"add.notes", _contacts_contact_pane_on_add_detail_gsimple_action_activate_callback}};

static void _contacts_contact_pane_on_add_detail_gsimple_action_activate_callback (GSimpleAction* action, GVariant* parameter, gpointer self) {
	contacts_contact_pane_on_add_detail ((ContactsContactPane*) self, action, parameter);
}


void contacts_contact_pane_update_sheet (ContactsContactPane* self) {
	gboolean _tmp0_;
	ContactsContactSheet* _tmp1_;
	ContactsContact* _tmp2_;
	ContactsContactSheet* _tmp3_;
	ContactsContact* _tmp4_;
	GtkScrolledWindow* _tmp5_;
	GeeMap* matches = NULL;
	ContactsContact* _tmp6_;
	ContactsStore* _tmp7_;
	FolksIndividualAggregator* _tmp8_;
	FolksIndividualAggregator* _tmp9_;
	ContactsContact* _tmp10_;
	FolksIndividual* _tmp11_;
	GeeMap* _tmp12_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->on_edit_mode;
	if (_tmp0_) {
		return;
	}
	_tmp1_ = self->priv->sheet;
	contacts_contact_sheet_clear (_tmp1_);
	_tmp2_ = self->contact;
	if (_tmp2_ == NULL) {
		return;
	}
	_tmp3_ = self->priv->sheet;
	_tmp4_ = self->contact;
	contacts_contact_sheet_update (_tmp3_, _tmp4_);
	_tmp5_ = self->priv->contact_sheet_page;
	gtk_stack_set_visible_child ((GtkStack*) self, (GtkWidget*) _tmp5_);
	_tmp6_ = self->contact;
	_tmp7_ = _tmp6_->store;
	_tmp8_ = contacts_store_get_aggregator (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = self->contact;
	_tmp11_ = _tmp10_->individual;
	_tmp12_ = folks_individual_aggregator_get_potential_matches (_tmp9_, _tmp11_, FOLKS_MATCH_RESULT_HIGH);
	matches = _tmp12_;
	{
		GeeIterator* _ind_it = NULL;
		GeeMap* _tmp13_;
		GeeSet* _tmp14_;
		GeeSet* _tmp15_;
		GeeSet* _tmp16_;
		GeeIterator* _tmp17_;
		GeeIterator* _tmp18_;
		_tmp13_ = matches;
		_tmp14_ = gee_map_get_keys (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = _tmp15_;
		_tmp17_ = gee_iterable_iterator ((GeeIterable*) _tmp16_);
		_tmp18_ = _tmp17_;
		_g_object_unref0 (_tmp16_);
		_ind_it = _tmp18_;
		while (TRUE) {
			GeeIterator* _tmp19_;
			gboolean _tmp20_;
			FolksIndividual* ind = NULL;
			GeeIterator* _tmp21_;
			gpointer _tmp22_;
			ContactsContact* c = NULL;
			FolksIndividual* _tmp23_;
			ContactsContact* _tmp24_;
			gboolean _tmp25_ = FALSE;
			ContactsContact* _tmp26_;
			_tmp19_ = _ind_it;
			_tmp20_ = gee_iterator_next (_tmp19_);
			if (!_tmp20_) {
				break;
			}
			_tmp21_ = _ind_it;
			_tmp22_ = gee_iterator_get (_tmp21_);
			ind = (FolksIndividual*) _tmp22_;
			_tmp23_ = ind;
			_tmp24_ = contacts_contact_from_individual (_tmp23_);
			c = _tmp24_;
			_tmp26_ = c;
			if (_tmp26_ != NULL) {
				ContactsContact* _tmp27_;
				ContactsContact* _tmp28_;
				gboolean _tmp29_;
				_tmp27_ = self->contact;
				_tmp28_ = c;
				_tmp29_ = contacts_contact_suggest_link_to (_tmp27_, _tmp28_);
				_tmp25_ = _tmp29_;
			} else {
				_tmp25_ = FALSE;
			}
			if (_tmp25_) {
				ContactsContact* _tmp30_;
				_tmp30_ = c;
				contacts_contact_pane_add_suggestion (self, _tmp30_);
			}
			_g_object_unref0 (c);
			_g_object_unref0 (ind);
		}
		_g_object_unref0 (_ind_it);
	}
	_g_object_unref0 (matches);
}


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


static Block24Data* block24_data_ref (Block24Data* _data24_) {
	g_atomic_int_inc (&_data24_->_ref_count_);
	return _data24_;
}


static void block24_data_unref (void * _userdata_) {
	Block24Data* _data24_;
	_data24_ = (Block24Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data24_->_ref_count_)) {
		ContactsContactPane* self;
		self = _data24_->self;
		_g_object_unref0 (_data24_->c);
		_g_object_unref0 (self);
		g_slice_free (Block24Data, _data24_);
	}
}


static gboolean __lambda62_ (ContactsContactPane* self, cairo_t* cr) {
	gboolean result = FALSE;
	GtkAllocation allocation = {0};
	GtkGrid* _tmp0_;
	GtkAllocation _tmp1_ = {0};
	GtkStyleContext* context = NULL;
	GtkGrid* _tmp2_;
	GtkStyleContext* _tmp3_;
	GtkStyleContext* _tmp4_;
	cairo_t* _tmp5_;
	GtkAllocation _tmp6_;
	gint _tmp7_;
	GtkAllocation _tmp8_;
	gint _tmp9_;
	g_return_val_if_fail (cr != NULL, FALSE);
	_tmp0_ = self->suggestion_grid;
	gtk_widget_get_allocation ((GtkWidget*) _tmp0_, &_tmp1_);
	allocation = _tmp1_;
	_tmp2_ = self->suggestion_grid;
	_tmp3_ = gtk_widget_get_style_context ((GtkWidget*) _tmp2_);
	_tmp4_ = _g_object_ref0 (_tmp3_);
	context = _tmp4_;
	_tmp5_ = cr;
	_tmp6_ = allocation;
	_tmp7_ = _tmp6_.width;
	_tmp8_ = allocation;
	_tmp9_ = _tmp8_.height;
	gtk_render_background (context, _tmp5_, (gdouble) 0, (gdouble) 0, (gdouble) _tmp7_, (gdouble) _tmp9_);
	result = FALSE;
	_g_object_unref0 (context);
	return result;
}


static gboolean ___lambda62__gtk_widget_draw (GtkWidget* _sender, cairo_t* cr, gpointer self) {
	gboolean result;
	result = __lambda62_ ((ContactsContactPane*) self, cr);
	return result;
}


static void __lambda63_ (Block24Data* _data24_, GtkWidget* w) {
	ContactsContactPane* self;
	GtkWidget* _tmp0_;
	ContactsContact* _tmp1_;
	FolksIndividual* _tmp2_;
	ContactsContact* _tmp3_;
	self = _data24_->self;
	g_return_if_fail (w != NULL);
	_tmp0_ = w;
	_tmp1_ = _data24_->c;
	_tmp2_ = _tmp1_->individual;
	_tmp3_ = _data24_->c;
	contacts_contact_frame_set_image (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, CONTACTS_TYPE_CONTACT_FRAME) ? ((ContactsContactFrame*) _tmp0_) : NULL, (FolksAvatarDetails*) _tmp2_, _tmp3_);
}


static void ___lambda63__gtk_callback (GtkWidget* widget, gpointer self) {
	__lambda63_ (self, widget);
}


static Block25Data* block25_data_ref (Block25Data* _data25_) {
	g_atomic_int_inc (&_data25_->_ref_count_);
	return _data25_;
}


static void block25_data_unref (void * _userdata_) {
	Block25Data* _data25_;
	_data25_ = (Block25Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data25_->_ref_count_)) {
		ContactsContactPane* self;
		self = _data25_->_data24_->self;
		_g_free0 (_data25_->linked_contact);
		block24_data_unref (_data25_->_data24_);
		_data25_->_data24_ = NULL;
		g_slice_free (Block25Data, _data25_);
	}
}


static void __lambda65_ (Block25Data* _data25_, GObject* obj, GAsyncResult* _result_) {
	Block24Data* _data24_;
	ContactsContactPane* self;
	ContactsLinkOperation* operation = NULL;
	GAsyncResult* _tmp0_;
	ContactsLinkOperation* _tmp1_;
	_data24_ = _data25_->_data24_;
	self = _data24_->self;
	g_return_if_fail (_result_ != NULL);
	_tmp0_ = _result_;
	_tmp1_ = contacts_link_contacts_finish (_tmp0_);
	operation = _tmp1_;
	g_signal_emit (self, contacts_contact_pane_signals[CONTACTS_CONTACT_PANE_CONTACTS_LINKED_SIGNAL], 0, NULL, _data25_->linked_contact, operation);
	_g_object_unref0 (operation);
}


static void ___lambda65__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	__lambda65_ (self, source_object, res);
	block25_data_unref (self);
}


static void __lambda64_ (Block24Data* _data24_) {
	ContactsContactPane* self;
	Block25Data* _data25_;
	ContactsContact* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	ContactsContact* _tmp4_;
	ContactsContact* _tmp5_;
	ContactsStore* _tmp6_;
	GtkGrid* _tmp7_;
	self = _data24_->self;
	_data25_ = g_slice_new0 (Block25Data);
	_data25_->_ref_count_ = 1;
	_data25_->_data24_ = block24_data_ref (_data24_);
	_tmp0_ = _data24_->c;
	_tmp1_ = contacts_contact_get_display_name (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	_data25_->linked_contact = _tmp3_;
	_tmp4_ = self->contact;
	_tmp5_ = _data24_->c;
	_tmp6_ = self->priv->store;
	contacts_link_contacts (_tmp4_, _tmp5_, _tmp6_, ___lambda65__gasync_ready_callback, block25_data_ref (_data25_));
	_tmp7_ = self->suggestion_grid;
	gtk_widget_destroy ((GtkWidget*) _tmp7_);
	block25_data_unref (_data25_);
	_data25_ = NULL;
}


static void ___lambda64__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda64_ (self);
}


static void __lambda66_ (Block24Data* _data24_) {
	ContactsContactPane* self;
	ContactsStore* _tmp0_;
	ContactsContact* _tmp1_;
	ContactsContact* _tmp2_;
	GtkGrid* _tmp3_;
	self = _data24_->self;
	_tmp0_ = self->priv->store;
	_tmp1_ = self->contact;
	_tmp2_ = _data24_->c;
	contacts_store_add_no_suggest_link (_tmp0_, _tmp1_, _tmp2_);
	_tmp3_ = self->suggestion_grid;
	gtk_widget_destroy ((GtkWidget*) _tmp3_);
}


static void ___lambda66__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__lambda66_ (self);
}


void contacts_contact_pane_add_suggestion (ContactsContactPane* self, ContactsContact* c) {
	Block24Data* _data24_;
	ContactsContact* _tmp0_;
	ContactsContact* _tmp1_;
	GtkOverlay* parent_overlay = NULL;
	GtkContainer* _tmp2_;
	GtkOverlay* _tmp3_;
	GtkGrid* _tmp4_;
	GtkGrid* _tmp6_;
	GtkGrid* _tmp7_;
	GtkOverlay* _tmp8_;
	GtkGrid* _tmp9_;
	GtkGrid* _tmp10_;
	GtkStyleContext* _tmp11_;
	GtkGrid* _tmp12_;
	GtkGrid* _tmp13_;
	ContactsContactFrame* image_frame = NULL;
	ContactsContactFrame* _tmp14_;
	ContactsContactFrame* _tmp15_;
	ContactsContactFrame* _tmp16_;
	ContactsContactFrame* _tmp17_;
	ContactsContact* _tmp18_;
	ContactsContactFrame* _tmp19_;
	GtkGrid* _tmp20_;
	ContactsContactFrame* _tmp21_;
	GtkLabel* label = NULL;
	GtkLabel* _tmp22_;
	ContactsContact* _tmp23_;
	gboolean _tmp24_;
	GtkLabel* _tmp40_;
	GtkLabel* _tmp41_;
	GtkLabel* _tmp42_;
	GtkLabel* _tmp43_;
	GtkLabel* _tmp44_;
	GtkLabel* _tmp45_;
	GtkLabel* _tmp46_;
	GtkLabel* _tmp47_;
	GtkGrid* _tmp48_;
	GtkLabel* _tmp49_;
	GtkButtonBox* bbox = NULL;
	GtkButtonBox* _tmp50_;
	GtkButton* yes = NULL;
	GtkButton* _tmp51_;
	GtkButton* no = NULL;
	GtkButton* _tmp52_;
	GtkGrid* _tmp53_;
	GtkGrid* _tmp54_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	_data24_ = g_slice_new0 (Block24Data);
	_data24_->_ref_count_ = 1;
	_data24_->self = g_object_ref (self);
	_tmp0_ = c;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data24_->c);
	_data24_->c = _tmp1_;
	_tmp2_ = (GtkContainer*) gtk_widget_get_parent ((GtkWidget*) self);
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, gtk_overlay_get_type ()) ? ((GtkOverlay*) _tmp2_) : NULL);
	parent_overlay = _tmp3_;
	_tmp4_ = self->suggestion_grid;
	if (_tmp4_ != NULL) {
		GtkGrid* _tmp5_;
		_tmp5_ = self->suggestion_grid;
		gtk_widget_destroy ((GtkWidget*) _tmp5_);
		_g_object_unref0 (self->suggestion_grid);
		self->suggestion_grid = NULL;
	}
	_tmp6_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp6_);
	_g_object_unref0 (self->suggestion_grid);
	self->suggestion_grid = _tmp6_;
	_tmp7_ = self->suggestion_grid;
	gtk_widget_set_valign ((GtkWidget*) _tmp7_, GTK_ALIGN_END);
	_tmp8_ = parent_overlay;
	_tmp9_ = self->suggestion_grid;
	gtk_overlay_add_overlay (_tmp8_, (GtkWidget*) _tmp9_);
	_tmp10_ = self->suggestion_grid;
	_tmp11_ = gtk_widget_get_style_context ((GtkWidget*) _tmp10_);
	gtk_style_context_add_class (_tmp11_, "contacts-suggestion");
	_tmp12_ = self->suggestion_grid;
	gtk_widget_set_redraw_on_allocate ((GtkWidget*) _tmp12_, TRUE);
	_tmp13_ = self->suggestion_grid;
	g_signal_connect_object ((GtkWidget*) _tmp13_, "draw", (GCallback) ___lambda62__gtk_widget_draw, self, 0);
	_tmp14_ = contacts_contact_frame_new (CONTACTS_CONTACT_SMALL_AVATAR_SIZE, FALSE);
	g_object_ref_sink (_tmp14_);
	image_frame = _tmp14_;
	_tmp15_ = image_frame;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp15_, FALSE);
	_tmp16_ = image_frame;
	g_object_set ((GtkWidget*) _tmp16_, "margin", 24, NULL);
	_tmp17_ = image_frame;
	gtk_widget_set_margin_end ((GtkWidget*) _tmp17_, 12);
	_tmp18_ = _data24_->c;
	_tmp19_ = image_frame;
	contacts_contact_keep_widget_uptodate (_tmp18_, (GtkWidget*) _tmp19_, ___lambda63__gtk_callback, block24_data_ref (_data24_), block24_data_unref);
	_tmp20_ = self->suggestion_grid;
	_tmp21_ = image_frame;
	gtk_grid_attach (_tmp20_, (GtkWidget*) _tmp21_, 0, 0, 1, 2);
	_tmp22_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp22_);
	label = _tmp22_;
	_tmp23_ = self->contact;
	_tmp24_ = _tmp23_->is_main;
	if (_tmp24_) {
		GtkLabel* _tmp25_;
		ContactsContact* _tmp26_;
		const gchar* _tmp27_;
		const gchar* _tmp28_;
		ContactsContact* _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		gchar* _tmp32_;
		gchar* _tmp33_;
		_tmp25_ = label;
		_tmp26_ = _data24_->c;
		_tmp27_ = contacts_contact_get_display_name (_tmp26_);
		_tmp28_ = _tmp27_;
		_tmp29_ = _data24_->c;
		_tmp30_ = contacts_contact_format_persona_stores (_tmp29_);
		_tmp31_ = _tmp30_;
		_tmp32_ = g_markup_printf_escaped (_ ("Does %s from %s belong here?"), _tmp28_, _tmp31_);
		_tmp33_ = _tmp32_;
		gtk_label_set_markup (_tmp25_, _tmp33_);
		_g_free0 (_tmp33_);
		_g_free0 (_tmp31_);
	} else {
		GtkLabel* _tmp34_;
		ContactsContact* _tmp35_;
		const gchar* _tmp36_;
		const gchar* _tmp37_;
		gchar* _tmp38_;
		gchar* _tmp39_;
		_tmp34_ = label;
		_tmp35_ = _data24_->c;
		_tmp36_ = contacts_contact_get_display_name (_tmp35_);
		_tmp37_ = _tmp36_;
		_tmp38_ = g_markup_printf_escaped (_ ("Do these details belong to %s?"), _tmp37_);
		_tmp39_ = _tmp38_;
		gtk_label_set_markup (_tmp34_, _tmp39_);
		_g_free0 (_tmp39_);
	}
	_tmp40_ = label;
	gtk_widget_set_valign ((GtkWidget*) _tmp40_, GTK_ALIGN_START);
	_tmp41_ = label;
	gtk_widget_set_halign ((GtkWidget*) _tmp41_, GTK_ALIGN_START);
	_tmp42_ = label;
	gtk_label_set_line_wrap (_tmp42_, TRUE);
	_tmp43_ = label;
	gtk_label_set_width_chars (_tmp43_, 20);
	_tmp44_ = label;
	gtk_label_set_line_wrap_mode (_tmp44_, PANGO_WRAP_WORD_CHAR);
	_tmp45_ = label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp45_, TRUE);
	_tmp46_ = label;
	gtk_widget_set_margin_top ((GtkWidget*) _tmp46_, 24);
	_tmp47_ = label;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp47_, 24);
	_tmp48_ = self->suggestion_grid;
	_tmp49_ = label;
	gtk_grid_attach (_tmp48_, (GtkWidget*) _tmp49_, 1, 0, 1, 2);
	_tmp50_ = (GtkButtonBox*) gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
	g_object_ref_sink (_tmp50_);
	bbox = _tmp50_;
	_tmp51_ = (GtkButton*) gtk_button_new_with_label (_ ("Yes"));
	g_object_ref_sink (_tmp51_);
	yes = _tmp51_;
	_tmp52_ = (GtkButton*) gtk_button_new_with_label (_ ("No"));
	g_object_ref_sink (_tmp52_);
	no = _tmp52_;
	g_signal_connect_data (yes, "clicked", (GCallback) ___lambda64__gtk_button_clicked, block24_data_ref (_data24_), (GClosureNotify) block24_data_unref, 0);
	g_signal_connect_data (no, "clicked", (GCallback) ___lambda66__gtk_button_clicked, block24_data_ref (_data24_), (GClosureNotify) block24_data_unref, 0);
	gtk_container_add ((GtkContainer*) bbox, (GtkWidget*) yes);
	gtk_container_add ((GtkContainer*) bbox, (GtkWidget*) no);
	gtk_box_set_spacing ((GtkBox*) bbox, 8);
	gtk_widget_set_halign ((GtkWidget*) bbox, GTK_ALIGN_END);
	gtk_widget_set_hexpand ((GtkWidget*) bbox, TRUE);
	g_object_set ((GtkWidget*) bbox, "margin", 24, NULL);
	gtk_widget_set_margin_start ((GtkWidget*) bbox, 12);
	_tmp53_ = self->suggestion_grid;
	gtk_grid_attach (_tmp53_, (GtkWidget*) bbox, 2, 0, 1, 2);
	_tmp54_ = self->suggestion_grid;
	gtk_widget_show_all ((GtkWidget*) _tmp54_);
	_g_object_unref0 (no);
	_g_object_unref0 (yes);
	_g_object_unref0 (bbox);
	_g_object_unref0 (label);
	_g_object_unref0 (image_frame);
	_g_object_unref0 (parent_overlay);
	block24_data_unref (_data24_);
	_data24_ = NULL;
}


static void _contacts_contact_pane_update_sheet_contacts_contact_personas_changed (ContactsContact* _sender, gpointer self) {
	contacts_contact_pane_update_sheet ((ContactsContactPane*) self);
}


static void _contacts_contact_pane_update_sheet_contacts_contact_changed (ContactsContact* _sender, gpointer self) {
	contacts_contact_pane_update_sheet ((ContactsContactPane*) self);
}


void contacts_contact_pane_show_contact (ContactsContactPane* self, ContactsContact* new_contact, gboolean show_matches) {
	ContactsContact* _tmp0_;
	ContactsContact* _tmp1_;
	GtkGrid* _tmp2_;
	ContactsContact* _tmp4_;
	ContactsContact* _tmp9_;
	ContactsContact* _tmp10_;
	ContactsContact* _tmp11_;
	ContactsContact* _tmp14_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->contact;
	_tmp1_ = new_contact;
	if (_tmp0_ == _tmp1_) {
		return;
	}
	_tmp2_ = self->suggestion_grid;
	if (_tmp2_ != NULL) {
		GtkGrid* _tmp3_;
		_tmp3_ = self->suggestion_grid;
		gtk_widget_destroy ((GtkWidget*) _tmp3_);
		_g_object_unref0 (self->suggestion_grid);
		self->suggestion_grid = NULL;
	}
	_tmp4_ = self->contact;
	if (_tmp4_ != NULL) {
		ContactsContact* _tmp5_;
		guint _tmp6_;
		ContactsContact* _tmp7_;
		guint _tmp8_;
		_tmp5_ = self->contact;
		g_signal_parse_name ("personas-changed", CONTACTS_TYPE_CONTACT, &_tmp6_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp5_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp6_, 0, NULL, (GCallback) _contacts_contact_pane_update_sheet_contacts_contact_personas_changed, self);
		_tmp7_ = self->contact;
		g_signal_parse_name ("changed", CONTACTS_TYPE_CONTACT, &_tmp8_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp7_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp8_, 0, NULL, (GCallback) _contacts_contact_pane_update_sheet_contacts_contact_changed, self);
	}
	_tmp9_ = new_contact;
	_tmp10_ = _g_object_ref0 (_tmp9_);
	_g_object_unref0 (self->contact);
	self->contact = _tmp10_;
	contacts_contact_pane_update_sheet (self);
	_tmp11_ = self->contact;
	if (_tmp11_ != NULL) {
		ContactsContact* _tmp12_;
		ContactsContact* _tmp13_;
		_tmp12_ = self->contact;
		g_signal_connect_object (_tmp12_, "personas-changed", (GCallback) _contacts_contact_pane_update_sheet_contacts_contact_personas_changed, self, 0);
		_tmp13_ = self->contact;
		g_signal_connect_object (_tmp13_, "changed", (GCallback) _contacts_contact_pane_update_sheet_contacts_contact_changed, self, 0);
	}
	_tmp14_ = self->contact;
	if (_tmp14_ == NULL) {
		GtkGrid* _tmp15_;
		_tmp15_ = self->priv->none_selected_page;
		gtk_stack_set_visible_child ((GtkStack*) self, (GtkWidget*) _tmp15_);
	}
}


static void _contacts_contact_pane_update_sheet_contacts_store_quiescent (ContactsStore* _sender, gpointer self) {
	contacts_contact_pane_update_sheet ((ContactsContactPane*) self);
}


static void _contacts_contact_pane_linked_accounts_gtk_button_clicked (GtkButton* _sender, gpointer self) {
	contacts_contact_pane_linked_accounts ((ContactsContactPane*) self);
}


static void _contacts_contact_pane_delete_contact_gtk_button_clicked (GtkButton* _sender, gpointer self) {
	contacts_contact_pane_delete_contact ((ContactsContactPane*) self);
}


ContactsContactPane* contacts_contact_pane_construct (GType object_type, ContactsWindow* parent_window, ContactsStore* contacts_store) {
	ContactsContactPane * self = NULL;
	ContactsWindow* _tmp0_;
	ContactsWindow* _tmp1_;
	ContactsStore* _tmp2_;
	ContactsStore* _tmp3_;
	ContactsStore* _tmp4_;
	GSimpleActionGroup* _tmp5_;
	GSimpleActionGroup* _tmp6_;
	GSimpleActionGroup* _tmp7_;
	ContactsContactEditor* _tmp8_;
	ContactsContactEditor* _tmp9_;
	GtkButton* _tmp10_;
	ContactsContactEditor* _tmp11_;
	GtkButton* _tmp12_;
	GtkBox* _tmp13_;
	ContactsContactEditor* _tmp14_;
	GSimpleAction* birthday_action = NULL;
	GSimpleActionGroup* _tmp15_;
	GAction* _tmp16_;
	GSimpleAction* _tmp17_;
	ContactsContactEditor* _tmp18_;
	GSimpleAction* nickname_action = NULL;
	GSimpleActionGroup* _tmp19_;
	GAction* _tmp20_;
	GSimpleAction* _tmp21_;
	ContactsContactEditor* _tmp22_;
	GSimpleAction* notes_action = NULL;
	GSimpleActionGroup* _tmp23_;
	GAction* _tmp24_;
	GSimpleAction* _tmp25_;
	ContactsContactEditor* _tmp26_;
	g_return_val_if_fail (parent_window != NULL, NULL);
	g_return_val_if_fail (contacts_store != NULL, NULL);
	self = (ContactsContactPane*) g_object_new (object_type, NULL);
	_tmp0_ = parent_window;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->parent_window);
	self->priv->parent_window = _tmp1_;
	_tmp2_ = contacts_store;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (self->priv->store);
	self->priv->store = _tmp3_;
	_tmp4_ = self->priv->store;
	g_signal_connect_object (_tmp4_, "quiescent", (GCallback) _contacts_contact_pane_update_sheet_contacts_store_quiescent, self, 0);
	_tmp5_ = g_simple_action_group_new ();
	_g_object_unref0 (self->priv->edit_contact_actions);
	self->priv->edit_contact_actions = _tmp5_;
	_tmp6_ = self->priv->edit_contact_actions;
	g_action_map_add_action_entries ((GActionMap*) _tmp6_, CONTACTS_CONTACT_PANE_action_entries, G_N_ELEMENTS (CONTACTS_CONTACT_PANE_action_entries), self);
	contacts_contact_pane_create_contact_sheet (self);
	_g_object_unref0 (self->suggestion_grid);
	self->suggestion_grid = NULL;
	self->on_edit_mode = FALSE;
	_tmp7_ = self->priv->edit_contact_actions;
	_tmp8_ = contacts_contact_editor_new (_tmp7_);
	g_object_ref_sink (_tmp8_);
	_g_object_unref0 (self->priv->editor);
	self->priv->editor = _tmp8_;
	_tmp9_ = self->priv->editor;
	_tmp10_ = _tmp9_->linked_button;
	g_signal_connect_object (_tmp10_, "clicked", (GCallback) _contacts_contact_pane_linked_accounts_gtk_button_clicked, self, 0);
	_tmp11_ = self->priv->editor;
	_tmp12_ = _tmp11_->remove_button;
	g_signal_connect_object (_tmp12_, "clicked", (GCallback) _contacts_contact_pane_delete_contact_gtk_button_clicked, self, 0);
	_tmp13_ = self->priv->contact_editor_page;
	_tmp14_ = self->priv->editor;
	gtk_container_add ((GtkContainer*) _tmp13_, (GtkWidget*) _tmp14_);
	_tmp15_ = self->priv->edit_contact_actions;
	_tmp16_ = g_action_map_lookup_action ((GActionMap*) _tmp15_, "add.birthday");
	_tmp17_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp16_, g_simple_action_get_type ()) ? ((GSimpleAction*) _tmp16_) : NULL);
	birthday_action = _tmp17_;
	_tmp18_ = self->priv->editor;
	g_object_bind_property_with_closures ((GObject*) _tmp18_, "has-birthday-row", (GObject*) birthday_action, "enabled", G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp19_ = self->priv->edit_contact_actions;
	_tmp20_ = g_action_map_lookup_action ((GActionMap*) _tmp19_, "add.nickname");
	_tmp21_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp20_, g_simple_action_get_type ()) ? ((GSimpleAction*) _tmp20_) : NULL);
	nickname_action = _tmp21_;
	_tmp22_ = self->priv->editor;
	g_object_bind_property_with_closures ((GObject*) _tmp22_, "has-nickname-row", (GObject*) nickname_action, "enabled", (G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE) | G_BINDING_INVERT_BOOLEAN, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp23_ = self->priv->edit_contact_actions;
	_tmp24_ = g_action_map_lookup_action ((GActionMap*) _tmp23_, "add.notes");
	_tmp25_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp24_, g_simple_action_get_type ()) ? ((GSimpleAction*) _tmp24_) : NULL);
	notes_action = _tmp25_;
	_tmp26_ = self->priv->editor;
	g_object_bind_property_with_closures ((GObject*) _tmp26_, "has-notes-row", (GObject*) notes_action, "enabled", (G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE) | G_BINDING_INVERT_BOOLEAN, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_g_object_unref0 (notes_action);
	_g_object_unref0 (nickname_action);
	_g_object_unref0 (birthday_action);
	return self;
}


ContactsContactPane* contacts_contact_pane_new (ContactsWindow* parent_window, ContactsStore* contacts_store) {
	return contacts_contact_pane_construct (CONTACTS_TYPE_CONTACT_PANE, parent_window, contacts_store);
}


static void contacts_contact_pane_create_contact_sheet (ContactsContactPane* self) {
	ContactsStore* _tmp0_;
	ContactsContactSheet* _tmp1_;
	ContactsContactSheet* _tmp2_;
	ContactsContactSheet* _tmp3_;
	ContactsContactSheet* _tmp4_;
	ContactsContactSheet* _tmp5_;
	Center* hcenter = NULL;
	Center* _tmp6_;
	ContactsContactSheet* _tmp7_;
	GtkScrolledWindow* _tmp8_;
	ContactsContactSheet* _tmp9_;
	GtkScrolledWindow* _tmp10_;
	GtkAdjustment* _tmp11_;
	GtkScrolledWindow* _tmp12_;
	GtkWidget* _tmp13_;
	GtkStyleContext* _tmp14_;
	GtkScrolledWindow* _tmp15_;
	GtkWidget* _tmp16_;
	GtkStyleContext* _tmp17_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->store;
	_tmp1_ = contacts_contact_sheet_new (_tmp0_);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->sheet);
	self->priv->sheet = _tmp1_;
	_tmp2_ = self->priv->sheet;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp2_, TRUE);
	_tmp3_ = self->priv->sheet;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp3_, TRUE);
	_tmp4_ = self->priv->sheet;
	g_object_set ((GtkWidget*) _tmp4_, "margin", 36, NULL);
	_tmp5_ = self->priv->sheet;
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp5_, 24);
	_tmp6_ = center_new ();
	g_object_ref_sink (_tmp6_);
	hcenter = _tmp6_;
	center_set_max_width (hcenter, 600);
	center_set_xalign (hcenter, 0.0);
	gtk_widget_show ((GtkWidget*) hcenter);
	_tmp7_ = self->priv->sheet;
	gtk_container_add ((GtkContainer*) hcenter, (GtkWidget*) _tmp7_);
	_tmp8_ = self->priv->contact_sheet_page;
	gtk_container_add ((GtkContainer*) _tmp8_, (GtkWidget*) hcenter);
	_tmp9_ = self->priv->sheet;
	_tmp10_ = self->priv->contact_sheet_page;
	_tmp11_ = gtk_scrolled_window_get_vadjustment (_tmp10_);
	gtk_container_set_focus_vadjustment ((GtkContainer*) _tmp9_, _tmp11_);
	_tmp12_ = self->priv->contact_sheet_page;
	_tmp13_ = gtk_bin_get_child ((GtkBin*) _tmp12_);
	_tmp14_ = gtk_widget_get_style_context (_tmp13_);
	gtk_style_context_add_class (_tmp14_, "contacts-main-view");
	_tmp15_ = self->priv->contact_sheet_page;
	_tmp16_ = gtk_bin_get_child ((GtkBin*) _tmp15_);
	_tmp17_ = gtk_widget_get_style_context (_tmp16_);
	gtk_style_context_add_class (_tmp17_, "view");
	_g_object_unref0 (hcenter);
}


static void contacts_contact_pane_on_add_detail (ContactsContactPane* self, GSimpleAction* action, GVariant* parameter) {
	gchar** tok = NULL;
	GSimpleAction* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
	gint tok_length1;
	gint _tok_size_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	const gchar* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = action;
	_tmp1_ = g_action_get_name ((GAction*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp4_ = _tmp3_ = g_strsplit (_tmp2_, ".", 0);
	tok = _tmp4_;
	tok_length1 = _vala_array_length (_tmp3_);
	_tok_size_ = tok_length1;
	_tmp5_ = tok;
	_tmp5__length1 = tok_length1;
	_tmp6_ = _tmp5_[0];
	if (g_strcmp0 (_tmp6_, "add") == 0) {
		gchar* _tmp7_ = NULL;
		gchar** _tmp8_;
		gint _tmp8__length1;
		ContactsContactEditor* _tmp12_;
		ContactsContact* _tmp13_;
		FolksPersona* _tmp14_;
		FolksPersona* _tmp15_;
		gchar** _tmp16_;
		gint _tmp16__length1;
		const gchar* _tmp17_;
		_tmp8_ = tok;
		_tmp8__length1 = tok_length1;
		if (_tmp8__length1 > 2) {
			gchar** _tmp9_;
			gint _tmp9__length1;
			const gchar* _tmp10_;
			gchar* _tmp11_;
			_tmp9_ = tok;
			_tmp9__length1 = tok_length1;
			_tmp10_ = _tmp9_[2];
			_tmp11_ = g_utf8_strup (_tmp10_, (gssize) -1);
			_g_free0 (_tmp7_);
			_tmp7_ = _tmp11_;
		} else {
			_g_free0 (_tmp7_);
			_tmp7_ = NULL;
		}
		_tmp12_ = self->priv->editor;
		_tmp13_ = self->contact;
		_tmp14_ = contacts_contact_find_primary_persona (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = tok;
		_tmp16__length1 = tok_length1;
		_tmp17_ = _tmp16_[1];
		contacts_contact_editor_add_new_row_for_property (_tmp12_, _tmp15_, _tmp17_, _tmp7_);
		_g_object_unref0 (_tmp15_);
		_g_free0 (_tmp7_);
	}
	tok = (_vala_array_free (tok, tok_length1, (GDestroyNotify) g_free), NULL);
}


static void contacts_contact_pane_linked_accounts (ContactsContactPane* self) {
	ContactsLinkedAccountsDialog* dialog = NULL;
	ContactsWindow* _tmp0_;
	ContactsContact* _tmp1_;
	ContactsLinkedAccountsDialog* _tmp2_;
	gint _result_ = 0;
	ContactsLinkedAccountsDialog* _tmp3_;
	gint _tmp4_;
	gboolean _tmp5_ = FALSE;
	gint _tmp6_;
	ContactsLinkedAccountsDialog* _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->parent_window;
	_tmp1_ = self->contact;
	_tmp2_ = contacts_linked_accounts_dialog_new (_tmp0_, _tmp1_);
	g_object_ref_sink (_tmp2_);
	dialog = _tmp2_;
	_tmp3_ = dialog;
	_tmp4_ = gtk_dialog_run ((GtkDialog*) _tmp3_);
	_result_ = _tmp4_;
	_tmp6_ = _result_;
	if (_tmp6_ == ((gint) GTK_RESPONSE_CLOSE)) {
		ContactsLinkedAccountsDialog* _tmp7_;
		gboolean _tmp8_;
		_tmp7_ = dialog;
		_tmp8_ = _tmp7_->any_unlinked;
		_tmp5_ = _tmp8_;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		contacts_contact_pane_set_edit_mode (self, FALSE, FALSE);
		contacts_contact_pane_set_edit_mode (self, TRUE, FALSE);
	}
	_tmp9_ = dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp9_);
	_g_object_unref0 (dialog);
}


static void contacts_contact_pane_delete_contact (ContactsContactPane* self) {
	ContactsContact* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->contact;
	if (_tmp0_ != NULL) {
		ContactsContact* _tmp1_;
		ContactsContact* _tmp2_;
		_tmp1_ = self->contact;
		contacts_contact_hide (_tmp1_);
		_tmp2_ = self->contact;
		g_signal_emit (self, contacts_contact_pane_signals[CONTACTS_CONTACT_PANE_WILL_DELETE_SIGNAL], 0, _tmp2_);
	}
}


static void ______lambda70_ (ContactsContactPane* self, GObject* obj, GAsyncResult* _result_) {
	GError * _inner_error_ = NULL;
	g_return_if_fail (_result_ != NULL);
	{
		GAsyncResult* _tmp0_;
		_tmp0_ = _result_;
		contacts_contact_set_persona_property_finish (_tmp0_, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch7_g_error;
		}
	}
	goto __finally7;
	__catch7_g_error:
	{
		GError* e2 = NULL;
		GError* _tmp1_;
		const gchar* _tmp2_;
		e2 = _inner_error_;
		_inner_error_ = NULL;
		_tmp1_ = e2;
		_tmp2_ = _tmp1_->message;
		contacts_contact_pane_show_message (self, _tmp2_);
		contacts_contact_pane_update_sheet (self);
		_g_error_free0 (e2);
	}
	__finally7:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


static void _______lambda70__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	______lambda70_ ((ContactsContactPane*) self, source_object, res);
	g_object_unref (self);
}


static void _____lambda72_ (ContactsContactPane* self, GObject* obj, GAsyncResult* _result_) {
	GError * _inner_error_ = NULL;
	g_return_if_fail (_result_ != NULL);
	{
		GAsyncResult* _tmp0_;
		FolksPersona* _tmp1_;
		FolksPersona* _tmp2_;
		_tmp0_ = _result_;
		_tmp1_ = contacts_contact_set_individual_property_finish (_tmp0_, &_inner_error_);
		_tmp2_ = _tmp1_;
		_g_object_unref0 (_tmp2_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch8_g_error;
		}
	}
	goto __finally8;
	__catch8_g_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		const gchar* _tmp4_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp3_ = e;
		_tmp4_ = _tmp3_->message;
		contacts_contact_pane_show_message (self, _tmp4_);
		_g_error_free0 (e);
	}
	__finally8:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


static void ______lambda72__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	_____lambda72_ ((ContactsContactPane*) self, source_object, res);
	g_object_unref (self);
}


static void _____lambda73_ (ContactsContactPane* self, GObject* obj, GAsyncResult* _result_) {
	GError * _inner_error_ = NULL;
	g_return_if_fail (_result_ != NULL);
	{
		GAsyncResult* _tmp0_;
		FolksPersona* _tmp1_;
		FolksPersona* _tmp2_;
		_tmp0_ = _result_;
		_tmp1_ = contacts_contact_set_individual_property_finish (_tmp0_, &_inner_error_);
		_tmp2_ = _tmp1_;
		_g_object_unref0 (_tmp2_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch9_g_error;
		}
	}
	goto __finally9;
	__catch9_g_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		const gchar* _tmp4_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp3_ = e;
		_tmp4_ = _tmp3_->message;
		contacts_contact_pane_show_message (self, _tmp4_);
		_g_error_free0 (e);
	}
	__finally9:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


static void ______lambda73__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	_____lambda73_ ((ContactsContactPane*) self, source_object, res);
	g_object_unref (self);
}


void contacts_contact_pane_set_edit_mode (ContactsContactPane* self, gboolean on_edit, gboolean drop_changes) {
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = on_edit;
	_tmp1_ = self->on_edit_mode;
	if (_tmp0_ == _tmp1_) {
		return;
	}
	_tmp2_ = on_edit;
	if (_tmp2_) {
		ContactsContact* _tmp3_;
		ContactsContactSheet* _tmp4_;
		GtkGrid* _tmp5_;
		ContactsContactEditor* _tmp7_;
		ContactsContactEditor* _tmp8_;
		ContactsContact* _tmp9_;
		ContactsContactEditor* _tmp10_;
		GtkBox* _tmp11_;
		_tmp3_ = self->contact;
		if (_tmp3_ == NULL) {
			return;
		}
		self->on_edit_mode = TRUE;
		_tmp4_ = self->priv->sheet;
		contacts_contact_sheet_clear (_tmp4_);
		_tmp5_ = self->suggestion_grid;
		if (_tmp5_ != NULL) {
			GtkGrid* _tmp6_;
			_tmp6_ = self->suggestion_grid;
			gtk_widget_destroy ((GtkWidget*) _tmp6_);
			_g_object_unref0 (self->suggestion_grid);
			self->suggestion_grid = NULL;
		}
		_tmp7_ = self->priv->editor;
		contacts_contact_editor_clear (_tmp7_);
		_tmp8_ = self->priv->editor;
		_tmp9_ = self->contact;
		contacts_contact_editor_edit (_tmp8_, _tmp9_);
		_tmp10_ = self->priv->editor;
		gtk_widget_show_all ((GtkWidget*) _tmp10_);
		_tmp11_ = self->priv->contact_editor_page;
		gtk_stack_set_visible_child ((GtkStack*) self, (GtkWidget*) _tmp11_);
	} else {
		gboolean _tmp12_;
		ContactsContactEditor* _tmp48_;
		ContactsContact* _tmp49_;
		self->on_edit_mode = FALSE;
		_tmp12_ = drop_changes;
		if (!_tmp12_) {
			ContactsContactEditor* _tmp36_;
			gboolean _tmp37_;
			ContactsContactEditor* _tmp42_;
			gboolean _tmp43_;
			{
				GeeIterator* _prop_it = NULL;
				ContactsContactEditor* _tmp13_;
				GeeHashMap* _tmp14_;
				GeeHashMap* _tmp15_;
				GeeSet* _tmp16_;
				GeeSet* _tmp17_;
				GeeSet* _tmp18_;
				GeeIterator* _tmp19_;
				GeeIterator* _tmp20_;
				_tmp13_ = self->priv->editor;
				_tmp14_ = contacts_contact_editor_properties_changed (_tmp13_);
				_tmp15_ = _tmp14_;
				_tmp16_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _tmp15_);
				_tmp17_ = _tmp16_;
				_tmp18_ = _tmp17_;
				_tmp19_ = gee_iterable_iterator ((GeeIterable*) _tmp18_);
				_tmp20_ = _tmp19_;
				_g_object_unref0 (_tmp18_);
				_g_object_unref0 (_tmp15_);
				_prop_it = _tmp20_;
				while (TRUE) {
					GeeIterator* _tmp21_;
					gboolean _tmp22_;
					GeeMapEntry* prop = NULL;
					GeeIterator* _tmp23_;
					gpointer _tmp24_;
					GeeMapEntry* _tmp25_;
					gconstpointer _tmp26_;
					ContactsContactEditorPropertyData* _tmp27_;
					FolksPersona* _tmp28_;
					GeeMapEntry* _tmp29_;
					gconstpointer _tmp30_;
					const gchar* _tmp31_;
					GeeMapEntry* _tmp32_;
					gconstpointer _tmp33_;
					ContactsContactEditorPropertyData* _tmp34_;
					GValue _tmp35_;
					_tmp21_ = _prop_it;
					_tmp22_ = gee_iterator_next (_tmp21_);
					if (!_tmp22_) {
						break;
					}
					_tmp23_ = _prop_it;
					_tmp24_ = gee_iterator_get (_tmp23_);
					prop = (GeeMapEntry*) _tmp24_;
					_tmp25_ = prop;
					_tmp26_ = gee_map_entry_get_value (_tmp25_);
					_tmp27_ = _tmp26_;
					_tmp28_ = (*((ContactsContactEditorPropertyData*) _tmp27_)).persona;
					_tmp29_ = prop;
					_tmp30_ = gee_map_entry_get_key (_tmp29_);
					_tmp31_ = _tmp30_;
					_tmp32_ = prop;
					_tmp33_ = gee_map_entry_get_value (_tmp32_);
					_tmp34_ = _tmp33_;
					_tmp35_ = (*((ContactsContactEditorPropertyData*) _tmp34_)).value;
					contacts_contact_set_persona_property (_tmp28_, (const gchar*) _tmp31_, &_tmp35_, _______lambda70__gasync_ready_callback, g_object_ref (self));
					_g_object_unref0 (prop);
				}
				_g_object_unref0 (_prop_it);
			}
			_tmp36_ = self->priv->editor;
			_tmp37_ = contacts_contact_editor_name_changed (_tmp36_);
			if (_tmp37_) {
				GValue v = {0};
				ContactsContactEditor* _tmp38_;
				GValue _tmp39_ = {0};
				ContactsContact* _tmp40_;
				GValue _tmp41_;
				_tmp38_ = self->priv->editor;
				contacts_contact_editor_get_full_name_value (_tmp38_, &_tmp39_);
				v = _tmp39_;
				_tmp40_ = self->contact;
				_tmp41_ = v;
				contacts_contact_set_individual_property (_tmp40_, "full-name", &_tmp41_, ______lambda72__gasync_ready_callback, g_object_ref (self));
				G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
			}
			_tmp42_ = self->priv->editor;
			_tmp43_ = contacts_contact_editor_avatar_changed (_tmp42_);
			if (_tmp43_) {
				GValue v = {0};
				ContactsContactEditor* _tmp44_;
				GValue _tmp45_ = {0};
				ContactsContact* _tmp46_;
				GValue _tmp47_;
				_tmp44_ = self->priv->editor;
				contacts_contact_editor_get_avatar_value (_tmp44_, &_tmp45_);
				v = _tmp45_;
				_tmp46_ = self->contact;
				_tmp47_ = v;
				contacts_contact_set_individual_property (_tmp46_, "avatar", &_tmp47_, ______lambda73__gasync_ready_callback, g_object_ref (self));
				G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
			}
		}
		_tmp48_ = self->priv->editor;
		contacts_contact_editor_clear (_tmp48_);
		_tmp49_ = self->contact;
		if (_tmp49_ != NULL) {
			ContactsContactSheet* _tmp50_;
			ContactsContactSheet* _tmp51_;
			ContactsContact* _tmp52_;
			GtkScrolledWindow* _tmp53_;
			_tmp50_ = self->priv->sheet;
			contacts_contact_sheet_clear (_tmp50_);
			_tmp51_ = self->priv->sheet;
			_tmp52_ = self->contact;
			contacts_contact_sheet_update (_tmp51_, _tmp52_);
			_tmp53_ = self->priv->contact_sheet_page;
			gtk_stack_set_visible_child ((GtkStack*) self, (GtkWidget*) _tmp53_);
		} else {
			GtkGrid* _tmp54_;
			_tmp54_ = self->priv->none_selected_page;
			gtk_stack_set_visible_child ((GtkStack*) self, (GtkWidget*) _tmp54_);
		}
	}
}


void contacts_contact_pane_new_contact (ContactsContactPane* self) {
	ContactsContactSheet* _tmp0_;
	GtkGrid* _tmp1_;
	ContactsContactEditor* _tmp3_;
	GtkBox* _tmp4_;
	g_return_if_fail (self != NULL);
	self->on_edit_mode = TRUE;
	_tmp0_ = self->priv->sheet;
	contacts_contact_sheet_clear (_tmp0_);
	_tmp1_ = self->suggestion_grid;
	if (_tmp1_ != NULL) {
		GtkGrid* _tmp2_;
		_tmp2_ = self->suggestion_grid;
		gtk_widget_destroy ((GtkWidget*) _tmp2_);
		_g_object_unref0 (self->suggestion_grid);
		self->suggestion_grid = NULL;
	}
	_tmp3_ = self->priv->editor;
	contacts_contact_editor_set_new_contact (_tmp3_);
	_tmp4_ = self->priv->contact_editor_page;
	gtk_stack_set_visible_child ((GtkStack*) self, (GtkWidget*) _tmp4_);
}


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


void contacts_contact_pane_create_contact (ContactsContactPane* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsContactPaneCreateContactData* _data_;
	ContactsContactPane* _tmp0_;
	_data_ = g_slice_new0 (ContactsContactPaneCreateContactData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, contacts_contact_pane_create_contact_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	contacts_contact_pane_create_contact_co (_data_);
}


void contacts_contact_pane_create_contact_finish (ContactsContactPane* self, GAsyncResult* _res_) {
	ContactsContactPaneCreateContactData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


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_contact_pane_create_contact_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ContactsContactPaneCreateContactData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_contact_pane_create_contact_co (_data_);
}


static gboolean contacts_contact_pane_create_contact_co (ContactsContactPaneCreateContactData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_str_hash;
	_data_->_tmp1_ = g_str_equal;
	_data_->_tmp2_ = g_hash_table_new_full (_data_->_tmp0_, _data_->_tmp1_, _g_free0_, __vala_GValue_free0_);
	_data_->details = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->self->priv->editor;
	_data_->_tmp4_ = contacts_contact_editor_name_changed (_data_->_tmp3_);
	if (_data_->_tmp4_) {
		_data_->_tmp5_ = _data_->details;
		_data_->_tmp6_ = g_strdup ("full-name");
		_data_->_tmp7_ = _data_->self->priv->editor;
		memset (&_data_->_tmp8_, 0, sizeof (GValue));
		contacts_contact_editor_get_full_name_value (_data_->_tmp7_, &_data_->_tmp8_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_tmp10_ = __g_value_dup0 (&_data_->_tmp9_);
		g_hash_table_insert (_data_->_tmp5_, _data_->_tmp6_, _data_->_tmp10_);
		G_IS_VALUE (&_data_->_tmp9_) ? (g_value_unset (&_data_->_tmp9_), NULL) : NULL;
	}
	_data_->_tmp11_ = _data_->self->priv->editor;
	_data_->_tmp12_ = contacts_contact_editor_avatar_changed (_data_->_tmp11_);
	if (_data_->_tmp12_) {
		_data_->_tmp13_ = _data_->details;
		_data_->_tmp14_ = g_strdup ("avatar");
		_data_->_tmp15_ = _data_->self->priv->editor;
		memset (&_data_->_tmp16_, 0, sizeof (GValue));
		contacts_contact_editor_get_avatar_value (_data_->_tmp15_, &_data_->_tmp16_);
		_data_->_tmp17_ = _data_->_tmp16_;
		_data_->_tmp18_ = __g_value_dup0 (&_data_->_tmp17_);
		g_hash_table_insert (_data_->_tmp13_, _data_->_tmp14_, _data_->_tmp18_);
		G_IS_VALUE (&_data_->_tmp17_) ? (g_value_unset (&_data_->_tmp17_), NULL) : NULL;
	}
	{
		_data_->_tmp19_ = _data_->self->priv->editor;
		_data_->_tmp20_ = contacts_contact_editor_properties_changed (_data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		_data_->_tmp22_ = gee_abstract_map_get_entries ((GeeAbstractMap*) _data_->_tmp21_);
		_data_->_tmp23_ = _data_->_tmp22_;
		_data_->_tmp24_ = _data_->_tmp23_;
		_data_->_tmp25_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp24_);
		_data_->_tmp26_ = _data_->_tmp25_;
		_g_object_unref0 (_data_->_tmp24_);
		_g_object_unref0 (_data_->_tmp21_);
		_data_->_prop_it = _data_->_tmp26_;
		while (TRUE) {
			_data_->_tmp27_ = _data_->_prop_it;
			_data_->_tmp28_ = gee_iterator_next (_data_->_tmp27_);
			if (!_data_->_tmp28_) {
				break;
			}
			_data_->_tmp29_ = _data_->_prop_it;
			_data_->_tmp30_ = gee_iterator_get (_data_->_tmp29_);
			_data_->prop = (GeeMapEntry*) _data_->_tmp30_;
			_data_->_tmp31_ = _data_->details;
			_data_->_tmp32_ = _data_->prop;
			_data_->_tmp33_ = gee_map_entry_get_key (_data_->_tmp32_);
			_data_->_tmp34_ = _data_->_tmp33_;
			_data_->_tmp35_ = g_strdup ((const gchar*) _data_->_tmp34_);
			_data_->_tmp36_ = _data_->prop;
			_data_->_tmp37_ = gee_map_entry_get_value (_data_->_tmp36_);
			_data_->_tmp38_ = _data_->_tmp37_;
			_data_->_tmp39_ = (*((ContactsContactEditorPropertyData*) _data_->_tmp38_)).value;
			_data_->_tmp40_ = _data_->_tmp39_;
			_data_->_tmp41_ = __g_value_dup0 (&_data_->_tmp40_);
			g_hash_table_insert (_data_->_tmp31_, _data_->_tmp35_, _data_->_tmp41_);
			_g_object_unref0 (_data_->prop);
		}
		_g_object_unref0 (_data_->_prop_it);
	}
	contacts_contact_pane_set_edit_mode (_data_->self, FALSE, TRUE);
	_data_->_tmp42_ = _data_->details;
	_data_->_tmp43_ = g_hash_table_size (_data_->_tmp42_);
	if (_data_->_tmp43_ == ((guint) 0)) {
		contacts_contact_pane_show_message_dialog (_data_->self, _ ("You need to enter some data"));
		_g_hash_table_unref0 (_data_->details);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (g_task_get_completed (_data_->_async_result) != TRUE) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp44_ = _data_->self->priv->store;
	_data_->_tmp45_ = contacts_store_get_aggregator (_data_->_tmp44_);
	_data_->_tmp46_ = _data_->_tmp45_;
	_data_->_tmp47_ = folks_individual_aggregator_get_primary_store (_data_->_tmp46_);
	_data_->_tmp48_ = _data_->_tmp47_;
	if (_data_->_tmp48_ == NULL) {
		contacts_contact_pane_show_message_dialog (_data_->self, _ ("No primary addressbook configured"));
		_g_hash_table_unref0 (_data_->details);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (g_task_get_completed (_data_->_async_result) != TRUE) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp49_ = _data_->self->priv->store;
	_data_->_tmp50_ = contacts_store_get_aggregator (_data_->_tmp49_);
	_data_->_tmp51_ = _data_->_tmp50_;
	_data_->_tmp52_ = folks_individual_aggregator_get_primary_store (_data_->_tmp51_);
	_data_->_tmp53_ = _data_->_tmp52_;
	_data_->_tmp54_ = _g_object_ref0 (_data_->_tmp53_);
	_data_->primary_store = _data_->_tmp54_;
	_data_->persona = NULL;
	{
		_data_->_tmp56_ = _data_->primary_store;
		_data_->_tmp57_ = _data_->details;
		_data_->_state_ = 1;
		contacts_contact_create_primary_persona_for_details (_data_->_tmp56_, _data_->_tmp57_, contacts_contact_pane_create_contact_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp58_ = contacts_contact_create_primary_persona_for_details_finish (_data_->_res_, &_data_->_inner_error_);
		_data_->_tmp55_ = _data_->_tmp58_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch10_g_error;
		}
		_data_->_tmp59_ = _data_->_tmp55_;
		_data_->_tmp55_ = NULL;
		_g_object_unref0 (_data_->persona);
		_data_->persona = _data_->_tmp59_;
		_g_object_unref0 (_data_->_tmp55_);
	}
	goto __finally10;
	__catch10_g_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp60_ = _data_->e;
		_data_->_tmp61_ = _data_->_tmp60_->message;
		_data_->_tmp62_ = g_strdup_printf (_ ("Unable to create new contacts: %s"), _data_->_tmp61_);
		_data_->_tmp63_ = _data_->_tmp62_;
		contacts_contact_pane_show_message_dialog (_data_->self, _data_->_tmp63_);
		_g_free0 (_data_->_tmp63_);
		_g_error_free0 (_data_->e);
		_g_object_unref0 (_data_->persona);
		_g_object_unref0 (_data_->primary_store);
		_g_hash_table_unref0 (_data_->details);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (g_task_get_completed (_data_->_async_result) != TRUE) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally10:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_object_unref0 (_data_->persona);
		_g_object_unref0 (_data_->primary_store);
		_g_hash_table_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_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp64_ = _data_->self->priv->store;
	_data_->_tmp65_ = _data_->persona;
	_data_->_tmp66_ = contacts_store_find_contact_with_persona (_data_->_tmp64_, _data_->_tmp65_);
	_data_->contact = _data_->_tmp66_;
	_data_->_tmp67_ = _data_->contact;
	if (_data_->_tmp67_ != NULL) {
		_data_->_tmp68_ = _data_->self->priv->parent_window;
		_data_->_tmp69_ = _data_->contact;
		contacts_window_set_shown_contact (_data_->_tmp68_, _data_->_tmp69_);
	} else {
		contacts_contact_pane_show_message_dialog (_data_->self, _ ("Unable to find newly created contact"));
	}
	_g_object_unref0 (_data_->contact);
	_g_object_unref0 (_data_->persona);
	_g_object_unref0 (_data_->primary_store);
	_g_hash_table_unref0 (_data_->details);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (g_task_get_completed (_data_->_async_result) != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void contacts_contact_pane_show_message_dialog (ContactsContactPane* self, const gchar* message) {
	GtkMessageDialog* dialog = NULL;
	ContactsWindow* _tmp0_;
	const gchar* _tmp1_;
	GtkMessageDialog* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = self->priv->parent_window;
	_tmp1_ = message;
	_tmp2_ = (GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) _tmp0_, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", _tmp1_);
	g_object_ref_sink (_tmp2_);
	dialog = _tmp2_;
	gtk_dialog_run ((GtkDialog*) dialog);
	gtk_widget_destroy ((GtkWidget*) dialog);
	_g_object_unref0 (dialog);
}


static void contacts_contact_pane_show_message (ContactsContactPane* self, const gchar* message) {
	ContactsInAppNotification* notification = NULL;
	const gchar* _tmp0_;
	ContactsInAppNotification* _tmp1_;
	ContactsWindow* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = message;
	_tmp1_ = contacts_in_app_notification_new (_tmp0_, NULL);
	g_object_ref_sink (_tmp1_);
	notification = _tmp1_;
	contacts_in_app_notification_show (notification);
	_tmp2_ = self->priv->parent_window;
	contacts_window_add_notification (_tmp2_, notification);
	_g_object_unref0 (notification);
}


static void g_cclosure_user_marshal_VOID__STRING_STRING_OBJECT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
	typedef void (*GMarshalFunc_VOID__STRING_STRING_OBJECT) (gpointer data1, const char* arg_1, const char* arg_2, gpointer arg_3, gpointer data2);
	register GMarshalFunc_VOID__STRING_STRING_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 4);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_STRING_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_string (param_values + 2), g_value_get_object (param_values + 3), data2);
}


static void contacts_contact_pane_class_init (ContactsContactPaneClass * klass) {
	gint ContactsContactPane_private_offset;
	contacts_contact_pane_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ContactsContactPanePrivate));
	G_OBJECT_CLASS (klass)->finalize = contacts_contact_pane_finalize;
	ContactsContactPane_private_offset = g_type_class_get_instance_private_offset (klass);
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/contacts/ui/contacts-contact-pane.ui");
	contacts_contact_pane_signals[CONTACTS_CONTACT_PANE_CONTACTS_LINKED_SIGNAL] = g_signal_new ("contacts-linked", CONTACTS_TYPE_CONTACT_PANE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_STRING_OBJECT, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, CONTACTS_TYPE_LINK_OPERATION);
	contacts_contact_pane_signals[CONTACTS_CONTACT_PANE_WILL_DELETE_SIGNAL] = g_signal_new ("will-delete", CONTACTS_TYPE_CONTACT_PANE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, CONTACTS_TYPE_CONTACT);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "none_selected_page", FALSE, ContactsContactPane_private_offset + G_STRUCT_OFFSET (ContactsContactPanePrivate, none_selected_page));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "contact_sheet_page", FALSE, ContactsContactPane_private_offset + G_STRUCT_OFFSET (ContactsContactPanePrivate, contact_sheet_page));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "contact_editor_page", FALSE, ContactsContactPane_private_offset + G_STRUCT_OFFSET (ContactsContactPanePrivate, contact_editor_page));
}


static void contacts_contact_pane_instance_init (ContactsContactPane * self) {
	self->priv = CONTACTS_CONTACT_PANE_GET_PRIVATE (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void contacts_contact_pane_finalize (GObject * obj) {
	ContactsContactPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_CONTACT_PANE, ContactsContactPane);
	_g_object_unref0 (self->priv->parent_window);
	_g_object_unref0 (self->priv->store);
	_g_object_unref0 (self->contact);
	_g_object_unref0 (self->priv->none_selected_page);
	_g_object_unref0 (self->priv->contact_sheet_page);
	_g_object_unref0 (self->priv->sheet);
	_g_object_unref0 (self->priv->contact_editor_page);
	_g_object_unref0 (self->priv->editor);
	_g_object_unref0 (self->priv->edit_contact_actions);
	_g_object_unref0 (self->suggestion_grid);
	G_OBJECT_CLASS (contacts_contact_pane_parent_class)->finalize (obj);
}


/**
 * The ContactPage is the right pane. It consists of 3 possible pages:
 * a page if nothing is selected, a ContactSheet to view contact information,
 * and a ContactEditor to edit contact information.
 */
GType contacts_contact_pane_get_type (void) {
	static volatile gsize contacts_contact_pane_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_contact_pane_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsContactPaneClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_contact_pane_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsContactPane), 0, (GInstanceInitFunc) contacts_contact_pane_instance_init, NULL };
		GType contacts_contact_pane_type_id;
		contacts_contact_pane_type_id = g_type_register_static (gtk_stack_get_type (), "ContactsContactPane", &g_define_type_info, 0);
		g_once_init_leave (&contacts_contact_pane_type_id__volatile, contacts_contact_pane_type_id);
	}
	return contacts_contact_pane_type_id__volatile;
}


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


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


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



