/* contacts-contact-sheet.c generated by valac 0.36.4, the Vala compiler
 * generated from contacts-contact-sheet.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 <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <pango/pango.h>
#include <folks/folks.h>
#include <gee.h>
#include <telepathy-glib/telepathy-glib.h>
#include <folks/folks-telepathy.h>
#include <glib/gi18n-lib.h>


#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;
typedef struct _ContactsContactSheetPrivate ContactsContactSheetPrivate;

#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 _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#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;
typedef struct _Block14Data Block14Data;

#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;
typedef struct _ContactsContactPrivate ContactsContactPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block15Data Block15Data;

#define CONTACTS_TYPE_TYPESET (contacts_typeset_get_type ())
#define CONTACTS_TYPESET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_TYPESET, ContactsTypeSet))
#define CONTACTS_TYPESET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_TYPESET, ContactsTypeSetClass))
#define CONTACTS_IS_TYPESET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_TYPESET))
#define CONTACTS_IS_TYPESET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_TYPESET))
#define CONTACTS_TYPESET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_TYPESET, ContactsTypeSetClass))

typedef struct _ContactsTypeSet ContactsTypeSet;
typedef struct _ContactsTypeSetClass ContactsTypeSetClass;
typedef struct _Block16Data Block16Data;
typedef struct _ContactsStorePrivate ContactsStorePrivate;
typedef struct _Block17Data Block17Data;
typedef struct _Block18Data Block18Data;

#define CONTACTS_CONTACT_TYPE_IM_DISPLAY (contacts_contact_im_display_get_type ())
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))

#define CONTACTS_TYPE_ADDRESS_MAP (contacts_address_map_get_type ())
#define CONTACTS_ADDRESS_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_ADDRESS_MAP, ContactsAddressMap))
#define CONTACTS_ADDRESS_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_ADDRESS_MAP, ContactsAddressMapClass))
#define CONTACTS_IS_ADDRESS_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_ADDRESS_MAP))
#define CONTACTS_IS_ADDRESS_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_ADDRESS_MAP))
#define CONTACTS_ADDRESS_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_ADDRESS_MAP, ContactsAddressMapClass))

typedef struct _ContactsAddressMap ContactsAddressMap;
typedef struct _ContactsAddressMapClass ContactsAddressMapClass;
#define _g_list_free0(var) ((var == NULL) ? NULL : (var = (g_list_free (var), NULL)))

struct _ContactsContactSheet {
	GtkGrid parent_instance;
	ContactsContactSheetPrivate * priv;
};

struct _ContactsContactSheetClass {
	GtkGridClass parent_class;
};

struct _ContactsContactSheetPrivate {
	ContactsStore* contacts_store;
};

struct _Block14Data {
	int _ref_count_;
	ContactsContactSheet* self;
	ContactsContact* c;
};

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

struct _ContactsContactClass {
	GObjectClass parent_class;
};

struct _Block15Data {
	int _ref_count_;
	Block14Data * _data14_;
	FolksEmailFieldDetails* email;
};

struct _Block16Data {
	int _ref_count_;
	Block14Data * _data14_;
	FolksPhoneFieldDetails* phone;
};

struct _ContactsStore {
	GObject parent_instance;
	ContactsStorePrivate * priv;
	GeeHashMap* calling_accounts;
	GeeHashMultiMap* dont_suggest_link;
};

struct _ContactsStoreClass {
	GObjectClass parent_class;
};

struct _Block17Data {
	int _ref_count_;
	Block14Data * _data14_;
	gchar* protocol;
};

struct _Block18Data {
	int _ref_count_;
	Block17Data * _data17_;
	FolksImFieldDetails* id;
};

typedef enum  {
	CONTACTS_CONTACT_IM_DISPLAY_DEFAULT,
	CONTACTS_CONTACT_IM_DISPLAY_ALIAS_SERVICE
} ContactsContactImDisplay;


static gpointer contacts_contact_sheet_parent_class = NULL;

GType contacts_contact_sheet_get_type (void) G_GNUC_CONST;
GType contacts_store_get_type (void) G_GNUC_CONST;
#define CONTACTS_CONTACT_SHEET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_CONTACT_SHEET, ContactsContactSheetPrivate))
enum  {
	CONTACTS_CONTACT_SHEET_DUMMY_PROPERTY
};
static GtkButton* contacts_contact_sheet_add_row_with_button (ContactsContactSheet* self, gint* row, const gchar* label_value, const gchar* value);
static void contacts_contact_sheet_add_row_with_link_button (ContactsContactSheet* self, gint* row, const gchar* label_value, const gchar* value);
static void contacts_contact_sheet_add_row_with_label (ContactsContactSheet* self, gint* row, const gchar* label_value, const gchar* value);
ContactsContactSheet* contacts_contact_sheet_new (ContactsStore* contacts_store);
ContactsContactSheet* contacts_contact_sheet_construct (GType object_type, ContactsStore* contacts_store);
GType contacts_contact_get_type (void) G_GNUC_CONST;
void contacts_contact_sheet_update (ContactsContactSheet* self, ContactsContact* c);
static Block14Data* block14_data_ref (Block14Data* _data14_);
static void block14_data_unref (void * _userdata_);
GType contacts_contact_frame_get_type (void) G_GNUC_CONST;
#define PROFILE_SIZE 96
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 __lambda28_ (Block14Data* _data14_, GtkWidget* w);
void contacts_contact_frame_set_image (ContactsContactFrame* self, FolksAvatarDetails* details, ContactsContact* contact);
static void ___lambda28__gtk_callback (GtkWidget* widget, gpointer self);
static void __lambda29_ (Block14Data* _data14_, GtkWidget* w);
const gchar* contacts_contact_get_display_name (ContactsContact* self);
static void ___lambda29__gtk_callback (GtkWidget* widget, gpointer self);
GeeList* contacts_contact_get_personas_for_display (ContactsContact* self);
gchar* contacts_contact_format_persona_store_name_for_contact (FolksPersona* persona);
GeeArrayList* contacts_contact_sort_fields (GType t_type, GBoxedCopyFunc t_dup_func, GDestroyNotify t_destroy_func, GeeCollection* fields);
static Block15Data* block15_data_ref (Block15Data* _data15_);
static void block15_data_unref (void * _userdata_);
GType contacts_typeset_get_type (void) G_GNUC_CONST;
ContactsTypeSet* contacts_typeset_get_email (void);
gchar* contacts_typeset_format_type (ContactsTypeSet* self, FolksAbstractFieldDetails* detail);
static void _______lambda30_ (Block15Data* _data15_);
void contacts_utils_compose_mail (const gchar* email);
static void ________lambda30__gtk_button_clicked (GtkButton* _sender, gpointer self);
static Block16Data* block16_data_ref (Block16Data* _data16_);
static void block16_data_unref (void * _userdata_);
gboolean contacts_store_get_can_call (ContactsStore* self);
ContactsTypeSet* contacts_typeset_get_phone (void);
static void ________lambda31_ (Block16Data* _data16_);
void contacts_utils_start_call (const gchar* contact_id, GeeHashMap* accounts);
static void _________lambda31__gtk_button_clicked (GtkButton* _sender, gpointer self);
static Block17Data* block17_data_ref (Block17Data* _data17_);
static void block17_data_unref (void * _userdata_);
static Block18Data* block18_data_ref (Block18Data* _data18_);
static void block18_data_unref (void * _userdata_);
GType contacts_contact_im_display_get_type (void) G_GNUC_CONST;
gchar* contacts_contact_format_im_service (const gchar* service, ContactsContactImDisplay* display);
static void __________lambda32_ (Block18Data* _data18_);
TpfPersona* contacts_contact_find_im_persona (ContactsContact* self, const gchar* protocol, const gchar* im_address);
void contacts_utils_start_chat (ContactsContact* contact, const gchar* protocol, const gchar* id);
static void ___________lambda32__gtk_button_clicked (GtkButton* _sender, gpointer self);
gboolean contacts_is_set (const gchar* str);
gchar** contacts_contact_format_address (FolksPostalAddress* addr, int* result_length1);
ContactsTypeSet* contacts_typeset_get_general (void);
GType contacts_address_map_get_type (void) G_GNUC_CONST;
ContactsAddressMap* contacts_address_map_new (ContactsContact* c, GeeSet* postal_addresses);
ContactsAddressMap* contacts_address_map_construct (GType object_type, ContactsContact* c, GeeSet* postal_addresses);
void contacts_address_map_load (ContactsAddressMap* self);
void contacts_contact_sheet_clear (ContactsContactSheet* self);
static void contacts_contact_sheet_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 GtkButton* contacts_contact_sheet_add_row_with_button (ContactsContactSheet* self, gint* row, const gchar* label_value, const gchar* value) {
	GtkButton* result = NULL;
	GtkLabel* type_label = NULL;
	const gchar* _tmp0_;
	GtkLabel* _tmp1_;
	GtkStyleContext* _tmp2_;
	gint _tmp3_;
	GtkButton* value_button = NULL;
	const gchar* _tmp4_;
	GtkButton* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	GtkWidget* _tmp8_;
	GtkWidget* _tmp9_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (label_value != NULL, NULL);
	g_return_val_if_fail (value != NULL, NULL);
	_tmp0_ = label_value;
	_tmp1_ = (GtkLabel*) gtk_label_new (_tmp0_);
	g_object_ref_sink (_tmp1_);
	type_label = _tmp1_;
	gtk_label_set_xalign (type_label, 1.0f);
	gtk_widget_set_halign ((GtkWidget*) type_label, GTK_ALIGN_END);
	_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) type_label);
	gtk_style_context_add_class (_tmp2_, "dim-label");
	_tmp3_ = *row;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) type_label, 0, _tmp3_, 1, 1);
	_tmp4_ = value;
	_tmp5_ = (GtkButton*) gtk_button_new_with_label (_tmp4_);
	g_object_ref_sink (_tmp5_);
	value_button = _tmp5_;
	gtk_widget_set_focus_on_click ((GtkWidget*) value_button, FALSE);
	gtk_button_set_relief (value_button, GTK_RELIEF_NONE);
	g_object_set (value_button, "xalign", 0.0f, NULL);
	gtk_widget_set_hexpand ((GtkWidget*) value_button, TRUE);
	_tmp6_ = *row;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) value_button, 1, _tmp6_, 1, 1);
	_tmp7_ = *row;
	*row = _tmp7_ + 1;
	_tmp8_ = gtk_bin_get_child ((GtkBin*) value_button);
	gtk_label_set_ellipsize (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, gtk_label_get_type ()) ? ((GtkLabel*) _tmp8_) : NULL, PANGO_ELLIPSIZE_END);
	_tmp9_ = gtk_bin_get_child ((GtkBin*) value_button);
	g_object_set (G_TYPE_CHECK_INSTANCE_TYPE (_tmp9_, gtk_label_get_type ()) ? ((GtkLabel*) _tmp9_) : NULL, "wrap-mode", PANGO_WRAP_CHAR, NULL);
	result = value_button;
	_g_object_unref0 (type_label);
	return result;
}


static void contacts_contact_sheet_add_row_with_link_button (ContactsContactSheet* self, gint* row, const gchar* label_value, const gchar* value) {
	GtkLabel* type_label = NULL;
	const gchar* _tmp0_;
	GtkLabel* _tmp1_;
	GtkStyleContext* _tmp2_;
	gint _tmp3_;
	GtkLinkButton* value_button = NULL;
	const gchar* _tmp4_;
	GtkLinkButton* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	GtkWidget* _tmp8_;
	GtkWidget* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label_value != NULL);
	g_return_if_fail (value != NULL);
	_tmp0_ = label_value;
	_tmp1_ = (GtkLabel*) gtk_label_new (_tmp0_);
	g_object_ref_sink (_tmp1_);
	type_label = _tmp1_;
	gtk_label_set_xalign (type_label, 1.0f);
	gtk_widget_set_halign ((GtkWidget*) type_label, GTK_ALIGN_END);
	_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) type_label);
	gtk_style_context_add_class (_tmp2_, "dim-label");
	_tmp3_ = *row;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) type_label, 0, _tmp3_, 1, 1);
	_tmp4_ = value;
	_tmp5_ = (GtkLinkButton*) gtk_link_button_new (_tmp4_);
	g_object_ref_sink (_tmp5_);
	value_button = _tmp5_;
	gtk_widget_set_focus_on_click ((GtkWidget*) value_button, FALSE);
	gtk_button_set_relief ((GtkButton*) value_button, GTK_RELIEF_NONE);
	g_object_set ((GtkButton*) value_button, "xalign", 0.0f, NULL);
	gtk_widget_set_hexpand ((GtkWidget*) value_button, TRUE);
	_tmp6_ = *row;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) value_button, 1, _tmp6_, 1, 1);
	_tmp7_ = *row;
	*row = _tmp7_ + 1;
	_tmp8_ = gtk_bin_get_child ((GtkBin*) value_button);
	gtk_label_set_ellipsize (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, gtk_label_get_type ()) ? ((GtkLabel*) _tmp8_) : NULL, PANGO_ELLIPSIZE_END);
	_tmp9_ = gtk_bin_get_child ((GtkBin*) value_button);
	g_object_set (G_TYPE_CHECK_INSTANCE_TYPE (_tmp9_, gtk_label_get_type ()) ? ((GtkLabel*) _tmp9_) : NULL, "wrap-mode", PANGO_WRAP_CHAR, NULL);
	_g_object_unref0 (value_button);
	_g_object_unref0 (type_label);
}


static void contacts_contact_sheet_add_row_with_label (ContactsContactSheet* self, gint* row, const gchar* label_value, const gchar* value) {
	GtkLabel* type_label = NULL;
	const gchar* _tmp0_;
	GtkLabel* _tmp1_;
	GtkStyleContext* _tmp2_;
	gint _tmp3_;
	GtkLabel* value_label = NULL;
	const gchar* _tmp4_;
	GtkLabel* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (label_value != NULL);
	g_return_if_fail (value != NULL);
	_tmp0_ = label_value;
	_tmp1_ = (GtkLabel*) gtk_label_new (_tmp0_);
	g_object_ref_sink (_tmp1_);
	type_label = _tmp1_;
	gtk_label_set_xalign (type_label, 1.0f);
	gtk_widget_set_halign ((GtkWidget*) type_label, GTK_ALIGN_END);
	gtk_widget_set_valign ((GtkWidget*) type_label, GTK_ALIGN_START);
	_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) type_label);
	gtk_style_context_add_class (_tmp2_, "dim-label");
	_tmp3_ = *row;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) type_label, 0, _tmp3_, 1, 1);
	_tmp4_ = value;
	_tmp5_ = (GtkLabel*) gtk_label_new (_tmp4_);
	g_object_ref_sink (_tmp5_);
	value_label = _tmp5_;
	gtk_label_set_line_wrap (value_label, TRUE);
	gtk_label_set_xalign (value_label, 0.0f);
	gtk_widget_set_halign ((GtkWidget*) value_label, GTK_ALIGN_START);
	gtk_label_set_ellipsize (value_label, PANGO_ELLIPSIZE_END);
	g_object_set (value_label, "wrap-mode", PANGO_WRAP_CHAR, NULL);
	gtk_label_set_selectable (value_label, TRUE);
	gtk_widget_set_margin_top ((GtkWidget*) type_label, 3);
	gtk_widget_set_margin_start ((GtkWidget*) value_label, 6);
	gtk_widget_set_margin_top ((GtkWidget*) value_label, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) value_label, 3);
	_tmp6_ = *row;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) value_label, 1, _tmp6_, 1, 1);
	_tmp7_ = *row;
	*row = _tmp7_ + 1;
	_g_object_unref0 (value_label);
	_g_object_unref0 (type_label);
}


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


ContactsContactSheet* contacts_contact_sheet_construct (GType object_type, ContactsStore* contacts_store) {
	ContactsContactSheet * self = NULL;
	ContactsStore* _tmp0_;
	ContactsStore* _tmp1_;
	g_return_val_if_fail (contacts_store != NULL, NULL);
	self = (ContactsContactSheet*) g_object_new (object_type, NULL);
	_tmp0_ = contacts_store;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->contacts_store);
	self->priv->contacts_store = _tmp1_;
	gtk_grid_set_row_spacing ((GtkGrid*) self, (guint) 12);
	gtk_grid_set_column_spacing ((GtkGrid*) self, (guint) 16);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	return self;
}


ContactsContactSheet* contacts_contact_sheet_new (ContactsStore* contacts_store) {
	return contacts_contact_sheet_construct (CONTACTS_TYPE_CONTACT_SHEET, contacts_store);
}


static Block14Data* block14_data_ref (Block14Data* _data14_) {
	g_atomic_int_inc (&_data14_->_ref_count_);
	return _data14_;
}


static void block14_data_unref (void * _userdata_) {
	Block14Data* _data14_;
	_data14_ = (Block14Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data14_->_ref_count_)) {
		ContactsContactSheet* self;
		self = _data14_->self;
		_g_object_unref0 (_data14_->c);
		_g_object_unref0 (self);
		g_slice_free (Block14Data, _data14_);
	}
}


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


static void ___lambda28__gtk_callback (GtkWidget* widget, gpointer self) {
	__lambda28_ (self, widget);
}


static void __lambda29_ (Block14Data* _data14_, GtkWidget* w) {
	ContactsContactSheet* self;
	GtkWidget* _tmp0_;
	ContactsContact* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	self = _data14_->self;
	g_return_if_fail (w != NULL);
	_tmp0_ = w;
	_tmp1_ = _data14_->c;
	_tmp2_ = contacts_contact_get_display_name (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_markup_printf_escaped ("<span font='16'>%s</span>", _tmp3_);
	_tmp5_ = _tmp4_;
	gtk_label_set_markup (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gtk_label_get_type ()) ? ((GtkLabel*) _tmp0_) : NULL, _tmp5_);
	_g_free0 (_tmp5_);
}


static void ___lambda29__gtk_callback (GtkWidget* widget, gpointer self) {
	__lambda29_ (self, widget);
}


static Block15Data* block15_data_ref (Block15Data* _data15_) {
	g_atomic_int_inc (&_data15_->_ref_count_);
	return _data15_;
}


static void block15_data_unref (void * _userdata_) {
	Block15Data* _data15_;
	_data15_ = (Block15Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data15_->_ref_count_)) {
		ContactsContactSheet* self;
		self = _data15_->_data14_->self;
		_g_object_unref0 (_data15_->email);
		block14_data_unref (_data15_->_data14_);
		_data15_->_data14_ = NULL;
		g_slice_free (Block15Data, _data15_);
	}
}


static void _______lambda30_ (Block15Data* _data15_) {
	Block14Data* _data14_;
	ContactsContactSheet* self;
	ContactsContact* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	FolksEmailFieldDetails* _tmp3_;
	gconstpointer _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	_data14_ = _data15_->_data14_;
	self = _data14_->self;
	_tmp0_ = _data14_->c;
	_tmp1_ = contacts_contact_get_display_name (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _data15_->email;
	_tmp4_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strdup_printf ("%s <%s>", _tmp2_, (const gchar*) _tmp5_);
	_tmp7_ = _tmp6_;
	contacts_utils_compose_mail (_tmp7_);
	_g_free0 (_tmp7_);
}


static void ________lambda30__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	_______lambda30_ (self);
}


static Block16Data* block16_data_ref (Block16Data* _data16_) {
	g_atomic_int_inc (&_data16_->_ref_count_);
	return _data16_;
}


static void block16_data_unref (void * _userdata_) {
	Block16Data* _data16_;
	_data16_ = (Block16Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data16_->_ref_count_)) {
		ContactsContactSheet* self;
		self = _data16_->_data14_->self;
		_g_object_unref0 (_data16_->phone);
		block14_data_unref (_data16_->_data14_);
		_data16_->_data14_ = NULL;
		g_slice_free (Block16Data, _data16_);
	}
}


static void ________lambda31_ (Block16Data* _data16_) {
	Block14Data* _data14_;
	ContactsContactSheet* self;
	FolksPhoneFieldDetails* _tmp0_;
	gconstpointer _tmp1_;
	const gchar* _tmp2_;
	ContactsStore* _tmp3_;
	GeeHashMap* _tmp4_;
	_data14_ = _data16_->_data14_;
	self = _data14_->self;
	_tmp0_ = _data16_->phone;
	_tmp1_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->contacts_store;
	_tmp4_ = _tmp3_->calling_accounts;
	contacts_utils_start_call ((const gchar*) _tmp2_, _tmp4_);
}


static void _________lambda31__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	________lambda31_ (self);
}


static Block17Data* block17_data_ref (Block17Data* _data17_) {
	g_atomic_int_inc (&_data17_->_ref_count_);
	return _data17_;
}


static void block17_data_unref (void * _userdata_) {
	Block17Data* _data17_;
	_data17_ = (Block17Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data17_->_ref_count_)) {
		ContactsContactSheet* self;
		self = _data17_->_data14_->self;
		_g_free0 (_data17_->protocol);
		block14_data_unref (_data17_->_data14_);
		_data17_->_data14_ = NULL;
		g_slice_free (Block17Data, _data17_);
	}
}


static Block18Data* block18_data_ref (Block18Data* _data18_) {
	g_atomic_int_inc (&_data18_->_ref_count_);
	return _data18_;
}


static void block18_data_unref (void * _userdata_) {
	Block18Data* _data18_;
	_data18_ = (Block18Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data18_->_ref_count_)) {
		ContactsContactSheet* self;
		self = _data18_->_data17_->_data14_->self;
		_g_object_unref0 (_data18_->id);
		block17_data_unref (_data18_->_data17_);
		_data18_->_data17_ = NULL;
		g_slice_free (Block18Data, _data18_);
	}
}


static void __________lambda32_ (Block18Data* _data18_) {
	Block17Data* _data17_;
	Block14Data* _data14_;
	ContactsContactSheet* self;
	TpfPersona* im_persona = NULL;
	ContactsContact* _tmp0_;
	const gchar* _tmp1_;
	FolksImFieldDetails* _tmp2_;
	gconstpointer _tmp3_;
	const gchar* _tmp4_;
	TpfPersona* _tmp5_;
	TpfPersona* _tmp6_;
	_data17_ = _data18_->_data17_;
	_data14_ = _data17_->_data14_;
	self = _data14_->self;
	_tmp0_ = _data14_->c;
	_tmp1_ = _data17_->protocol;
	_tmp2_ = _data18_->id;
	_tmp3_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = contacts_contact_find_im_persona (_tmp0_, _tmp1_, (const gchar*) _tmp4_);
	im_persona = _tmp5_;
	_tmp6_ = im_persona;
	if (_tmp6_ != NULL) {
		FolksPresenceType type = 0;
		TpfPersona* _tmp7_;
		FolksPresenceType _tmp8_;
		FolksPresenceType _tmp9_;
		gboolean _tmp10_ = FALSE;
		gboolean _tmp11_ = FALSE;
		gboolean _tmp12_ = FALSE;
		FolksPresenceType _tmp13_;
		_tmp7_ = im_persona;
		_tmp8_ = folks_presence_details_get_presence_type ((FolksPresenceDetails*) _tmp7_);
		_tmp9_ = _tmp8_;
		type = _tmp9_;
		_tmp13_ = type;
		if (_tmp13_ != FOLKS_PRESENCE_TYPE_UNSET) {
			FolksPresenceType _tmp14_;
			_tmp14_ = type;
			_tmp12_ = _tmp14_ != FOLKS_PRESENCE_TYPE_ERROR;
		} else {
			_tmp12_ = FALSE;
		}
		if (_tmp12_) {
			FolksPresenceType _tmp15_;
			_tmp15_ = type;
			_tmp11_ = _tmp15_ != FOLKS_PRESENCE_TYPE_OFFLINE;
		} else {
			_tmp11_ = FALSE;
		}
		if (_tmp11_) {
			FolksPresenceType _tmp16_;
			_tmp16_ = type;
			_tmp10_ = _tmp16_ != FOLKS_PRESENCE_TYPE_UNKNOWN;
		} else {
			_tmp10_ = FALSE;
		}
		if (_tmp10_) {
			ContactsContact* _tmp17_;
			const gchar* _tmp18_;
			FolksImFieldDetails* _tmp19_;
			gconstpointer _tmp20_;
			const gchar* _tmp21_;
			_tmp17_ = _data14_->c;
			_tmp18_ = _data17_->protocol;
			_tmp19_ = _data18_->id;
			_tmp20_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp19_);
			_tmp21_ = _tmp20_;
			contacts_utils_start_chat (_tmp17_, _tmp18_, (const gchar*) _tmp21_);
		}
	}
	_g_object_unref0 (im_persona);
}


static void ___________lambda32__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	__________lambda32_ (self);
}


void contacts_contact_sheet_update (ContactsContactSheet* self, ContactsContact* c) {
	Block14Data* _data14_;
	ContactsContact* _tmp0_;
	ContactsContact* _tmp1_;
	ContactsContactFrame* image_frame = NULL;
	ContactsContactFrame* _tmp2_;
	ContactsContactFrame* _tmp3_;
	GtkStyleContext* _tmp4_;
	ContactsContactFrame* _tmp5_;
	ContactsContactFrame* _tmp6_;
	ContactsContactFrame* _tmp7_;
	ContactsContact* _tmp8_;
	ContactsContactFrame* _tmp9_;
	ContactsContactFrame* _tmp10_;
	GtkLabel* name_label = NULL;
	GtkLabel* _tmp11_;
	GtkLabel* _tmp12_;
	GtkLabel* _tmp13_;
	GtkLabel* _tmp14_;
	GtkLabel* _tmp15_;
	GtkLabel* _tmp16_;
	GtkLabel* _tmp17_;
	GtkLabel* _tmp18_;
	ContactsContact* _tmp19_;
	GtkLabel* _tmp20_;
	GtkLabel* _tmp21_;
	gint i = 0;
	gint last_store_position = 0;
	gboolean is_first_persona = FALSE;
	GeeList* personas = NULL;
	ContactsContact* _tmp22_;
	GeeList* _tmp23_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	_data14_ = g_slice_new0 (Block14Data);
	_data14_->_ref_count_ = 1;
	_data14_->self = g_object_ref (self);
	_tmp0_ = c;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data14_->c);
	_data14_->c = _tmp1_;
	_tmp2_ = contacts_contact_frame_new (PROFILE_SIZE, FALSE);
	g_object_ref_sink (_tmp2_);
	image_frame = _tmp2_;
	_tmp3_ = image_frame;
	_tmp4_ = gtk_widget_get_style_context ((GtkWidget*) _tmp3_);
	gtk_style_context_add_class (_tmp4_, "main-avatar-frame");
	_tmp5_ = image_frame;
	gtk_frame_set_shadow_type ((GtkFrame*) _tmp5_, GTK_SHADOW_IN);
	_tmp6_ = image_frame;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp6_, FALSE);
	_tmp7_ = image_frame;
	gtk_widget_set_valign ((GtkWidget*) _tmp7_, GTK_ALIGN_START);
	_tmp8_ = _data14_->c;
	_tmp9_ = image_frame;
	contacts_contact_keep_widget_uptodate (_tmp8_, (GtkWidget*) _tmp9_, ___lambda28__gtk_callback, block14_data_ref (_data14_), block14_data_unref);
	_tmp10_ = image_frame;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp10_, 0, 0, 1, 3);
	_tmp11_ = (GtkLabel*) gtk_label_new (NULL);
	g_object_ref_sink (_tmp11_);
	name_label = _tmp11_;
	_tmp12_ = name_label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp12_, TRUE);
	_tmp13_ = name_label;
	gtk_widget_set_halign ((GtkWidget*) _tmp13_, GTK_ALIGN_START);
	_tmp14_ = name_label;
	gtk_widget_set_valign ((GtkWidget*) _tmp14_, GTK_ALIGN_CENTER);
	_tmp15_ = name_label;
	gtk_widget_set_margin_start ((GtkWidget*) _tmp15_, 6);
	_tmp16_ = name_label;
	gtk_label_set_ellipsize (_tmp16_, PANGO_ELLIPSIZE_END);
	_tmp17_ = name_label;
	gtk_label_set_xalign (_tmp17_, 0.0f);
	_tmp18_ = name_label;
	gtk_label_set_selectable (_tmp18_, TRUE);
	_tmp19_ = _data14_->c;
	_tmp20_ = name_label;
	contacts_contact_keep_widget_uptodate (_tmp19_, (GtkWidget*) _tmp20_, ___lambda29__gtk_callback, block14_data_ref (_data14_), block14_data_unref);
	_tmp21_ = name_label;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp21_, 1, 0, 1, 3);
	i = 3;
	last_store_position = 0;
	is_first_persona = TRUE;
	_tmp22_ = _data14_->c;
	_tmp23_ = contacts_contact_get_personas_for_display (_tmp22_);
	personas = _tmp23_;
	{
		GeeList* _p_list = NULL;
		GeeList* _tmp24_;
		GeeList* _tmp25_;
		gint _p_size = 0;
		GeeList* _tmp26_;
		gint _tmp27_;
		gint _tmp28_;
		gint _p_index = 0;
		_tmp24_ = personas;
		_tmp25_ = _g_object_ref0 (_tmp24_);
		_p_list = _tmp25_;
		_tmp26_ = _p_list;
		_tmp27_ = gee_collection_get_size ((GeeCollection*) _tmp26_);
		_tmp28_ = _tmp27_;
		_p_size = _tmp28_;
		_p_index = -1;
		while (TRUE) {
			gint _tmp29_;
			gint _tmp30_;
			gint _tmp31_;
			FolksPersona* p = NULL;
			GeeList* _tmp32_;
			gint _tmp33_;
			gpointer _tmp34_;
			gboolean _tmp35_;
			FolksEmailDetails* details = NULL;
			FolksPersona* _tmp50_;
			FolksEmailDetails* _tmp51_;
			FolksEmailDetails* _tmp52_;
			FolksPhoneDetails* phone_details = NULL;
			FolksPersona* _tmp79_;
			FolksPhoneDetails* _tmp80_;
			FolksPhoneDetails* _tmp81_;
			FolksImDetails* im_details = NULL;
			FolksPersona* _tmp119_;
			FolksImDetails* _tmp120_;
			FolksImDetails* _tmp121_;
			FolksUrlDetails* url_details = NULL;
			FolksPersona* _tmp155_;
			FolksUrlDetails* _tmp156_;
			FolksUrlDetails* _tmp157_;
			FolksNameDetails* name_details = NULL;
			FolksPersona* _tmp169_;
			FolksNameDetails* _tmp170_;
			FolksNameDetails* _tmp171_;
			FolksBirthdayDetails* birthday_details = NULL;
			FolksPersona* _tmp179_;
			FolksBirthdayDetails* _tmp180_;
			FolksBirthdayDetails* _tmp181_;
			FolksNoteDetails* note_details = NULL;
			FolksPersona* _tmp192_;
			FolksNoteDetails* _tmp193_;
			FolksNoteDetails* _tmp194_;
			FolksPostalAddressDetails* addr_details = NULL;
			FolksPersona* _tmp206_;
			FolksPostalAddressDetails* _tmp207_;
			FolksPostalAddressDetails* _tmp208_;
			gint _tmp250_;
			gint _tmp251_;
			gint _tmp252_;
			_tmp29_ = _p_index;
			_p_index = _tmp29_ + 1;
			_tmp30_ = _p_index;
			_tmp31_ = _p_size;
			if (!(_tmp30_ < _tmp31_)) {
				break;
			}
			_tmp32_ = _p_list;
			_tmp33_ = _p_index;
			_tmp34_ = gee_list_get (_tmp32_, _tmp33_);
			p = (FolksPersona*) _tmp34_;
			_tmp35_ = is_first_persona;
			if (!_tmp35_) {
				GtkLabel* store_name = NULL;
				GtkLabel* _tmp36_;
				GtkLabel* _tmp37_;
				FolksPersona* _tmp38_;
				gchar* _tmp39_;
				gchar* _tmp40_;
				gchar* _tmp41_;
				gchar* _tmp42_;
				GtkLabel* _tmp43_;
				GtkLabel* _tmp44_;
				GtkLabel* _tmp45_;
				GtkLabel* _tmp46_;
				gint _tmp47_;
				gint _tmp48_;
				gint _tmp49_;
				_tmp36_ = (GtkLabel*) gtk_label_new ("");
				g_object_ref_sink (_tmp36_);
				store_name = _tmp36_;
				_tmp37_ = store_name;
				_tmp38_ = p;
				_tmp39_ = contacts_contact_format_persona_store_name_for_contact (_tmp38_);
				_tmp40_ = _tmp39_;
				_tmp41_ = g_markup_printf_escaped ("<span font='16px bold'>%s</span>", _tmp40_);
				_tmp42_ = _tmp41_;
				gtk_label_set_markup (_tmp37_, _tmp42_);
				_g_free0 (_tmp42_);
				_g_free0 (_tmp40_);
				_tmp43_ = store_name;
				gtk_widget_set_halign ((GtkWidget*) _tmp43_, GTK_ALIGN_START);
				_tmp44_ = store_name;
				gtk_label_set_xalign (_tmp44_, 0.0f);
				_tmp45_ = store_name;
				gtk_widget_set_margin_start ((GtkWidget*) _tmp45_, 6);
				_tmp46_ = store_name;
				_tmp47_ = i;
				gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp46_, 0, _tmp47_, 3, 1);
				_tmp48_ = i;
				i = _tmp48_ + 1;
				_tmp49_ = i;
				last_store_position = _tmp49_;
				_g_object_unref0 (store_name);
			}
			_tmp50_ = p;
			_tmp51_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp50_, FOLKS_TYPE_EMAIL_DETAILS) ? ((FolksEmailDetails*) _tmp50_) : NULL);
			details = _tmp51_;
			_tmp52_ = details;
			if (_tmp52_ != NULL) {
				GeeArrayList* emails = NULL;
				FolksEmailDetails* _tmp53_;
				GeeSet* _tmp54_;
				GeeSet* _tmp55_;
				GeeArrayList* _tmp56_;
				_tmp53_ = details;
				_tmp54_ = folks_email_details_get_email_addresses (_tmp53_);
				_tmp55_ = _tmp54_;
				_tmp56_ = contacts_contact_sort_fields (FOLKS_TYPE_EMAIL_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, (GeeCollection*) _tmp55_);
				emails = _tmp56_;
				{
					GeeArrayList* _email_list = NULL;
					GeeArrayList* _tmp57_;
					GeeArrayList* _tmp58_;
					gint _email_size = 0;
					GeeArrayList* _tmp59_;
					gint _tmp60_;
					gint _tmp61_;
					gint _email_index = 0;
					_tmp57_ = emails;
					_tmp58_ = _g_object_ref0 (_tmp57_);
					_email_list = _tmp58_;
					_tmp59_ = _email_list;
					_tmp60_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp59_);
					_tmp61_ = _tmp60_;
					_email_size = _tmp61_;
					_email_index = -1;
					while (TRUE) {
						Block15Data* _data15_;
						gint _tmp62_;
						gint _tmp63_;
						gint _tmp64_;
						GeeArrayList* _tmp65_;
						gint _tmp66_;
						gpointer _tmp67_;
						GtkButton* button = NULL;
						ContactsTypeSet* _tmp68_;
						ContactsTypeSet* _tmp69_;
						FolksEmailFieldDetails* _tmp70_;
						gchar* _tmp71_;
						gchar* _tmp72_;
						FolksEmailFieldDetails* _tmp73_;
						gconstpointer _tmp74_;
						const gchar* _tmp75_;
						GtkButton* _tmp76_;
						GtkButton* _tmp77_;
						GtkButton* _tmp78_;
						_data15_ = g_slice_new0 (Block15Data);
						_data15_->_ref_count_ = 1;
						_data15_->_data14_ = block14_data_ref (_data14_);
						_tmp62_ = _email_index;
						_email_index = _tmp62_ + 1;
						_tmp63_ = _email_index;
						_tmp64_ = _email_size;
						if (!(_tmp63_ < _tmp64_)) {
							block15_data_unref (_data15_);
							_data15_ = NULL;
							break;
						}
						_tmp65_ = _email_list;
						_tmp66_ = _email_index;
						_tmp67_ = gee_abstract_list_get ((GeeAbstractList*) _tmp65_, _tmp66_);
						_data15_->email = (FolksEmailFieldDetails*) _tmp67_;
						_tmp68_ = contacts_typeset_get_email ();
						_tmp69_ = _tmp68_;
						_tmp70_ = _data15_->email;
						_tmp71_ = contacts_typeset_format_type (_tmp69_, (FolksAbstractFieldDetails*) _tmp70_);
						_tmp72_ = _tmp71_;
						_tmp73_ = _data15_->email;
						_tmp74_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp73_);
						_tmp75_ = _tmp74_;
						_tmp76_ = contacts_contact_sheet_add_row_with_button (self, &i, _tmp72_, (const gchar*) _tmp75_);
						_tmp77_ = _tmp76_;
						_g_free0 (_tmp72_);
						button = _tmp77_;
						_tmp78_ = button;
						g_signal_connect_data (_tmp78_, "clicked", (GCallback) ________lambda30__gtk_button_clicked, block15_data_ref (_data15_), (GClosureNotify) block15_data_unref, 0);
						_g_object_unref0 (button);
						block15_data_unref (_data15_);
						_data15_ = NULL;
					}
					_g_object_unref0 (_email_list);
				}
				_g_object_unref0 (emails);
			}
			_tmp79_ = p;
			_tmp80_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp79_, FOLKS_TYPE_PHONE_DETAILS) ? ((FolksPhoneDetails*) _tmp79_) : NULL);
			phone_details = _tmp80_;
			_tmp81_ = phone_details;
			if (_tmp81_ != NULL) {
				GeeArrayList* phones = NULL;
				FolksPhoneDetails* _tmp82_;
				GeeSet* _tmp83_;
				GeeSet* _tmp84_;
				GeeArrayList* _tmp85_;
				_tmp82_ = phone_details;
				_tmp83_ = folks_phone_details_get_phone_numbers (_tmp82_);
				_tmp84_ = _tmp83_;
				_tmp85_ = contacts_contact_sort_fields (FOLKS_TYPE_PHONE_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, (GeeCollection*) _tmp84_);
				phones = _tmp85_;
				{
					GeeArrayList* _phone_list = NULL;
					GeeArrayList* _tmp86_;
					GeeArrayList* _tmp87_;
					gint _phone_size = 0;
					GeeArrayList* _tmp88_;
					gint _tmp89_;
					gint _tmp90_;
					gint _phone_index = 0;
					_tmp86_ = phones;
					_tmp87_ = _g_object_ref0 (_tmp86_);
					_phone_list = _tmp87_;
					_tmp88_ = _phone_list;
					_tmp89_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp88_);
					_tmp90_ = _tmp89_;
					_phone_size = _tmp90_;
					_phone_index = -1;
					while (TRUE) {
						Block16Data* _data16_;
						gint _tmp91_;
						gint _tmp92_;
						gint _tmp93_;
						GeeArrayList* _tmp94_;
						gint _tmp95_;
						gpointer _tmp96_;
						ContactsStore* _tmp97_;
						gboolean _tmp98_;
						gboolean _tmp99_;
						_data16_ = g_slice_new0 (Block16Data);
						_data16_->_ref_count_ = 1;
						_data16_->_data14_ = block14_data_ref (_data14_);
						_tmp91_ = _phone_index;
						_phone_index = _tmp91_ + 1;
						_tmp92_ = _phone_index;
						_tmp93_ = _phone_size;
						if (!(_tmp92_ < _tmp93_)) {
							block16_data_unref (_data16_);
							_data16_ = NULL;
							break;
						}
						_tmp94_ = _phone_list;
						_tmp95_ = _phone_index;
						_tmp96_ = gee_abstract_list_get ((GeeAbstractList*) _tmp94_, _tmp95_);
						_data16_->phone = (FolksPhoneFieldDetails*) _tmp96_;
						_tmp97_ = self->priv->contacts_store;
						_tmp98_ = contacts_store_get_can_call (_tmp97_);
						_tmp99_ = _tmp98_;
						if (_tmp99_) {
							GtkButton* button = NULL;
							ContactsTypeSet* _tmp100_;
							ContactsTypeSet* _tmp101_;
							FolksPhoneFieldDetails* _tmp102_;
							gchar* _tmp103_;
							gchar* _tmp104_;
							FolksPhoneFieldDetails* _tmp105_;
							gconstpointer _tmp106_;
							const gchar* _tmp107_;
							GtkButton* _tmp108_;
							GtkButton* _tmp109_;
							GtkButton* _tmp110_;
							_tmp100_ = contacts_typeset_get_phone ();
							_tmp101_ = _tmp100_;
							_tmp102_ = _data16_->phone;
							_tmp103_ = contacts_typeset_format_type (_tmp101_, (FolksAbstractFieldDetails*) _tmp102_);
							_tmp104_ = _tmp103_;
							_tmp105_ = _data16_->phone;
							_tmp106_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp105_);
							_tmp107_ = _tmp106_;
							_tmp108_ = contacts_contact_sheet_add_row_with_button (self, &i, _tmp104_, (const gchar*) _tmp107_);
							_tmp109_ = _tmp108_;
							_g_free0 (_tmp104_);
							button = _tmp109_;
							_tmp110_ = button;
							g_signal_connect_data (_tmp110_, "clicked", (GCallback) _________lambda31__gtk_button_clicked, block16_data_ref (_data16_), (GClosureNotify) block16_data_unref, 0);
							_g_object_unref0 (button);
						} else {
							ContactsTypeSet* _tmp111_;
							ContactsTypeSet* _tmp112_;
							FolksPhoneFieldDetails* _tmp113_;
							gchar* _tmp114_;
							gchar* _tmp115_;
							FolksPhoneFieldDetails* _tmp116_;
							gconstpointer _tmp117_;
							const gchar* _tmp118_;
							_tmp111_ = contacts_typeset_get_phone ();
							_tmp112_ = _tmp111_;
							_tmp113_ = _data16_->phone;
							_tmp114_ = contacts_typeset_format_type (_tmp112_, (FolksAbstractFieldDetails*) _tmp113_);
							_tmp115_ = _tmp114_;
							_tmp116_ = _data16_->phone;
							_tmp117_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp116_);
							_tmp118_ = _tmp117_;
							contacts_contact_sheet_add_row_with_label (self, &i, _tmp115_, (const gchar*) _tmp118_);
							_g_free0 (_tmp115_);
						}
						block16_data_unref (_data16_);
						_data16_ = NULL;
					}
					_g_object_unref0 (_phone_list);
				}
				_g_object_unref0 (phones);
			}
			_tmp119_ = p;
			_tmp120_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp119_, FOLKS_TYPE_IM_DETAILS) ? ((FolksImDetails*) _tmp119_) : NULL);
			im_details = _tmp120_;
			_tmp121_ = im_details;
			if (_tmp121_ != NULL) {
				{
					GeeIterator* _protocol_it = NULL;
					FolksImDetails* _tmp122_;
					GeeMultiMap* _tmp123_;
					GeeMultiMap* _tmp124_;
					GeeSet* _tmp125_;
					GeeSet* _tmp126_;
					GeeIterator* _tmp127_;
					GeeIterator* _tmp128_;
					_tmp122_ = im_details;
					_tmp123_ = folks_im_details_get_im_addresses (_tmp122_);
					_tmp124_ = _tmp123_;
					_tmp125_ = gee_multi_map_get_keys (_tmp124_);
					_tmp126_ = _tmp125_;
					_tmp127_ = gee_iterable_iterator ((GeeIterable*) _tmp126_);
					_tmp128_ = _tmp127_;
					_g_object_unref0 (_tmp126_);
					_protocol_it = _tmp128_;
					while (TRUE) {
						Block17Data* _data17_;
						GeeIterator* _tmp129_;
						gboolean _tmp130_;
						GeeIterator* _tmp131_;
						gpointer _tmp132_;
						_data17_ = g_slice_new0 (Block17Data);
						_data17_->_ref_count_ = 1;
						_data17_->_data14_ = block14_data_ref (_data14_);
						_tmp129_ = _protocol_it;
						_tmp130_ = gee_iterator_next (_tmp129_);
						if (!_tmp130_) {
							block17_data_unref (_data17_);
							_data17_ = NULL;
							break;
						}
						_tmp131_ = _protocol_it;
						_tmp132_ = gee_iterator_get (_tmp131_);
						_data17_->protocol = (gchar*) _tmp132_;
						{
							GeeIterator* _id_it = NULL;
							FolksImDetails* _tmp133_;
							GeeMultiMap* _tmp134_;
							GeeMultiMap* _tmp135_;
							const gchar* _tmp136_;
							GeeCollection* _tmp137_;
							GeeCollection* _tmp138_;
							GeeIterator* _tmp139_;
							GeeIterator* _tmp140_;
							_tmp133_ = im_details;
							_tmp134_ = folks_im_details_get_im_addresses (_tmp133_);
							_tmp135_ = _tmp134_;
							_tmp136_ = _data17_->protocol;
							_tmp137_ = gee_multi_map_get (_tmp135_, _tmp136_);
							_tmp138_ = _tmp137_;
							_tmp139_ = gee_iterable_iterator ((GeeIterable*) _tmp138_);
							_tmp140_ = _tmp139_;
							_g_object_unref0 (_tmp138_);
							_id_it = _tmp140_;
							while (TRUE) {
								Block18Data* _data18_;
								GeeIterator* _tmp141_;
								gboolean _tmp142_;
								GeeIterator* _tmp143_;
								gpointer _tmp144_;
								FolksPersona* _tmp145_;
								_data18_ = g_slice_new0 (Block18Data);
								_data18_->_ref_count_ = 1;
								_data18_->_data17_ = block17_data_ref (_data17_);
								_tmp141_ = _id_it;
								_tmp142_ = gee_iterator_next (_tmp141_);
								if (!_tmp142_) {
									block18_data_unref (_data18_);
									_data18_ = NULL;
									break;
								}
								_tmp143_ = _id_it;
								_tmp144_ = gee_iterator_get (_tmp143_);
								_data18_->id = (FolksImFieldDetails*) _tmp144_;
								_tmp145_ = p;
								if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp145_, TPF_TYPE_PERSONA)) {
									GtkButton* button = NULL;
									const gchar* _tmp146_;
									gchar* _tmp147_;
									gchar* _tmp148_;
									FolksImFieldDetails* _tmp149_;
									gconstpointer _tmp150_;
									const gchar* _tmp151_;
									GtkButton* _tmp152_;
									GtkButton* _tmp153_;
									GtkButton* _tmp154_;
									_tmp146_ = _data17_->protocol;
									_tmp147_ = contacts_contact_format_im_service (_tmp146_, NULL);
									_tmp148_ = _tmp147_;
									_tmp149_ = _data18_->id;
									_tmp150_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp149_);
									_tmp151_ = _tmp150_;
									_tmp152_ = contacts_contact_sheet_add_row_with_button (self, &i, _tmp148_, (const gchar*) _tmp151_);
									_tmp153_ = _tmp152_;
									_g_free0 (_tmp148_);
									button = _tmp153_;
									_tmp154_ = button;
									g_signal_connect_data (_tmp154_, "clicked", (GCallback) ___________lambda32__gtk_button_clicked, block18_data_ref (_data18_), (GClosureNotify) block18_data_unref, 0);
									_g_object_unref0 (button);
								}
								block18_data_unref (_data18_);
								_data18_ = NULL;
							}
							_g_object_unref0 (_id_it);
						}
						block17_data_unref (_data17_);
						_data17_ = NULL;
					}
					_g_object_unref0 (_protocol_it);
				}
			}
			_tmp155_ = p;
			_tmp156_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp155_, FOLKS_TYPE_URL_DETAILS) ? ((FolksUrlDetails*) _tmp155_) : NULL);
			url_details = _tmp156_;
			_tmp157_ = url_details;
			if (_tmp157_ != NULL) {
				{
					GeeIterator* _url_it = NULL;
					FolksUrlDetails* _tmp158_;
					GeeSet* _tmp159_;
					GeeSet* _tmp160_;
					GeeIterator* _tmp161_;
					_tmp158_ = url_details;
					_tmp159_ = folks_url_details_get_urls (_tmp158_);
					_tmp160_ = _tmp159_;
					_tmp161_ = gee_iterable_iterator ((GeeIterable*) _tmp160_);
					_url_it = _tmp161_;
					while (TRUE) {
						GeeIterator* _tmp162_;
						gboolean _tmp163_;
						FolksUrlFieldDetails* url = NULL;
						GeeIterator* _tmp164_;
						gpointer _tmp165_;
						FolksUrlFieldDetails* _tmp166_;
						gconstpointer _tmp167_;
						const gchar* _tmp168_;
						_tmp162_ = _url_it;
						_tmp163_ = gee_iterator_next (_tmp162_);
						if (!_tmp163_) {
							break;
						}
						_tmp164_ = _url_it;
						_tmp165_ = gee_iterator_get (_tmp164_);
						url = (FolksUrlFieldDetails*) _tmp165_;
						_tmp166_ = url;
						_tmp167_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp166_);
						_tmp168_ = _tmp167_;
						contacts_contact_sheet_add_row_with_link_button (self, &i, _ ("Website"), (const gchar*) _tmp168_);
						_g_object_unref0 (url);
					}
					_g_object_unref0 (_url_it);
				}
			}
			_tmp169_ = p;
			_tmp170_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp169_, FOLKS_TYPE_NAME_DETAILS) ? ((FolksNameDetails*) _tmp169_) : NULL);
			name_details = _tmp170_;
			_tmp171_ = name_details;
			if (_tmp171_ != NULL) {
				FolksNameDetails* _tmp172_;
				const gchar* _tmp173_;
				const gchar* _tmp174_;
				gboolean _tmp175_;
				_tmp172_ = name_details;
				_tmp173_ = folks_name_details_get_nickname (_tmp172_);
				_tmp174_ = _tmp173_;
				_tmp175_ = contacts_is_set (_tmp174_);
				if (_tmp175_) {
					FolksNameDetails* _tmp176_;
					const gchar* _tmp177_;
					const gchar* _tmp178_;
					_tmp176_ = name_details;
					_tmp177_ = folks_name_details_get_nickname (_tmp176_);
					_tmp178_ = _tmp177_;
					contacts_contact_sheet_add_row_with_label (self, &i, _ ("Nickname"), _tmp178_);
				}
			}
			_tmp179_ = p;
			_tmp180_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp179_, FOLKS_TYPE_BIRTHDAY_DETAILS) ? ((FolksBirthdayDetails*) _tmp179_) : NULL);
			birthday_details = _tmp180_;
			_tmp181_ = birthday_details;
			if (_tmp181_ != NULL) {
				FolksBirthdayDetails* _tmp182_;
				GDateTime* _tmp183_;
				GDateTime* _tmp184_;
				_tmp182_ = birthday_details;
				_tmp183_ = folks_birthday_details_get_birthday (_tmp182_);
				_tmp184_ = _tmp183_;
				if (_tmp184_ != NULL) {
					FolksBirthdayDetails* _tmp185_;
					GDateTime* _tmp186_;
					GDateTime* _tmp187_;
					GDateTime* _tmp188_;
					GDateTime* _tmp189_;
					gchar* _tmp190_;
					gchar* _tmp191_;
					_tmp185_ = birthday_details;
					_tmp186_ = folks_birthday_details_get_birthday (_tmp185_);
					_tmp187_ = _tmp186_;
					_tmp188_ = g_date_time_to_local (_tmp187_);
					_tmp189_ = _tmp188_;
					_tmp190_ = g_date_time_format (_tmp189_, "%x");
					_tmp191_ = _tmp190_;
					contacts_contact_sheet_add_row_with_label (self, &i, _ ("Birthday"), _tmp191_);
					_g_free0 (_tmp191_);
					_g_date_time_unref0 (_tmp189_);
				}
			}
			_tmp192_ = p;
			_tmp193_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp192_, FOLKS_TYPE_NOTE_DETAILS) ? ((FolksNoteDetails*) _tmp192_) : NULL);
			note_details = _tmp193_;
			_tmp194_ = note_details;
			if (_tmp194_ != NULL) {
				{
					GeeIterator* _note_it = NULL;
					FolksNoteDetails* _tmp195_;
					GeeSet* _tmp196_;
					GeeSet* _tmp197_;
					GeeIterator* _tmp198_;
					_tmp195_ = note_details;
					_tmp196_ = folks_note_details_get_notes (_tmp195_);
					_tmp197_ = _tmp196_;
					_tmp198_ = gee_iterable_iterator ((GeeIterable*) _tmp197_);
					_note_it = _tmp198_;
					while (TRUE) {
						GeeIterator* _tmp199_;
						gboolean _tmp200_;
						FolksNoteFieldDetails* note = NULL;
						GeeIterator* _tmp201_;
						gpointer _tmp202_;
						FolksNoteFieldDetails* _tmp203_;
						gconstpointer _tmp204_;
						const gchar* _tmp205_;
						_tmp199_ = _note_it;
						_tmp200_ = gee_iterator_next (_tmp199_);
						if (!_tmp200_) {
							break;
						}
						_tmp201_ = _note_it;
						_tmp202_ = gee_iterator_get (_tmp201_);
						note = (FolksNoteFieldDetails*) _tmp202_;
						_tmp203_ = note;
						_tmp204_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp203_);
						_tmp205_ = _tmp204_;
						contacts_contact_sheet_add_row_with_label (self, &i, _ ("Note"), (const gchar*) _tmp205_);
						_g_object_unref0 (note);
					}
					_g_object_unref0 (_note_it);
				}
			}
			_tmp206_ = p;
			_tmp207_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp206_, FOLKS_TYPE_POSTAL_ADDRESS_DETAILS) ? ((FolksPostalAddressDetails*) _tmp206_) : NULL);
			addr_details = _tmp207_;
			_tmp208_ = addr_details;
			if (_tmp208_ != NULL) {
				FolksPostalAddressDetails* _tmp236_;
				GeeSet* _tmp237_;
				GeeSet* _tmp238_;
				gint _tmp239_;
				gint _tmp240_;
				{
					GeeIterator* _addr_it = NULL;
					FolksPostalAddressDetails* _tmp209_;
					GeeSet* _tmp210_;
					GeeSet* _tmp211_;
					GeeIterator* _tmp212_;
					_tmp209_ = addr_details;
					_tmp210_ = folks_postal_address_details_get_postal_addresses (_tmp209_);
					_tmp211_ = _tmp210_;
					_tmp212_ = gee_iterable_iterator ((GeeIterable*) _tmp211_);
					_addr_it = _tmp212_;
					while (TRUE) {
						GeeIterator* _tmp213_;
						gboolean _tmp214_;
						FolksPostalAddressFieldDetails* addr = NULL;
						GeeIterator* _tmp215_;
						gpointer _tmp216_;
						gchar** strs = NULL;
						FolksPostalAddressFieldDetails* _tmp217_;
						gconstpointer _tmp218_;
						FolksPostalAddress* _tmp219_;
						gint _tmp220_;
						gchar** _tmp221_;
						gint strs_length1;
						gint _strs_size_;
						gchar* all_strs = NULL;
						gchar* _tmp222_;
						gchar** _tmp223_;
						gint _tmp223__length1;
						ContactsTypeSet* _tmp230_;
						ContactsTypeSet* _tmp231_;
						FolksPostalAddressFieldDetails* _tmp232_;
						gchar* _tmp233_;
						gchar* _tmp234_;
						const gchar* _tmp235_;
						_tmp213_ = _addr_it;
						_tmp214_ = gee_iterator_next (_tmp213_);
						if (!_tmp214_) {
							break;
						}
						_tmp215_ = _addr_it;
						_tmp216_ = gee_iterator_get (_tmp215_);
						addr = (FolksPostalAddressFieldDetails*) _tmp216_;
						_tmp217_ = addr;
						_tmp218_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp217_);
						_tmp219_ = _tmp218_;
						_tmp221_ = contacts_contact_format_address ((FolksPostalAddress*) _tmp219_, &_tmp220_);
						strs = _tmp221_;
						strs_length1 = _tmp220_;
						_strs_size_ = strs_length1;
						_tmp222_ = g_strdup ("");
						all_strs = _tmp222_;
						_tmp223_ = strs;
						_tmp223__length1 = strs_length1;
						{
							gchar** s_collection = NULL;
							gint s_collection_length1 = 0;
							gint _s_collection_size_ = 0;
							gint s_it = 0;
							s_collection = _tmp223_;
							s_collection_length1 = _tmp223__length1;
							for (s_it = 0; s_it < _tmp223__length1; s_it = s_it + 1) {
								gchar* _tmp224_;
								gchar* s = NULL;
								_tmp224_ = g_strdup (s_collection[s_it]);
								s = _tmp224_;
								{
									const gchar* _tmp225_;
									const gchar* _tmp226_;
									gchar* _tmp227_;
									gchar* _tmp228_;
									gchar* _tmp229_;
									_tmp225_ = all_strs;
									_tmp226_ = s;
									_tmp227_ = g_strconcat (_tmp226_, "\n", NULL);
									_tmp228_ = _tmp227_;
									_tmp229_ = g_strconcat (_tmp225_, _tmp228_, NULL);
									_g_free0 (all_strs);
									all_strs = _tmp229_;
									_g_free0 (_tmp228_);
									_g_free0 (s);
								}
							}
						}
						_tmp230_ = contacts_typeset_get_general ();
						_tmp231_ = _tmp230_;
						_tmp232_ = addr;
						_tmp233_ = contacts_typeset_format_type (_tmp231_, (FolksAbstractFieldDetails*) _tmp232_);
						_tmp234_ = _tmp233_;
						_tmp235_ = all_strs;
						contacts_contact_sheet_add_row_with_label (self, &i, _tmp234_, _tmp235_);
						_g_free0 (_tmp234_);
						_g_free0 (all_strs);
						strs = (_vala_array_free (strs, strs_length1, (GDestroyNotify) g_free), NULL);
						_g_object_unref0 (addr);
					}
					_g_object_unref0 (_addr_it);
				}
				_tmp236_ = addr_details;
				_tmp237_ = folks_postal_address_details_get_postal_addresses (_tmp236_);
				_tmp238_ = _tmp237_;
				_tmp239_ = gee_collection_get_size ((GeeCollection*) _tmp238_);
				_tmp240_ = _tmp239_;
				if (_tmp240_ > 0) {
					ContactsAddressMap* map = NULL;
					ContactsContact* _tmp241_;
					FolksPostalAddressDetails* _tmp242_;
					GeeSet* _tmp243_;
					GeeSet* _tmp244_;
					ContactsAddressMap* _tmp245_;
					ContactsAddressMap* _tmp246_;
					ContactsAddressMap* _tmp247_;
					gint _tmp248_;
					gint _tmp249_;
					_tmp241_ = _data14_->c;
					_tmp242_ = addr_details;
					_tmp243_ = folks_postal_address_details_get_postal_addresses (_tmp242_);
					_tmp244_ = _tmp243_;
					_tmp245_ = contacts_address_map_new (_tmp241_, _tmp244_);
					g_object_ref_sink (_tmp245_);
					map = _tmp245_;
					_tmp246_ = map;
					contacts_address_map_load (_tmp246_);
					_tmp247_ = map;
					_tmp248_ = i;
					gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp247_, 1, _tmp248_, 1, 1);
					_tmp249_ = i;
					i = _tmp249_ + 1;
					_g_object_unref0 (map);
				}
			}
			_tmp250_ = i;
			if (_tmp250_ != 3) {
				is_first_persona = FALSE;
			}
			_tmp251_ = i;
			_tmp252_ = last_store_position;
			if (_tmp251_ == _tmp252_) {
				gint _tmp253_;
				GtkWidget* _tmp254_;
				_tmp253_ = i;
				_tmp254_ = gtk_grid_get_child_at ((GtkGrid*) self, 0, _tmp253_ - 1);
				gtk_widget_destroy (_tmp254_);
			}
			_g_object_unref0 (addr_details);
			_g_object_unref0 (note_details);
			_g_object_unref0 (birthday_details);
			_g_object_unref0 (name_details);
			_g_object_unref0 (url_details);
			_g_object_unref0 (im_details);
			_g_object_unref0 (phone_details);
			_g_object_unref0 (details);
			_g_object_unref0 (p);
		}
		_g_object_unref0 (_p_list);
	}
	gtk_widget_show_all ((GtkWidget*) self);
	_g_object_unref0 (personas);
	_g_object_unref0 (name_label);
	_g_object_unref0 (image_frame);
	block14_data_unref (_data14_);
	_data14_ = NULL;
}


void contacts_contact_sheet_clear (ContactsContactSheet* self) {
	GList* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = gtk_container_get_children ((GtkContainer*) self);
	{
		GList* w_collection = NULL;
		GList* w_it = NULL;
		w_collection = _tmp0_;
		for (w_it = w_collection; w_it != NULL; w_it = w_it->next) {
			GtkWidget* w = NULL;
			w = (GtkWidget*) w_it->data;
			{
				GtkWidget* _tmp1_;
				_tmp1_ = w;
				gtk_widget_destroy (_tmp1_);
			}
		}
		_g_list_free0 (w_collection);
	}
}


static void contacts_contact_sheet_class_init (ContactsContactSheetClass * klass) {
	contacts_contact_sheet_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ContactsContactSheetPrivate));
	G_OBJECT_CLASS (klass)->finalize = contacts_contact_sheet_finalize;
}


static void contacts_contact_sheet_instance_init (ContactsContactSheet * self) {
	self->priv = CONTACTS_CONTACT_SHEET_GET_PRIVATE (self);
}


static void contacts_contact_sheet_finalize (GObject * obj) {
	ContactsContactSheet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_CONTACT_SHEET, ContactsContactSheet);
	_g_object_unref0 (self->priv->contacts_store);
	G_OBJECT_CLASS (contacts_contact_sheet_parent_class)->finalize (obj);
}


GType contacts_contact_sheet_get_type (void) {
	static volatile gsize contacts_contact_sheet_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_contact_sheet_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsContactSheetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_contact_sheet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsContactSheet), 0, (GInstanceInitFunc) contacts_contact_sheet_instance_init, NULL };
		GType contacts_contact_sheet_type_id;
		contacts_contact_sheet_type_id = g_type_register_static (gtk_grid_get_type (), "ContactsContactSheet", &g_define_type_info, 0);
		g_once_init_leave (&contacts_contact_sheet_type_id__volatile, contacts_contact_sheet_type_id);
	}
	return contacts_contact_sheet_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);
}



