/* contacts-linked-accounts-dialog.c generated by valac 0.21.2.6-90bab, the Vala compiler
 * generated from contacts-linked-accounts-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 <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <gee.h>
#include <folks/folks.h>


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

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

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

typedef struct _ContactsContact ContactsContact;
typedef struct _ContactsContactClass ContactsContactClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block31Data Block31Data;
#define _g_free0(var) (var = (g_free (var), NULL))

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

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

#define CONTACTS_TYPE_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_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;
typedef struct _Block32Data Block32Data;

#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 CONTACTS_TYPE_LINK_OPERATION (contacts_link_operation_get_type ())
#define CONTACTS_LINK_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_LINK_OPERATION, ContactsLinkOperation))
#define CONTACTS_LINK_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_LINK_OPERATION, ContactsLinkOperationClass))
#define CONTACTS_IS_LINK_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_LINK_OPERATION))
#define CONTACTS_IS_LINK_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_LINK_OPERATION))
#define CONTACTS_LINK_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_LINK_OPERATION, ContactsLinkOperationClass))

typedef struct _ContactsLinkOperation ContactsLinkOperation;
typedef struct _ContactsLinkOperationClass ContactsLinkOperationClass;

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

struct _ContactsLinkedAccountsDialogClass {
	GtkDialogClass parent_class;
};

struct _ContactsLinkedAccountsDialogPrivate {
	ContactsContact* contact;
	GtkListBox* linked_accounts_view;
};

struct _Block31Data {
	int _ref_count_;
	ContactsLinkedAccountsDialog * self;
	ContactsContact* contact;
};

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

struct _ContactsAppClass {
	GtkApplicationClass parent_class;
};

struct _Block32Data {
	int _ref_count_;
	Block31Data * _data31_;
	FolksPersona* p;
	GtkGrid* row_grid;
};

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

struct _ContactsContactClass {
	GObjectClass parent_class;
};


static gpointer contacts_linked_accounts_dialog_parent_class = NULL;
extern ContactsApp* contacts_app_app;

GType contacts_linked_accounts_dialog_get_type (void) G_GNUC_CONST;
GType contacts_contact_get_type (void) G_GNUC_CONST;
#define CONTACTS_LINKED_ACCOUNTS_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_LINKED_ACCOUNTS_DIALOG, ContactsLinkedAccountsDialogPrivate))
enum  {
	CONTACTS_LINKED_ACCOUNTS_DIALOG_DUMMY_PROPERTY
};
ContactsLinkedAccountsDialog* contacts_linked_accounts_dialog_new (ContactsContact* contact);
ContactsLinkedAccountsDialog* contacts_linked_accounts_dialog_construct (GType object_type, ContactsContact* contact);
static Block31Data* block31_data_ref (Block31Data* _data31_);
static void block31_data_unref (void * _userdata_);
const gchar* contacts_contact_get_display_name (ContactsContact* self);
GType contacts_app_get_type (void) G_GNUC_CONST;
GType contacts_store_get_type (void) G_GNUC_CONST;
GType contacts_window_get_type (void) G_GNUC_CONST;
GeeList* contacts_contact_get_personas_for_display (ContactsContact* self);
static Block32Data* block32_data_ref (Block32Data* _data32_);
static void block32_data_unref (void * _userdata_);
GType contacts_contact_frame_get_type (void) G_GNUC_CONST;
#define CONTACTS_CONTACT_SMALL_AVATAR_SIZE 54
ContactsContactFrame* contacts_contact_frame_new (gint size, gboolean with_button);
ContactsContactFrame* contacts_contact_frame_construct (GType object_type, gint size, gboolean with_button);
void contacts_contact_keep_widget_uptodate (ContactsContact* self, GtkWidget* w, GtkCallback callback, void* callback_target, GDestroyNotify callback_target_destroy_notify);
static void ____lambda91_ (Block32Data* _data32_, GtkWidget* w);
void contacts_contact_frame_set_image (ContactsContactFrame* self, FolksAvatarDetails* details, ContactsContact* contact);
static void _____lambda91__gtk_callback (GtkWidget* widget, gpointer self);
gchar* contacts_contact_format_persona_store_name_for_contact (FolksPersona* persona);
static void ____lambda92_ (Block32Data* _data32_);
void contacts_unlink_persona (ContactsContact* contact, FolksPersona* persona_to_unlink, GAsyncReadyCallback _callback_, gpointer _user_data_);
GType contacts_link_operation_get_type (void) G_GNUC_CONST;
ContactsLinkOperation* contacts_unlink_persona_finish (GAsyncResult* _res_);
static void __lambda93_ (Block32Data* _data32_, GObject* obj, GAsyncResult* _result_);
static void ___lambda93__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
static void _____lambda92__gtk_button_clicked (GtkButton* _sender, gpointer self);
static void contacts_linked_accounts_dialog_finalize (GObject* obj);


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


static Block31Data* block31_data_ref (Block31Data* _data31_) {
	g_atomic_int_inc (&_data31_->_ref_count_);
	return _data31_;
}


static void block31_data_unref (void * _userdata_) {
	Block31Data* _data31_;
	_data31_ = (Block31Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data31_->_ref_count_)) {
		ContactsLinkedAccountsDialog * self;
		self = _data31_->self;
		_g_object_unref0 (_data31_->contact);
		_g_object_unref0 (self);
		g_slice_free (Block31Data, _data31_);
	}
}


static Block32Data* block32_data_ref (Block32Data* _data32_) {
	g_atomic_int_inc (&_data32_->_ref_count_);
	return _data32_;
}


static void block32_data_unref (void * _userdata_) {
	Block32Data* _data32_;
	_data32_ = (Block32Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data32_->_ref_count_)) {
		ContactsLinkedAccountsDialog * self;
		self = _data32_->_data31_->self;
		_g_object_unref0 (_data32_->row_grid);
		_g_object_unref0 (_data32_->p);
		block31_data_unref (_data32_->_data31_);
		_data32_->_data31_ = NULL;
		g_slice_free (Block32Data, _data32_);
	}
}


static void ____lambda91_ (Block32Data* _data32_, GtkWidget* w) {
	Block31Data* _data31_;
	ContactsLinkedAccountsDialog * self;
	GtkWidget* _tmp0_ = NULL;
	ContactsContact* _tmp1_ = NULL;
	FolksIndividual* _tmp2_ = NULL;
	ContactsContact* _tmp3_ = NULL;
	_data31_ = _data32_->_data31_;
	self = _data31_->self;
	g_return_if_fail (w != NULL);
	_tmp0_ = w;
	_tmp1_ = _data31_->contact;
	_tmp2_ = _tmp1_->individual;
	_tmp3_ = _data31_->contact;
	contacts_contact_frame_set_image (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, CONTACTS_TYPE_CONTACT_FRAME) ? ((ContactsContactFrame*) _tmp0_) : NULL, (FolksAvatarDetails*) _tmp2_, _tmp3_);
}


static void _____lambda91__gtk_callback (GtkWidget* widget, gpointer self) {
	____lambda91_ (self, widget);
}


static void __lambda93_ (Block32Data* _data32_, GObject* obj, GAsyncResult* _result_) {
	Block31Data* _data31_;
	ContactsLinkedAccountsDialog * self;
	GAsyncResult* _tmp0_ = NULL;
	ContactsLinkOperation* _tmp1_ = NULL;
	ContactsLinkOperation* _tmp2_ = NULL;
	GtkWidget* sep = NULL;
	GtkGrid* _tmp3_ = NULL;
	gconstpointer _tmp4_ = NULL;
	GtkWidget* _tmp5_ = NULL;
	GtkWidget* _tmp6_ = NULL;
	GtkGrid* _tmp8_ = NULL;
	_data31_ = _data32_->_data31_;
	self = _data31_->self;
	g_return_if_fail (_result_ != NULL);
	_tmp0_ = _result_;
	_tmp1_ = contacts_unlink_persona_finish (_tmp0_);
	_tmp2_ = _tmp1_;
	_g_object_unref0 (_tmp2_);
	_tmp3_ = _data32_->row_grid;
	_tmp4_ = g_object_get_data ((GObject*) _tmp3_, "separator");
	_tmp5_ = _g_object_ref0 ((GtkWidget*) _tmp4_);
	sep = _tmp5_;
	_tmp6_ = sep;
	if (_tmp6_ != NULL) {
		GtkWidget* _tmp7_ = NULL;
		_tmp7_ = sep;
		gtk_widget_destroy (_tmp7_);
	}
	_tmp8_ = _data32_->row_grid;
	gtk_widget_destroy ((GtkWidget*) _tmp8_);
	self->any_unlinked = TRUE;
	_g_object_unref0 (sep);
}


static void ___lambda93__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	__lambda93_ (self, source_object, res);
	block32_data_unref (self);
}


static void ____lambda92_ (Block32Data* _data32_) {
	Block31Data* _data31_;
	ContactsLinkedAccountsDialog * self;
	ContactsContact* _tmp0_ = NULL;
	FolksPersona* _tmp1_ = NULL;
	_data31_ = _data32_->_data31_;
	self = _data31_->self;
	_tmp0_ = _data31_->contact;
	_tmp1_ = _data32_->p;
	contacts_unlink_persona (_tmp0_, _tmp1_, ___lambda93__gasync_ready_callback, block32_data_ref (_data32_));
}


static void _____lambda92__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	____lambda92_ (self);
}


ContactsLinkedAccountsDialog* contacts_linked_accounts_dialog_construct (GType object_type, ContactsContact* contact) {
	ContactsLinkedAccountsDialog * self = NULL;
	Block31Data* _data31_;
	ContactsContact* _tmp0_ = NULL;
	ContactsContact* _tmp1_ = NULL;
	ContactsContact* _tmp2_ = NULL;
	ContactsContact* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	ContactsContact* _tmp5_ = NULL;
	const gchar* _tmp6_ = NULL;
	const gchar* _tmp7_ = NULL;
	gchar* _tmp8_ = NULL;
	gchar* _tmp9_ = NULL;
	ContactsApp* _tmp10_ = NULL;
	ContactsWindow* _tmp11_ = NULL;
	const gchar* _tmp12_ = NULL;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp13_ = NULL;
	GtkGrid* _tmp14_ = NULL;
	GtkGrid* _tmp15_ = NULL;
	GtkGrid* _tmp16_ = NULL;
	GtkScrolledWindow* scrolled = NULL;
	GtkScrolledWindow* _tmp17_ = NULL;
	GtkScrolledWindow* _tmp18_ = NULL;
	GtkScrolledWindow* _tmp19_ = NULL;
	GtkScrolledWindow* _tmp20_ = NULL;
	GtkScrolledWindow* _tmp21_ = NULL;
	GtkListBox* _tmp22_ = NULL;
	GtkListBox* _tmp23_ = NULL;
	GtkScrolledWindow* _tmp24_ = NULL;
	GtkListBox* _tmp25_ = NULL;
	GtkGrid* _tmp26_ = NULL;
	GtkScrolledWindow* _tmp27_ = NULL;
	GtkLabel* label = NULL;
	const gchar* _tmp28_ = NULL;
	GtkLabel* _tmp29_ = NULL;
	GtkLabel* _tmp30_ = NULL;
	GtkGrid* _tmp31_ = NULL;
	GtkLabel* _tmp32_ = NULL;
	GtkGrid* _tmp33_ = NULL;
	GtkBox* _tmp34_ = NULL;
	GtkGrid* _tmp35_ = NULL;
	GeeList* personas = NULL;
	ContactsContact* _tmp36_ = NULL;
	GeeList* _tmp37_ = NULL;
	gboolean is_first = FALSE;
	gint counter = 0;
	g_return_val_if_fail (contact != NULL, NULL);
	_data31_ = g_slice_new0 (Block31Data);
	_data31_->_ref_count_ = 1;
	_tmp0_ = contact;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data31_->contact);
	_data31_->contact = _tmp1_;
	self = (ContactsLinkedAccountsDialog*) g_object_new (object_type, NULL);
	_data31_->self = g_object_ref (self);
	_tmp2_ = _data31_->contact;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (self->priv->contact);
	self->priv->contact = _tmp3_;
	self->any_unlinked = FALSE;
	_tmp4_ = _ ("%s - Linked Accounts");
	_tmp5_ = _data31_->contact;
	_tmp6_ = contacts_contact_get_display_name (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strdup_printf (_tmp4_, _tmp7_);
	_tmp9_ = _tmp8_;
	gtk_window_set_title ((GtkWindow*) self, _tmp9_);
	_g_free0 (_tmp9_);
	_tmp10_ = contacts_app_app;
	_tmp11_ = _tmp10_->window;
	gtk_window_set_transient_for ((GtkWindow*) self, (GtkWindow*) _tmp11_);
	gtk_window_set_modal ((GtkWindow*) self, TRUE);
	gtk_window_set_default_size ((GtkWindow*) self, 600, 400);
	_tmp12_ = _ ("Close");
	gtk_dialog_add_buttons ((GtkDialog*) self, _tmp12_, GTK_RESPONSE_CLOSE, NULL, NULL);
	_tmp13_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp13_);
	grid = _tmp13_;
	_tmp14_ = grid;
	gtk_orientable_set_orientation ((GtkOrientable*) _tmp14_, GTK_ORIENTATION_VERTICAL);
	_tmp15_ = grid;
	gtk_grid_set_row_spacing (_tmp15_, (guint) 12);
	_tmp16_ = grid;
	gtk_container_set_border_width ((GtkContainer*) _tmp16_, (guint) 8);
	_tmp17_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_ref_sink (_tmp17_);
	scrolled = _tmp17_;
	_tmp18_ = scrolled;
	gtk_scrolled_window_set_policy (_tmp18_, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	_tmp19_ = scrolled;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp19_, TRUE);
	_tmp20_ = scrolled;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp20_, TRUE);
	_tmp21_ = scrolled;
	gtk_scrolled_window_set_shadow_type (_tmp21_, GTK_SHADOW_NONE);
	_tmp22_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp22_);
	_g_object_unref0 (self->priv->linked_accounts_view);
	self->priv->linked_accounts_view = _tmp22_;
	_tmp23_ = self->priv->linked_accounts_view;
	gtk_list_box_set_selection_mode (_tmp23_, GTK_SELECTION_NONE);
	_tmp24_ = scrolled;
	_tmp25_ = self->priv->linked_accounts_view;
	gtk_container_add ((GtkContainer*) _tmp24_, (GtkWidget*) _tmp25_);
	_tmp26_ = grid;
	_tmp27_ = scrolled;
	gtk_container_add ((GtkContainer*) _tmp26_, (GtkWidget*) _tmp27_);
	_tmp28_ = _ ("You can manually link contacts from the contacts list");
	_tmp29_ = (GtkLabel*) gtk_label_new (_tmp28_);
	g_object_ref_sink (_tmp29_);
	label = _tmp29_;
	_tmp30_ = label;
	gtk_widget_set_halign ((GtkWidget*) _tmp30_, GTK_ALIGN_CENTER);
	_tmp31_ = grid;
	_tmp32_ = label;
	gtk_container_add ((GtkContainer*) _tmp31_, (GtkWidget*) _tmp32_);
	_tmp33_ = grid;
	gtk_widget_show_all ((GtkWidget*) _tmp33_);
	_tmp34_ = (GtkBox*) gtk_dialog_get_content_area ((GtkDialog*) self);
	_tmp35_ = grid;
	gtk_container_add (G_TYPE_CHECK_INSTANCE_TYPE (_tmp34_, GTK_TYPE_CONTAINER) ? ((GtkContainer*) _tmp34_) : NULL, (GtkWidget*) _tmp35_);
	_tmp36_ = _data31_->contact;
	_tmp37_ = contacts_contact_get_personas_for_display (_tmp36_);
	personas = _tmp37_;
	is_first = TRUE;
	counter = 1;
	{
		GeeList* _p_list = NULL;
		GeeList* _tmp38_ = NULL;
		GeeList* _tmp39_ = NULL;
		gint _p_size = 0;
		GeeList* _tmp40_ = NULL;
		gint _tmp41_ = 0;
		gint _tmp42_ = 0;
		gint _p_index = 0;
		_tmp38_ = personas;
		_tmp39_ = _g_object_ref0 (_tmp38_);
		_p_list = _tmp39_;
		_tmp40_ = _p_list;
		_tmp41_ = gee_collection_get_size ((GeeCollection*) _tmp40_);
		_tmp42_ = _tmp41_;
		_p_size = _tmp42_;
		_p_index = -1;
		while (TRUE) {
			Block32Data* _data32_;
			gint _tmp43_ = 0;
			gint _tmp44_ = 0;
			gint _tmp45_ = 0;
			GeeList* _tmp46_ = NULL;
			gint _tmp47_ = 0;
			gpointer _tmp48_ = NULL;
			gboolean _tmp49_ = FALSE;
			GtkGrid* _tmp50_ = NULL;
			GtkGrid* _tmp51_ = NULL;
			ContactsContactFrame* image_frame = NULL;
			ContactsContactFrame* _tmp52_ = NULL;
			ContactsContactFrame* _tmp53_ = NULL;
			ContactsContactFrame* _tmp54_ = NULL;
			ContactsContactFrame* _tmp55_ = NULL;
			GtkTextDirection _tmp56_ = 0;
			ContactsContact* _tmp59_ = NULL;
			ContactsContactFrame* _tmp60_ = NULL;
			GtkGrid* _tmp61_ = NULL;
			ContactsContactFrame* _tmp62_ = NULL;
			GtkLabel* display_name = NULL;
			GtkLabel* _tmp63_ = NULL;
			GtkLabel* _tmp64_ = NULL;
			GtkLabel* _tmp65_ = NULL;
			GtkLabel* _tmp66_ = NULL;
			GtkLabel* _tmp67_ = NULL;
			FolksPersona* _tmp68_ = NULL;
			const gchar* _tmp69_ = NULL;
			const gchar* _tmp70_ = NULL;
			gchar* _tmp71_ = NULL;
			gchar* _tmp72_ = NULL;
			GtkGrid* _tmp73_ = NULL;
			GtkLabel* _tmp74_ = NULL;
			GtkLabel* store_name = NULL;
			FolksPersona* _tmp75_ = NULL;
			gchar* _tmp76_ = NULL;
			gchar* _tmp77_ = NULL;
			GtkLabel* _tmp78_ = NULL;
			GtkLabel* _tmp79_ = NULL;
			GtkLabel* _tmp80_ = NULL;
			GtkLabel* _tmp81_ = NULL;
			GtkLabel* _tmp82_ = NULL;
			GtkLabel* _tmp83_ = NULL;
			GtkStyleContext* _tmp84_ = NULL;
			GtkGrid* _tmp85_ = NULL;
			GtkLabel* _tmp86_ = NULL;
			GtkButton* button = NULL;
			const gchar* _tmp87_ = NULL;
			GtkButton* _tmp88_ = NULL;
			GtkButton* _tmp89_ = NULL;
			GtkButton* _tmp90_ = NULL;
			GtkTextDirection _tmp91_ = 0;
			GtkButton* _tmp94_ = NULL;
			GtkButton* _tmp95_ = NULL;
			GtkWidget* _tmp96_ = NULL;
			GtkGrid* _tmp97_ = NULL;
			GtkButton* _tmp98_ = NULL;
			GtkButton* _tmp99_ = NULL;
			GtkGrid* _tmp100_ = NULL;
			GtkListBox* _tmp101_ = NULL;
			GtkGrid* _tmp102_ = NULL;
			gint _tmp103_ = 0;
			GeeList* _tmp104_ = NULL;
			gint _tmp105_ = 0;
			gint _tmp106_ = 0;
			_data32_ = g_slice_new0 (Block32Data);
			_data32_->_ref_count_ = 1;
			_data32_->_data31_ = block31_data_ref (_data31_);
			_tmp43_ = _p_index;
			_p_index = _tmp43_ + 1;
			_tmp44_ = _p_index;
			_tmp45_ = _p_size;
			if (!(_tmp44_ < _tmp45_)) {
				block32_data_unref (_data32_);
				_data32_ = NULL;
				break;
			}
			_tmp46_ = _p_list;
			_tmp47_ = _p_index;
			_tmp48_ = gee_list_get (_tmp46_, _tmp47_);
			_data32_->p = (FolksPersona*) _tmp48_;
			_tmp49_ = is_first;
			if (_tmp49_) {
				is_first = FALSE;
				block32_data_unref (_data32_);
				_data32_ = NULL;
				continue;
			}
			_tmp50_ = (GtkGrid*) gtk_grid_new ();
			g_object_ref_sink (_tmp50_);
			_data32_->row_grid = _tmp50_;
			_tmp51_ = _data32_->row_grid;
			gtk_grid_set_row_spacing (_tmp51_, (guint) 6);
			_tmp52_ = contacts_contact_frame_new (CONTACTS_CONTACT_SMALL_AVATAR_SIZE, FALSE);
			g_object_ref_sink (_tmp52_);
			image_frame = _tmp52_;
			_tmp53_ = image_frame;
			gtk_widget_set_hexpand ((GtkWidget*) _tmp53_, FALSE);
			_tmp54_ = image_frame;
			g_object_set ((GtkWidget*) _tmp54_, "margin", 6, NULL);
			_tmp55_ = image_frame;
			_tmp56_ = gtk_widget_get_direction ((GtkWidget*) _tmp55_);
			if (_tmp56_ == GTK_TEXT_DIR_LTR) {
				ContactsContactFrame* _tmp57_ = NULL;
				_tmp57_ = image_frame;
				gtk_widget_set_margin_right ((GtkWidget*) _tmp57_, 12);
			} else {
				ContactsContactFrame* _tmp58_ = NULL;
				_tmp58_ = image_frame;
				gtk_widget_set_margin_left ((GtkWidget*) _tmp58_, 12);
			}
			_tmp59_ = _data31_->contact;
			_tmp60_ = image_frame;
			contacts_contact_keep_widget_uptodate (_tmp59_, (GtkWidget*) _tmp60_, _____lambda91__gtk_callback, block32_data_ref (_data32_), block32_data_unref);
			_tmp61_ = _data32_->row_grid;
			_tmp62_ = image_frame;
			gtk_grid_attach (_tmp61_, (GtkWidget*) _tmp62_, 0, 0, 1, 2);
			_tmp63_ = (GtkLabel*) gtk_label_new ("");
			g_object_ref_sink (_tmp63_);
			display_name = _tmp63_;
			_tmp64_ = display_name;
			gtk_widget_set_halign ((GtkWidget*) _tmp64_, GTK_ALIGN_START);
			_tmp65_ = display_name;
			gtk_widget_set_valign ((GtkWidget*) _tmp65_, GTK_ALIGN_END);
			_tmp66_ = display_name;
			gtk_widget_set_hexpand ((GtkWidget*) _tmp66_, TRUE);
			_tmp67_ = display_name;
			_tmp68_ = _data32_->p;
			_tmp69_ = folks_persona_get_display_id (_tmp68_);
			_tmp70_ = _tmp69_;
			_tmp71_ = g_markup_printf_escaped ("<span font='12px bold'>%s</span>", _tmp70_);
			_tmp72_ = _tmp71_;
			gtk_label_set_markup (_tmp67_, _tmp72_);
			_g_free0 (_tmp72_);
			_tmp73_ = _data32_->row_grid;
			_tmp74_ = display_name;
			gtk_grid_attach (_tmp73_, (GtkWidget*) _tmp74_, 1, 0, 1, 1);
			_tmp75_ = _data32_->p;
			_tmp76_ = contacts_contact_format_persona_store_name_for_contact (_tmp75_);
			_tmp77_ = _tmp76_;
			_tmp78_ = (GtkLabel*) gtk_label_new (_tmp77_);
			g_object_ref_sink (_tmp78_);
			_tmp79_ = _tmp78_;
			_g_free0 (_tmp77_);
			store_name = _tmp79_;
			_tmp80_ = store_name;
			gtk_widget_set_halign ((GtkWidget*) _tmp80_, GTK_ALIGN_START);
			_tmp81_ = store_name;
			gtk_widget_set_valign ((GtkWidget*) _tmp81_, GTK_ALIGN_START);
			_tmp82_ = store_name;
			gtk_widget_set_hexpand ((GtkWidget*) _tmp82_, TRUE);
			_tmp83_ = store_name;
			_tmp84_ = gtk_widget_get_style_context ((GtkWidget*) _tmp83_);
			gtk_style_context_add_class (_tmp84_, "dim-label");
			_tmp85_ = _data32_->row_grid;
			_tmp86_ = store_name;
			gtk_grid_attach (_tmp85_, (GtkWidget*) _tmp86_, 1, 1, 1, 1);
			_tmp87_ = _ ("Remove");
			_tmp88_ = (GtkButton*) gtk_button_new_with_label (_tmp87_);
			g_object_ref_sink (_tmp88_);
			button = _tmp88_;
			_tmp89_ = button;
			g_object_set ((GtkWidget*) _tmp89_, "margin", 6, NULL);
			_tmp90_ = button;
			_tmp91_ = gtk_widget_get_direction ((GtkWidget*) _tmp90_);
			if (_tmp91_ == GTK_TEXT_DIR_LTR) {
				GtkButton* _tmp92_ = NULL;
				_tmp92_ = button;
				gtk_widget_set_margin_left ((GtkWidget*) _tmp92_, 12);
			} else {
				GtkButton* _tmp93_ = NULL;
				_tmp93_ = button;
				gtk_widget_set_margin_right ((GtkWidget*) _tmp93_, 12);
			}
			_tmp94_ = button;
			gtk_widget_set_valign ((GtkWidget*) _tmp94_, GTK_ALIGN_CENTER);
			_tmp95_ = button;
			_tmp96_ = gtk_bin_get_child ((GtkBin*) _tmp95_);
			g_object_set (_tmp96_, "margin", 6, NULL);
			_tmp97_ = _data32_->row_grid;
			_tmp98_ = button;
			gtk_grid_attach (_tmp97_, (GtkWidget*) _tmp98_, 2, 0, 1, 2);
			_tmp99_ = button;
			g_signal_connect_data (_tmp99_, "clicked", (GCallback) _____lambda92__gtk_button_clicked, block32_data_ref (_data32_), (GClosureNotify) block32_data_unref, 0);
			_tmp100_ = _data32_->row_grid;
			gtk_widget_show_all ((GtkWidget*) _tmp100_);
			_tmp101_ = self->priv->linked_accounts_view;
			_tmp102_ = _data32_->row_grid;
			gtk_container_add ((GtkContainer*) _tmp101_, (GtkWidget*) _tmp102_);
			_tmp103_ = counter;
			_tmp104_ = personas;
			_tmp105_ = gee_collection_get_size ((GeeCollection*) _tmp104_);
			_tmp106_ = _tmp105_;
			if (_tmp103_ != (_tmp106_ - 1)) {
				GtkSeparator* sep = NULL;
				GtkSeparator* _tmp107_ = NULL;
				GtkListBox* _tmp108_ = NULL;
				GtkSeparator* _tmp109_ = NULL;
				gint _tmp110_ = 0;
				GtkGrid* _tmp111_ = NULL;
				GtkSeparator* _tmp112_ = NULL;
				GtkSeparator* _tmp113_ = NULL;
				_tmp107_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
				g_object_ref_sink (_tmp107_);
				sep = _tmp107_;
				_tmp108_ = self->priv->linked_accounts_view;
				_tmp109_ = sep;
				gtk_container_add ((GtkContainer*) _tmp108_, (GtkWidget*) _tmp109_);
				_tmp110_ = counter;
				counter = _tmp110_ + 1;
				_tmp111_ = _data32_->row_grid;
				_tmp112_ = sep;
				_tmp113_ = _g_object_ref0 (_tmp112_);
				g_object_set_data_full ((GObject*) _tmp111_, "separator", _tmp113_, g_object_unref);
				_g_object_unref0 (sep);
			}
			_g_object_unref0 (button);
			_g_object_unref0 (store_name);
			_g_object_unref0 (display_name);
			_g_object_unref0 (image_frame);
			block32_data_unref (_data32_);
			_data32_ = NULL;
		}
		_g_object_unref0 (_p_list);
	}
	_g_object_unref0 (personas);
	_g_object_unref0 (label);
	_g_object_unref0 (scrolled);
	_g_object_unref0 (grid);
	block31_data_unref (_data31_);
	_data31_ = NULL;
	return self;
}


ContactsLinkedAccountsDialog* contacts_linked_accounts_dialog_new (ContactsContact* contact) {
	return contacts_linked_accounts_dialog_construct (CONTACTS_TYPE_LINKED_ACCOUNTS_DIALOG, contact);
}


static void contacts_linked_accounts_dialog_class_init (ContactsLinkedAccountsDialogClass * klass) {
	contacts_linked_accounts_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ContactsLinkedAccountsDialogPrivate));
	G_OBJECT_CLASS (klass)->finalize = contacts_linked_accounts_dialog_finalize;
}


static void contacts_linked_accounts_dialog_instance_init (ContactsLinkedAccountsDialog * self) {
	self->priv = CONTACTS_LINKED_ACCOUNTS_DIALOG_GET_PRIVATE (self);
}


static void contacts_linked_accounts_dialog_finalize (GObject* obj) {
	ContactsLinkedAccountsDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_LINKED_ACCOUNTS_DIALOG, ContactsLinkedAccountsDialog);
	_g_object_unref0 (self->priv->contact);
	_g_object_unref0 (self->priv->linked_accounts_view);
	G_OBJECT_CLASS (contacts_linked_accounts_dialog_parent_class)->finalize (obj);
}


GType contacts_linked_accounts_dialog_get_type (void) {
	static volatile gsize contacts_linked_accounts_dialog_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_linked_accounts_dialog_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsLinkedAccountsDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_linked_accounts_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsLinkedAccountsDialog), 0, (GInstanceInitFunc) contacts_linked_accounts_dialog_instance_init, NULL };
		GType contacts_linked_accounts_dialog_type_id;
		contacts_linked_accounts_dialog_type_id = g_type_register_static (GTK_TYPE_DIALOG, "ContactsLinkedAccountsDialog", &g_define_type_info, 0);
		g_once_init_leave (&contacts_linked_accounts_dialog_type_id__volatile, contacts_linked_accounts_dialog_type_id);
	}
	return contacts_linked_accounts_dialog_type_id__volatile;
}



