/* contacts-new-contact-dialog.c generated by valac 0.20.1.71-45f6, the Vala compiler
 * generated from contacts-new-contact-dialog.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 <gee.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>
#include <folks/folks.h>
#include <gio/gio.h>


#define CONTACTS_TYPE_NEW_CONTACT_DIALOG (contacts_new_contact_dialog_get_type ())
#define CONTACTS_NEW_CONTACT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_NEW_CONTACT_DIALOG, ContactsNewContactDialog))
#define CONTACTS_NEW_CONTACT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_NEW_CONTACT_DIALOG, ContactsNewContactDialogClass))
#define CONTACTS_IS_NEW_CONTACT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_NEW_CONTACT_DIALOG))
#define CONTACTS_IS_NEW_CONTACT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_NEW_CONTACT_DIALOG))
#define CONTACTS_NEW_CONTACT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_NEW_CONTACT_DIALOG, ContactsNewContactDialogClass))

typedef struct _ContactsNewContactDialog ContactsNewContactDialog;
typedef struct _ContactsNewContactDialogClass ContactsNewContactDialogClass;
typedef struct _ContactsNewContactDialogPrivate ContactsNewContactDialogPrivate;

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

typedef struct _ContactsStore ContactsStore;
typedef struct _ContactsStoreClass ContactsStoreClass;

#define CONTACTS_TYPE_TYPECOMBO (contacts_typecombo_get_type ())
#define CONTACTS_TYPECOMBO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_TYPECOMBO, ContactsTypeCombo))
#define CONTACTS_TYPECOMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_TYPECOMBO, ContactsTypeComboClass))
#define CONTACTS_IS_TYPECOMBO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_TYPECOMBO))
#define CONTACTS_IS_TYPECOMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_TYPECOMBO))
#define CONTACTS_TYPECOMBO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_TYPECOMBO, ContactsTypeComboClass))

typedef struct _ContactsTypeCombo ContactsTypeCombo;
typedef struct _ContactsTypeComboClass ContactsTypeComboClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

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

typedef struct _ContactsWindow ContactsWindow;
typedef struct _ContactsWindowClass ContactsWindowClass;

#define CONTACTS_TYPE_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 CONTACTS_TYPE_MENU_BUTTON (contacts_menu_button_get_type ())
#define CONTACTS_MENU_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_MENU_BUTTON, ContactsMenuButton))
#define CONTACTS_MENU_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_MENU_BUTTON, ContactsMenuButtonClass))
#define CONTACTS_IS_MENU_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_MENU_BUTTON))
#define CONTACTS_IS_MENU_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_MENU_BUTTON))
#define CONTACTS_MENU_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_MENU_BUTTON, ContactsMenuButtonClass))

typedef struct _ContactsMenuButton ContactsMenuButton;
typedef struct _ContactsMenuButtonClass ContactsMenuButtonClass;
typedef struct _Block38Data Block38Data;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _Block39Data Block39Data;

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

typedef struct _ContactsApp ContactsApp;
typedef struct _ContactsAppClass ContactsAppClass;
typedef struct _ContactsAppPrivate ContactsAppPrivate;
typedef struct _Block40Data Block40Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (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;

struct _ContactsNewContactDialog {
	GtkDialog parent_instance;
	ContactsNewContactDialogPrivate * priv;
};

struct _ContactsNewContactDialogClass {
	GtkDialogClass parent_class;
};

struct _ContactsNewContactDialogPrivate {
	ContactsStore* contacts_store;
	GtkGrid* grid;
	GtkEntry* name_entry;
	GeeArrayList* email_entries;
	GeeArrayList* email_combos;
	GeeArrayList* phone_entries;
	GeeArrayList* phone_combos;
	GeeArrayList* address_entries;
	GeeArrayList* address_combos;
};

struct _Block38Data {
	int _ref_count_;
	ContactsNewContactDialog * self;
	GtkMessageDialog* d;
};

struct _Block39Data {
	int _ref_count_;
	ContactsNewContactDialog * self;
	GtkDialog* dialog;
};

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

struct _ContactsAppClass {
	GtkApplicationClass parent_class;
};

struct _Block40Data {
	int _ref_count_;
	ContactsNewContactDialog * self;
	GtkDialog* dialog;
};


extern ContactsNewContactDialog* new_contact_dialog;
ContactsNewContactDialog* new_contact_dialog = NULL;
static gpointer contacts_new_contact_dialog_parent_class = NULL;
extern gchar** contacts_contact_postal_element_props;
extern gint contacts_contact_postal_element_props_length1;
extern gchar** contacts_contact_postal_element_names;
extern gint contacts_contact_postal_element_names_length1;
extern ContactsApp* contacts_app_app;

GType contacts_new_contact_dialog_get_type (void) G_GNUC_CONST;
GType contacts_store_get_type (void) G_GNUC_CONST;
GType contacts_typecombo_get_type (void) G_GNUC_CONST;
#define CONTACTS_NEW_CONTACT_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_NEW_CONTACT_DIALOG, ContactsNewContactDialogPrivate))
enum  {
	CONTACTS_NEW_CONTACT_DIALOG_DUMMY_PROPERTY
};
GType contacts_window_get_type (void) G_GNUC_CONST;
ContactsNewContactDialog* contacts_new_contact_dialog_get_default (ContactsStore* contacts_store, ContactsWindow* parent);
static ContactsNewContactDialog* contacts_new_contact_dialog_new (ContactsStore* contacts_store, ContactsWindow* parent);
static ContactsNewContactDialog* contacts_new_contact_dialog_construct (GType object_type, ContactsStore* contacts_store, ContactsWindow* parent);
static void contacts_new_contact_dialog_pack_label (ContactsNewContactDialog* self, const gchar* text, gint* row);
GType contacts_typeset_get_type (void) G_GNUC_CONST;
static void contacts_new_contact_dialog_pack_entry_combo (ContactsNewContactDialog* self, GeeArrayList* entries, GeeArrayList* combos, ContactsTypeSet* type_set, gint* row);
ContactsTypeSet* contacts_typeset_get_general (void);
static void contacts_new_contact_dialog_pack_spacing (ContactsNewContactDialog* self, gint height, gint* row);
ContactsTypeSet* contacts_typeset_get_phone (void);
static void contacts_new_contact_dialog_pack_address_combo (ContactsNewContactDialog* self, GeeArrayList* entries, GeeArrayList* combos, ContactsTypeSet* type_set, gint* row);
GType contacts_menu_button_get_type (void) G_GNUC_CONST;
ContactsMenuButton* contacts_menu_button_new (const gchar* label);
ContactsMenuButton* contacts_menu_button_construct (GType object_type, const gchar* label);
void contacts_menu_button_set_menu (ContactsMenuButton* self, GtkMenu* menu);
GtkMenuItem* contacts_utils_add_menu_item (GtkMenu* menu, const gchar* label);
static void __lambda105_ (ContactsNewContactDialog* self);
static gint contacts_new_contact_dialog_row_after (ContactsNewContactDialog* self, GtkWidget* widget);
static void ___lambda105__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
static void __lambda106_ (ContactsNewContactDialog* self);
static void ___lambda106__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
static void __lambda107_ (ContactsNewContactDialog* self);
static void ___lambda107__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
ContactsTypeCombo* contacts_typecombo_new (ContactsTypeSet* type_set);
ContactsTypeCombo* contacts_typecombo_construct (GType object_type, ContactsTypeSet* type_set);
void contacts_typecombo_set_to (ContactsTypeCombo* self, const gchar* type);
static gboolean contacts_new_contact_dialog_real_map_event (GtkWidget* base, GdkEventAny* e);
static void contacts_new_contact_dialog_real_response (GtkDialog* base, gint response_id);
static Block38Data* block38_data_ref (Block38Data* _data38_);
static void block38_data_unref (void * _userdata_);
static void ____lambda108_ (Block38Data* _data38_, gint response_id);
static void _____lambda108__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
GHashTable* contacts_new_contact_dialog_get_details (ContactsNewContactDialog* self);
void contacts_new_contact_dialog_create_persona (ContactsNewContactDialog* self, GHashTable* details);
static void _g_free0_ (gpointer var);
static void _vala_GValue_free (GValue* self);
static void __vala_GValue_free0_ (gpointer var);
static GValue* _g_value_dup (GValue* self);
void contacts_typecombo_update_details (ContactsTypeCombo* self, FolksAbstractFieldDetails* details);
FolksIndividualAggregator* contacts_store_get_aggregator (ContactsStore* self);
static Block39Data* block39_data_ref (Block39Data* _data39_);
static void block39_data_unref (void * _userdata_);
static void ___lambda109_ (Block39Data* _data39_);
static void ____lambda109__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
void contacts_contact_create_primary_persona_for_details (FolksPersonaStore* store, GHashTable* details, GAsyncReadyCallback _callback_, gpointer _user_data_);
FolksPersona* contacts_contact_create_primary_persona_for_details_finish (GAsyncResult* _res_, GError** error);
GType contacts_app_get_type (void) G_GNUC_CONST;
static void __lambda110_ (ContactsNewContactDialog* self, GObject* obj, GAsyncResult* res);
static Block40Data* block40_data_ref (Block40Data* _data40_);
static void block40_data_unref (void * _userdata_);
GType contacts_contact_get_type (void) G_GNUC_CONST;
ContactsContact* contacts_store_find_contact_with_persona (ContactsStore* self, FolksPersona* persona);
static void ___lambda111_ (Block40Data* _data40_);
static void ____lambda111__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
void contacts_app_show_contact (ContactsApp* self, ContactsContact* contact);
static void ___lambda110__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
static void contacts_new_contact_dialog_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 gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


ContactsNewContactDialog* contacts_new_contact_dialog_get_default (ContactsStore* contacts_store, ContactsWindow* parent) {
	ContactsNewContactDialog* result = NULL;
	ContactsNewContactDialog* _tmp0_ = NULL;
	ContactsNewContactDialog* _tmp4_ = NULL;
	ContactsNewContactDialog* _tmp5_ = NULL;
	g_return_val_if_fail (contacts_store != NULL, NULL);
	_tmp0_ = new_contact_dialog;
	if (_tmp0_ == NULL) {
		ContactsStore* _tmp1_ = NULL;
		ContactsWindow* _tmp2_ = NULL;
		ContactsNewContactDialog* _tmp3_ = NULL;
		_tmp1_ = contacts_store;
		_tmp2_ = parent;
		_tmp3_ = contacts_new_contact_dialog_new (_tmp1_, _tmp2_);
		g_object_ref_sink (_tmp3_);
		_g_object_unref0 (new_contact_dialog);
		new_contact_dialog = _tmp3_;
	}
	_tmp4_ = new_contact_dialog;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	result = _tmp5_;
	return result;
}


static void __lambda105_ (ContactsNewContactDialog* self) {
	gint row = 0;
	GeeArrayList* _tmp0_ = NULL;
	GeeArrayList* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	gpointer _tmp4_ = NULL;
	GtkEntry* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	gint _tmp7_ = 0;
	GeeArrayList* _tmp8_ = NULL;
	GeeArrayList* _tmp9_ = NULL;
	ContactsTypeSet* _tmp10_ = NULL;
	ContactsTypeSet* _tmp11_ = NULL;
	GtkGrid* _tmp12_ = NULL;
	_tmp0_ = self->priv->email_entries;
	_tmp1_ = self->priv->email_entries;
	_tmp2_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_abstract_list_get ((GeeAbstractList*) _tmp0_, _tmp3_ - 1);
	_tmp5_ = (GtkEntry*) _tmp4_;
	_tmp6_ = contacts_new_contact_dialog_row_after (self, (GtkWidget*) _tmp5_);
	_tmp7_ = _tmp6_;
	_g_object_unref0 (_tmp5_);
	row = _tmp7_;
	_tmp8_ = self->priv->email_entries;
	_tmp9_ = self->priv->email_combos;
	_tmp10_ = contacts_typeset_get_general ();
	_tmp11_ = _tmp10_;
	contacts_new_contact_dialog_pack_entry_combo (self, _tmp8_, _tmp9_, _tmp11_, &row);
	_tmp12_ = self->priv->grid;
	gtk_widget_show_all ((GtkWidget*) _tmp12_);
}


static void ___lambda105__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	__lambda105_ (self);
}


static void __lambda106_ (ContactsNewContactDialog* self) {
	gint row = 0;
	GeeArrayList* _tmp0_ = NULL;
	GeeArrayList* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	gpointer _tmp4_ = NULL;
	GtkEntry* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	gint _tmp7_ = 0;
	GeeArrayList* _tmp8_ = NULL;
	GeeArrayList* _tmp9_ = NULL;
	ContactsTypeSet* _tmp10_ = NULL;
	ContactsTypeSet* _tmp11_ = NULL;
	GtkGrid* _tmp12_ = NULL;
	_tmp0_ = self->priv->phone_entries;
	_tmp1_ = self->priv->phone_entries;
	_tmp2_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_abstract_list_get ((GeeAbstractList*) _tmp0_, _tmp3_ - 1);
	_tmp5_ = (GtkEntry*) _tmp4_;
	_tmp6_ = contacts_new_contact_dialog_row_after (self, (GtkWidget*) _tmp5_);
	_tmp7_ = _tmp6_;
	_g_object_unref0 (_tmp5_);
	row = _tmp7_;
	_tmp8_ = self->priv->phone_entries;
	_tmp9_ = self->priv->phone_combos;
	_tmp10_ = contacts_typeset_get_phone ();
	_tmp11_ = _tmp10_;
	contacts_new_contact_dialog_pack_entry_combo (self, _tmp8_, _tmp9_, _tmp11_, &row);
	_tmp12_ = self->priv->grid;
	gtk_widget_show_all ((GtkWidget*) _tmp12_);
}


static void ___lambda106__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	__lambda106_ (self);
}


static void __lambda107_ (ContactsNewContactDialog* self) {
	gint row = 0;
	GeeArrayList* _tmp0_ = NULL;
	GeeArrayList* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	gpointer _tmp4_ = NULL;
	GtkGrid* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	gint _tmp7_ = 0;
	GeeArrayList* _tmp8_ = NULL;
	GeeArrayList* _tmp9_ = NULL;
	ContactsTypeSet* _tmp10_ = NULL;
	ContactsTypeSet* _tmp11_ = NULL;
	GtkGrid* _tmp12_ = NULL;
	_tmp0_ = self->priv->address_entries;
	_tmp1_ = self->priv->address_entries;
	_tmp2_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_abstract_list_get ((GeeAbstractList*) _tmp0_, _tmp3_ - 1);
	_tmp5_ = (GtkGrid*) _tmp4_;
	_tmp6_ = contacts_new_contact_dialog_row_after (self, (GtkWidget*) _tmp5_);
	_tmp7_ = _tmp6_;
	_g_object_unref0 (_tmp5_);
	row = _tmp7_;
	_tmp8_ = self->priv->address_entries;
	_tmp9_ = self->priv->address_combos;
	_tmp10_ = contacts_typeset_get_general ();
	_tmp11_ = _tmp10_;
	contacts_new_contact_dialog_pack_address_combo (self, _tmp8_, _tmp9_, _tmp11_, &row);
	_tmp12_ = self->priv->grid;
	gtk_widget_show_all ((GtkWidget*) _tmp12_);
}


static void ___lambda107__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
	__lambda107_ (self);
}


static ContactsNewContactDialog* contacts_new_contact_dialog_construct (GType object_type, ContactsStore* contacts_store, ContactsWindow* parent) {
	ContactsNewContactDialog * self = NULL;
	const gchar* _tmp0_ = NULL;
	ContactsStore* _tmp1_ = NULL;
	ContactsStore* _tmp2_ = NULL;
	ContactsWindow* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	GtkBox* box = NULL;
	GtkBox* _tmp5_ = NULL;
	GtkBox* _tmp6_ = NULL;
	GtkScrolledWindow* scrolled = NULL;
	GtkScrolledWindow* _tmp7_ = NULL;
	GtkGrid* _tmp8_ = NULL;
	GtkGrid* _tmp9_ = NULL;
	GtkGrid* _tmp10_ = NULL;
	GtkGrid* _tmp11_ = NULL;
	GtkGrid* _tmp12_ = NULL;
	GtkFrame* frame = NULL;
	GtkFrame* _tmp13_ = NULL;
	GtkLabel* l = NULL;
	const gchar* _tmp14_ = NULL;
	GtkLabel* _tmp15_ = NULL;
	GtkLabel* _tmp16_ = NULL;
	GtkEntry* _tmp17_ = NULL;
	GtkEntry* _tmp18_ = NULL;
	GtkEntry* _tmp19_ = NULL;
	GtkEntry* _tmp20_ = NULL;
	GtkGrid* _tmp21_ = NULL;
	GtkEntry* _tmp22_ = NULL;
	const gchar* _tmp23_ = NULL;
	GtkLabel* _tmp24_ = NULL;
	GtkLabel* _tmp25_ = NULL;
	GtkLabel* _tmp26_ = NULL;
	GtkLabel* _tmp27_ = NULL;
	GtkGrid* _tmp28_ = NULL;
	GtkLabel* _tmp29_ = NULL;
	gint y = 0;
	const gchar* _tmp30_ = NULL;
	GeeArrayList* _tmp31_ = NULL;
	GeeArrayList* _tmp32_ = NULL;
	GeeArrayList* _tmp33_ = NULL;
	GeeArrayList* _tmp34_ = NULL;
	ContactsTypeSet* _tmp35_ = NULL;
	ContactsTypeSet* _tmp36_ = NULL;
	const gchar* _tmp37_ = NULL;
	GeeArrayList* _tmp38_ = NULL;
	GeeArrayList* _tmp39_ = NULL;
	GeeArrayList* _tmp40_ = NULL;
	GeeArrayList* _tmp41_ = NULL;
	ContactsTypeSet* _tmp42_ = NULL;
	ContactsTypeSet* _tmp43_ = NULL;
	const gchar* _tmp44_ = NULL;
	GeeArrayList* _tmp45_ = NULL;
	GeeArrayList* _tmp46_ = NULL;
	GeeArrayList* _tmp47_ = NULL;
	GeeArrayList* _tmp48_ = NULL;
	ContactsTypeSet* _tmp49_ = NULL;
	ContactsTypeSet* _tmp50_ = NULL;
	ContactsMenuButton* menu_button = NULL;
	const gchar* _tmp51_ = NULL;
	ContactsMenuButton* _tmp52_ = NULL;
	GtkGrid* _tmp53_ = NULL;
	gint _tmp54_ = 0;
	GtkMenu* menu = NULL;
	GtkMenu* _tmp55_ = NULL;
	const gchar* _tmp56_ = NULL;
	GtkMenuItem* _tmp57_ = NULL;
	GtkMenuItem* _tmp58_ = NULL;
	const gchar* _tmp59_ = NULL;
	GtkMenuItem* _tmp60_ = NULL;
	GtkMenuItem* _tmp61_ = NULL;
	const gchar* _tmp62_ = NULL;
	GtkMenuItem* _tmp63_ = NULL;
	GtkMenuItem* _tmp64_ = NULL;
	g_return_val_if_fail (contacts_store != NULL, NULL);
	self = (ContactsNewContactDialog*) g_object_new (object_type, NULL);
	_tmp0_ = _ ("New contact");
	gtk_window_set_title ((GtkWindow*) self, _tmp0_);
	_tmp1_ = contacts_store;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (self->priv->contacts_store);
	self->priv->contacts_store = _tmp2_;
	gtk_window_set_destroy_with_parent ((GtkWindow*) self, TRUE);
	_tmp3_ = parent;
	gtk_window_set_transient_for ((GtkWindow*) self, (GtkWindow*) _tmp3_);
	_tmp4_ = _ ("Create Contact");
	gtk_dialog_add_buttons ((GtkDialog*) self, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _tmp4_, GTK_RESPONSE_OK, NULL);
	gtk_dialog_set_default_response ((GtkDialog*) self, (gint) GTK_RESPONSE_OK);
	_tmp5_ = (GtkBox*) gtk_dialog_get_content_area ((GtkDialog*) self);
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, GTK_TYPE_BOX) ? ((GtkBox*) _tmp5_) : NULL);
	box = _tmp6_;
	_tmp7_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_ref_sink (_tmp7_);
	scrolled = _tmp7_;
	gtk_widget_set_size_request ((GtkWidget*) scrolled, 430, 600);
	gtk_scrolled_window_set_policy (scrolled, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	gtk_widget_set_vexpand ((GtkWidget*) scrolled, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) scrolled, TRUE);
	gtk_scrolled_window_set_shadow_type (scrolled, GTK_SHADOW_IN);
	gtk_container_set_border_width ((GtkContainer*) scrolled, (guint) 6);
	gtk_box_pack_start (box, (GtkWidget*) scrolled, TRUE, TRUE, (guint) 0);
	_tmp8_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp8_);
	_g_object_unref0 (self->priv->grid);
	self->priv->grid = _tmp8_;
	_tmp9_ = self->priv->grid;
	gtk_container_set_border_width ((GtkContainer*) _tmp9_, (guint) 12);
	_tmp10_ = self->priv->grid;
	gtk_grid_set_column_spacing (_tmp10_, (guint) 10);
	_tmp11_ = self->priv->grid;
	gtk_grid_set_row_spacing (_tmp11_, (guint) 4);
	_tmp12_ = self->priv->grid;
	gtk_scrolled_window_add_with_viewport (scrolled, (GtkWidget*) _tmp12_);
	_tmp13_ = (GtkFrame*) gtk_frame_new (NULL);
	g_object_ref_sink (_tmp13_);
	frame = _tmp13_;
	gtk_widget_set_size_request ((GtkWidget*) frame, 96, 96);
	gtk_widget_set_hexpand ((GtkWidget*) frame, FALSE);
	gtk_widget_set_vexpand ((GtkWidget*) frame, FALSE);
	_tmp14_ = _ ("Add or \nselect a picture");
	_tmp15_ = (GtkLabel*) gtk_label_new (_tmp14_);
	g_object_ref_sink (_tmp15_);
	l = _tmp15_;
	_tmp16_ = l;
	gtk_container_add ((GtkContainer*) frame, (GtkWidget*) _tmp16_);
	_tmp17_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp17_);
	_g_object_unref0 (self->priv->name_entry);
	self->priv->name_entry = _tmp17_;
	_tmp18_ = self->priv->name_entry;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp18_, TRUE);
	_tmp19_ = self->priv->name_entry;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp19_, FALSE);
	_tmp20_ = self->priv->name_entry;
	gtk_widget_set_halign ((GtkWidget*) _tmp20_, GTK_ALIGN_FILL);
	_tmp21_ = self->priv->grid;
	_tmp22_ = self->priv->name_entry;
	gtk_grid_attach (_tmp21_, (GtkWidget*) _tmp22_, 0, 1, 3, 1);
	_tmp23_ = _ ("Contact Name");
	_tmp24_ = (GtkLabel*) gtk_label_new (_tmp23_);
	g_object_ref_sink (_tmp24_);
	_g_object_unref0 (l);
	l = _tmp24_;
	_tmp25_ = l;
	gtk_widget_set_halign ((GtkWidget*) _tmp25_, GTK_ALIGN_START);
	_tmp26_ = l;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp26_, FALSE);
	_tmp27_ = l;
	gtk_widget_set_valign ((GtkWidget*) _tmp27_, GTK_ALIGN_START);
	_tmp28_ = self->priv->grid;
	_tmp29_ = l;
	gtk_grid_attach (_tmp28_, (GtkWidget*) _tmp29_, 0, 0, 2, 1);
	y = 2;
	_tmp30_ = _ ("Email");
	contacts_new_contact_dialog_pack_label (self, _tmp30_, &y);
	_tmp31_ = gee_array_list_new (GTK_TYPE_ENTRY, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->email_entries);
	self->priv->email_entries = _tmp31_;
	_tmp32_ = gee_array_list_new (CONTACTS_TYPE_TYPECOMBO, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->email_combos);
	self->priv->email_combos = _tmp32_;
	_tmp33_ = self->priv->email_entries;
	_tmp34_ = self->priv->email_combos;
	_tmp35_ = contacts_typeset_get_general ();
	_tmp36_ = _tmp35_;
	contacts_new_contact_dialog_pack_entry_combo (self, _tmp33_, _tmp34_, _tmp36_, &y);
	contacts_new_contact_dialog_pack_spacing (self, 12, &y);
	_tmp37_ = _ ("Phone");
	contacts_new_contact_dialog_pack_label (self, _tmp37_, &y);
	_tmp38_ = gee_array_list_new (GTK_TYPE_ENTRY, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->phone_entries);
	self->priv->phone_entries = _tmp38_;
	_tmp39_ = gee_array_list_new (CONTACTS_TYPE_TYPECOMBO, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->phone_combos);
	self->priv->phone_combos = _tmp39_;
	_tmp40_ = self->priv->phone_entries;
	_tmp41_ = self->priv->phone_combos;
	_tmp42_ = contacts_typeset_get_phone ();
	_tmp43_ = _tmp42_;
	contacts_new_contact_dialog_pack_entry_combo (self, _tmp40_, _tmp41_, _tmp43_, &y);
	contacts_new_contact_dialog_pack_spacing (self, 12, &y);
	_tmp44_ = _ ("Address");
	contacts_new_contact_dialog_pack_label (self, _tmp44_, &y);
	_tmp45_ = gee_array_list_new (GTK_TYPE_GRID, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->address_entries);
	self->priv->address_entries = _tmp45_;
	_tmp46_ = gee_array_list_new (CONTACTS_TYPE_TYPECOMBO, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->address_combos);
	self->priv->address_combos = _tmp46_;
	_tmp47_ = self->priv->address_entries;
	_tmp48_ = self->priv->address_combos;
	_tmp49_ = contacts_typeset_get_general ();
	_tmp50_ = _tmp49_;
	contacts_new_contact_dialog_pack_address_combo (self, _tmp47_, _tmp48_, _tmp50_, &y);
	contacts_new_contact_dialog_pack_spacing (self, 16, &y);
	_tmp51_ = _ ("Add Detail");
	_tmp52_ = contacts_menu_button_new (_tmp51_);
	g_object_ref_sink (_tmp52_);
	menu_button = _tmp52_;
	_tmp53_ = self->priv->grid;
	_tmp54_ = y;
	gtk_grid_attach (_tmp53_, (GtkWidget*) menu_button, 0, _tmp54_, 2, 1);
	gtk_widget_set_hexpand ((GtkWidget*) menu_button, FALSE);
	gtk_widget_set_halign ((GtkWidget*) menu_button, GTK_ALIGN_START);
	_tmp55_ = (GtkMenu*) gtk_menu_new ();
	g_object_ref_sink (_tmp55_);
	menu = _tmp55_;
	contacts_menu_button_set_menu (menu_button, menu);
	_tmp56_ = _ ("Email");
	_tmp57_ = contacts_utils_add_menu_item (menu, _tmp56_);
	_tmp58_ = _tmp57_;
	g_signal_connect_object (_tmp58_, "activate", (GCallback) ___lambda105__gtk_menu_item_activate, self, 0);
	_g_object_unref0 (_tmp58_);
	_tmp59_ = _ ("Phone");
	_tmp60_ = contacts_utils_add_menu_item (menu, _tmp59_);
	_tmp61_ = _tmp60_;
	g_signal_connect_object (_tmp61_, "activate", (GCallback) ___lambda106__gtk_menu_item_activate, self, 0);
	_g_object_unref0 (_tmp61_);
	_tmp62_ = _ ("Address");
	_tmp63_ = contacts_utils_add_menu_item (menu, _tmp62_);
	_tmp64_ = _tmp63_;
	g_signal_connect_object (_tmp64_, "activate", (GCallback) ___lambda107__gtk_menu_item_activate, self, 0);
	_g_object_unref0 (_tmp64_);
	_g_object_unref0 (menu);
	_g_object_unref0 (menu_button);
	_g_object_unref0 (l);
	_g_object_unref0 (frame);
	_g_object_unref0 (scrolled);
	_g_object_unref0 (box);
	return self;
}


static ContactsNewContactDialog* contacts_new_contact_dialog_new (ContactsStore* contacts_store, ContactsWindow* parent) {
	return contacts_new_contact_dialog_construct (CONTACTS_TYPE_NEW_CONTACT_DIALOG, contacts_store, parent);
}


static gint contacts_new_contact_dialog_row_after (ContactsNewContactDialog* self, GtkWidget* widget) {
	gint result = 0;
	gint row = 0;
	GtkGrid* _tmp0_ = NULL;
	GtkWidget* _tmp1_ = NULL;
	GtkGrid* _tmp2_ = NULL;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (widget != NULL, 0);
	_tmp0_ = self->priv->grid;
	_tmp1_ = widget;
	gtk_container_child_get ((GtkContainer*) _tmp0_, _tmp1_, "top-attach", &row, NULL);
	_tmp2_ = self->priv->grid;
	gtk_grid_insert_row (_tmp2_, row + 1);
	result = row + 1;
	return result;
}


static void contacts_new_contact_dialog_pack_label (ContactsNewContactDialog* self, const gchar* text, gint* row) {
	GtkLabel* l = NULL;
	const gchar* _tmp0_ = NULL;
	GtkLabel* _tmp1_ = NULL;
	GtkGrid* _tmp2_ = NULL;
	gint _tmp3_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (text != NULL);
	_tmp0_ = text;
	_tmp1_ = (GtkLabel*) gtk_label_new (_tmp0_);
	g_object_ref_sink (_tmp1_);
	l = _tmp1_;
	gtk_widget_set_halign ((GtkWidget*) l, GTK_ALIGN_START);
	_tmp2_ = self->priv->grid;
	_tmp3_ = *row;
	*row = _tmp3_ + 1;
	gtk_grid_attach (_tmp2_, (GtkWidget*) l, 0, _tmp3_, 1, 1);
	_g_object_unref0 (l);
}


static void contacts_new_contact_dialog_pack_spacing (ContactsNewContactDialog* self, gint height, gint* row) {
	GtkAlignment* a = NULL;
	GtkAlignment* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	GtkGrid* _tmp2_ = NULL;
	gint _tmp3_ = 0;
	g_return_if_fail (self != NULL);
	_tmp0_ = (GtkAlignment*) gtk_alignment_new ((gfloat) 0, (gfloat) 0, (gfloat) 0, (gfloat) 0);
	g_object_ref_sink (_tmp0_);
	a = _tmp0_;
	_tmp1_ = height;
	gtk_widget_set_size_request ((GtkWidget*) a, -1, _tmp1_);
	_tmp2_ = self->priv->grid;
	_tmp3_ = *row;
	*row = _tmp3_ + 1;
	gtk_grid_attach (_tmp2_, (GtkWidget*) a, 0, _tmp3_, 2, 1);
	_g_object_unref0 (a);
}


static void contacts_new_contact_dialog_pack_entry_combo (ContactsNewContactDialog* self, GeeArrayList* entries, GeeArrayList* combos, ContactsTypeSet* type_set, gint* row) {
	GtkEntry* entry = NULL;
	GtkEntry* _tmp0_ = NULL;
	GeeArrayList* _tmp1_ = NULL;
	GtkGrid* _tmp2_ = NULL;
	gint _tmp3_ = 0;
	ContactsTypeCombo* combo = NULL;
	ContactsTypeSet* _tmp4_ = NULL;
	ContactsTypeCombo* _tmp5_ = NULL;
	GeeArrayList* _tmp6_ = NULL;
	GtkGrid* _tmp7_ = NULL;
	gint _tmp8_ = 0;
	gint _tmp9_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entries != NULL);
	g_return_if_fail (combos != NULL);
	g_return_if_fail (type_set != NULL);
	_tmp0_ = (GtkEntry*) gtk_entry_new ();
	g_object_ref_sink (_tmp0_);
	entry = _tmp0_;
	_tmp1_ = entries;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp1_, entry);
	gtk_widget_set_hexpand ((GtkWidget*) entry, TRUE);
	_tmp2_ = self->priv->grid;
	_tmp3_ = *row;
	gtk_grid_attach (_tmp2_, (GtkWidget*) entry, 0, _tmp3_, 2, 1);
	_tmp4_ = type_set;
	_tmp5_ = contacts_typecombo_new (_tmp4_);
	g_object_ref_sink (_tmp5_);
	combo = _tmp5_;
	gtk_widget_set_hexpand ((GtkWidget*) combo, FALSE);
	_tmp6_ = combos;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp6_, combo);
	_tmp7_ = self->priv->grid;
	_tmp8_ = *row;
	gtk_grid_attach (_tmp7_, (GtkWidget*) combo, 2, _tmp8_, 1, 1);
	contacts_typecombo_set_to (combo, "HOME");
	_tmp9_ = *row;
	*row = _tmp9_ + 1;
	_g_object_unref0 (combo);
	_g_object_unref0 (entry);
}


static void contacts_new_contact_dialog_pack_address_combo (ContactsNewContactDialog* self, GeeArrayList* entries, GeeArrayList* combos, ContactsTypeSet* type_set, gint* row) {
	GtkGrid* sub_grid = NULL;
	GtkGrid* _tmp0_ = NULL;
	GtkGrid* _tmp1_ = NULL;
	GtkGrid* _tmp2_ = NULL;
	GeeArrayList* _tmp3_ = NULL;
	GtkGrid* _tmp4_ = NULL;
	GtkGrid* _tmp19_ = NULL;
	GtkGrid* _tmp20_ = NULL;
	gint _tmp21_ = 0;
	ContactsTypeCombo* combo = NULL;
	ContactsTypeSet* _tmp22_ = NULL;
	ContactsTypeCombo* _tmp23_ = NULL;
	GeeArrayList* _tmp24_ = NULL;
	GtkGrid* _tmp25_ = NULL;
	gint _tmp26_ = 0;
	gint _tmp27_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (entries != NULL);
	g_return_if_fail (combos != NULL);
	g_return_if_fail (type_set != NULL);
	_tmp0_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp0_);
	sub_grid = _tmp0_;
	_tmp1_ = sub_grid;
	gtk_orientable_set_orientation ((GtkOrientable*) _tmp1_, GTK_ORIENTATION_VERTICAL);
	_tmp2_ = sub_grid;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp2_, TRUE);
	_tmp3_ = entries;
	_tmp4_ = sub_grid;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, _tmp4_);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp5_ = FALSE;
			_tmp5_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gint _tmp8_ = 0;
				gchar** _tmp9_ = NULL;
				gint _tmp9__length1 = 0;
				GtkEntry* entry = NULL;
				GtkEntry* _tmp10_ = NULL;
				GtkEntry* _tmp11_ = NULL;
				gchar** _tmp12_ = NULL;
				gint _tmp12__length1 = 0;
				gint _tmp13_ = 0;
				const gchar* _tmp14_ = NULL;
				GtkEntry* _tmp15_ = NULL;
				GtkGrid* _tmp16_ = NULL;
				GtkEntry* _tmp17_ = NULL;
				gint _tmp18_ = 0;
				_tmp6_ = _tmp5_;
				if (!_tmp6_) {
					gint _tmp7_ = 0;
					_tmp7_ = i;
					i = _tmp7_ + 1;
				}
				_tmp5_ = FALSE;
				_tmp8_ = i;
				_tmp9_ = contacts_contact_postal_element_props;
				_tmp9__length1 = contacts_contact_postal_element_props_length1;
				if (!(_tmp8_ < _tmp9__length1)) {
					break;
				}
				_tmp10_ = (GtkEntry*) gtk_entry_new ();
				g_object_ref_sink (_tmp10_);
				entry = _tmp10_;
				_tmp11_ = entry;
				_tmp12_ = contacts_contact_postal_element_names;
				_tmp12__length1 = contacts_contact_postal_element_names_length1;
				_tmp13_ = i;
				_tmp14_ = _tmp12_[_tmp13_];
				g_object_set ((GObject*) _tmp11_, "placeholder-text", _tmp14_, NULL);
				_tmp15_ = entry;
				gtk_widget_set_hexpand ((GtkWidget*) _tmp15_, TRUE);
				_tmp16_ = sub_grid;
				_tmp17_ = entry;
				_tmp18_ = i;
				gtk_grid_attach (_tmp16_, (GtkWidget*) _tmp17_, 0, _tmp18_, 1, 1);
				_g_object_unref0 (entry);
			}
		}
	}
	_tmp19_ = self->priv->grid;
	_tmp20_ = sub_grid;
	_tmp21_ = *row;
	gtk_grid_attach (_tmp19_, (GtkWidget*) _tmp20_, 0, _tmp21_, 2, 1);
	_tmp22_ = type_set;
	_tmp23_ = contacts_typecombo_new (_tmp22_);
	g_object_ref_sink (_tmp23_);
	combo = _tmp23_;
	gtk_widget_set_hexpand ((GtkWidget*) combo, FALSE);
	_tmp24_ = combos;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp24_, combo);
	_tmp25_ = self->priv->grid;
	_tmp26_ = *row;
	gtk_grid_attach (_tmp25_, (GtkWidget*) combo, 2, _tmp26_, 1, 1);
	contacts_typecombo_set_to (combo, "HOME");
	_tmp27_ = *row;
	*row = _tmp27_ + 1;
	_g_object_unref0 (combo);
	_g_object_unref0 (sub_grid);
}


static gboolean contacts_new_contact_dialog_real_map_event (GtkWidget* base, GdkEventAny* e) {
	ContactsNewContactDialog * self;
	gboolean result = FALSE;
	gboolean r = FALSE;
	GdkEventAny _tmp0_ = {0};
	gboolean _tmp1_ = FALSE;
	GtkEntry* _tmp2_ = NULL;
	self = (ContactsNewContactDialog*) base;
	g_return_val_if_fail (e != NULL, FALSE);
	_tmp0_ = *e;
	_tmp1_ = GTK_WIDGET_CLASS (contacts_new_contact_dialog_parent_class)->map_event ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_DIALOG, GtkDialog), &_tmp0_);
	r = _tmp1_;
	_tmp2_ = self->priv->name_entry;
	gtk_widget_grab_focus ((GtkWidget*) _tmp2_);
	result = r;
	return result;
}


static Block38Data* block38_data_ref (Block38Data* _data38_) {
	g_atomic_int_inc (&_data38_->_ref_count_);
	return _data38_;
}


static void block38_data_unref (void * _userdata_) {
	Block38Data* _data38_;
	_data38_ = (Block38Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data38_->_ref_count_)) {
		ContactsNewContactDialog * self;
		self = _data38_->self;
		_g_object_unref0 (_data38_->d);
		_g_object_unref0 (self);
		g_slice_free (Block38Data, _data38_);
	}
}


static void ____lambda108_ (Block38Data* _data38_, gint response_id) {
	ContactsNewContactDialog * self;
	GtkMessageDialog* _tmp0_ = NULL;
	self = _data38_->self;
	_tmp0_ = _data38_->d;
	gtk_widget_destroy ((GtkWidget*) _tmp0_);
}


static void _____lambda108__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) {
	____lambda108_ (self, response_id);
}


static void contacts_new_contact_dialog_real_response (GtkDialog* base, gint response_id) {
	ContactsNewContactDialog * self;
	gint _tmp0_ = 0;
	self = (ContactsNewContactDialog*) base;
	_tmp0_ = response_id;
	if (_tmp0_ == ((gint) GTK_RESPONSE_OK)) {
		GtkEntry* _tmp1_ = NULL;
		const gchar* _tmp2_ = NULL;
		GHashTable* details = NULL;
		GHashTable* _tmp7_ = NULL;
		GHashTable* _tmp8_ = NULL;
		_tmp1_ = self->priv->name_entry;
		_tmp2_ = gtk_entry_get_text (_tmp1_);
		if (g_strcmp0 (_tmp2_, "") == 0) {
			Block38Data* _data38_;
			const gchar* _tmp3_ = NULL;
			GtkMessageDialog* _tmp4_ = NULL;
			GtkMessageDialog* _tmp5_ = NULL;
			GtkMessageDialog* _tmp6_ = NULL;
			_data38_ = g_slice_new0 (Block38Data);
			_data38_->_ref_count_ = 1;
			_data38_->self = g_object_ref (self);
			_tmp3_ = _ ("You must specify a contact name");
			_tmp4_ = (GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) self, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", _tmp3_);
			g_object_ref_sink (_tmp4_);
			_data38_->d = _tmp4_;
			_tmp5_ = _data38_->d;
			gtk_widget_show_all ((GtkWidget*) _tmp5_);
			_tmp6_ = _data38_->d;
			g_signal_connect_data ((GtkDialog*) _tmp6_, "response", (GCallback) _____lambda108__gtk_dialog_response, block38_data_ref (_data38_), (GClosureNotify) block38_data_unref, 0);
			block38_data_unref (_data38_);
			_data38_ = NULL;
			return;
		}
		_tmp7_ = contacts_new_contact_dialog_get_details (self);
		details = _tmp7_;
		_tmp8_ = details;
		contacts_new_contact_dialog_create_persona (self, _tmp8_);
		_g_hash_table_unref0 (details);
	}
	_g_object_unref0 (new_contact_dialog);
	new_contact_dialog = NULL;
	gtk_widget_destroy ((GtkWidget*) self);
}


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


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


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


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


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


GHashTable* contacts_new_contact_dialog_get_details (ContactsNewContactDialog* self) {
	GHashTable* result = NULL;
	GHashTable* details = NULL;
	GHashFunc _tmp0_ = NULL;
	GEqualFunc _tmp1_ = NULL;
	GHashTable* _tmp2_ = NULL;
	GValue v = {0};
	GValue _tmp3_ = {0};
	GtkEntry* _tmp4_ = NULL;
	const gchar* _tmp5_ = NULL;
	GHashTable* _tmp6_ = NULL;
	gchar* _tmp7_ = NULL;
	GValue _tmp8_ = {0};
	GValue _tmp9_ = {0};
	GValue* _tmp10_ = NULL;
	GeeHashSet* email_details = NULL;
	GeeHashSet* _tmp11_ = NULL;
	GeeHashSet* _tmp34_ = NULL;
	gboolean _tmp35_ = FALSE;
	gboolean _tmp36_ = FALSE;
	GeeHashSet* phone_details = NULL;
	GeeHashSet* _tmp47_ = NULL;
	GeeHashSet* _tmp70_ = NULL;
	gboolean _tmp71_ = FALSE;
	gboolean _tmp72_ = FALSE;
	GeeHashSet* address_details = NULL;
	GeeHashSet* _tmp83_ = NULL;
	GeeHashSet* _tmp131_ = NULL;
	gboolean _tmp132_ = FALSE;
	gboolean _tmp133_ = FALSE;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, __vala_GValue_free0_);
	details = _tmp2_;
	g_value_init (&_tmp3_, G_TYPE_STRING);
	v = _tmp3_;
	_tmp4_ = self->priv->name_entry;
	_tmp5_ = gtk_entry_get_text (_tmp4_);
	g_value_set_string (&v, _tmp5_);
	_tmp6_ = details;
	_tmp7_ = g_strdup ("full-name");
	_tmp8_ = v;
	_tmp9_ = _tmp8_;
	_tmp10_ = __g_value_dup0 (&_tmp9_);
	g_hash_table_insert (_tmp6_, _tmp7_, _tmp10_);
	_tmp11_ = gee_hash_set_new (FOLKS_TYPE_EMAIL_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
	email_details = _tmp11_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp12_ = FALSE;
			_tmp12_ = TRUE;
			while (TRUE) {
				gboolean _tmp13_ = FALSE;
				gint _tmp15_ = 0;
				GeeArrayList* _tmp16_ = NULL;
				gint _tmp17_ = 0;
				gint _tmp18_ = 0;
				GtkEntry* entry = NULL;
				GeeArrayList* _tmp19_ = NULL;
				gint _tmp20_ = 0;
				gpointer _tmp21_ = NULL;
				ContactsTypeCombo* combo = NULL;
				GeeArrayList* _tmp22_ = NULL;
				gint _tmp23_ = 0;
				gpointer _tmp24_ = NULL;
				GtkEntry* _tmp25_ = NULL;
				const gchar* _tmp26_ = NULL;
				FolksEmailFieldDetails* d = NULL;
				GtkEntry* _tmp27_ = NULL;
				const gchar* _tmp28_ = NULL;
				FolksEmailFieldDetails* _tmp29_ = NULL;
				ContactsTypeCombo* _tmp30_ = NULL;
				FolksEmailFieldDetails* _tmp31_ = NULL;
				GeeHashSet* _tmp32_ = NULL;
				FolksEmailFieldDetails* _tmp33_ = NULL;
				_tmp13_ = _tmp12_;
				if (!_tmp13_) {
					gint _tmp14_ = 0;
					_tmp14_ = i;
					i = _tmp14_ + 1;
				}
				_tmp12_ = FALSE;
				_tmp15_ = i;
				_tmp16_ = self->priv->email_entries;
				_tmp17_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp16_);
				_tmp18_ = _tmp17_;
				if (!(_tmp15_ < _tmp18_)) {
					break;
				}
				_tmp19_ = self->priv->email_entries;
				_tmp20_ = i;
				_tmp21_ = gee_abstract_list_get ((GeeAbstractList*) _tmp19_, _tmp20_);
				entry = (GtkEntry*) _tmp21_;
				_tmp22_ = self->priv->email_combos;
				_tmp23_ = i;
				_tmp24_ = gee_abstract_list_get ((GeeAbstractList*) _tmp22_, _tmp23_);
				combo = (ContactsTypeCombo*) _tmp24_;
				_tmp25_ = entry;
				_tmp26_ = gtk_entry_get_text (_tmp25_);
				if (g_strcmp0 (_tmp26_, "") == 0) {
					_g_object_unref0 (combo);
					_g_object_unref0 (entry);
					continue;
				}
				_tmp27_ = entry;
				_tmp28_ = gtk_entry_get_text (_tmp27_);
				_tmp29_ = folks_email_field_details_new (_tmp28_, NULL);
				d = _tmp29_;
				_tmp30_ = combo;
				_tmp31_ = d;
				contacts_typecombo_update_details (_tmp30_, (FolksAbstractFieldDetails*) _tmp31_);
				_tmp32_ = email_details;
				_tmp33_ = d;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp32_, _tmp33_);
				_g_object_unref0 (d);
				_g_object_unref0 (combo);
				_g_object_unref0 (entry);
			}
		}
	}
	_tmp34_ = email_details;
	_tmp35_ = gee_collection_get_is_empty ((GeeCollection*) _tmp34_);
	_tmp36_ = _tmp35_;
	if (!_tmp36_) {
		GeeHashSet* _tmp37_ = NULL;
		GType _tmp38_ = 0UL;
		GValue _tmp39_ = {0};
		GValue _tmp40_ = {0};
		GeeHashSet* _tmp41_ = NULL;
		GHashTable* _tmp42_ = NULL;
		gchar* _tmp43_ = NULL;
		GValue _tmp44_ = {0};
		GValue _tmp45_ = {0};
		GValue* _tmp46_ = NULL;
		_tmp37_ = email_details;
		_tmp38_ = G_TYPE_FROM_INSTANCE ((GObject*) _tmp37_);
		g_value_init (&_tmp39_, _tmp38_);
		G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
		v = _tmp39_;
		_tmp40_ = v;
		_tmp41_ = email_details;
		g_value_set_object (&v, (GObject*) _tmp41_);
		_tmp42_ = details;
		_tmp43_ = g_strdup ("email-addresses");
		_tmp44_ = v;
		_tmp45_ = _tmp44_;
		_tmp46_ = __g_value_dup0 (&_tmp45_);
		g_hash_table_insert (_tmp42_, _tmp43_, _tmp46_);
	}
	_tmp47_ = gee_hash_set_new (FOLKS_TYPE_PHONE_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
	phone_details = _tmp47_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp48_ = FALSE;
			_tmp48_ = TRUE;
			while (TRUE) {
				gboolean _tmp49_ = FALSE;
				gint _tmp51_ = 0;
				GeeArrayList* _tmp52_ = NULL;
				gint _tmp53_ = 0;
				gint _tmp54_ = 0;
				GtkEntry* entry = NULL;
				GeeArrayList* _tmp55_ = NULL;
				gint _tmp56_ = 0;
				gpointer _tmp57_ = NULL;
				ContactsTypeCombo* combo = NULL;
				GeeArrayList* _tmp58_ = NULL;
				gint _tmp59_ = 0;
				gpointer _tmp60_ = NULL;
				GtkEntry* _tmp61_ = NULL;
				const gchar* _tmp62_ = NULL;
				FolksPhoneFieldDetails* d = NULL;
				GtkEntry* _tmp63_ = NULL;
				const gchar* _tmp64_ = NULL;
				FolksPhoneFieldDetails* _tmp65_ = NULL;
				ContactsTypeCombo* _tmp66_ = NULL;
				FolksPhoneFieldDetails* _tmp67_ = NULL;
				GeeHashSet* _tmp68_ = NULL;
				FolksPhoneFieldDetails* _tmp69_ = NULL;
				_tmp49_ = _tmp48_;
				if (!_tmp49_) {
					gint _tmp50_ = 0;
					_tmp50_ = i;
					i = _tmp50_ + 1;
				}
				_tmp48_ = FALSE;
				_tmp51_ = i;
				_tmp52_ = self->priv->phone_entries;
				_tmp53_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp52_);
				_tmp54_ = _tmp53_;
				if (!(_tmp51_ < _tmp54_)) {
					break;
				}
				_tmp55_ = self->priv->phone_entries;
				_tmp56_ = i;
				_tmp57_ = gee_abstract_list_get ((GeeAbstractList*) _tmp55_, _tmp56_);
				entry = (GtkEntry*) _tmp57_;
				_tmp58_ = self->priv->phone_combos;
				_tmp59_ = i;
				_tmp60_ = gee_abstract_list_get ((GeeAbstractList*) _tmp58_, _tmp59_);
				combo = (ContactsTypeCombo*) _tmp60_;
				_tmp61_ = entry;
				_tmp62_ = gtk_entry_get_text (_tmp61_);
				if (g_strcmp0 (_tmp62_, "") == 0) {
					_g_object_unref0 (combo);
					_g_object_unref0 (entry);
					continue;
				}
				_tmp63_ = entry;
				_tmp64_ = gtk_entry_get_text (_tmp63_);
				_tmp65_ = folks_phone_field_details_new (_tmp64_, NULL);
				d = _tmp65_;
				_tmp66_ = combo;
				_tmp67_ = d;
				contacts_typecombo_update_details (_tmp66_, (FolksAbstractFieldDetails*) _tmp67_);
				_tmp68_ = phone_details;
				_tmp69_ = d;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp68_, _tmp69_);
				_g_object_unref0 (d);
				_g_object_unref0 (combo);
				_g_object_unref0 (entry);
			}
		}
	}
	_tmp70_ = phone_details;
	_tmp71_ = gee_collection_get_is_empty ((GeeCollection*) _tmp70_);
	_tmp72_ = _tmp71_;
	if (!_tmp72_) {
		GeeHashSet* _tmp73_ = NULL;
		GType _tmp74_ = 0UL;
		GValue _tmp75_ = {0};
		GValue _tmp76_ = {0};
		GeeHashSet* _tmp77_ = NULL;
		GHashTable* _tmp78_ = NULL;
		gchar* _tmp79_ = NULL;
		GValue _tmp80_ = {0};
		GValue _tmp81_ = {0};
		GValue* _tmp82_ = NULL;
		_tmp73_ = phone_details;
		_tmp74_ = G_TYPE_FROM_INSTANCE ((GObject*) _tmp73_);
		g_value_init (&_tmp75_, _tmp74_);
		G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
		v = _tmp75_;
		_tmp76_ = v;
		_tmp77_ = phone_details;
		g_value_set_object (&v, (GObject*) _tmp77_);
		_tmp78_ = details;
		_tmp79_ = g_strdup ("phone-numbers");
		_tmp80_ = v;
		_tmp81_ = _tmp80_;
		_tmp82_ = __g_value_dup0 (&_tmp81_);
		g_hash_table_insert (_tmp78_, _tmp79_, _tmp82_);
	}
	_tmp83_ = gee_hash_set_new (FOLKS_TYPE_POSTAL_ADDRESS_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
	address_details = _tmp83_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp84_ = FALSE;
			_tmp84_ = TRUE;
			while (TRUE) {
				gboolean _tmp85_ = FALSE;
				gint _tmp87_ = 0;
				GeeArrayList* _tmp88_ = NULL;
				gint _tmp89_ = 0;
				gint _tmp90_ = 0;
				GtkGrid* a_grid = NULL;
				GeeArrayList* _tmp91_ = NULL;
				gint _tmp92_ = 0;
				gpointer _tmp93_ = NULL;
				ContactsTypeCombo* combo = NULL;
				GeeArrayList* _tmp94_ = NULL;
				gint _tmp95_ = 0;
				gpointer _tmp96_ = NULL;
				GtkEntry* entries[8] = {0};
				gboolean all_empty = FALSE;
				gboolean _tmp111_ = FALSE;
				FolksPostalAddress* p = NULL;
				FolksPostalAddress* _tmp112_ = NULL;
				FolksPostalAddressFieldDetails* d = NULL;
				FolksPostalAddress* _tmp125_ = NULL;
				FolksPostalAddressFieldDetails* _tmp126_ = NULL;
				ContactsTypeCombo* _tmp127_ = NULL;
				FolksPostalAddressFieldDetails* _tmp128_ = NULL;
				GeeHashSet* _tmp129_ = NULL;
				FolksPostalAddressFieldDetails* _tmp130_ = NULL;
				_tmp85_ = _tmp84_;
				if (!_tmp85_) {
					gint _tmp86_ = 0;
					_tmp86_ = i;
					i = _tmp86_ + 1;
				}
				_tmp84_ = FALSE;
				_tmp87_ = i;
				_tmp88_ = self->priv->address_entries;
				_tmp89_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp88_);
				_tmp90_ = _tmp89_;
				if (!(_tmp87_ < _tmp90_)) {
					break;
				}
				_tmp91_ = self->priv->address_entries;
				_tmp92_ = i;
				_tmp93_ = gee_abstract_list_get ((GeeAbstractList*) _tmp91_, _tmp92_);
				a_grid = (GtkGrid*) _tmp93_;
				_tmp94_ = self->priv->address_combos;
				_tmp95_ = i;
				_tmp96_ = gee_abstract_list_get ((GeeAbstractList*) _tmp94_, _tmp95_);
				combo = (ContactsTypeCombo*) _tmp96_;
				all_empty = TRUE;
				{
					gint j = 0;
					j = 0;
					{
						gboolean _tmp97_ = FALSE;
						_tmp97_ = TRUE;
						while (TRUE) {
							gboolean _tmp98_ = FALSE;
							gint _tmp100_ = 0;
							gchar** _tmp101_ = NULL;
							gint _tmp101__length1 = 0;
							gint _tmp102_ = 0;
							GtkGrid* _tmp103_ = NULL;
							gint _tmp104_ = 0;
							GtkWidget* _tmp105_ = NULL;
							GtkEntry* _tmp106_ = NULL;
							GtkEntry* _tmp107_ = NULL;
							gint _tmp108_ = 0;
							GtkEntry* _tmp109_ = NULL;
							const gchar* _tmp110_ = NULL;
							_tmp98_ = _tmp97_;
							if (!_tmp98_) {
								gint _tmp99_ = 0;
								_tmp99_ = j;
								j = _tmp99_ + 1;
							}
							_tmp97_ = FALSE;
							_tmp100_ = j;
							_tmp101_ = contacts_contact_postal_element_props;
							_tmp101__length1 = contacts_contact_postal_element_props_length1;
							if (!(_tmp100_ < _tmp101__length1)) {
								break;
							}
							_tmp102_ = j;
							_tmp103_ = a_grid;
							_tmp104_ = j;
							_tmp105_ = gtk_grid_get_child_at (_tmp103_, 0, _tmp104_);
							_tmp106_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp105_, GTK_TYPE_ENTRY, GtkEntry));
							_g_object_unref0 (entries[_tmp102_]);
							entries[_tmp102_] = _tmp106_;
							_tmp107_ = entries[_tmp102_];
							_tmp108_ = j;
							_tmp109_ = entries[_tmp108_];
							_tmp110_ = gtk_entry_get_text (_tmp109_);
							if (g_strcmp0 (_tmp110_, "") != 0) {
								all_empty = FALSE;
							}
						}
					}
				}
				_tmp111_ = all_empty;
				if (_tmp111_) {
					_vala_array_destroy (entries, 8, (GDestroyNotify) g_object_unref);
					_g_object_unref0 (combo);
					_g_object_unref0 (a_grid);
					continue;
				}
				_tmp112_ = folks_postal_address_new (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
				p = _tmp112_;
				{
					gint j = 0;
					j = 0;
					{
						gboolean _tmp113_ = FALSE;
						_tmp113_ = TRUE;
						while (TRUE) {
							gboolean _tmp114_ = FALSE;
							gint _tmp116_ = 0;
							gchar** _tmp117_ = NULL;
							gint _tmp117__length1 = 0;
							FolksPostalAddress* _tmp118_ = NULL;
							gchar** _tmp119_ = NULL;
							gint _tmp119__length1 = 0;
							gint _tmp120_ = 0;
							const gchar* _tmp121_ = NULL;
							gint _tmp122_ = 0;
							GtkEntry* _tmp123_ = NULL;
							const gchar* _tmp124_ = NULL;
							_tmp114_ = _tmp113_;
							if (!_tmp114_) {
								gint _tmp115_ = 0;
								_tmp115_ = j;
								j = _tmp115_ + 1;
							}
							_tmp113_ = FALSE;
							_tmp116_ = j;
							_tmp117_ = contacts_contact_postal_element_props;
							_tmp117__length1 = contacts_contact_postal_element_props_length1;
							if (!(_tmp116_ < _tmp117__length1)) {
								break;
							}
							_tmp118_ = p;
							_tmp119_ = contacts_contact_postal_element_props;
							_tmp119__length1 = contacts_contact_postal_element_props_length1;
							_tmp120_ = j;
							_tmp121_ = _tmp119_[_tmp120_];
							_tmp122_ = j;
							_tmp123_ = entries[_tmp122_];
							_tmp124_ = gtk_entry_get_text (_tmp123_);
							g_object_set ((GObject*) _tmp118_, _tmp121_, _tmp124_, NULL);
						}
					}
				}
				_tmp125_ = p;
				_tmp126_ = folks_postal_address_field_details_new (_tmp125_, NULL);
				d = _tmp126_;
				_tmp127_ = combo;
				_tmp128_ = d;
				contacts_typecombo_update_details (_tmp127_, (FolksAbstractFieldDetails*) _tmp128_);
				_tmp129_ = address_details;
				_tmp130_ = d;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp129_, _tmp130_);
				_g_object_unref0 (d);
				_g_object_unref0 (p);
				_vala_array_destroy (entries, 8, (GDestroyNotify) g_object_unref);
				_g_object_unref0 (combo);
				_g_object_unref0 (a_grid);
			}
		}
	}
	_tmp131_ = address_details;
	_tmp132_ = gee_collection_get_is_empty ((GeeCollection*) _tmp131_);
	_tmp133_ = _tmp132_;
	if (!_tmp133_) {
		GeeHashSet* _tmp134_ = NULL;
		GType _tmp135_ = 0UL;
		GValue _tmp136_ = {0};
		GValue _tmp137_ = {0};
		GeeHashSet* _tmp138_ = NULL;
		GHashTable* _tmp139_ = NULL;
		gchar* _tmp140_ = NULL;
		GValue _tmp141_ = {0};
		GValue _tmp142_ = {0};
		GValue* _tmp143_ = NULL;
		_tmp134_ = address_details;
		_tmp135_ = G_TYPE_FROM_INSTANCE ((GObject*) _tmp134_);
		g_value_init (&_tmp136_, _tmp135_);
		G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
		v = _tmp136_;
		_tmp137_ = v;
		_tmp138_ = address_details;
		g_value_set_object (&v, (GObject*) _tmp138_);
		_tmp139_ = details;
		_tmp140_ = g_strdup ("postal-addresses");
		_tmp141_ = v;
		_tmp142_ = _tmp141_;
		_tmp143_ = __g_value_dup0 (&_tmp142_);
		g_hash_table_insert (_tmp139_, _tmp140_, _tmp143_);
	}
	result = details;
	_g_object_unref0 (address_details);
	_g_object_unref0 (phone_details);
	_g_object_unref0 (email_details);
	G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
	return result;
}


static Block39Data* block39_data_ref (Block39Data* _data39_) {
	g_atomic_int_inc (&_data39_->_ref_count_);
	return _data39_;
}


static void block39_data_unref (void * _userdata_) {
	Block39Data* _data39_;
	_data39_ = (Block39Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data39_->_ref_count_)) {
		ContactsNewContactDialog * self;
		self = _data39_->self;
		_g_object_unref0 (_data39_->dialog);
		_g_object_unref0 (self);
		g_slice_free (Block39Data, _data39_);
	}
}


static void ___lambda109_ (Block39Data* _data39_) {
	ContactsNewContactDialog * self;
	GtkDialog* _tmp0_ = NULL;
	self = _data39_->self;
	_tmp0_ = _data39_->dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp0_);
}


static void ____lambda109__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) {
	___lambda109_ (self);
}


static Block40Data* block40_data_ref (Block40Data* _data40_) {
	g_atomic_int_inc (&_data40_->_ref_count_);
	return _data40_;
}


static void block40_data_unref (void * _userdata_) {
	Block40Data* _data40_;
	_data40_ = (Block40Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data40_->_ref_count_)) {
		ContactsNewContactDialog * self;
		self = _data40_->self;
		_g_object_unref0 (_data40_->dialog);
		_g_object_unref0 (self);
		g_slice_free (Block40Data, _data40_);
	}
}


static void ___lambda111_ (Block40Data* _data40_) {
	ContactsNewContactDialog * self;
	GtkDialog* _tmp0_ = NULL;
	self = _data40_->self;
	_tmp0_ = _data40_->dialog;
	gtk_widget_destroy ((GtkWidget*) _tmp0_);
}


static void ____lambda111__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) {
	___lambda111_ (self);
}


static void __lambda110_ (ContactsNewContactDialog* self, GObject* obj, GAsyncResult* res) {
	Block40Data* _data40_;
	FolksPersona* persona = NULL;
	ContactsContact* contact = NULL;
	ContactsStore* _tmp8_ = NULL;
	FolksPersona* _tmp9_ = NULL;
	ContactsContact* _tmp10_ = NULL;
	ContactsContact* _tmp11_ = NULL;
	GtkDialog* _tmp15_ = NULL;
	ContactsApp* _tmp18_ = NULL;
	ContactsContact* _tmp19_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_if_fail (res != NULL);
	_data40_ = g_slice_new0 (Block40Data);
	_data40_->_ref_count_ = 1;
	_data40_->self = g_object_ref (self);
	persona = NULL;
	_data40_->dialog = NULL;
	{
		FolksPersona* _tmp0_ = NULL;
		GAsyncResult* _tmp1_ = NULL;
		FolksPersona* _tmp2_ = NULL;
		_tmp1_ = res;
		_tmp2_ = contacts_contact_create_primary_persona_for_details_finish (_tmp1_, &_inner_error_);
		_tmp0_ = _tmp2_;
		if (_inner_error_ != NULL) {
			goto __catch24_g_error;
		}
		_g_object_unref0 (persona);
		persona = _tmp0_;
	}
	goto __finally24;
	__catch24_g_error:
	{
		GError* e = NULL;
		GtkWidget* _tmp3_ = NULL;
		const gchar* _tmp4_ = NULL;
		GError* _tmp5_ = NULL;
		const gchar* _tmp6_ = NULL;
		GtkMessageDialog* _tmp7_ = NULL;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp3_ = gtk_widget_get_toplevel ((GtkWidget*) self);
		_tmp4_ = _ ("Unable to create new contacts: %s\n");
		_tmp5_ = e;
		_tmp6_ = _tmp5_->message;
		_tmp7_ = (GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) (G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, CONTACTS_TYPE_WINDOW) ? ((ContactsWindow*) _tmp3_) : NULL), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", _tmp4_, _tmp6_);
		g_object_ref_sink (_tmp7_);
		_g_object_unref0 (_data40_->dialog);
		_data40_->dialog = (GtkDialog*) _tmp7_;
		_g_error_free0 (e);
	}
	__finally24:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (persona);
		block40_data_unref (_data40_);
		_data40_ = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp8_ = self->priv->contacts_store;
	_tmp9_ = persona;
	_tmp10_ = contacts_store_find_contact_with_persona (_tmp8_, _tmp9_);
	contact = _tmp10_;
	_tmp11_ = contact;
	if (_tmp11_ == NULL) {
		GtkWidget* _tmp12_ = NULL;
		const gchar* _tmp13_ = NULL;
		GtkMessageDialog* _tmp14_ = NULL;
		_tmp12_ = gtk_widget_get_toplevel ((GtkWidget*) self);
		_tmp13_ = _ ("Unable to find newly created contact\n");
		_tmp14_ = (GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) (G_TYPE_CHECK_INSTANCE_TYPE (_tmp12_, CONTACTS_TYPE_WINDOW) ? ((ContactsWindow*) _tmp12_) : NULL), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", _tmp13_);
		g_object_ref_sink (_tmp14_);
		_g_object_unref0 (_data40_->dialog);
		_data40_->dialog = (GtkDialog*) _tmp14_;
	}
	_tmp15_ = _data40_->dialog;
	if (_tmp15_ != NULL) {
		GtkDialog* _tmp16_ = NULL;
		GtkDialog* _tmp17_ = NULL;
		_tmp16_ = _data40_->dialog;
		gtk_widget_show ((GtkWidget*) _tmp16_);
		_tmp17_ = _data40_->dialog;
		g_signal_connect_data (_tmp17_, "response", (GCallback) ____lambda111__gtk_dialog_response, block40_data_ref (_data40_), (GClosureNotify) block40_data_unref, 0);
		_g_object_unref0 (contact);
		_g_object_unref0 (persona);
		block40_data_unref (_data40_);
		_data40_ = NULL;
		return;
	}
	_tmp18_ = contacts_app_app;
	_tmp19_ = contact;
	contacts_app_show_contact (_tmp18_, _tmp19_);
	_g_object_unref0 (contact);
	_g_object_unref0 (persona);
	block40_data_unref (_data40_);
	_data40_ = NULL;
}


static void ___lambda110__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	__lambda110_ (self, source_object, res);
	g_object_unref (self);
}


void contacts_new_contact_dialog_create_persona (ContactsNewContactDialog* self, GHashTable* details) {
	ContactsStore* _tmp0_ = NULL;
	FolksIndividualAggregator* _tmp1_ = NULL;
	FolksIndividualAggregator* _tmp2_ = NULL;
	FolksPersonaStore* _tmp3_ = NULL;
	FolksPersonaStore* _tmp4_ = NULL;
	ContactsApp* _tmp9_ = NULL;
	ContactsStore* _tmp10_ = NULL;
	FolksIndividualAggregator* _tmp11_ = NULL;
	FolksIndividualAggregator* _tmp12_ = NULL;
	FolksPersonaStore* _tmp13_ = NULL;
	FolksPersonaStore* _tmp14_ = NULL;
	GHashTable* _tmp15_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (details != NULL);
	_tmp0_ = self->priv->contacts_store;
	_tmp1_ = contacts_store_get_aggregator (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = folks_individual_aggregator_get_primary_store (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ == NULL) {
		Block39Data* _data39_;
		const gchar* _tmp5_ = NULL;
		GtkMessageDialog* _tmp6_ = NULL;
		GtkDialog* _tmp7_ = NULL;
		GtkDialog* _tmp8_ = NULL;
		_data39_ = g_slice_new0 (Block39Data);
		_data39_->_ref_count_ = 1;
		_data39_->self = g_object_ref (self);
		_tmp5_ = _ ("No primary addressbook configured\n");
		_tmp6_ = (GtkMessageDialog*) gtk_message_dialog_new ((GtkWindow*) self, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", _tmp5_);
		g_object_ref_sink (_tmp6_);
		_data39_->dialog = (GtkDialog*) _tmp6_;
		_tmp7_ = _data39_->dialog;
		gtk_widget_show ((GtkWidget*) _tmp7_);
		_tmp8_ = _data39_->dialog;
		g_signal_connect_data (_tmp8_, "response", (GCallback) ____lambda109__gtk_dialog_response, block39_data_ref (_data39_), (GClosureNotify) block39_data_unref, 0);
		block39_data_unref (_data39_);
		_data39_ = NULL;
		return;
	}
	_tmp9_ = contacts_app_app;
	_tmp10_ = _tmp9_->contacts_store;
	_tmp11_ = contacts_store_get_aggregator (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = folks_individual_aggregator_get_primary_store (_tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = details;
	contacts_contact_create_primary_persona_for_details (_tmp14_, _tmp15_, ___lambda110__gasync_ready_callback, g_object_ref (self));
}


static void contacts_new_contact_dialog_class_init (ContactsNewContactDialogClass * klass) {
	contacts_new_contact_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ContactsNewContactDialogPrivate));
	GTK_WIDGET_CLASS (klass)->map_event = contacts_new_contact_dialog_real_map_event;
	GTK_DIALOG_CLASS (klass)->response = contacts_new_contact_dialog_real_response;
	G_OBJECT_CLASS (klass)->finalize = contacts_new_contact_dialog_finalize;
}


static void contacts_new_contact_dialog_instance_init (ContactsNewContactDialog * self) {
	self->priv = CONTACTS_NEW_CONTACT_DIALOG_GET_PRIVATE (self);
}


static void contacts_new_contact_dialog_finalize (GObject* obj) {
	ContactsNewContactDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_NEW_CONTACT_DIALOG, ContactsNewContactDialog);
	_g_object_unref0 (self->priv->contacts_store);
	_g_object_unref0 (self->priv->grid);
	_g_object_unref0 (self->priv->name_entry);
	_g_object_unref0 (self->priv->email_entries);
	_g_object_unref0 (self->priv->email_combos);
	_g_object_unref0 (self->priv->phone_entries);
	_g_object_unref0 (self->priv->phone_combos);
	_g_object_unref0 (self->priv->address_entries);
	_g_object_unref0 (self->priv->address_combos);
	G_OBJECT_CLASS (contacts_new_contact_dialog_parent_class)->finalize (obj);
}


GType contacts_new_contact_dialog_get_type (void) {
	static volatile gsize contacts_new_contact_dialog_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_new_contact_dialog_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsNewContactDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_new_contact_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsNewContactDialog), 0, (GInstanceInitFunc) contacts_new_contact_dialog_instance_init, NULL };
		GType contacts_new_contact_dialog_type_id;
		contacts_new_contact_dialog_type_id = g_type_register_static (GTK_TYPE_DIALOG, "ContactsNewContactDialog", &g_define_type_info, 0);
		g_once_init_leave (&contacts_new_contact_dialog_type_id__volatile, contacts_new_contact_dialog_type_id);
	}
	return contacts_new_contact_dialog_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);
}



