/* contacts-linked-accounts-dialog.c generated by valac 0.30.0, 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 _Block33Data Block33Data;
#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 _Block34Data Block34Data;

#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 _Block33Data {
	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 _Block34Data {
	int _ref_count_;
	Block33Data * _data33_;
	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;
	FolksPersona* fake_persona;
};

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 Block33Data* block33_data_ref (Block33Data* _data33_);
static void block33_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;
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 Block34Data* block34_data_ref (Block34Data* _data34_);
static void block34_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 ____lambda75_ (Block34Data* _data34_, GtkWidget* w);
void contacts_contact_frame_set_image (ContactsContactFrame* self, FolksAvatarDetails* details, ContactsContact* contact);
static void _____lambda75__gtk_callback (GtkWidget* widget, gpointer self);
gchar* contacts_contact_format_persona_store_name_for_contact (FolksPersona* persona);
static void ____lambda76_ (Block34Data* _data34_);
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 __lambda77_ (Block34Data* _data34_, GObject* obj, GAsyncResult* _result_);
static void ___lambda77__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
static void _____lambda76__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 Block33Data* block33_data_ref (Block33Data* _data33_) {
	g_atomic_int_inc (&_data33_->_ref_count_);
	return _data33_;
}


static void block33_data_unref (void * _userdata_) {
	Block33Data* _data33_;
	_data33_ = (Block33Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data33_->_ref_count_)) {
		ContactsLinkedAccountsDialog* self;
		self = _data33_->self;
		_g_object_unref0 (_data33_->contact);
		_g_object_unref0 (self);
		g_slice_free (Block33Data, _data33_);
	}
}


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


static Block34Data* block34_data_ref (Block34Data* _data34_) {
	g_atomic_int_inc (&_data34_->_ref_count_);
	return _data34_;
}


static void block34_data_unref (void * _userdata_) {
	Block34Data* _data34_;
	_data34_ = (Block34Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data34_->_ref_count_)) {
		ContactsLinkedAccountsDialog* self;
		self = _data34_->_data33_->self;
		_g_object_unref0 (_data34_->row_grid);
		_g_object_unref0 (_data34_->p);
		block33_data_unref (_data34_->_data33_);
		_data34_->_data33_ = NULL;
		g_slice_free (Block34Data, _data34_);
	}
}


static void ____lambda75_ (Block34Data* _data34_, GtkWidget* w) {
	Block33Data* _data33_;
	ContactsLinkedAccountsDialog* self;
	GtkWidget* _tmp0_ = NULL;
	ContactsContact* _tmp1_ = NULL;
	FolksIndividual* _tmp2_ = NULL;
	ContactsContact* _tmp3_ = NULL;
	_data33_ = _data34_->_data33_;
	self = _data33_->self;
	g_return_if_fail (w != NULL);
	_tmp0_ = w;
	_tmp1_ = _data33_->contact;
	_tmp2_ = _tmp1_->individual;
	_tmp3_ = _data33_->contact;
	contacts_contact_frame_set_image (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, CONTACTS_TYPE_CONTACT_FRAME) ? ((ContactsContactFrame*) _tmp0_) : NULL, (FolksAvatarDetails*) _tmp2_, _tmp3_);
}


static void _____lambda75__gtk_callback (GtkWidget* widget, gpointer self) {
	____lambda75_ (self, widget);
}


static void __lambda77_ (Block34Data* _data34_, GObject* obj, GAsyncResult* _result_) {
	Block33Data* _data33_;
	ContactsLinkedAccountsDialog* self;
	GAsyncResult* _tmp0_ = NULL;
	ContactsLinkOperation* _tmp1_ = NULL;
	ContactsLinkOperation* _tmp2_ = NULL;
	GtkGrid* _tmp3_ = NULL;
	_data33_ = _data34_->_data33_;
	self = _data33_->self;
	g_return_if_fail (_result_ != NULL);
	_tmp0_ = _result_;
	_tmp1_ = contacts_unlink_persona_finish (_tmp0_);
	_tmp2_ = _tmp1_;
	_g_object_unref0 (_tmp2_);
	_tmp3_ = _data34_->row_grid;
	gtk_widget_destroy ((GtkWidget*) _tmp3_);
	self->any_unlinked = TRUE;
}


static void ___lambda77__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	__lambda77_ (self, source_object, res);
	block34_data_unref (self);
}


static void ____lambda76_ (Block34Data* _data34_) {
	Block33Data* _data33_;
	ContactsLinkedAccountsDialog* self;
	ContactsContact* _tmp0_ = NULL;
	FolksPersona* _tmp1_ = NULL;
	_data33_ = _data34_->_data33_;
	self = _data33_->self;
	_tmp0_ = _data33_->contact;
	_tmp1_ = _data34_->p;
	contacts_unlink_persona (_tmp0_, _tmp1_, ___lambda77__gasync_ready_callback, block34_data_ref (_data34_));
}


static void _____lambda76__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	____lambda76_ (self);
}


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



