/* contacts-accounts-list.c generated by valac 0.56.0, the Vala compiler
 * generated from contacts-accounts-list.vala, do not modify */

/*
 * Copyright (C) 2011 Erick Pérez Castellanos <erick.red@gmail.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 <adwaita.h>
#include <glib-object.h>
#include <folks/folks.h>
#include <gtk/gtk.h>
#include "contacts.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <libedataserver/libedataserver.h>
#include <folks/folks-eds.h>
#include <config.h>
#include <glib/gi18n-lib.h>

#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define CONTACTS_TYPE_ACCOUNTS_LIST (contacts_accounts_list_get_type ())
#define CONTACTS_ACCOUNTS_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_ACCOUNTS_LIST, ContactsAccountsList))
#define CONTACTS_ACCOUNTS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_ACCOUNTS_LIST, ContactsAccountsListClass))
#define CONTACTS_IS_ACCOUNTS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_ACCOUNTS_LIST))
#define CONTACTS_IS_ACCOUNTS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_ACCOUNTS_LIST))
#define CONTACTS_ACCOUNTS_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_ACCOUNTS_LIST, ContactsAccountsListClass))

typedef struct _ContactsAccountsList ContactsAccountsList;
typedef struct _ContactsAccountsListClass ContactsAccountsListClass;
typedef struct _ContactsAccountsListPrivate ContactsAccountsListPrivate;
enum  {
	CONTACTS_ACCOUNTS_LIST_0_PROPERTY,
	CONTACTS_ACCOUNTS_LIST_NUM_PROPERTIES
};
static GParamSpec* contacts_accounts_list_properties[CONTACTS_ACCOUNTS_LIST_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	CONTACTS_ACCOUNTS_LIST_ACCOUNT_SELECTED_SIGNAL,
	CONTACTS_ACCOUNTS_LIST_NUM_SIGNALS
};
static guint contacts_accounts_list_signals[CONTACTS_ACCOUNTS_LIST_NUM_SIGNALS] = {0};

struct _ContactsAccountsList {
	AdwBin parent_instance;
	ContactsAccountsListPrivate * priv;
	FolksPersonaStore* selected_store;
};

struct _ContactsAccountsListClass {
	AdwBinClass parent_class;
};

struct _ContactsAccountsListPrivate {
	GtkListBox* listbox;
	GtkListBoxRow* last_selected_row;
	ContactsStore* contacts_store;
};

static gint ContactsAccountsList_private_offset;
static gpointer contacts_accounts_list_parent_class = NULL;

VALA_EXTERN GType contacts_accounts_list_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ContactsAccountsList, g_object_unref)
VALA_EXTERN ContactsAccountsList* contacts_accounts_list_new (ContactsStore* contacts_store);
VALA_EXTERN ContactsAccountsList* contacts_accounts_list_construct (GType object_type,
                                                        ContactsStore* contacts_store);
static void contacts_accounts_list_on_row_activated (ContactsAccountsList* self,
                                              GtkListBox* listbox,
                                              GtkListBoxRow* row);
VALA_EXTERN void contacts_accounts_list_update_contents (ContactsAccountsList* self,
                                             gboolean select_active);
static GObject * contacts_accounts_list_constructor (GType type,
                                              guint n_construct_properties,
                                              GObjectConstructParam * construct_properties);
static void _contacts_accounts_list_on_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                          GtkListBoxRow* row,
                                                                          gpointer self);
static void contacts_accounts_list_finalize (GObject * obj);
static GType contacts_accounts_list_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
contacts_accounts_list_get_instance_private (ContactsAccountsList* self)
{
	return G_STRUCT_MEMBER_P (self, ContactsAccountsList_private_offset);
}

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

ContactsAccountsList*
contacts_accounts_list_construct (GType object_type,
                                  ContactsStore* contacts_store)
{
	ContactsAccountsList * self = NULL;
	ContactsStore* _tmp0_;
	g_return_val_if_fail (contacts_store != NULL, NULL);
	self = (ContactsAccountsList*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (contacts_store);
	_g_object_unref0 (self->priv->contacts_store);
	self->priv->contacts_store = _tmp0_;
	return self;
}

ContactsAccountsList*
contacts_accounts_list_new (ContactsStore* contacts_store)
{
	return contacts_accounts_list_construct (CONTACTS_TYPE_ACCOUNTS_LIST, contacts_store);
}

static void
contacts_accounts_list_on_row_activated (ContactsAccountsList* self,
                                         GtkListBox* listbox,
                                         GtkListBoxRow* row)
{
	gboolean _tmp0_ = FALSE;
	GtkListBoxRow* _tmp1_;
	GtkImage* checkmark = NULL;
	gconstpointer _tmp3_;
	GtkImage* _tmp4_;
	GtkImage* _tmp5_;
	GtkListBoxRow* _tmp6_;
	gconstpointer _tmp12_;
	FolksPersonaStore* _tmp13_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (listbox != NULL);
	if (row == NULL) {
		return;
	}
	_tmp1_ = self->priv->last_selected_row;
	if (_tmp1_ != NULL) {
		GtkListBoxRow* _tmp2_;
		_tmp2_ = self->priv->last_selected_row;
		_tmp0_ = _tmp2_ == row;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	_tmp3_ = g_object_get_data ((GObject*) row, "checkmark");
	_tmp4_ = _g_object_ref0 ((GtkImage*) _tmp3_);
	checkmark = _tmp4_;
	_tmp5_ = checkmark;
	gtk_widget_show ((GtkWidget*) _tmp5_);
	_tmp6_ = self->priv->last_selected_row;
	if (_tmp6_ != NULL) {
		GtkListBoxRow* _tmp7_;
		gconstpointer _tmp8_;
		GtkImage* _tmp9_;
		GtkImage* _tmp10_;
		_tmp7_ = self->priv->last_selected_row;
		_tmp8_ = g_object_get_data ((GObject*) _tmp7_, "checkmark");
		_tmp9_ = _g_object_ref0 ((GtkImage*) _tmp8_);
		_g_object_unref0 (checkmark);
		checkmark = _tmp9_;
		_tmp10_ = checkmark;
		if (_tmp10_ != NULL) {
			GtkImage* _tmp11_;
			_tmp11_ = checkmark;
			gtk_widget_hide ((GtkWidget*) _tmp11_);
		}
	}
	self->priv->last_selected_row = row;
	_tmp12_ = g_object_get_data ((GObject*) row, "store");
	_tmp13_ = _g_object_ref0 ((FolksPersonaStore*) _tmp12_);
	_g_object_unref0 (self->selected_store);
	self->selected_store = _tmp13_;
	g_signal_emit (self, contacts_accounts_list_signals[CONTACTS_ACCOUNTS_LIST_ACCOUNT_SELECTED_SIGNAL], 0);
	_g_object_unref0 (checkmark);
}

void
contacts_accounts_list_update_contents (ContactsAccountsList* self,
                                        gboolean select_active)
{
	GtkWidget* child = NULL;
	GtkListBox* _tmp0_;
	GtkWidget* _tmp1_;
	FolksPersonaStore** eds_stores = NULL;
	ContactsStore* _tmp8_;
	gint _tmp9_ = 0;
	FolksPersonaStore** _tmp10_;
	gint eds_stores_length1;
	gint _eds_stores_size_;
	FolksPersonaStore** _tmp11_;
	gint _tmp11__length1;
	FolksPersonaStore* local_store = NULL;
	FolksPersonaStore** _tmp12_;
	gint _tmp12__length1;
	FolksPersonaStore* _tmp86_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->listbox;
	_tmp1_ = gtk_widget_get_first_child ((GtkWidget*) _tmp0_);
	child = _tmp1_;
	while (TRUE) {
		GtkWidget* _tmp2_;
		GtkWidget* next = NULL;
		GtkWidget* _tmp3_;
		GtkWidget* _tmp4_;
		GtkListBox* _tmp5_;
		GtkWidget* _tmp6_;
		GtkWidget* _tmp7_;
		_tmp2_ = child;
		if (!(_tmp2_ != NULL)) {
			break;
		}
		_tmp3_ = child;
		_tmp4_ = gtk_widget_get_next_sibling (_tmp3_);
		next = _tmp4_;
		_tmp5_ = self->priv->listbox;
		_tmp6_ = child;
		gtk_list_box_remove (_tmp5_, _tmp6_);
		_tmp7_ = next;
		child = _tmp7_;
	}
	_tmp8_ = self->priv->contacts_store;
	_tmp10_ = contacts_utils_get_eds_address_books (_tmp8_, &_tmp9_);
	eds_stores = _tmp10_;
	eds_stores_length1 = _tmp9_;
	_eds_stores_size_ = eds_stores_length1;
	_tmp11_ = eds_stores;
	_tmp11__length1 = eds_stores_length1;
	g_debug ("contacts-accounts-list.vala:76: Found %d EDS stores", _tmp11__length1);
	local_store = NULL;
	_tmp12_ = eds_stores;
	_tmp12__length1 = eds_stores_length1;
	{
		FolksPersonaStore** persona_store_collection = NULL;
		gint persona_store_collection_length1 = 0;
		gint _persona_store_collection_size_ = 0;
		gint persona_store_it = 0;
		persona_store_collection = _tmp12_;
		persona_store_collection_length1 = _tmp12__length1;
		for (persona_store_it = 0; persona_store_it < persona_store_collection_length1; persona_store_it = persona_store_it + 1) {
			FolksPersonaStore* persona_store = NULL;
			persona_store = persona_store_collection[persona_store_it];
			{
				FolksPersonaStore* _tmp13_;
				const gchar* _tmp14_;
				const gchar* _tmp15_;
				ESource* source = NULL;
				FolksPersonaStore* _tmp17_;
				ESource* _tmp18_;
				ESource* _tmp19_;
				ESource* _tmp20_;
				ESource* parent_source = NULL;
				ESourceRegistry* _tmp21_;
				ESource* _tmp22_;
				const gchar* _tmp23_;
				const gchar* _tmp24_;
				ESource* _tmp25_;
				gchar* provider_name = NULL;
				FolksPersonaStore* _tmp26_;
				gchar* _tmp27_;
				const gchar* _tmp28_;
				gchar* source_account_id = NULL;
				gchar* _tmp29_;
				ESource* _tmp30_;
				AdwActionRow* row = NULL;
				AdwActionRow* _tmp38_;
				AdwActionRow* _tmp39_;
				FolksPersonaStore* _tmp40_;
				FolksPersonaStore* _tmp41_;
				GtkImage* provider_image = NULL;
				const gchar* _tmp42_;
				GtkImage* _tmp46_;
				AdwActionRow* _tmp47_;
				GtkImage* _tmp48_;
				AdwActionRow* _tmp49_;
				const gchar* _tmp50_;
				AdwActionRow* _tmp51_;
				ESource* _tmp52_;
				const gchar* _tmp53_;
				const gchar* _tmp54_;
				GtkImage* checkmark = NULL;
				GtkImage* _tmp55_;
				GtkImage* _tmp56_;
				GtkImage* _tmp57_;
				GtkImage* _tmp58_;
				GtkImage* _tmp59_;
				GtkImage* _tmp60_;
				GtkImage* _tmp61_;
				FolksPersonaStore* _tmp62_;
				ContactsStore* _tmp63_;
				FolksIndividualAggregator* _tmp64_;
				FolksIndividualAggregator* _tmp65_;
				FolksPersonaStore* _tmp66_;
				FolksPersonaStore* _tmp67_;
				AdwActionRow* _tmp68_;
				GtkImage* _tmp69_;
				AdwActionRow* _tmp70_;
				GtkImage* _tmp71_;
				AdwActionRow* _tmp72_;
				GtkImage* _tmp73_;
				GtkImage* _tmp74_;
				GtkListBox* _tmp75_;
				AdwActionRow* _tmp76_;
				gboolean _tmp77_ = FALSE;
				_tmp13_ = persona_store;
				_tmp14_ = folks_persona_store_get_id (_tmp13_);
				_tmp15_ = _tmp14_;
				if (g_strcmp0 (_tmp15_, "system-address-book") == 0) {
					FolksPersonaStore* _tmp16_;
					_tmp16_ = persona_store;
					local_store = _tmp16_;
					continue;
				}
				_tmp17_ = persona_store;
				_tmp18_ = edsf_persona_store_get_source (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, EDSF_TYPE_PERSONA_STORE, EdsfPersonaStore));
				_tmp19_ = _tmp18_;
				_tmp20_ = _g_object_ref0 (_tmp19_);
				source = _tmp20_;
				_tmp21_ = contacts_eds_source_registry;
				_tmp22_ = source;
				_tmp23_ = e_source_get_parent (_tmp22_);
				_tmp24_ = _tmp23_;
				_tmp25_ = e_source_registry_ref_source (_tmp21_, _tmp24_);
				parent_source = _tmp25_;
				_tmp26_ = persona_store;
				_tmp27_ = contacts_utils_format_persona_store_name (_tmp26_);
				provider_name = _tmp27_;
				_tmp28_ = provider_name;
				g_debug ("contacts-accounts-list.vala:89: Contact store \"%s\"", _tmp28_);
				_tmp29_ = g_strdup ("");
				source_account_id = _tmp29_;
				_tmp30_ = parent_source;
				if (e_source_has_extension (_tmp30_, E_SOURCE_EXTENSION_GOA)) {
					ESourceGoa* goa_source_ext = NULL;
					ESource* _tmp31_;
					ESourceExtension* _tmp32_;
					ESourceGoa* _tmp33_;
					ESourceGoa* _tmp34_;
					const gchar* _tmp35_;
					const gchar* _tmp36_;
					gchar* _tmp37_;
					_tmp31_ = parent_source;
					_tmp32_ = e_source_get_extension (_tmp31_, E_SOURCE_EXTENSION_GOA);
					_tmp33_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp32_, e_source_goa_get_type ()) ? ((ESourceGoa*) _tmp32_) : NULL);
					goa_source_ext = _tmp33_;
					_tmp34_ = goa_source_ext;
					_tmp35_ = e_source_goa_get_account_id (_tmp34_);
					_tmp36_ = _tmp35_;
					_tmp37_ = g_strdup (_tmp36_);
					_g_free0 (source_account_id);
					source_account_id = _tmp37_;
					_g_object_unref0 (goa_source_ext);
				}
				_tmp38_ = (AdwActionRow*) adw_action_row_new ();
				g_object_ref_sink (_tmp38_);
				row = _tmp38_;
				_tmp39_ = row;
				_tmp40_ = persona_store;
				_tmp41_ = _g_object_ref0 (_tmp40_);
				g_object_set_data_full ((GObject*) _tmp39_, "store", _tmp41_, g_object_unref);
				_tmp42_ = source_account_id;
				if (g_strcmp0 (_tmp42_, "") != 0) {
					const gchar* _tmp43_;
					GtkImage* _tmp44_;
					_tmp43_ = source_account_id;
					_tmp44_ = contacts_get_icon_for_goa_account (_tmp43_);
					_g_object_unref0 (provider_image);
					provider_image = _tmp44_;
				} else {
					GtkImage* _tmp45_;
					_tmp45_ = (GtkImage*) gtk_image_new_from_icon_name (APP_ID);
					g_object_ref_sink (_tmp45_);
					_g_object_unref0 (provider_image);
					provider_image = _tmp45_;
				}
				_tmp46_ = provider_image;
				gtk_image_set_icon_size (_tmp46_, GTK_ICON_SIZE_LARGE);
				_tmp47_ = row;
				_tmp48_ = provider_image;
				adw_action_row_add_prefix (_tmp47_, (GtkWidget*) _tmp48_);
				_tmp49_ = row;
				_tmp50_ = provider_name;
				adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp49_, _tmp50_);
				_tmp51_ = row;
				_tmp52_ = parent_source;
				_tmp53_ = e_source_get_display_name (_tmp52_);
				_tmp54_ = _tmp53_;
				adw_action_row_set_subtitle (_tmp51_, _tmp54_);
				_tmp55_ = (GtkImage*) gtk_image_new_from_icon_name ("object-select-symbolic");
				g_object_ref_sink (_tmp55_);
				checkmark = _tmp55_;
				_tmp56_ = checkmark;
				gtk_widget_set_margin_end ((GtkWidget*) _tmp56_, 6);
				_tmp57_ = checkmark;
				gtk_widget_set_valign ((GtkWidget*) _tmp57_, GTK_ALIGN_CENTER);
				_tmp58_ = checkmark;
				gtk_widget_set_halign ((GtkWidget*) _tmp58_, GTK_ALIGN_END);
				_tmp59_ = checkmark;
				gtk_widget_set_hexpand ((GtkWidget*) _tmp59_, TRUE);
				_tmp60_ = checkmark;
				gtk_widget_set_vexpand ((GtkWidget*) _tmp60_, TRUE);
				_tmp61_ = checkmark;
				_tmp62_ = persona_store;
				_tmp63_ = self->priv->contacts_store;
				_tmp64_ = contacts_store_get_aggregator (_tmp63_);
				_tmp65_ = _tmp64_;
				_tmp66_ = folks_individual_aggregator_get_primary_store (_tmp65_);
				_tmp67_ = _tmp66_;
				gtk_widget_set_visible ((GtkWidget*) _tmp61_, _tmp62_ == _tmp67_);
				_tmp68_ = row;
				_tmp69_ = checkmark;
				adw_action_row_add_suffix (_tmp68_, (GtkWidget*) _tmp69_);
				_tmp70_ = row;
				_tmp71_ = checkmark;
				adw_action_row_set_activatable_widget (_tmp70_, (GtkWidget*) _tmp71_);
				_tmp72_ = row;
				_tmp73_ = checkmark;
				_tmp74_ = _g_object_ref0 (_tmp73_);
				g_object_set_data_full ((GObject*) _tmp72_, "checkmark", _tmp74_, g_object_unref);
				_tmp75_ = self->priv->listbox;
				_tmp76_ = row;
				gtk_list_box_append (_tmp75_, (GtkWidget*) _tmp76_);
				if (select_active) {
					FolksPersonaStore* _tmp78_;
					ContactsStore* _tmp79_;
					FolksIndividualAggregator* _tmp80_;
					FolksIndividualAggregator* _tmp81_;
					FolksPersonaStore* _tmp82_;
					FolksPersonaStore* _tmp83_;
					_tmp78_ = persona_store;
					_tmp79_ = self->priv->contacts_store;
					_tmp80_ = contacts_store_get_aggregator (_tmp79_);
					_tmp81_ = _tmp80_;
					_tmp82_ = folks_individual_aggregator_get_primary_store (_tmp81_);
					_tmp83_ = _tmp82_;
					_tmp77_ = _tmp78_ == _tmp83_;
				} else {
					_tmp77_ = FALSE;
				}
				if (_tmp77_) {
					GtkListBox* _tmp84_;
					AdwActionRow* _tmp85_;
					_tmp84_ = self->priv->listbox;
					_tmp85_ = row;
					g_signal_emit_by_name (_tmp84_, "row-activated", (GtkListBoxRow*) _tmp85_);
				}
				_g_object_unref0 (checkmark);
				_g_object_unref0 (provider_image);
				_g_object_unref0 (row);
				_g_free0 (source_account_id);
				_g_free0 (provider_name);
				_g_object_unref0 (parent_source);
				_g_object_unref0 (source);
			}
		}
	}
	_tmp86_ = local_store;
	if (_tmp86_ != NULL) {
		AdwActionRow* local_row = NULL;
		AdwActionRow* _tmp87_;
		GtkImage* provider_image = NULL;
		GtkImage* _tmp88_;
		GtkImage* _tmp89_;
		AdwActionRow* _tmp90_;
		GtkImage* _tmp91_;
		AdwActionRow* _tmp92_;
		GtkImage* checkmark = NULL;
		GtkImage* _tmp93_;
		GtkImage* _tmp94_;
		GtkImage* _tmp95_;
		GtkImage* _tmp96_;
		GtkImage* _tmp97_;
		GtkImage* _tmp98_;
		GtkImage* _tmp99_;
		FolksPersonaStore* _tmp100_;
		ContactsStore* _tmp101_;
		FolksIndividualAggregator* _tmp102_;
		FolksIndividualAggregator* _tmp103_;
		FolksPersonaStore* _tmp104_;
		FolksPersonaStore* _tmp105_;
		AdwActionRow* _tmp106_;
		GtkImage* _tmp107_;
		AdwActionRow* _tmp108_;
		GtkImage* _tmp109_;
		AdwActionRow* _tmp110_;
		GtkImage* _tmp111_;
		GtkImage* _tmp112_;
		AdwActionRow* _tmp113_;
		FolksPersonaStore* _tmp114_;
		FolksPersonaStore* _tmp115_;
		GtkListBox* _tmp116_;
		AdwActionRow* _tmp117_;
		gboolean _tmp118_ = FALSE;
		_tmp87_ = (AdwActionRow*) adw_action_row_new ();
		g_object_ref_sink (_tmp87_);
		local_row = _tmp87_;
		_tmp88_ = (GtkImage*) gtk_image_new_from_icon_name (APP_ID);
		g_object_ref_sink (_tmp88_);
		provider_image = _tmp88_;
		_tmp89_ = provider_image;
		gtk_image_set_icon_size (_tmp89_, GTK_ICON_SIZE_LARGE);
		_tmp90_ = local_row;
		_tmp91_ = provider_image;
		adw_action_row_add_prefix (_tmp90_, (GtkWidget*) _tmp91_);
		_tmp92_ = local_row;
		adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp92_, _ ("Local Address Book"));
		_tmp93_ = (GtkImage*) gtk_image_new_from_icon_name ("object-select-symbolic");
		g_object_ref_sink (_tmp93_);
		checkmark = _tmp93_;
		_tmp94_ = checkmark;
		gtk_widget_set_margin_end ((GtkWidget*) _tmp94_, 6);
		_tmp95_ = checkmark;
		gtk_widget_set_valign ((GtkWidget*) _tmp95_, GTK_ALIGN_CENTER);
		_tmp96_ = checkmark;
		gtk_widget_set_halign ((GtkWidget*) _tmp96_, GTK_ALIGN_END);
		_tmp97_ = checkmark;
		gtk_widget_set_hexpand ((GtkWidget*) _tmp97_, TRUE);
		_tmp98_ = checkmark;
		gtk_widget_set_vexpand ((GtkWidget*) _tmp98_, TRUE);
		_tmp99_ = checkmark;
		_tmp100_ = local_store;
		_tmp101_ = self->priv->contacts_store;
		_tmp102_ = contacts_store_get_aggregator (_tmp101_);
		_tmp103_ = _tmp102_;
		_tmp104_ = folks_individual_aggregator_get_primary_store (_tmp103_);
		_tmp105_ = _tmp104_;
		gtk_widget_set_visible ((GtkWidget*) _tmp99_, _tmp100_ == _tmp105_);
		_tmp106_ = local_row;
		_tmp107_ = checkmark;
		adw_action_row_add_suffix (_tmp106_, (GtkWidget*) _tmp107_);
		_tmp108_ = local_row;
		_tmp109_ = checkmark;
		adw_action_row_set_activatable_widget (_tmp108_, (GtkWidget*) _tmp109_);
		_tmp110_ = local_row;
		_tmp111_ = checkmark;
		_tmp112_ = _g_object_ref0 (_tmp111_);
		g_object_set_data_full ((GObject*) _tmp110_, "checkmark", _tmp112_, g_object_unref);
		_tmp113_ = local_row;
		_tmp114_ = local_store;
		_tmp115_ = _g_object_ref0 (_tmp114_);
		g_object_set_data_full ((GObject*) _tmp113_, "store", _tmp115_, g_object_unref);
		_tmp116_ = self->priv->listbox;
		_tmp117_ = local_row;
		gtk_list_box_append (_tmp116_, (GtkWidget*) _tmp117_);
		if (select_active) {
			FolksPersonaStore* _tmp119_;
			ContactsStore* _tmp120_;
			FolksIndividualAggregator* _tmp121_;
			FolksIndividualAggregator* _tmp122_;
			FolksPersonaStore* _tmp123_;
			FolksPersonaStore* _tmp124_;
			_tmp119_ = local_store;
			_tmp120_ = self->priv->contacts_store;
			_tmp121_ = contacts_store_get_aggregator (_tmp120_);
			_tmp122_ = _tmp121_;
			_tmp123_ = folks_individual_aggregator_get_primary_store (_tmp122_);
			_tmp124_ = _tmp123_;
			_tmp118_ = _tmp119_ == _tmp124_;
		} else {
			_tmp118_ = FALSE;
		}
		if (_tmp118_) {
			GtkListBox* _tmp125_;
			AdwActionRow* _tmp126_;
			_tmp125_ = self->priv->listbox;
			_tmp126_ = local_row;
			g_signal_emit_by_name (_tmp125_, "row-activated", (GtkListBoxRow*) _tmp126_);
		}
		_g_object_unref0 (checkmark);
		_g_object_unref0 (provider_image);
		_g_object_unref0 (local_row);
	}
	eds_stores = (_vala_array_free (eds_stores, eds_stores_length1, (GDestroyNotify) g_object_unref), NULL);
}

static void
_contacts_accounts_list_on_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                     GtkListBoxRow* row,
                                                                     gpointer self)
{
	contacts_accounts_list_on_row_activated ((ContactsAccountsList*) self, _sender, row);
}

static GObject *
contacts_accounts_list_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ContactsAccountsList * self;
	GtkListBox* _tmp0_;
	parent_class = G_OBJECT_CLASS (contacts_accounts_list_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_ACCOUNTS_LIST, ContactsAccountsList);
	_tmp0_ = self->priv->listbox;
	g_signal_connect_object (_tmp0_, "row-activated", (GCallback) _contacts_accounts_list_on_row_activated_gtk_list_box_row_activated, self, 0);
	return obj;
}

static void
contacts_accounts_list_class_init (ContactsAccountsListClass * klass,
                                   gpointer klass_data)
{
	contacts_accounts_list_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ContactsAccountsList_private_offset);
	G_OBJECT_CLASS (klass)->constructor = contacts_accounts_list_constructor;
	G_OBJECT_CLASS (klass)->finalize = contacts_accounts_list_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Contacts/ui/contacts-accounts-list.ui");
	contacts_accounts_list_signals[CONTACTS_ACCOUNTS_LIST_ACCOUNT_SELECTED_SIGNAL] = g_signal_new ("account-selected", CONTACTS_TYPE_ACCOUNTS_LIST, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "listbox", FALSE, ContactsAccountsList_private_offset + G_STRUCT_OFFSET (ContactsAccountsListPrivate, listbox));
}

static void
contacts_accounts_list_instance_init (ContactsAccountsList * self,
                                      gpointer klass)
{
	self->priv = contacts_accounts_list_get_instance_private (self);
	self->priv->last_selected_row = NULL;
	self->selected_store = NULL;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
contacts_accounts_list_finalize (GObject * obj)
{
	ContactsAccountsList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_ACCOUNTS_LIST, ContactsAccountsList);
	_g_object_unref0 (self->priv->contacts_store);
	_g_object_unref0 (self->selected_store);
	G_OBJECT_CLASS (contacts_accounts_list_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
contacts_accounts_list_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ContactsAccountsListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_accounts_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsAccountsList), 0, (GInstanceInitFunc) contacts_accounts_list_instance_init, NULL };
	GType contacts_accounts_list_type_id;
	contacts_accounts_list_type_id = g_type_register_static (adw_bin_get_type (), "ContactsAccountsList", &g_define_type_info, 0);
	ContactsAccountsList_private_offset = g_type_add_instance_private (contacts_accounts_list_type_id, sizeof (ContactsAccountsListPrivate));
	return contacts_accounts_list_type_id;
}

GType
contacts_accounts_list_get_type (void)
{
	static volatile gsize contacts_accounts_list_type_id__once = 0;
	if (g_once_init_enter (&contacts_accounts_list_type_id__once)) {
		GType contacts_accounts_list_type_id;
		contacts_accounts_list_type_id = contacts_accounts_list_get_type_once ();
		g_once_init_leave (&contacts_accounts_list_type_id__once, contacts_accounts_list_type_id);
	}
	return contacts_accounts_list_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize 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,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

