/* contacts-linked-accounts-dialog.c generated by valac 0.38.7, 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 <gee.h>
#include <folks/folks.h>
#include <gio/gio.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;
enum  {
	CONTACTS_LINKED_ACCOUNTS_DIALOG_0_PROPERTY,
	CONTACTS_LINKED_ACCOUNTS_DIALOG_NUM_PROPERTIES
};
static GParamSpec* contacts_linked_accounts_dialog_properties[CONTACTS_LINKED_ACCOUNTS_DIALOG_NUM_PROPERTIES];
#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;
typedef struct _Block26Data Block26Data;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block27Data Block27Data;

#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_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_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 _Block26Data {
	int _ref_count_;
	ContactsLinkedAccountsDialog* self;
	ContactsContact* contact;
};

struct _Block27Data {
	int _ref_count_;
	Block26Data * _data26_;
	FolksPersona* p;
	GtkGrid* row_grid;
};

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

struct _ContactsContactClass {
	GObjectClass parent_class;
};


static gpointer contacts_linked_accounts_dialog_parent_class = NULL;

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))
GType contacts_window_get_type (void) G_GNUC_CONST;
ContactsLinkedAccountsDialog* contacts_linked_accounts_dialog_new (ContactsWindow* main_win, ContactsContact* contact);
ContactsLinkedAccountsDialog* contacts_linked_accounts_dialog_construct (GType object_type, ContactsWindow* main_win, ContactsContact* contact);
static Block26Data* block26_data_ref (Block26Data* _data26_);
static void block26_data_unref (void * _userdata_);
const gchar* contacts_contact_get_display_name (ContactsContact* self);
void contacts_add_separator (GtkListBoxRow* row, GtkListBoxRow* before_row);
static void _contacts_add_separator_gtk_list_box_update_header_func (GtkListBoxRow* row, GtkListBoxRow* before, gpointer self);
GeeList* contacts_contact_get_personas_for_display (ContactsContact* self);
static Block27Data* block27_data_ref (Block27Data* _data27_);
static void block27_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 ____lambda67_ (Block27Data* _data27_, GtkWidget* w);
void contacts_contact_frame_set_image (ContactsContactFrame* self, FolksAvatarDetails* details, ContactsContact* contact);
GType contacts_store_get_type (void) G_GNUC_CONST;
static void _____lambda67__gtk_callback (GtkWidget* widget, gpointer self);
gchar* contacts_contact_format_persona_store_name_for_contact (FolksPersona* persona);
static void ____lambda68_ (Block27Data* _data27_);
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 __lambda69_ (Block27Data* _data27_, GObject* obj, GAsyncResult* _result_);
static void ___lambda69__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
static void _____lambda68__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 Block26Data* block26_data_ref (Block26Data* _data26_) {
	g_atomic_int_inc (&_data26_->_ref_count_);
	return _data26_;
}


static void block26_data_unref (void * _userdata_) {
	Block26Data* _data26_;
	_data26_ = (Block26Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data26_->_ref_count_)) {
		ContactsLinkedAccountsDialog* self;
		self = _data26_->self;
		_g_object_unref0 (_data26_->contact);
		_g_object_unref0 (self);
		g_slice_free (Block26Data, _data26_);
	}
}


static void _contacts_add_separator_gtk_list_box_update_header_func (GtkListBoxRow* row, GtkListBoxRow* before, gpointer self) {
	contacts_add_separator (row, before);
}


static Block27Data* block27_data_ref (Block27Data* _data27_) {
	g_atomic_int_inc (&_data27_->_ref_count_);
	return _data27_;
}


static void block27_data_unref (void * _userdata_) {
	Block27Data* _data27_;
	_data27_ = (Block27Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data27_->_ref_count_)) {
		ContactsLinkedAccountsDialog* self;
		self = _data27_->_data26_->self;
		_g_object_unref0 (_data27_->row_grid);
		_g_object_unref0 (_data27_->p);
		block26_data_unref (_data27_->_data26_);
		_data27_->_data26_ = NULL;
		g_slice_free (Block27Data, _data27_);
	}
}


static void ____lambda67_ (Block27Data* _data27_, GtkWidget* w) {
	Block26Data* _data26_;
	ContactsLinkedAccountsDialog* self;
	GtkWidget* _tmp0_;
	ContactsContact* _tmp1_;
	FolksIndividual* _tmp2_;
	ContactsContact* _tmp3_;
	_data26_ = _data27_->_data26_;
	self = _data26_->self;
	g_return_if_fail (w != NULL);
	_tmp0_ = w;
	_tmp1_ = _data26_->contact;
	_tmp2_ = _tmp1_->individual;
	_tmp3_ = _data26_->contact;
	contacts_contact_frame_set_image (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, CONTACTS_TYPE_CONTACT_FRAME) ? ((ContactsContactFrame*) _tmp0_) : NULL, (FolksAvatarDetails*) _tmp2_, _tmp3_);
}


static void _____lambda67__gtk_callback (GtkWidget* widget, gpointer self) {
	____lambda67_ (self, widget);
}


static void __lambda69_ (Block27Data* _data27_, GObject* obj, GAsyncResult* _result_) {
	Block26Data* _data26_;
	ContactsLinkedAccountsDialog* self;
	GAsyncResult* _tmp0_;
	ContactsLinkOperation* _tmp1_;
	ContactsLinkOperation* _tmp2_;
	GtkGrid* _tmp3_;
	_data26_ = _data27_->_data26_;
	self = _data26_->self;
	g_return_if_fail (_result_ != NULL);
	_tmp0_ = _result_;
	_tmp1_ = contacts_unlink_persona_finish (_tmp0_);
	_tmp2_ = _tmp1_;
	_g_object_unref0 (_tmp2_);
	_tmp3_ = _data27_->row_grid;
	gtk_widget_destroy ((GtkWidget*) _tmp3_);
	self->any_unlinked = TRUE;
}


static void ___lambda69__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	__lambda69_ (self, source_object, res);
	block27_data_unref (self);
}


static void ____lambda68_ (Block27Data* _data27_) {
	Block26Data* _data26_;
	ContactsLinkedAccountsDialog* self;
	ContactsContact* _tmp0_;
	FolksPersona* _tmp1_;
	_data26_ = _data27_->_data26_;
	self = _data26_->self;
	_tmp0_ = _data26_->contact;
	_tmp1_ = _data27_->p;
	contacts_unlink_persona (_tmp0_, _tmp1_, ___lambda69__gasync_ready_callback, block27_data_ref (_data27_));
}


static void _____lambda68__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	____lambda68_ (self);
}


ContactsLinkedAccountsDialog* contacts_linked_accounts_dialog_construct (GType object_type, ContactsWindow* main_win, ContactsContact* contact) {
	ContactsLinkedAccountsDialog * self = NULL;
	Block26Data* _data26_;
	ContactsContact* _tmp0_;
	ContactsContact* _tmp1_;
	ContactsWindow* _tmp2_;
	ContactsContact* _tmp3_;
	ContactsContact* _tmp4_;
	GtkHeaderBar* headerbar = NULL;
	GtkWidget* _tmp5_;
	GtkHeaderBar* _tmp6_;
	GtkHeaderBar* _tmp7_;
	ContactsContact* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	GtkHeaderBar* _tmp13_;
	GtkGrid* grid = NULL;
	GtkGrid* _tmp14_;
	GtkGrid* _tmp15_;
	GtkGrid* _tmp16_;
	GtkGrid* _tmp17_;
	GtkScrolledWindow* scrolled = NULL;
	GtkScrolledWindow* _tmp18_;
	GtkScrolledWindow* _tmp19_;
	GtkScrolledWindow* _tmp20_;
	GtkScrolledWindow* _tmp21_;
	GtkScrolledWindow* _tmp22_;
	GtkListBox* _tmp23_;
	GtkListBox* _tmp24_;
	GtkListBox* _tmp25_;
	GtkScrolledWindow* _tmp26_;
	GtkListBox* _tmp27_;
	GtkGrid* _tmp28_;
	GtkScrolledWindow* _tmp29_;
	GtkLabel* label = NULL;
	GtkLabel* _tmp30_;
	GtkLabel* _tmp31_;
	GtkGrid* _tmp32_;
	GtkLabel* _tmp33_;
	GtkGrid* _tmp34_;
	GtkBox* _tmp35_;
	GtkGrid* _tmp36_;
	GeeList* personas = NULL;
	ContactsContact* _tmp37_;
	GeeList* _tmp38_;
	gboolean is_first = FALSE;
	g_return_val_if_fail (main_win != NULL, NULL);
	g_return_val_if_fail (contact != NULL, NULL);
	_data26_ = g_slice_new0 (Block26Data);
	_data26_->_ref_count_ = 1;
	_tmp0_ = contact;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data26_->contact);
	_data26_->contact = _tmp1_;
	_tmp2_ = main_win;
	self = (ContactsLinkedAccountsDialog*) g_object_new (object_type, "use-header-bar", 1, "transient-for", _tmp2_, "modal", TRUE, NULL);
	_data26_->self = g_object_ref (self);
	_tmp3_ = _data26_->contact;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (self->priv->contact);
	self->priv->contact = _tmp4_;
	self->any_unlinked = FALSE;
	_tmp5_ = gtk_dialog_get_header_bar ((GtkDialog*) self);
	_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, gtk_header_bar_get_type ()) ? ((GtkHeaderBar*) _tmp5_) : NULL);
	headerbar = _tmp6_;
	_tmp7_ = headerbar;
	_tmp8_ = _data26_->contact;
	_tmp9_ = contacts_contact_get_display_name (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = g_strdup_printf (_ ("%s"), _tmp10_);
	_tmp12_ = _tmp11_;
	gtk_header_bar_set_title (_tmp7_, _tmp12_);
	_g_free0 (_tmp12_);
	_tmp13_ = headerbar;
	gtk_header_bar_set_subtitle (_tmp13_, _ ("Linked Accounts"));
	gtk_window_set_default_size ((GtkWindow*) self, 600, 400);
	_tmp14_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp14_);
	grid = _tmp14_;
	_tmp15_ = grid;
	gtk_orientable_set_orientation ((GtkOrientable*) _tmp15_, GTK_ORIENTATION_VERTICAL);
	_tmp16_ = grid;
	gtk_grid_set_row_spacing (_tmp16_, (guint) 12);
	_tmp17_ = grid;
	gtk_container_set_border_width ((GtkContainer*) _tmp17_, (guint) 8);
	_tmp18_ = (GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL);
	g_object_ref_sink (_tmp18_);
	scrolled = _tmp18_;
	_tmp19_ = scrolled;
	gtk_scrolled_window_set_policy (_tmp19_, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	_tmp20_ = scrolled;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp20_, TRUE);
	_tmp21_ = scrolled;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp21_, TRUE);
	_tmp22_ = scrolled;
	gtk_scrolled_window_set_shadow_type (_tmp22_, GTK_SHADOW_IN);
	_tmp23_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp23_);
	_g_object_unref0 (self->priv->linked_accounts_view);
	self->priv->linked_accounts_view = _tmp23_;
	_tmp24_ = self->priv->linked_accounts_view;
	gtk_list_box_set_selection_mode (_tmp24_, GTK_SELECTION_NONE);
	_tmp25_ = self->priv->linked_accounts_view;
	gtk_list_box_set_header_func (_tmp25_, _contacts_add_separator_gtk_list_box_update_header_func, NULL, NULL);
	_tmp26_ = scrolled;
	_tmp27_ = self->priv->linked_accounts_view;
	gtk_container_add ((GtkContainer*) _tmp26_, (GtkWidget*) _tmp27_);
	_tmp28_ = grid;
	_tmp29_ = scrolled;
	gtk_container_add ((GtkContainer*) _tmp28_, (GtkWidget*) _tmp29_);
	_tmp30_ = (GtkLabel*) gtk_label_new (_ ("You can link contacts by selecting them from the contacts list"));
	g_object_ref_sink (_tmp30_);
	label = _tmp30_;
	_tmp31_ = label;
	gtk_widget_set_halign ((GtkWidget*) _tmp31_, GTK_ALIGN_CENTER);
	_tmp32_ = grid;
	_tmp33_ = label;
	gtk_container_add ((GtkContainer*) _tmp32_, (GtkWidget*) _tmp33_);
	_tmp34_ = grid;
	gtk_widget_show_all ((GtkWidget*) _tmp34_);
	_tmp35_ = (GtkBox*) gtk_dialog_get_content_area ((GtkDialog*) self);
	_tmp36_ = grid;
	gtk_container_add (G_TYPE_CHECK_INSTANCE_TYPE (_tmp35_, gtk_container_get_type ()) ? ((GtkContainer*) _tmp35_) : NULL, (GtkWidget*) _tmp36_);
	_tmp37_ = _data26_->contact;
	_tmp38_ = contacts_contact_get_personas_for_display (_tmp37_);
	personas = _tmp38_;
	is_first = TRUE;
	{
		GeeList* _p_list = NULL;
		GeeList* _tmp39_;
		GeeList* _tmp40_;
		gint _p_size = 0;
		GeeList* _tmp41_;
		gint _tmp42_;
		gint _tmp43_;
		gint _p_index = 0;
		_tmp39_ = personas;
		_tmp40_ = _g_object_ref0 (_tmp39_);
		_p_list = _tmp40_;
		_tmp41_ = _p_list;
		_tmp42_ = gee_collection_get_size ((GeeCollection*) _tmp41_);
		_tmp43_ = _tmp42_;
		_p_size = _tmp43_;
		_p_index = -1;
		while (TRUE) {
			Block27Data* _data27_;
			gint _tmp44_;
			gint _tmp45_;
			gint _tmp46_;
			GeeList* _tmp47_;
			gint _tmp48_;
			gpointer _tmp49_;
			gboolean _tmp50_;
			GtkGrid* _tmp51_;
			ContactsContactFrame* image_frame = NULL;
			ContactsContactFrame* _tmp52_;
			ContactsContactFrame* _tmp53_;
			ContactsContactFrame* _tmp54_;
			ContactsContactFrame* _tmp55_;
			ContactsContact* _tmp56_;
			ContactsContactFrame* _tmp57_;
			GtkGrid* _tmp58_;
			ContactsContactFrame* _tmp59_;
			GtkLabel* display_name = NULL;
			GtkLabel* _tmp60_;
			GtkLabel* _tmp61_;
			GtkLabel* _tmp62_;
			GtkLabel* _tmp63_;
			GtkLabel* _tmp64_;
			FolksPersona* _tmp65_;
			const gchar* _tmp66_;
			const gchar* _tmp67_;
			gchar* _tmp68_;
			gchar* _tmp69_;
			GtkGrid* _tmp70_;
			GtkLabel* _tmp71_;
			GtkLabel* store_name = NULL;
			FolksPersona* _tmp72_;
			gchar* _tmp73_;
			gchar* _tmp74_;
			GtkLabel* _tmp75_;
			GtkLabel* _tmp76_;
			GtkLabel* _tmp77_;
			GtkLabel* _tmp78_;
			GtkLabel* _tmp79_;
			GtkLabel* _tmp80_;
			GtkStyleContext* _tmp81_;
			GtkGrid* _tmp82_;
			GtkLabel* _tmp83_;
			GtkButton* button = NULL;
			GtkButton* _tmp84_;
			GtkButton* _tmp85_;
			GtkButton* _tmp86_;
			GtkButton* _tmp87_;
			GtkWidget* _tmp88_;
			GtkGrid* _tmp89_;
			GtkButton* _tmp90_;
			GtkButton* _tmp91_;
			GtkGrid* _tmp92_;
			GtkListBox* _tmp93_;
			GtkGrid* _tmp94_;
			_data27_ = g_slice_new0 (Block27Data);
			_data27_->_ref_count_ = 1;
			_data27_->_data26_ = block26_data_ref (_data26_);
			_tmp44_ = _p_index;
			_p_index = _tmp44_ + 1;
			_tmp45_ = _p_index;
			_tmp46_ = _p_size;
			if (!(_tmp45_ < _tmp46_)) {
				block27_data_unref (_data27_);
				_data27_ = NULL;
				break;
			}
			_tmp47_ = _p_list;
			_tmp48_ = _p_index;
			_tmp49_ = gee_list_get (_tmp47_, _tmp48_);
			_data27_->p = (FolksPersona*) _tmp49_;
			_tmp50_ = is_first;
			if (_tmp50_) {
				is_first = FALSE;
				block27_data_unref (_data27_);
				_data27_ = NULL;
				continue;
			}
			_tmp51_ = (GtkGrid*) gtk_grid_new ();
			g_object_ref_sink (_tmp51_);
			_data27_->row_grid = _tmp51_;
			_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;
			gtk_widget_set_margin_end ((GtkWidget*) _tmp55_, 12);
			_tmp56_ = _data26_->contact;
			_tmp57_ = image_frame;
			contacts_contact_keep_widget_uptodate (_tmp56_, (GtkWidget*) _tmp57_, _____lambda67__gtk_callback, block27_data_ref (_data27_), block27_data_unref);
			_tmp58_ = _data27_->row_grid;
			_tmp59_ = image_frame;
			gtk_grid_attach (_tmp58_, (GtkWidget*) _tmp59_, 0, 0, 1, 2);
			_tmp60_ = (GtkLabel*) gtk_label_new ("");
			g_object_ref_sink (_tmp60_);
			display_name = _tmp60_;
			_tmp61_ = display_name;
			gtk_widget_set_halign ((GtkWidget*) _tmp61_, GTK_ALIGN_START);
			_tmp62_ = display_name;
			gtk_widget_set_valign ((GtkWidget*) _tmp62_, GTK_ALIGN_END);
			_tmp63_ = display_name;
			gtk_widget_set_hexpand ((GtkWidget*) _tmp63_, TRUE);
			_tmp64_ = display_name;
			_tmp65_ = _data27_->p;
			_tmp66_ = folks_persona_get_display_id (_tmp65_);
			_tmp67_ = _tmp66_;
			_tmp68_ = g_markup_printf_escaped ("<span font='bold'>%s</span>", _tmp67_);
			_tmp69_ = _tmp68_;
			gtk_label_set_markup (_tmp64_, _tmp69_);
			_g_free0 (_tmp69_);
			_tmp70_ = _data27_->row_grid;
			_tmp71_ = display_name;
			gtk_grid_attach (_tmp70_, (GtkWidget*) _tmp71_, 1, 0, 1, 1);
			_tmp72_ = _data27_->p;
			_tmp73_ = contacts_contact_format_persona_store_name_for_contact (_tmp72_);
			_tmp74_ = _tmp73_;
			_tmp75_ = (GtkLabel*) gtk_label_new (_tmp74_);
			g_object_ref_sink (_tmp75_);
			_tmp76_ = _tmp75_;
			_g_free0 (_tmp74_);
			store_name = _tmp76_;
			_tmp77_ = store_name;
			gtk_widget_set_halign ((GtkWidget*) _tmp77_, GTK_ALIGN_START);
			_tmp78_ = store_name;
			gtk_widget_set_valign ((GtkWidget*) _tmp78_, GTK_ALIGN_START);
			_tmp79_ = store_name;
			gtk_widget_set_hexpand ((GtkWidget*) _tmp79_, TRUE);
			_tmp80_ = store_name;
			_tmp81_ = gtk_widget_get_style_context ((GtkWidget*) _tmp80_);
			gtk_style_context_add_class (_tmp81_, "dim-label");
			_tmp82_ = _data27_->row_grid;
			_tmp83_ = store_name;
			gtk_grid_attach (_tmp82_, (GtkWidget*) _tmp83_, 1, 1, 1, 1);
			_tmp84_ = (GtkButton*) gtk_button_new_with_label (_ ("Unlink"));
			g_object_ref_sink (_tmp84_);
			button = _tmp84_;
			_tmp85_ = button;
			gtk_widget_set_margin_end ((GtkWidget*) _tmp85_, 6);
			_tmp86_ = button;
			gtk_widget_set_valign ((GtkWidget*) _tmp86_, GTK_ALIGN_CENTER);
			_tmp87_ = button;
			_tmp88_ = gtk_bin_get_child ((GtkBin*) _tmp87_);
			g_object_set (_tmp88_, "margin", 1, NULL);
			_tmp89_ = _data27_->row_grid;
			_tmp90_ = button;
			gtk_grid_attach (_tmp89_, (GtkWidget*) _tmp90_, 2, 0, 1, 2);
			_tmp91_ = button;
			g_signal_connect_data (_tmp91_, "clicked", (GCallback) _____lambda68__gtk_button_clicked, block27_data_ref (_data27_), (GClosureNotify) block27_data_unref, 0);
			_tmp92_ = _data27_->row_grid;
			gtk_widget_show_all ((GtkWidget*) _tmp92_);
			_tmp93_ = self->priv->linked_accounts_view;
			_tmp94_ = _data27_->row_grid;
			gtk_container_add ((GtkContainer*) _tmp93_, (GtkWidget*) _tmp94_);
			_g_object_unref0 (button);
			_g_object_unref0 (store_name);
			_g_object_unref0 (display_name);
			_g_object_unref0 (image_frame);
			block27_data_unref (_data27_);
			_data27_ = NULL;
		}
		_g_object_unref0 (_p_list);
	}
	_g_object_unref0 (personas);
	_g_object_unref0 (label);
	_g_object_unref0 (scrolled);
	_g_object_unref0 (grid);
	_g_object_unref0 (headerbar);
	block26_data_unref (_data26_);
	_data26_ = NULL;
	return self;
}


ContactsLinkedAccountsDialog* contacts_linked_accounts_dialog_new (ContactsWindow* main_win, ContactsContact* contact) {
	return contacts_linked_accounts_dialog_construct (CONTACTS_TYPE_LINKED_ACCOUNTS_DIALOG, main_win, 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_dialog_get_type (), "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;
}



