/* contacts-contact-sheet.c generated by valac 0.38.8, 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 <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;
enum  {
	CONTACTS_CONTACT_SHEET_0_PROPERTY,
	CONTACTS_CONTACT_SHEET_NUM_PROPERTIES
};
static GParamSpec* contacts_contact_sheet_properties[CONTACTS_CONTACT_SHEET_NUM_PROPERTIES];
#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;
#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;
};


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))
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);
ContactsTypeSet* contacts_typeset_get_phone (void);
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);
}


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_;
			FolksUrlDetails* url_details = NULL;
			FolksPersona* _tmp105_;
			FolksUrlDetails* _tmp106_;
			FolksUrlDetails* _tmp107_;
			FolksNameDetails* name_details = NULL;
			FolksPersona* _tmp119_;
			FolksNameDetails* _tmp120_;
			FolksNameDetails* _tmp121_;
			FolksBirthdayDetails* birthday_details = NULL;
			FolksPersona* _tmp129_;
			FolksBirthdayDetails* _tmp130_;
			FolksBirthdayDetails* _tmp131_;
			FolksNoteDetails* note_details = NULL;
			FolksPersona* _tmp142_;
			FolksNoteDetails* _tmp143_;
			FolksNoteDetails* _tmp144_;
			FolksPostalAddressDetails* addr_details = NULL;
			FolksPersona* _tmp156_;
			FolksPostalAddressDetails* _tmp157_;
			FolksPostalAddressDetails* _tmp158_;
			gint _tmp200_;
			gint _tmp201_;
			gint _tmp202_;
			_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) {
						gint _tmp91_;
						gint _tmp92_;
						gint _tmp93_;
						FolksPhoneFieldDetails* phone = NULL;
						GeeArrayList* _tmp94_;
						gint _tmp95_;
						gpointer _tmp96_;
						ContactsTypeSet* _tmp97_;
						ContactsTypeSet* _tmp98_;
						FolksPhoneFieldDetails* _tmp99_;
						gchar* _tmp100_;
						gchar* _tmp101_;
						FolksPhoneFieldDetails* _tmp102_;
						gconstpointer _tmp103_;
						const gchar* _tmp104_;
						_tmp91_ = _phone_index;
						_phone_index = _tmp91_ + 1;
						_tmp92_ = _phone_index;
						_tmp93_ = _phone_size;
						if (!(_tmp92_ < _tmp93_)) {
							break;
						}
						_tmp94_ = _phone_list;
						_tmp95_ = _phone_index;
						_tmp96_ = gee_abstract_list_get ((GeeAbstractList*) _tmp94_, _tmp95_);
						phone = (FolksPhoneFieldDetails*) _tmp96_;
						_tmp97_ = contacts_typeset_get_phone ();
						_tmp98_ = _tmp97_;
						_tmp99_ = phone;
						_tmp100_ = contacts_typeset_format_type (_tmp98_, (FolksAbstractFieldDetails*) _tmp99_);
						_tmp101_ = _tmp100_;
						_tmp102_ = phone;
						_tmp103_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp102_);
						_tmp104_ = _tmp103_;
						contacts_contact_sheet_add_row_with_label (self, &i, _tmp101_, (const gchar*) _tmp104_);
						_g_free0 (_tmp101_);
						_g_object_unref0 (phone);
					}
					_g_object_unref0 (_phone_list);
				}
				_g_object_unref0 (phones);
			}
			_tmp105_ = p;
			_tmp106_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp105_, FOLKS_TYPE_URL_DETAILS) ? ((FolksUrlDetails*) _tmp105_) : NULL);
			url_details = _tmp106_;
			_tmp107_ = url_details;
			if (_tmp107_ != NULL) {
				{
					GeeIterator* _url_it = NULL;
					FolksUrlDetails* _tmp108_;
					GeeSet* _tmp109_;
					GeeSet* _tmp110_;
					GeeIterator* _tmp111_;
					_tmp108_ = url_details;
					_tmp109_ = folks_url_details_get_urls (_tmp108_);
					_tmp110_ = _tmp109_;
					_tmp111_ = gee_iterable_iterator ((GeeIterable*) _tmp110_);
					_url_it = _tmp111_;
					while (TRUE) {
						GeeIterator* _tmp112_;
						gboolean _tmp113_;
						FolksUrlFieldDetails* url = NULL;
						GeeIterator* _tmp114_;
						gpointer _tmp115_;
						FolksUrlFieldDetails* _tmp116_;
						gconstpointer _tmp117_;
						const gchar* _tmp118_;
						_tmp112_ = _url_it;
						_tmp113_ = gee_iterator_next (_tmp112_);
						if (!_tmp113_) {
							break;
						}
						_tmp114_ = _url_it;
						_tmp115_ = gee_iterator_get (_tmp114_);
						url = (FolksUrlFieldDetails*) _tmp115_;
						_tmp116_ = url;
						_tmp117_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp116_);
						_tmp118_ = _tmp117_;
						contacts_contact_sheet_add_row_with_link_button (self, &i, _ ("Website"), (const gchar*) _tmp118_);
						_g_object_unref0 (url);
					}
					_g_object_unref0 (_url_it);
				}
			}
			_tmp119_ = p;
			_tmp120_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp119_, FOLKS_TYPE_NAME_DETAILS) ? ((FolksNameDetails*) _tmp119_) : NULL);
			name_details = _tmp120_;
			_tmp121_ = name_details;
			if (_tmp121_ != NULL) {
				FolksNameDetails* _tmp122_;
				const gchar* _tmp123_;
				const gchar* _tmp124_;
				gboolean _tmp125_;
				_tmp122_ = name_details;
				_tmp123_ = folks_name_details_get_nickname (_tmp122_);
				_tmp124_ = _tmp123_;
				_tmp125_ = contacts_is_set (_tmp124_);
				if (_tmp125_) {
					FolksNameDetails* _tmp126_;
					const gchar* _tmp127_;
					const gchar* _tmp128_;
					_tmp126_ = name_details;
					_tmp127_ = folks_name_details_get_nickname (_tmp126_);
					_tmp128_ = _tmp127_;
					contacts_contact_sheet_add_row_with_label (self, &i, _ ("Nickname"), _tmp128_);
				}
			}
			_tmp129_ = p;
			_tmp130_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp129_, FOLKS_TYPE_BIRTHDAY_DETAILS) ? ((FolksBirthdayDetails*) _tmp129_) : NULL);
			birthday_details = _tmp130_;
			_tmp131_ = birthday_details;
			if (_tmp131_ != NULL) {
				FolksBirthdayDetails* _tmp132_;
				GDateTime* _tmp133_;
				GDateTime* _tmp134_;
				_tmp132_ = birthday_details;
				_tmp133_ = folks_birthday_details_get_birthday (_tmp132_);
				_tmp134_ = _tmp133_;
				if (_tmp134_ != NULL) {
					FolksBirthdayDetails* _tmp135_;
					GDateTime* _tmp136_;
					GDateTime* _tmp137_;
					GDateTime* _tmp138_;
					GDateTime* _tmp139_;
					gchar* _tmp140_;
					gchar* _tmp141_;
					_tmp135_ = birthday_details;
					_tmp136_ = folks_birthday_details_get_birthday (_tmp135_);
					_tmp137_ = _tmp136_;
					_tmp138_ = g_date_time_to_local (_tmp137_);
					_tmp139_ = _tmp138_;
					_tmp140_ = g_date_time_format (_tmp139_, "%x");
					_tmp141_ = _tmp140_;
					contacts_contact_sheet_add_row_with_label (self, &i, _ ("Birthday"), _tmp141_);
					_g_free0 (_tmp141_);
					_g_date_time_unref0 (_tmp139_);
				}
			}
			_tmp142_ = p;
			_tmp143_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp142_, FOLKS_TYPE_NOTE_DETAILS) ? ((FolksNoteDetails*) _tmp142_) : NULL);
			note_details = _tmp143_;
			_tmp144_ = note_details;
			if (_tmp144_ != NULL) {
				{
					GeeIterator* _note_it = NULL;
					FolksNoteDetails* _tmp145_;
					GeeSet* _tmp146_;
					GeeSet* _tmp147_;
					GeeIterator* _tmp148_;
					_tmp145_ = note_details;
					_tmp146_ = folks_note_details_get_notes (_tmp145_);
					_tmp147_ = _tmp146_;
					_tmp148_ = gee_iterable_iterator ((GeeIterable*) _tmp147_);
					_note_it = _tmp148_;
					while (TRUE) {
						GeeIterator* _tmp149_;
						gboolean _tmp150_;
						FolksNoteFieldDetails* note = NULL;
						GeeIterator* _tmp151_;
						gpointer _tmp152_;
						FolksNoteFieldDetails* _tmp153_;
						gconstpointer _tmp154_;
						const gchar* _tmp155_;
						_tmp149_ = _note_it;
						_tmp150_ = gee_iterator_next (_tmp149_);
						if (!_tmp150_) {
							break;
						}
						_tmp151_ = _note_it;
						_tmp152_ = gee_iterator_get (_tmp151_);
						note = (FolksNoteFieldDetails*) _tmp152_;
						_tmp153_ = note;
						_tmp154_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp153_);
						_tmp155_ = _tmp154_;
						contacts_contact_sheet_add_row_with_label (self, &i, _ ("Note"), (const gchar*) _tmp155_);
						_g_object_unref0 (note);
					}
					_g_object_unref0 (_note_it);
				}
			}
			_tmp156_ = p;
			_tmp157_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp156_, FOLKS_TYPE_POSTAL_ADDRESS_DETAILS) ? ((FolksPostalAddressDetails*) _tmp156_) : NULL);
			addr_details = _tmp157_;
			_tmp158_ = addr_details;
			if (_tmp158_ != NULL) {
				FolksPostalAddressDetails* _tmp186_;
				GeeSet* _tmp187_;
				GeeSet* _tmp188_;
				gint _tmp189_;
				gint _tmp190_;
				{
					GeeIterator* _addr_it = NULL;
					FolksPostalAddressDetails* _tmp159_;
					GeeSet* _tmp160_;
					GeeSet* _tmp161_;
					GeeIterator* _tmp162_;
					_tmp159_ = addr_details;
					_tmp160_ = folks_postal_address_details_get_postal_addresses (_tmp159_);
					_tmp161_ = _tmp160_;
					_tmp162_ = gee_iterable_iterator ((GeeIterable*) _tmp161_);
					_addr_it = _tmp162_;
					while (TRUE) {
						GeeIterator* _tmp163_;
						gboolean _tmp164_;
						FolksPostalAddressFieldDetails* addr = NULL;
						GeeIterator* _tmp165_;
						gpointer _tmp166_;
						gchar** strs = NULL;
						FolksPostalAddressFieldDetails* _tmp167_;
						gconstpointer _tmp168_;
						FolksPostalAddress* _tmp169_;
						gint _tmp170_;
						gchar** _tmp171_;
						gint strs_length1;
						gint _strs_size_;
						gchar* all_strs = NULL;
						gchar* _tmp172_;
						gchar** _tmp173_;
						gint _tmp173__length1;
						ContactsTypeSet* _tmp180_;
						ContactsTypeSet* _tmp181_;
						FolksPostalAddressFieldDetails* _tmp182_;
						gchar* _tmp183_;
						gchar* _tmp184_;
						const gchar* _tmp185_;
						_tmp163_ = _addr_it;
						_tmp164_ = gee_iterator_next (_tmp163_);
						if (!_tmp164_) {
							break;
						}
						_tmp165_ = _addr_it;
						_tmp166_ = gee_iterator_get (_tmp165_);
						addr = (FolksPostalAddressFieldDetails*) _tmp166_;
						_tmp167_ = addr;
						_tmp168_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _tmp167_);
						_tmp169_ = _tmp168_;
						_tmp171_ = contacts_contact_format_address ((FolksPostalAddress*) _tmp169_, &_tmp170_);
						strs = _tmp171_;
						strs_length1 = _tmp170_;
						_strs_size_ = strs_length1;
						_tmp172_ = g_strdup ("");
						all_strs = _tmp172_;
						_tmp173_ = strs;
						_tmp173__length1 = strs_length1;
						{
							gchar** s_collection = NULL;
							gint s_collection_length1 = 0;
							gint _s_collection_size_ = 0;
							gint s_it = 0;
							s_collection = _tmp173_;
							s_collection_length1 = _tmp173__length1;
							for (s_it = 0; s_it < _tmp173__length1; s_it = s_it + 1) {
								gchar* _tmp174_;
								gchar* s = NULL;
								_tmp174_ = g_strdup (s_collection[s_it]);
								s = _tmp174_;
								{
									const gchar* _tmp175_;
									const gchar* _tmp176_;
									gchar* _tmp177_;
									gchar* _tmp178_;
									gchar* _tmp179_;
									_tmp175_ = all_strs;
									_tmp176_ = s;
									_tmp177_ = g_strconcat (_tmp176_, "\n", NULL);
									_tmp178_ = _tmp177_;
									_tmp179_ = g_strconcat (_tmp175_, _tmp178_, NULL);
									_g_free0 (all_strs);
									all_strs = _tmp179_;
									_g_free0 (_tmp178_);
									_g_free0 (s);
								}
							}
						}
						_tmp180_ = contacts_typeset_get_general ();
						_tmp181_ = _tmp180_;
						_tmp182_ = addr;
						_tmp183_ = contacts_typeset_format_type (_tmp181_, (FolksAbstractFieldDetails*) _tmp182_);
						_tmp184_ = _tmp183_;
						_tmp185_ = all_strs;
						contacts_contact_sheet_add_row_with_label (self, &i, _tmp184_, _tmp185_);
						_g_free0 (_tmp184_);
						_g_free0 (all_strs);
						strs = (_vala_array_free (strs, strs_length1, (GDestroyNotify) g_free), NULL);
						_g_object_unref0 (addr);
					}
					_g_object_unref0 (_addr_it);
				}
				_tmp186_ = addr_details;
				_tmp187_ = folks_postal_address_details_get_postal_addresses (_tmp186_);
				_tmp188_ = _tmp187_;
				_tmp189_ = gee_collection_get_size ((GeeCollection*) _tmp188_);
				_tmp190_ = _tmp189_;
				if (_tmp190_ > 0) {
					ContactsAddressMap* map = NULL;
					ContactsContact* _tmp191_;
					FolksPostalAddressDetails* _tmp192_;
					GeeSet* _tmp193_;
					GeeSet* _tmp194_;
					ContactsAddressMap* _tmp195_;
					ContactsAddressMap* _tmp196_;
					ContactsAddressMap* _tmp197_;
					gint _tmp198_;
					gint _tmp199_;
					_tmp191_ = _data14_->c;
					_tmp192_ = addr_details;
					_tmp193_ = folks_postal_address_details_get_postal_addresses (_tmp192_);
					_tmp194_ = _tmp193_;
					_tmp195_ = contacts_address_map_new (_tmp191_, _tmp194_);
					g_object_ref_sink (_tmp195_);
					map = _tmp195_;
					_tmp196_ = map;
					contacts_address_map_load (_tmp196_);
					_tmp197_ = map;
					_tmp198_ = i;
					gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp197_, 1, _tmp198_, 1, 1);
					_tmp199_ = i;
					i = _tmp199_ + 1;
					_g_object_unref0 (map);
				}
			}
			_tmp200_ = i;
			if (_tmp200_ != 3) {
				is_first_persona = FALSE;
			}
			_tmp201_ = i;
			_tmp202_ = last_store_position;
			if (_tmp201_ == _tmp202_) {
				gint _tmp203_;
				GtkWidget* _tmp204_;
				_tmp203_ = i;
				_tmp204_ = gtk_grid_get_child_at ((GtkGrid*) self, 0, _tmp203_ - 1);
				gtk_widget_destroy (_tmp204_);
			}
			_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 (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);
}



