/* contacts-view.c generated by valac 0.20.1, the Vala compiler
 * generated from contacts-view.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 <egg-list-box.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <folks/folks.h>
#include <pango/pango.h>
#include <glib/gi18n-lib.h>
#include <gobject/gvaluecollector.h>


#define CONTACTS_TYPE_VIEW (contacts_view_get_type ())
#define CONTACTS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_VIEW, ContactsView))
#define CONTACTS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_VIEW, ContactsViewClass))
#define CONTACTS_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_VIEW))
#define CONTACTS_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_VIEW))
#define CONTACTS_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_VIEW, ContactsViewClass))

typedef struct _ContactsView ContactsView;
typedef struct _ContactsViewClass ContactsViewClass;
typedef struct _ContactsViewPrivate ContactsViewPrivate;

#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_VIEW_TYPE_SUBSET (contacts_view_subset_get_type ())

#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 CONTACTS_VIEW_TYPE_CONTACT_DATA (contacts_view_contact_data_get_type ())
#define CONTACTS_VIEW_CONTACT_DATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_VIEW_TYPE_CONTACT_DATA, ContactsViewContactData))
#define CONTACTS_VIEW_CONTACT_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_VIEW_TYPE_CONTACT_DATA, ContactsViewContactDataClass))
#define CONTACTS_VIEW_IS_CONTACT_DATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_VIEW_TYPE_CONTACT_DATA))
#define CONTACTS_VIEW_IS_CONTACT_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_VIEW_TYPE_CONTACT_DATA))
#define CONTACTS_VIEW_CONTACT_DATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_VIEW_TYPE_CONTACT_DATA, ContactsViewContactDataClass))

typedef struct _ContactsViewContactData ContactsViewContactData;
typedef struct _ContactsViewContactDataClass ContactsViewContactDataClass;

#define CONTACTS_VIEW_TYPE_TEXT_DISPLAY (contacts_view_text_display_get_type ())
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _contacts_view_contact_data_unref0(var) ((var == NULL) ? NULL : (var = (contacts_view_contact_data_unref (var), NULL)))
typedef struct _ContactsViewContactDataPrivate ContactsViewContactDataPrivate;

#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 _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block36Data Block36Data;
typedef struct _ContactsViewParamSpecContactData ContactsViewParamSpecContactData;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _ContactsView {
	EggListBox parent_instance;
	ContactsViewPrivate * priv;
};

struct _ContactsViewClass {
	EggListBoxClass parent_class;
};

typedef enum  {
	CONTACTS_VIEW_SUBSET_MAIN,
	CONTACTS_VIEW_SUBSET_OTHER,
	CONTACTS_VIEW_SUBSET_ALL_SEPARATED,
	CONTACTS_VIEW_SUBSET_ALL
} ContactsViewSubset;

typedef enum  {
	CONTACTS_VIEW_TEXT_DISPLAY_NONE,
	CONTACTS_VIEW_TEXT_DISPLAY_PRESENCE,
	CONTACTS_VIEW_TEXT_DISPLAY_STORES
} ContactsViewTextDisplay;

struct _ContactsViewPrivate {
	ContactsStore* contacts_store;
	ContactsViewSubset show_subset;
	GeeHashMap* contacts;
	GeeHashSet* hidden_contacts;
	gint nr_contacts_marked;
	gchar** filter_values;
	gint filter_values_length1;
	gint _filter_values_size_;
	ContactsViewTextDisplay text_display;
	gboolean selectors_visible;
	GtkWidget* last_selected;
};

struct _ContactsViewContactData {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ContactsViewContactDataPrivate * priv;
	ContactsContact* contact;
	GtkGrid* grid;
	GtkLabel* label;
	ContactsContactFrame* image_frame;
	GtkCheckButton* selector_button;
	gint sort_prio;
	gchar* display_name;
	gunichar initial_letter;
	gboolean filtered;
};

struct _ContactsViewContactDataClass {
	GTypeClass parent_class;
	void (*finalize) (ContactsViewContactData *self);
};

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;
};

struct _Block36Data {
	int _ref_count_;
	ContactsView * self;
	ContactsViewContactData* data;
};

struct _ContactsViewParamSpecContactData {
	GParamSpec parent_instance;
};


static gpointer contacts_view_parent_class = NULL;
static gpointer contacts_view_contact_data_parent_class = NULL;

GType contacts_view_get_type (void) G_GNUC_CONST;
GType contacts_store_get_type (void) G_GNUC_CONST;
GType contacts_view_subset_get_type (void) G_GNUC_CONST;
GType contacts_contact_get_type (void) G_GNUC_CONST;
static gpointer contacts_view_contact_data_ref (gpointer instance);
static void contacts_view_contact_data_unref (gpointer instance);
static GParamSpec* contacts_view_param_spec_contact_data (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) G_GNUC_UNUSED;
static void contacts_view_value_set_contact_data (GValue* value, gpointer v_object) G_GNUC_UNUSED;
static void contacts_view_value_take_contact_data (GValue* value, gpointer v_object) G_GNUC_UNUSED;
static gpointer contacts_view_value_get_contact_data (const GValue* value) G_GNUC_UNUSED;
static GType contacts_view_contact_data_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
GType contacts_view_text_display_get_type (void) G_GNUC_CONST;
#define CONTACTS_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_VIEW, ContactsViewPrivate))
enum  {
	CONTACTS_VIEW_DUMMY_PROPERTY
};
ContactsView* contacts_view_new (ContactsStore* store, ContactsViewTextDisplay text_display);
ContactsView* contacts_view_construct (GType object_type, ContactsStore* store, ContactsViewTextDisplay text_display);
static gint __lambda23_ (ContactsView* self, GtkWidget* widget_a, GtkWidget* widget_b);
static gint contacts_view_compare_data (ContactsView* self, ContactsViewContactData* a_data, ContactsViewContactData* b_data);
static gint ___lambda23__gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self);
static gboolean contacts_view_filter (ContactsView* self, GtkWidget* child);
static gboolean _contacts_view_filter_egg_list_box_filter_func (GtkWidget* child, gpointer self);
static void contacts_view_update_separator (ContactsView* self, GtkWidget** separator, GtkWidget* widget, GtkWidget* before_widget);
static void _contacts_view_update_separator_egg_list_box_update_separator_func (GtkWidget** separator, GtkWidget* child, GtkWidget* before, gpointer self);
static void contacts_view_contact_added_cb (ContactsView* self, ContactsStore* store, ContactsContact* c);
static void _contacts_view_contact_added_cb_contacts_store_added (ContactsStore* _sender, ContactsContact* c, gpointer self);
static void contacts_view_contact_removed_cb (ContactsView* self, ContactsStore* store, ContactsContact* c);
static void _contacts_view_contact_removed_cb_contacts_store_removed (ContactsStore* _sender, ContactsContact* c, gpointer self);
static void contacts_view_contact_changed_cb (ContactsView* self, ContactsStore* store, ContactsContact* c);
static void _contacts_view_contact_changed_cb_contacts_store_changed (ContactsStore* _sender, ContactsContact* c, gpointer self);
GeeCollection* contacts_store_get_contacts (ContactsStore* self);
static gint contacts_view_get_sort_prio (ContactsView* self, ContactsViewContactData* data);
gboolean contacts_is_set (const gchar* str);
GType contacts_contact_frame_get_type (void) G_GNUC_CONST;
static gboolean contacts_view_is_other (ContactsView* self, ContactsViewContactData* data);
void contacts_view_set_show_subset (ContactsView* self, ContactsViewSubset subset);
static void contacts_view_update_all_filtered (ContactsView* self);
void contacts_view_set_custom_sort_prio (ContactsView* self, ContactsContact* c, gint prio);
void contacts_view_hide_contact (ContactsView* self, ContactsContact* contact);
void contacts_view_set_filter_values (ContactsView* self, gchar** values, int values_length1);
static gchar** _vala_array_dup4 (gchar** self, int length);
static gboolean contacts_view_calculate_filtered (ContactsView* self, ContactsContact* c);
gboolean contacts_contact_get_is_hidden (ContactsContact* self);
gboolean contacts_contact_contains_strings (ContactsContact* self, gchar** strings, int strings_length1);
static void contacts_view_update_data (ContactsView* self, ContactsViewContactData* data);
const gchar* contacts_contact_get_display_name (ContactsContact* self);
gunichar contacts_contact_get_initial_letter (ContactsContact* self);
void contacts_contact_frame_set_image (ContactsContactFrame* self, FolksAvatarDetails* details, ContactsContact* contact);
static Block36Data* block36_data_ref (Block36Data* _data36_);
static void block36_data_unref (void * _userdata_);
static ContactsViewContactData* contacts_view_contact_data_new (void);
static ContactsViewContactData* contacts_view_contact_data_construct (GType object_type);
#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);
GtkWidget* contacts_contact_create_merged_presence_widget (ContactsContact* self);
gchar* contacts_contact_format_persona_stores (ContactsContact* self);
static void __lambda24_ (Block36Data* _data36_);
static void ___lambda24__gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void contacts_view_real_child_selected (EggListBox* base, GtkWidget* child);
void contacts_contact_fetch_contact_info (ContactsContact* self);
void contacts_view_select_contact (ContactsView* self, ContactsContact* contact);
void contacts_view_show_selectors (ContactsView* self);
void contacts_view_hide_selectors (ContactsView* self);
GeeLinkedList* contacts_view_get_marked_contacts (ContactsView* self);
enum  {
	CONTACTS_VIEW_CONTACT_DATA_DUMMY_PROPERTY
};
static void contacts_view_contact_data_finalize (ContactsViewContactData* obj);
static void contacts_view_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


GType contacts_view_subset_get_type (void) {
	static volatile gsize contacts_view_subset_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_view_subset_type_id__volatile)) {
		static const GEnumValue values[] = {{CONTACTS_VIEW_SUBSET_MAIN, "CONTACTS_VIEW_SUBSET_MAIN", "main"}, {CONTACTS_VIEW_SUBSET_OTHER, "CONTACTS_VIEW_SUBSET_OTHER", "other"}, {CONTACTS_VIEW_SUBSET_ALL_SEPARATED, "CONTACTS_VIEW_SUBSET_ALL_SEPARATED", "all-separated"}, {CONTACTS_VIEW_SUBSET_ALL, "CONTACTS_VIEW_SUBSET_ALL", "all"}, {0, NULL, NULL}};
		GType contacts_view_subset_type_id;
		contacts_view_subset_type_id = g_enum_register_static ("ContactsViewSubset", values);
		g_once_init_leave (&contacts_view_subset_type_id__volatile, contacts_view_subset_type_id);
	}
	return contacts_view_subset_type_id__volatile;
}


GType contacts_view_text_display_get_type (void) {
	static volatile gsize contacts_view_text_display_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_view_text_display_type_id__volatile)) {
		static const GEnumValue values[] = {{CONTACTS_VIEW_TEXT_DISPLAY_NONE, "CONTACTS_VIEW_TEXT_DISPLAY_NONE", "none"}, {CONTACTS_VIEW_TEXT_DISPLAY_PRESENCE, "CONTACTS_VIEW_TEXT_DISPLAY_PRESENCE", "presence"}, {CONTACTS_VIEW_TEXT_DISPLAY_STORES, "CONTACTS_VIEW_TEXT_DISPLAY_STORES", "stores"}, {0, NULL, NULL}};
		GType contacts_view_text_display_type_id;
		contacts_view_text_display_type_id = g_enum_register_static ("ContactsViewTextDisplay", values);
		g_once_init_leave (&contacts_view_text_display_type_id__volatile, contacts_view_text_display_type_id);
	}
	return contacts_view_text_display_type_id__volatile;
}


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


static gpointer _contacts_view_contact_data_ref0 (gpointer self) {
	return self ? contacts_view_contact_data_ref (self) : NULL;
}


static gint __lambda23_ (ContactsView* self, GtkWidget* widget_a, GtkWidget* widget_b) {
	gint result = 0;
	GtkWidget* _tmp0_;
	gconstpointer _tmp1_ = NULL;
	ContactsViewContactData* _tmp2_;
	ContactsViewContactData* a;
	GtkWidget* _tmp3_;
	gconstpointer _tmp4_ = NULL;
	ContactsViewContactData* _tmp5_;
	ContactsViewContactData* b;
	gint _tmp6_ = 0;
	g_return_val_if_fail (widget_a != NULL, 0);
	g_return_val_if_fail (widget_b != NULL, 0);
	_tmp0_ = widget_a;
	_tmp1_ = g_object_get_data ((GObject*) _tmp0_, "data");
	_tmp2_ = _contacts_view_contact_data_ref0 ((ContactsViewContactData*) _tmp1_);
	a = _tmp2_;
	_tmp3_ = widget_b;
	_tmp4_ = g_object_get_data ((GObject*) _tmp3_, "data");
	_tmp5_ = _contacts_view_contact_data_ref0 ((ContactsViewContactData*) _tmp4_);
	b = _tmp5_;
	_tmp6_ = contacts_view_compare_data (self, a, b);
	result = _tmp6_;
	_contacts_view_contact_data_unref0 (b);
	_contacts_view_contact_data_unref0 (a);
	return result;
}


static gint ___lambda23__gcompare_data_func (gconstpointer a, gconstpointer b, gpointer self) {
	gint result;
	result = __lambda23_ (self, a, b);
	return result;
}


static gboolean _contacts_view_filter_egg_list_box_filter_func (GtkWidget* child, gpointer self) {
	gboolean result;
	result = contacts_view_filter (self, child);
	return result;
}


static void _contacts_view_update_separator_egg_list_box_update_separator_func (GtkWidget** separator, GtkWidget* child, GtkWidget* before, gpointer self) {
	contacts_view_update_separator (self, separator, child, before);
}


static void _contacts_view_contact_added_cb_contacts_store_added (ContactsStore* _sender, ContactsContact* c, gpointer self) {
	contacts_view_contact_added_cb (self, _sender, c);
}


static void _contacts_view_contact_removed_cb_contacts_store_removed (ContactsStore* _sender, ContactsContact* c, gpointer self) {
	contacts_view_contact_removed_cb (self, _sender, c);
}


static void _contacts_view_contact_changed_cb_contacts_store_changed (ContactsStore* _sender, ContactsContact* c, gpointer self) {
	contacts_view_contact_changed_cb (self, _sender, c);
}


ContactsView* contacts_view_construct (GType object_type, ContactsStore* store, ContactsViewTextDisplay text_display) {
	ContactsView * self = NULL;
	ContactsStore* _tmp0_;
	ContactsStore* _tmp1_;
	GeeHashSet* _tmp2_;
	ContactsViewTextDisplay _tmp3_;
	GeeHashMap* _tmp4_;
	ContactsStore* _tmp5_;
	ContactsStore* _tmp6_;
	ContactsStore* _tmp7_;
	g_return_val_if_fail (store != NULL, NULL);
	self = (ContactsView*) g_object_new (object_type, NULL);
	egg_list_box_set_selection_mode ((EggListBox*) self, GTK_SELECTION_BROWSE);
	_tmp0_ = store;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->contacts_store);
	self->priv->contacts_store = _tmp1_;
	_tmp2_ = gee_hash_set_new (CONTACTS_TYPE_CONTACT, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->hidden_contacts);
	self->priv->hidden_contacts = _tmp2_;
	self->priv->nr_contacts_marked = 0;
	self->priv->show_subset = CONTACTS_VIEW_SUBSET_ALL;
	_tmp3_ = text_display;
	self->priv->text_display = _tmp3_;
	_tmp4_ = gee_hash_map_new (CONTACTS_TYPE_CONTACT, (GBoxedCopyFunc) g_object_ref, g_object_unref, CONTACTS_VIEW_TYPE_CONTACT_DATA, (GBoxedCopyFunc) contacts_view_contact_data_ref, contacts_view_contact_data_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->contacts);
	self->priv->contacts = _tmp4_;
	egg_list_box_set_sort_func ((EggListBox*) self, ___lambda23__gcompare_data_func, g_object_ref (self), g_object_unref);
	egg_list_box_set_filter_func ((EggListBox*) self, _contacts_view_filter_egg_list_box_filter_func, g_object_ref (self), g_object_unref);
	egg_list_box_set_separator_funcs ((EggListBox*) self, _contacts_view_update_separator_egg_list_box_update_separator_func, g_object_ref (self), g_object_unref);
	self->priv->selectors_visible = FALSE;
	_tmp5_ = self->priv->contacts_store;
	g_signal_connect_object (_tmp5_, "added", (GCallback) _contacts_view_contact_added_cb_contacts_store_added, self, 0);
	_tmp6_ = self->priv->contacts_store;
	g_signal_connect_object (_tmp6_, "removed", (GCallback) _contacts_view_contact_removed_cb_contacts_store_removed, self, 0);
	_tmp7_ = self->priv->contacts_store;
	g_signal_connect_object (_tmp7_, "changed", (GCallback) _contacts_view_contact_changed_cb_contacts_store_changed, self, 0);
	{
		ContactsStore* _tmp8_;
		GeeCollection* _tmp9_ = NULL;
		GeeCollection* _tmp10_;
		GeeIterator* _tmp11_ = NULL;
		GeeIterator* _tmp12_;
		GeeIterator* _c_it;
		_tmp8_ = store;
		_tmp9_ = contacts_store_get_contacts (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = gee_iterable_iterator ((GeeIterable*) _tmp10_);
		_tmp12_ = _tmp11_;
		_g_object_unref0 (_tmp10_);
		_c_it = _tmp12_;
		while (TRUE) {
			GeeIterator* _tmp13_;
			gboolean _tmp14_ = FALSE;
			GeeIterator* _tmp15_;
			gpointer _tmp16_ = NULL;
			ContactsContact* c;
			ContactsStore* _tmp17_;
			ContactsContact* _tmp18_;
			_tmp13_ = _c_it;
			_tmp14_ = gee_iterator_next (_tmp13_);
			if (!_tmp14_) {
				break;
			}
			_tmp15_ = _c_it;
			_tmp16_ = gee_iterator_get (_tmp15_);
			c = (ContactsContact*) _tmp16_;
			_tmp17_ = store;
			_tmp18_ = c;
			contacts_view_contact_added_cb (self, _tmp17_, _tmp18_);
			_g_object_unref0 (c);
		}
		_g_object_unref0 (_c_it);
	}
	return self;
}


ContactsView* contacts_view_new (ContactsStore* store, ContactsViewTextDisplay text_display) {
	return contacts_view_construct (CONTACTS_TYPE_VIEW, store, text_display);
}


static gint contacts_view_compare_data (ContactsView* self, ContactsViewContactData* a_data, ContactsViewContactData* b_data) {
	gint result = 0;
	ContactsViewContactData* _tmp0_;
	gint _tmp1_ = 0;
	gint a_prio;
	ContactsViewContactData* _tmp2_;
	gint _tmp3_ = 0;
	gint b_prio;
	gint _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gboolean _tmp8_ = FALSE;
	ContactsViewContactData* _tmp9_;
	const gchar* _tmp10_;
	gboolean _tmp11_ = FALSE;
	gboolean _tmp15_;
	ContactsViewContactData* _tmp21_;
	const gchar* _tmp22_;
	gboolean _tmp23_ = FALSE;
	ContactsViewContactData* _tmp24_;
	const gchar* _tmp25_;
	gboolean _tmp26_ = FALSE;
	g_return_val_if_fail (self != NULL, 0);
	g_return_val_if_fail (a_data != NULL, 0);
	g_return_val_if_fail (b_data != NULL, 0);
	_tmp0_ = a_data;
	_tmp1_ = contacts_view_get_sort_prio (self, _tmp0_);
	a_prio = _tmp1_;
	_tmp2_ = b_data;
	_tmp3_ = contacts_view_get_sort_prio (self, _tmp2_);
	b_prio = _tmp3_;
	_tmp4_ = a_prio;
	_tmp5_ = b_prio;
	if (_tmp4_ > _tmp5_) {
		result = -1;
		return result;
	}
	_tmp6_ = a_prio;
	_tmp7_ = b_prio;
	if (_tmp6_ < _tmp7_) {
		result = 1;
		return result;
	}
	_tmp9_ = a_data;
	_tmp10_ = _tmp9_->display_name;
	_tmp11_ = contacts_is_set (_tmp10_);
	if (_tmp11_) {
		ContactsViewContactData* _tmp12_;
		const gchar* _tmp13_;
		gboolean _tmp14_ = FALSE;
		_tmp12_ = b_data;
		_tmp13_ = _tmp12_->display_name;
		_tmp14_ = contacts_is_set (_tmp13_);
		_tmp8_ = _tmp14_;
	} else {
		_tmp8_ = FALSE;
	}
	_tmp15_ = _tmp8_;
	if (_tmp15_) {
		ContactsViewContactData* _tmp16_;
		const gchar* _tmp17_;
		ContactsViewContactData* _tmp18_;
		const gchar* _tmp19_;
		gint _tmp20_ = 0;
		_tmp16_ = a_data;
		_tmp17_ = _tmp16_->display_name;
		_tmp18_ = b_data;
		_tmp19_ = _tmp18_->display_name;
		_tmp20_ = g_utf8_collate (_tmp17_, _tmp19_);
		result = _tmp20_;
		return result;
	}
	_tmp21_ = a_data;
	_tmp22_ = _tmp21_->display_name;
	_tmp23_ = contacts_is_set (_tmp22_);
	if (_tmp23_) {
		result = -1;
		return result;
	}
	_tmp24_ = b_data;
	_tmp25_ = _tmp24_->display_name;
	_tmp26_ = contacts_is_set (_tmp25_);
	if (_tmp26_) {
		result = 1;
		return result;
	}
	result = 0;
	return result;
}


static gboolean contacts_view_is_other (ContactsView* self, ContactsViewContactData* data) {
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	ContactsViewSubset _tmp2_;
	gboolean _tmp5_;
	gboolean _tmp9_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (data != NULL, FALSE);
	_tmp2_ = self->priv->show_subset;
	if (_tmp2_ == CONTACTS_VIEW_SUBSET_ALL_SEPARATED) {
		ContactsViewContactData* _tmp3_;
		ContactsContact* _tmp4_;
		_tmp3_ = data;
		_tmp4_ = _tmp3_->contact;
		_tmp1_ = _tmp4_ != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	_tmp5_ = _tmp1_;
	if (_tmp5_) {
		ContactsViewContactData* _tmp6_;
		ContactsContact* _tmp7_;
		gboolean _tmp8_;
		_tmp6_ = data;
		_tmp7_ = _tmp6_->contact;
		_tmp8_ = _tmp7_->is_main;
		_tmp0_ = !_tmp8_;
	} else {
		_tmp0_ = FALSE;
	}
	_tmp9_ = _tmp0_;
	if (_tmp9_) {
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}


static gint contacts_view_get_sort_prio (ContactsView* self, ContactsViewContactData* data) {
	gint result = 0;
	ContactsViewContactData* _tmp0_;
	gint _tmp1_;
	ContactsViewContactData* _tmp4_;
	gboolean _tmp5_ = FALSE;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = data;
	_tmp1_ = _tmp0_->sort_prio;
	if (_tmp1_ != 0) {
		ContactsViewContactData* _tmp2_;
		gint _tmp3_;
		_tmp2_ = data;
		_tmp3_ = _tmp2_->sort_prio;
		result = _tmp3_;
		return result;
	}
	_tmp4_ = data;
	_tmp5_ = contacts_view_is_other (self, _tmp4_);
	if (_tmp5_) {
		result = -1;
		return result;
	}
	result = 0;
	return result;
}


void contacts_view_set_show_subset (ContactsView* self, ContactsViewSubset subset) {
	ContactsViewSubset _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = subset;
	self->priv->show_subset = _tmp0_;
	contacts_view_update_all_filtered (self);
	egg_list_box_refilter ((EggListBox*) self);
	egg_list_box_resort ((EggListBox*) self);
}


void contacts_view_set_custom_sort_prio (ContactsView* self, ContactsContact* c, gint prio) {
	gint _tmp0_;
	GeeHashMap* _tmp1_;
	ContactsContact* _tmp2_;
	gpointer _tmp3_ = NULL;
	ContactsViewContactData* data;
	ContactsViewContactData* _tmp4_;
	ContactsViewContactData* _tmp5_;
	gint _tmp6_;
	ContactsViewContactData* _tmp7_;
	GtkGrid* _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	_tmp0_ = prio;
	_vala_assert (_tmp0_ >= 0, "prio >= 0");
	_tmp1_ = self->priv->contacts;
	_tmp2_ = c;
	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, _tmp2_);
	data = (ContactsViewContactData*) _tmp3_;
	_tmp4_ = data;
	if (_tmp4_ == NULL) {
		_contacts_view_contact_data_unref0 (data);
		return;
	}
	_tmp5_ = data;
	_tmp6_ = prio;
	_tmp5_->sort_prio = _tmp6_;
	_tmp7_ = data;
	_tmp8_ = _tmp7_->grid;
	egg_list_box_child_changed ((EggListBox*) self, (GtkWidget*) _tmp8_);
	_contacts_view_contact_data_unref0 (data);
}


void contacts_view_hide_contact (ContactsView* self, ContactsContact* contact) {
	GeeHashSet* _tmp0_;
	ContactsContact* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (contact != NULL);
	_tmp0_ = self->priv->hidden_contacts;
	_tmp1_ = contact;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp1_);
	contacts_view_update_all_filtered (self);
	egg_list_box_refilter ((EggListBox*) self);
}


static gchar** _vala_array_dup4 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


void contacts_view_set_filter_values (ContactsView* self, gchar** values, int values_length1) {
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = values;
	_tmp0__length1 = values_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup4 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_);
	_tmp1__length1 = _tmp0__length1;
	self->priv->filter_values = (_vala_array_free (self->priv->filter_values, self->priv->filter_values_length1, (GDestroyNotify) g_free), NULL);
	self->priv->filter_values = _tmp1_;
	self->priv->filter_values_length1 = _tmp1__length1;
	self->priv->_filter_values_size_ = self->priv->filter_values_length1;
	contacts_view_update_all_filtered (self);
	egg_list_box_refilter ((EggListBox*) self);
}


static gboolean contacts_view_calculate_filtered (ContactsView* self, ContactsContact* c) {
	gboolean result = FALSE;
	ContactsContact* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GeeHashSet* _tmp3_;
	ContactsContact* _tmp4_;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	ContactsViewSubset _tmp8_;
	gboolean _tmp11_;
	gboolean _tmp17_;
	gboolean _tmp18_ = FALSE;
	gchar** _tmp19_;
	gint _tmp19__length1;
	gboolean _tmp21_;
	ContactsContact* _tmp22_;
	gchar** _tmp23_;
	gint _tmp23__length1;
	gboolean _tmp24_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (c != NULL, FALSE);
	_tmp0_ = c;
	_tmp1_ = contacts_contact_get_is_hidden (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		result = FALSE;
		return result;
	}
	_tmp3_ = self->priv->hidden_contacts;
	_tmp4_ = c;
	_tmp5_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp3_, _tmp4_);
	if (_tmp5_) {
		result = FALSE;
		return result;
	}
	_tmp8_ = self->priv->show_subset;
	if (_tmp8_ == CONTACTS_VIEW_SUBSET_MAIN) {
		ContactsContact* _tmp9_;
		gboolean _tmp10_;
		_tmp9_ = c;
		_tmp10_ = _tmp9_->is_main;
		_tmp7_ = !_tmp10_;
	} else {
		_tmp7_ = FALSE;
	}
	_tmp11_ = _tmp7_;
	if (_tmp11_) {
		_tmp6_ = TRUE;
	} else {
		gboolean _tmp12_ = FALSE;
		ContactsViewSubset _tmp13_;
		gboolean _tmp16_;
		_tmp13_ = self->priv->show_subset;
		if (_tmp13_ == CONTACTS_VIEW_SUBSET_OTHER) {
			ContactsContact* _tmp14_;
			gboolean _tmp15_;
			_tmp14_ = c;
			_tmp15_ = _tmp14_->is_main;
			_tmp12_ = _tmp15_;
		} else {
			_tmp12_ = FALSE;
		}
		_tmp16_ = _tmp12_;
		_tmp6_ = _tmp16_;
	}
	_tmp17_ = _tmp6_;
	if (_tmp17_) {
		result = FALSE;
		return result;
	}
	_tmp19_ = self->priv->filter_values;
	_tmp19__length1 = self->priv->filter_values_length1;
	if (_tmp19_ == NULL) {
		_tmp18_ = TRUE;
	} else {
		gchar** _tmp20_;
		gint _tmp20__length1;
		_tmp20_ = self->priv->filter_values;
		_tmp20__length1 = self->priv->filter_values_length1;
		_tmp18_ = _tmp20__length1 == 0;
	}
	_tmp21_ = _tmp18_;
	if (_tmp21_) {
		result = TRUE;
		return result;
	}
	_tmp22_ = c;
	_tmp23_ = self->priv->filter_values;
	_tmp23__length1 = self->priv->filter_values_length1;
	_tmp24_ = contacts_contact_contains_strings (_tmp22_, _tmp23_, _tmp23__length1);
	result = _tmp24_;
	return result;
}


static void contacts_view_update_data (ContactsView* self, ContactsViewContactData* data) {
	ContactsViewContactData* _tmp0_;
	ContactsContact* _tmp1_;
	ContactsContact* _tmp2_;
	ContactsContact* c;
	ContactsViewContactData* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	ContactsViewContactData* _tmp7_;
	gunichar _tmp8_;
	gunichar _tmp9_;
	ContactsViewContactData* _tmp10_;
	gboolean _tmp11_ = FALSE;
	ContactsViewContactData* _tmp12_;
	GtkLabel* _tmp13_;
	ContactsViewContactData* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_ = NULL;
	gchar* _tmp17_;
	ContactsViewContactData* _tmp18_;
	ContactsContactFrame* _tmp19_;
	FolksIndividual* _tmp20_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (data != NULL);
	_tmp0_ = data;
	_tmp1_ = _tmp0_->contact;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	c = _tmp2_;
	_tmp3_ = data;
	_tmp4_ = contacts_contact_get_display_name (c);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strdup (_tmp5_);
	_g_free0 (_tmp3_->display_name);
	_tmp3_->display_name = _tmp6_;
	_tmp7_ = data;
	_tmp8_ = contacts_contact_get_initial_letter (c);
	_tmp9_ = _tmp8_;
	_tmp7_->initial_letter = _tmp9_;
	_tmp10_ = data;
	_tmp11_ = contacts_view_calculate_filtered (self, c);
	_tmp10_->filtered = _tmp11_;
	_tmp12_ = data;
	_tmp13_ = _tmp12_->label;
	_tmp14_ = data;
	_tmp15_ = _tmp14_->display_name;
	_tmp16_ = g_markup_printf_escaped ("<span font='16px'>%s</span>", _tmp15_);
	_tmp17_ = _tmp16_;
	gtk_label_set_markup (_tmp13_, _tmp17_);
	_g_free0 (_tmp17_);
	_tmp18_ = data;
	_tmp19_ = _tmp18_->image_frame;
	_tmp20_ = c->individual;
	contacts_contact_frame_set_image (_tmp19_, (FolksAvatarDetails*) _tmp20_, c);
	_g_object_unref0 (c);
}


static void contacts_view_update_all_filtered (ContactsView* self) {
	g_return_if_fail (self != NULL);
	{
		GeeHashMap* _tmp0_;
		GeeCollection* _tmp1_;
		GeeCollection* _tmp2_;
		GeeCollection* _tmp3_;
		GeeIterator* _tmp4_ = NULL;
		GeeIterator* _tmp5_;
		GeeIterator* _data_it;
		_tmp0_ = self->priv->contacts;
		_tmp1_ = gee_abstract_map_get_values ((GeeMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_data_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			gboolean _tmp7_ = FALSE;
			GeeIterator* _tmp8_;
			gpointer _tmp9_ = NULL;
			ContactsViewContactData* data;
			ContactsViewContactData* _tmp10_;
			ContactsViewContactData* _tmp11_;
			ContactsContact* _tmp12_;
			gboolean _tmp13_ = FALSE;
			_tmp6_ = _data_it;
			_tmp7_ = gee_iterator_next (_tmp6_);
			if (!_tmp7_) {
				break;
			}
			_tmp8_ = _data_it;
			_tmp9_ = gee_iterator_get (_tmp8_);
			data = (ContactsViewContactData*) _tmp9_;
			_tmp10_ = data;
			_tmp11_ = data;
			_tmp12_ = _tmp11_->contact;
			_tmp13_ = contacts_view_calculate_filtered (self, _tmp12_);
			_tmp10_->filtered = _tmp13_;
			_contacts_view_contact_data_unref0 (data);
		}
		_g_object_unref0 (_data_it);
	}
}


static void contacts_view_contact_changed_cb (ContactsView* self, ContactsStore* store, ContactsContact* c) {
	GeeHashMap* _tmp0_;
	ContactsContact* _tmp1_;
	gpointer _tmp2_ = NULL;
	ContactsViewContactData* data;
	GtkGrid* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (store != NULL);
	g_return_if_fail (c != NULL);
	_tmp0_ = self->priv->contacts;
	_tmp1_ = c;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, _tmp1_);
	data = (ContactsViewContactData*) _tmp2_;
	contacts_view_update_data (self, data);
	_tmp3_ = data->grid;
	egg_list_box_child_changed ((EggListBox*) self, (GtkWidget*) _tmp3_);
	_contacts_view_contact_data_unref0 (data);
}


static Block36Data* block36_data_ref (Block36Data* _data36_) {
	g_atomic_int_inc (&_data36_->_ref_count_);
	return _data36_;
}


static void block36_data_unref (void * _userdata_) {
	Block36Data* _data36_;
	_data36_ = (Block36Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data36_->_ref_count_)) {
		ContactsView * self;
		self = _data36_->self;
		_contacts_view_contact_data_unref0 (_data36_->data);
		_g_object_unref0 (self);
		g_slice_free (Block36Data, _data36_);
	}
}


static void __lambda24_ (Block36Data* _data36_) {
	ContactsView * self;
	ContactsViewContactData* _tmp0_;
	GtkCheckButton* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gint _tmp6_;
	self = _data36_->self;
	_tmp0_ = _data36_->data;
	_tmp1_ = _tmp0_->selector_button;
	_tmp2_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		gint _tmp4_;
		_tmp4_ = self->priv->nr_contacts_marked;
		self->priv->nr_contacts_marked = _tmp4_ + 1;
	} else {
		gint _tmp5_;
		_tmp5_ = self->priv->nr_contacts_marked;
		self->priv->nr_contacts_marked = _tmp5_ - 1;
	}
	_tmp6_ = self->priv->nr_contacts_marked;
	g_signal_emit_by_name (self, "contacts-marked", _tmp6_);
}


static void ___lambda24__gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
	__lambda24_ (self);
}


static void contacts_view_contact_added_cb (ContactsView* self, ContactsStore* store, ContactsContact* c) {
	Block36Data* _data36_;
	ContactsViewContactData* _tmp0_;
	ContactsViewContactData* _tmp1_;
	ContactsContact* _tmp2_;
	ContactsContact* _tmp3_;
	ContactsViewContactData* _tmp4_;
	GtkGrid* _tmp5_;
	ContactsViewContactData* _tmp6_;
	GtkGrid* _tmp7_;
	ContactsViewContactData* _tmp8_;
	GtkGrid* _tmp9_;
	ContactsViewContactData* _tmp10_;
	ContactsContactFrame* _tmp11_;
	ContactsViewContactData* _tmp12_;
	GtkLabel* _tmp13_;
	ContactsViewContactData* _tmp14_;
	GtkLabel* _tmp15_;
	ContactsViewContactData* _tmp16_;
	GtkLabel* _tmp17_;
	ContactsViewContactData* _tmp18_;
	GtkLabel* _tmp19_;
	ContactsViewContactData* _tmp20_;
	GtkCheckButton* _tmp21_;
	ContactsViewContactData* _tmp22_;
	GtkCheckButton* _tmp23_;
	ContactsViewContactData* _tmp24_;
	GtkCheckButton* _tmp25_;
	ContactsViewContactData* _tmp26_;
	GtkCheckButton* _tmp27_;
	ContactsViewContactData* _tmp28_;
	GtkGrid* _tmp29_;
	ContactsViewContactData* _tmp30_;
	ContactsContactFrame* _tmp31_;
	ContactsViewContactData* _tmp32_;
	GtkGrid* _tmp33_;
	ContactsViewContactData* _tmp34_;
	GtkLabel* _tmp35_;
	ContactsViewContactData* _tmp36_;
	GtkGrid* _tmp37_;
	ContactsViewContactData* _tmp38_;
	GtkCheckButton* _tmp39_;
	ContactsViewTextDisplay _tmp40_;
	ContactsViewTextDisplay _tmp50_;
	ContactsViewContactData* _tmp63_;
	ContactsViewContactData* _tmp64_;
	GtkCheckButton* _tmp65_;
	ContactsViewContactData* _tmp66_;
	GtkGrid* _tmp67_;
	ContactsViewContactData* _tmp68_;
	ContactsViewContactData* _tmp69_;
	ContactsViewContactData* _tmp70_;
	GtkGrid* _tmp71_;
	gboolean _tmp72_;
	GeeHashMap* _tmp75_;
	ContactsContact* _tmp76_;
	ContactsViewContactData* _tmp77_;
	ContactsViewContactData* _tmp78_;
	GtkGrid* _tmp79_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (store != NULL);
	g_return_if_fail (c != NULL);
	_data36_ = g_slice_new0 (Block36Data);
	_data36_->_ref_count_ = 1;
	_data36_->self = g_object_ref (self);
	_tmp0_ = contacts_view_contact_data_new ();
	_data36_->data = _tmp0_;
	_tmp1_ = _data36_->data;
	_tmp2_ = c;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (_tmp1_->contact);
	_tmp1_->contact = _tmp3_;
	_tmp4_ = _data36_->data;
	_tmp5_ = (GtkGrid*) gtk_grid_new ();
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (_tmp4_->grid);
	_tmp4_->grid = _tmp5_;
	_tmp6_ = _data36_->data;
	_tmp7_ = _tmp6_->grid;
	g_object_set ((GtkWidget*) _tmp7_, "margin", 12, NULL);
	_tmp8_ = _data36_->data;
	_tmp9_ = _tmp8_->grid;
	gtk_grid_set_column_spacing (_tmp9_, (guint) 10);
	_tmp10_ = _data36_->data;
	_tmp11_ = contacts_contact_frame_new (CONTACTS_CONTACT_SMALL_AVATAR_SIZE, FALSE);
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (_tmp10_->image_frame);
	_tmp10_->image_frame = _tmp11_;
	_tmp12_ = _data36_->data;
	_tmp13_ = (GtkLabel*) gtk_label_new ("");
	g_object_ref_sink (_tmp13_);
	_g_object_unref0 (_tmp12_->label);
	_tmp12_->label = _tmp13_;
	_tmp14_ = _data36_->data;
	_tmp15_ = _tmp14_->label;
	gtk_label_set_ellipsize (_tmp15_, PANGO_ELLIPSIZE_END);
	_tmp16_ = _data36_->data;
	_tmp17_ = _tmp16_->label;
	gtk_widget_set_valign ((GtkWidget*) _tmp17_, GTK_ALIGN_START);
	_tmp18_ = _data36_->data;
	_tmp19_ = _tmp18_->label;
	gtk_widget_set_halign ((GtkWidget*) _tmp19_, GTK_ALIGN_START);
	_tmp20_ = _data36_->data;
	_tmp21_ = (GtkCheckButton*) gtk_check_button_new ();
	g_object_ref_sink (_tmp21_);
	_g_object_unref0 (_tmp20_->selector_button);
	_tmp20_->selector_button = _tmp21_;
	_tmp22_ = _data36_->data;
	_tmp23_ = _tmp22_->selector_button;
	gtk_widget_set_valign ((GtkWidget*) _tmp23_, GTK_ALIGN_CENTER);
	_tmp24_ = _data36_->data;
	_tmp25_ = _tmp24_->selector_button;
	gtk_widget_set_halign ((GtkWidget*) _tmp25_, GTK_ALIGN_END);
	_tmp26_ = _data36_->data;
	_tmp27_ = _tmp26_->selector_button;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp27_, TRUE);
	_tmp28_ = _data36_->data;
	_tmp29_ = _tmp28_->grid;
	_tmp30_ = _data36_->data;
	_tmp31_ = _tmp30_->image_frame;
	gtk_grid_attach (_tmp29_, (GtkWidget*) _tmp31_, 0, 0, 1, 2);
	_tmp32_ = _data36_->data;
	_tmp33_ = _tmp32_->grid;
	_tmp34_ = _data36_->data;
	_tmp35_ = _tmp34_->label;
	gtk_grid_attach (_tmp33_, (GtkWidget*) _tmp35_, 1, 0, 1, 1);
	_tmp36_ = _data36_->data;
	_tmp37_ = _tmp36_->grid;
	_tmp38_ = _data36_->data;
	_tmp39_ = _tmp38_->selector_button;
	gtk_grid_attach (_tmp37_, (GtkWidget*) _tmp39_, 2, 0, 1, 2);
	_tmp40_ = self->priv->text_display;
	if (_tmp40_ == CONTACTS_VIEW_TEXT_DISPLAY_PRESENCE) {
		ContactsContact* _tmp41_;
		GtkWidget* _tmp42_ = NULL;
		GtkWidget* merged_presence;
		GtkWidget* _tmp43_;
		GtkWidget* _tmp44_;
		GtkWidget* _tmp45_;
		GtkWidget* _tmp46_;
		ContactsViewContactData* _tmp47_;
		GtkGrid* _tmp48_;
		GtkWidget* _tmp49_;
		_tmp41_ = c;
		_tmp42_ = contacts_contact_create_merged_presence_widget (_tmp41_);
		merged_presence = _tmp42_;
		_tmp43_ = merged_presence;
		gtk_widget_set_halign (_tmp43_, GTK_ALIGN_START);
		_tmp44_ = merged_presence;
		gtk_widget_set_valign (_tmp44_, GTK_ALIGN_END);
		_tmp45_ = merged_presence;
		gtk_widget_set_vexpand (_tmp45_, FALSE);
		_tmp46_ = merged_presence;
		gtk_widget_set_margin_bottom (_tmp46_, 4);
		_tmp47_ = _data36_->data;
		_tmp48_ = _tmp47_->grid;
		_tmp49_ = merged_presence;
		gtk_grid_attach (_tmp48_, _tmp49_, 1, 1, 1, 1);
		_g_object_unref0 (merged_presence);
	}
	_tmp50_ = self->priv->text_display;
	if (_tmp50_ == CONTACTS_VIEW_TEXT_DISPLAY_STORES) {
		GtkLabel* _tmp51_;
		GtkLabel* stores;
		GtkLabel* _tmp52_;
		ContactsContact* _tmp53_;
		gchar* _tmp54_ = NULL;
		gchar* _tmp55_;
		gchar* _tmp56_ = NULL;
		gchar* _tmp57_;
		GtkLabel* _tmp58_;
		GtkLabel* _tmp59_;
		ContactsViewContactData* _tmp60_;
		GtkGrid* _tmp61_;
		GtkLabel* _tmp62_;
		_tmp51_ = (GtkLabel*) gtk_label_new ("");
		g_object_ref_sink (_tmp51_);
		stores = _tmp51_;
		_tmp52_ = stores;
		_tmp53_ = c;
		_tmp54_ = contacts_contact_format_persona_stores (_tmp53_);
		_tmp55_ = _tmp54_;
		_tmp56_ = g_markup_printf_escaped ("<span font='12px'>%s</span>", _tmp55_);
		_tmp57_ = _tmp56_;
		gtk_label_set_markup (_tmp52_, _tmp57_);
		_g_free0 (_tmp57_);
		_g_free0 (_tmp55_);
		_tmp58_ = stores;
		gtk_label_set_ellipsize (_tmp58_, PANGO_ELLIPSIZE_END);
		_tmp59_ = stores;
		gtk_widget_set_halign ((GtkWidget*) _tmp59_, GTK_ALIGN_START);
		_tmp60_ = _data36_->data;
		_tmp61_ = _tmp60_->grid;
		_tmp62_ = stores;
		gtk_grid_attach (_tmp61_, (GtkWidget*) _tmp62_, 1, 1, 1, 1);
		_g_object_unref0 (stores);
	}
	_tmp63_ = _data36_->data;
	contacts_view_update_data (self, _tmp63_);
	_tmp64_ = _data36_->data;
	_tmp65_ = _tmp64_->selector_button;
	g_signal_connect_data ((GtkToggleButton*) _tmp65_, "toggled", (GCallback) ___lambda24__gtk_toggle_button_toggled, block36_data_ref (_data36_), (GClosureNotify) block36_data_unref, 0);
	_tmp66_ = _data36_->data;
	_tmp67_ = _tmp66_->grid;
	_tmp68_ = _data36_->data;
	_tmp69_ = _contacts_view_contact_data_ref0 (_tmp68_);
	g_object_set_data_full ((GObject*) _tmp67_, "data", _tmp69_, contacts_view_contact_data_unref);
	_tmp70_ = _data36_->data;
	_tmp71_ = _tmp70_->grid;
	gtk_widget_show_all ((GtkWidget*) _tmp71_);
	_tmp72_ = self->priv->selectors_visible;
	if (!_tmp72_) {
		ContactsViewContactData* _tmp73_;
		GtkCheckButton* _tmp74_;
		_tmp73_ = _data36_->data;
		_tmp74_ = _tmp73_->selector_button;
		gtk_widget_hide ((GtkWidget*) _tmp74_);
	}
	_tmp75_ = self->priv->contacts;
	_tmp76_ = c;
	_tmp77_ = _data36_->data;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp75_, _tmp76_, _tmp77_);
	_tmp78_ = _data36_->data;
	_tmp79_ = _tmp78_->grid;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp79_);
	block36_data_unref (_data36_);
	_data36_ = NULL;
}


static void contacts_view_contact_removed_cb (ContactsView* self, ContactsStore* store, ContactsContact* c) {
	GeeHashMap* _tmp0_;
	ContactsContact* _tmp1_;
	gpointer _tmp2_ = NULL;
	ContactsViewContactData* data;
	GtkGrid* _tmp3_;
	GtkLabel* _tmp4_;
	ContactsContactFrame* _tmp5_;
	GeeHashMap* _tmp6_;
	ContactsContact* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (store != NULL);
	g_return_if_fail (c != NULL);
	_tmp0_ = self->priv->contacts;
	_tmp1_ = c;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, _tmp1_);
	data = (ContactsViewContactData*) _tmp2_;
	_tmp3_ = data->grid;
	gtk_widget_destroy ((GtkWidget*) _tmp3_);
	_tmp4_ = data->label;
	gtk_widget_destroy ((GtkWidget*) _tmp4_);
	_tmp5_ = data->image_frame;
	gtk_widget_destroy ((GtkWidget*) _tmp5_);
	_tmp6_ = self->priv->contacts;
	_tmp7_ = c;
	gee_abstract_map_unset ((GeeAbstractMap*) _tmp6_, _tmp7_, NULL);
	_contacts_view_contact_data_unref0 (data);
}


static void contacts_view_real_child_selected (EggListBox* base, GtkWidget* child) {
	ContactsView * self;
	ContactsViewContactData* _tmp0_ = NULL;
	GtkWidget* _tmp1_;
	ContactsViewContactData* _tmp4_;
	ContactsViewContactData* _tmp5_;
	ContactsViewContactData* data;
	ContactsContact* _tmp6_ = NULL;
	ContactsViewContactData* _tmp7_;
	ContactsContact* _tmp10_;
	ContactsContact* _tmp11_;
	ContactsContact* contact;
	ContactsContact* _tmp12_;
	ContactsContact* _tmp13_;
	GtkWidget* _tmp15_;
	ContactsViewContactData* _tmp26_;
	self = (ContactsView*) base;
	_tmp1_ = child;
	if (_tmp1_ != NULL) {
		GtkWidget* _tmp2_;
		gconstpointer _tmp3_ = NULL;
		_tmp2_ = child;
		_tmp3_ = g_object_get_data ((GObject*) _tmp2_, "data");
		_tmp0_ = (ContactsViewContactData*) _tmp3_;
	} else {
		_tmp0_ = NULL;
	}
	_tmp4_ = _tmp0_;
	_tmp5_ = _contacts_view_contact_data_ref0 (_tmp4_);
	data = _tmp5_;
	_tmp7_ = data;
	if (_tmp7_ != NULL) {
		ContactsViewContactData* _tmp8_;
		ContactsContact* _tmp9_;
		_tmp8_ = data;
		_tmp9_ = _tmp8_->contact;
		_tmp6_ = _tmp9_;
	} else {
		_tmp6_ = NULL;
	}
	_tmp10_ = _tmp6_;
	_tmp11_ = _g_object_ref0 (_tmp10_);
	contact = _tmp11_;
	_tmp12_ = contact;
	g_signal_emit_by_name (self, "selection-changed", _tmp12_);
	_tmp13_ = contact;
	if (_tmp13_ != NULL) {
		ContactsContact* _tmp14_;
		_tmp14_ = contact;
		contacts_contact_fetch_contact_info (_tmp14_);
	}
	_tmp15_ = self->priv->last_selected;
	if (_tmp15_ != NULL) {
		GtkWidget* _tmp16_;
		gconstpointer _tmp17_ = NULL;
		ContactsViewContactData* _tmp18_;
		ContactsViewContactData* last_data;
		ContactsViewContactData* _tmp19_;
		GtkLabel* _tmp20_;
		GtkStateFlags _tmp21_ = 0;
		GtkStateFlags label_flags;
		GtkStateFlags _tmp22_;
		ContactsViewContactData* _tmp23_;
		GtkLabel* _tmp24_;
		GtkStateFlags _tmp25_;
		_tmp16_ = self->priv->last_selected;
		_tmp17_ = g_object_get_data ((GObject*) _tmp16_, "data");
		_tmp18_ = _contacts_view_contact_data_ref0 ((ContactsViewContactData*) _tmp17_);
		last_data = _tmp18_;
		_tmp19_ = last_data;
		_tmp20_ = _tmp19_->label;
		_tmp21_ = gtk_widget_get_state_flags ((GtkWidget*) _tmp20_);
		label_flags = _tmp21_;
		_tmp22_ = label_flags;
		label_flags = _tmp22_ & (~GTK_STATE_FLAG_SELECTED);
		_tmp23_ = last_data;
		_tmp24_ = _tmp23_->label;
		_tmp25_ = label_flags;
		gtk_widget_set_state_flags ((GtkWidget*) _tmp24_, _tmp25_, TRUE);
		_contacts_view_contact_data_unref0 (last_data);
	}
	_tmp26_ = data;
	if (_tmp26_ != NULL) {
		ContactsViewContactData* _tmp27_;
		GtkLabel* _tmp28_;
		GtkWidget* _tmp29_;
		GtkWidget* _tmp30_;
		_tmp27_ = data;
		_tmp28_ = _tmp27_->label;
		gtk_widget_set_state_flags ((GtkWidget*) _tmp28_, GTK_STATE_FLAG_SELECTED, FALSE);
		_tmp29_ = child;
		_tmp30_ = _g_object_ref0 (_tmp29_);
		_g_object_unref0 (self->priv->last_selected);
		self->priv->last_selected = _tmp30_;
	}
	_g_object_unref0 (contact);
	_contacts_view_contact_data_unref0 (data);
}


static gboolean contacts_view_filter (ContactsView* self, GtkWidget* child) {
	gboolean result = FALSE;
	GtkWidget* _tmp0_;
	gconstpointer _tmp1_ = NULL;
	ContactsViewContactData* _tmp2_;
	ContactsViewContactData* data;
	gboolean _tmp3_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (child != NULL, FALSE);
	_tmp0_ = child;
	_tmp1_ = g_object_get_data ((GObject*) _tmp0_, "data");
	_tmp2_ = _contacts_view_contact_data_ref0 ((ContactsViewContactData*) _tmp1_);
	data = _tmp2_;
	_tmp3_ = data->filtered;
	result = _tmp3_;
	_contacts_view_contact_data_unref0 (data);
	return result;
}


static void contacts_view_update_separator (ContactsView* self, GtkWidget** separator, GtkWidget* widget, GtkWidget* before_widget) {
	GtkWidget* _tmp0_;
	gconstpointer _tmp1_ = NULL;
	ContactsViewContactData* _tmp2_;
	ContactsViewContactData* w_data;
	ContactsViewContactData* before_data;
	GtkWidget* _tmp3_;
	gboolean _tmp7_ = FALSE;
	ContactsViewContactData* _tmp8_;
	gboolean _tmp11_;
	gboolean _tmp26_ = FALSE;
	gboolean _tmp27_ = FALSE;
	ContactsViewContactData* _tmp28_;
	gboolean _tmp31_;
	gboolean _tmp34_;
	gboolean _tmp45_ = FALSE;
	ContactsViewContactData* _tmp46_;
	gboolean _tmp47_ = FALSE;
	gboolean _tmp53_;
	ContactsViewContactData* _tmp68_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	_tmp0_ = widget;
	_tmp1_ = g_object_get_data ((GObject*) _tmp0_, "data");
	_tmp2_ = _contacts_view_contact_data_ref0 ((ContactsViewContactData*) _tmp1_);
	w_data = _tmp2_;
	before_data = NULL;
	_tmp3_ = before_widget;
	if (_tmp3_ != NULL) {
		GtkWidget* _tmp4_;
		gconstpointer _tmp5_ = NULL;
		ContactsViewContactData* _tmp6_;
		_tmp4_ = before_widget;
		_tmp5_ = g_object_get_data ((GObject*) _tmp4_, "data");
		_tmp6_ = _contacts_view_contact_data_ref0 ((ContactsViewContactData*) _tmp5_);
		_contacts_view_contact_data_unref0 (before_data);
		before_data = _tmp6_;
	}
	_tmp8_ = before_data;
	if (_tmp8_ == NULL) {
		ContactsViewContactData* _tmp9_;
		gint _tmp10_;
		_tmp9_ = w_data;
		_tmp10_ = _tmp9_->sort_prio;
		_tmp7_ = _tmp10_ > 0;
	} else {
		_tmp7_ = FALSE;
	}
	_tmp11_ = _tmp7_;
	if (_tmp11_) {
		gboolean _tmp12_ = FALSE;
		GtkWidget* _tmp13_;
		gboolean _tmp16_;
		_tmp13_ = *separator;
		if (_tmp13_ == NULL) {
			_tmp12_ = TRUE;
		} else {
			GtkWidget* _tmp14_;
			gconstpointer _tmp15_ = NULL;
			_tmp14_ = *separator;
			_tmp15_ = g_object_get_data ((GObject*) _tmp14_, "contacts-suggestions-header");
			_tmp12_ = !((gboolean) ((gintptr) _tmp15_));
		}
		_tmp16_ = _tmp12_;
		if (_tmp16_) {
			GtkLabel* _tmp17_;
			GtkLabel* l;
			GtkLabel* _tmp18_;
			GtkLabel* _tmp19_;
			const gchar* _tmp20_ = NULL;
			gchar* _tmp21_ = NULL;
			gchar* _tmp22_;
			GtkLabel* _tmp23_;
			GtkLabel* _tmp24_;
			GtkWidget* _tmp25_;
			_tmp17_ = (GtkLabel*) gtk_label_new ("");
			g_object_ref_sink (_tmp17_);
			l = _tmp17_;
			_tmp18_ = l;
			g_object_set_data_full ((GObject*) _tmp18_, "contacts-suggestions-header", (gpointer) ((gintptr) TRUE), NULL);
			_tmp19_ = l;
			_tmp20_ = _ ("Suggestions");
			_tmp21_ = g_markup_printf_escaped ("<b>%s</b>", _tmp20_);
			_tmp22_ = _tmp21_;
			gtk_label_set_markup (_tmp19_, _tmp22_);
			_g_free0 (_tmp22_);
			_tmp23_ = l;
			gtk_widget_set_halign ((GtkWidget*) _tmp23_, GTK_ALIGN_START);
			_tmp24_ = l;
			_tmp25_ = _g_object_ref0 ((GtkWidget*) _tmp24_);
			_g_object_unref0 (*separator);
			*separator = _tmp25_;
			_g_object_unref0 (l);
		}
		_contacts_view_contact_data_unref0 (before_data);
		_contacts_view_contact_data_unref0 (w_data);
		return;
	}
	_tmp28_ = before_data;
	if (_tmp28_ != NULL) {
		ContactsViewContactData* _tmp29_;
		gint _tmp30_;
		_tmp29_ = before_data;
		_tmp30_ = _tmp29_->sort_prio;
		_tmp27_ = _tmp30_ > 0;
	} else {
		_tmp27_ = FALSE;
	}
	_tmp31_ = _tmp27_;
	if (_tmp31_) {
		ContactsViewContactData* _tmp32_;
		gint _tmp33_;
		_tmp32_ = w_data;
		_tmp33_ = _tmp32_->sort_prio;
		_tmp26_ = _tmp33_ == 0;
	} else {
		_tmp26_ = FALSE;
	}
	_tmp34_ = _tmp26_;
	if (_tmp34_) {
		gboolean _tmp35_ = FALSE;
		GtkWidget* _tmp36_;
		gboolean _tmp39_;
		_tmp36_ = *separator;
		if (_tmp36_ == NULL) {
			_tmp35_ = TRUE;
		} else {
			GtkWidget* _tmp37_;
			gconstpointer _tmp38_ = NULL;
			_tmp37_ = *separator;
			_tmp38_ = g_object_get_data ((GObject*) _tmp37_, "contacts-rest-header");
			_tmp35_ = !((gboolean) ((gintptr) _tmp38_));
		}
		_tmp39_ = _tmp35_;
		if (_tmp39_) {
			GtkLabel* _tmp40_;
			GtkLabel* l;
			GtkLabel* _tmp41_;
			GtkLabel* _tmp42_;
			GtkLabel* _tmp43_;
			GtkWidget* _tmp44_;
			_tmp40_ = (GtkLabel*) gtk_label_new ("");
			g_object_ref_sink (_tmp40_);
			l = _tmp40_;
			_tmp41_ = l;
			g_object_set_data_full ((GObject*) _tmp41_, "contacts-rest-header", (gpointer) ((gintptr) TRUE), NULL);
			_tmp42_ = l;
			gtk_widget_set_halign ((GtkWidget*) _tmp42_, GTK_ALIGN_START);
			_tmp43_ = l;
			_tmp44_ = _g_object_ref0 ((GtkWidget*) _tmp43_);
			_g_object_unref0 (*separator);
			*separator = _tmp44_;
			_g_object_unref0 (l);
		}
		_contacts_view_contact_data_unref0 (before_data);
		_contacts_view_contact_data_unref0 (w_data);
		return;
	}
	_tmp46_ = w_data;
	_tmp47_ = contacts_view_is_other (self, _tmp46_);
	if (_tmp47_) {
		gboolean _tmp48_ = FALSE;
		ContactsViewContactData* _tmp49_;
		gboolean _tmp52_;
		_tmp49_ = before_data;
		if (_tmp49_ == NULL) {
			_tmp48_ = TRUE;
		} else {
			ContactsViewContactData* _tmp50_;
			gboolean _tmp51_ = FALSE;
			_tmp50_ = before_data;
			_tmp51_ = contacts_view_is_other (self, _tmp50_);
			_tmp48_ = !_tmp51_;
		}
		_tmp52_ = _tmp48_;
		_tmp45_ = _tmp52_;
	} else {
		_tmp45_ = FALSE;
	}
	_tmp53_ = _tmp45_;
	if (_tmp53_) {
		gboolean _tmp54_ = FALSE;
		GtkWidget* _tmp55_;
		gboolean _tmp58_;
		_tmp55_ = *separator;
		if (_tmp55_ == NULL) {
			_tmp54_ = TRUE;
		} else {
			GtkWidget* _tmp56_;
			gconstpointer _tmp57_ = NULL;
			_tmp56_ = *separator;
			_tmp57_ = g_object_get_data ((GObject*) _tmp56_, "contacts-other-header");
			_tmp54_ = !((gboolean) ((gintptr) _tmp57_));
		}
		_tmp58_ = _tmp54_;
		if (_tmp58_) {
			GtkLabel* _tmp59_;
			GtkLabel* l;
			GtkLabel* _tmp60_;
			GtkLabel* _tmp61_;
			const gchar* _tmp62_ = NULL;
			gchar* _tmp63_ = NULL;
			gchar* _tmp64_;
			GtkLabel* _tmp65_;
			GtkLabel* _tmp66_;
			GtkWidget* _tmp67_;
			_tmp59_ = (GtkLabel*) gtk_label_new ("");
			g_object_ref_sink (_tmp59_);
			l = _tmp59_;
			_tmp60_ = l;
			g_object_set_data_full ((GObject*) _tmp60_, "contacts-other-header", (gpointer) ((gintptr) TRUE), NULL);
			_tmp61_ = l;
			_tmp62_ = _ ("Other Contacts");
			_tmp63_ = g_markup_printf_escaped ("<b>%s</b>", _tmp62_);
			_tmp64_ = _tmp63_;
			gtk_label_set_markup (_tmp61_, _tmp64_);
			_g_free0 (_tmp64_);
			_tmp65_ = l;
			gtk_widget_set_halign ((GtkWidget*) _tmp65_, GTK_ALIGN_START);
			_tmp66_ = l;
			_tmp67_ = _g_object_ref0 ((GtkWidget*) _tmp66_);
			_g_object_unref0 (*separator);
			*separator = _tmp67_;
			_g_object_unref0 (l);
		}
		_contacts_view_contact_data_unref0 (before_data);
		_contacts_view_contact_data_unref0 (w_data);
		return;
	}
	_tmp68_ = before_data;
	if (_tmp68_ != NULL) {
		gboolean _tmp69_ = FALSE;
		GtkWidget* _tmp70_;
		gboolean _tmp72_;
		_tmp70_ = *separator;
		if (_tmp70_ == NULL) {
			_tmp69_ = TRUE;
		} else {
			GtkWidget* _tmp71_;
			_tmp71_ = *separator;
			_tmp69_ = !G_TYPE_CHECK_INSTANCE_TYPE (_tmp71_, GTK_TYPE_SEPARATOR);
		}
		_tmp72_ = _tmp69_;
		if (_tmp72_) {
			GtkSeparator* _tmp73_;
			_tmp73_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
			g_object_ref_sink (_tmp73_);
			_g_object_unref0 (*separator);
			*separator = (GtkWidget*) _tmp73_;
		}
		_contacts_view_contact_data_unref0 (before_data);
		_contacts_view_contact_data_unref0 (w_data);
		return;
	}
	_g_object_unref0 (*separator);
	*separator = NULL;
	_contacts_view_contact_data_unref0 (before_data);
	_contacts_view_contact_data_unref0 (w_data);
}


void contacts_view_select_contact (ContactsView* self, ContactsContact* contact) {
	ContactsContact* _tmp0_;
	GeeHashMap* _tmp1_;
	ContactsContact* _tmp2_;
	gpointer _tmp3_ = NULL;
	ContactsViewContactData* data;
	ContactsViewContactData* _tmp4_;
	GtkGrid* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = contact;
	if (_tmp0_ == NULL) {
		egg_list_box_select_child ((EggListBox*) self, NULL);
		return;
	}
	_tmp1_ = self->priv->contacts;
	_tmp2_ = contact;
	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, _tmp2_);
	data = (ContactsViewContactData*) _tmp3_;
	_tmp4_ = data;
	_tmp5_ = _tmp4_->grid;
	egg_list_box_select_child ((EggListBox*) self, (GtkWidget*) _tmp5_);
	_contacts_view_contact_data_unref0 (data);
}


void contacts_view_show_selectors (ContactsView* self) {
	g_return_if_fail (self != NULL);
	{
		GeeHashMap* _tmp0_;
		GeeCollection* _tmp1_;
		GeeCollection* _tmp2_;
		GeeCollection* _tmp3_;
		GeeIterator* _tmp4_ = NULL;
		GeeIterator* _tmp5_;
		GeeIterator* _data_it;
		_tmp0_ = self->priv->contacts;
		_tmp1_ = gee_abstract_map_get_values ((GeeMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_data_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			gboolean _tmp7_ = FALSE;
			GeeIterator* _tmp8_;
			gpointer _tmp9_ = NULL;
			ContactsViewContactData* data;
			ContactsViewContactData* _tmp10_;
			GtkCheckButton* _tmp11_;
			_tmp6_ = _data_it;
			_tmp7_ = gee_iterator_next (_tmp6_);
			if (!_tmp7_) {
				break;
			}
			_tmp8_ = _data_it;
			_tmp9_ = gee_iterator_get (_tmp8_);
			data = (ContactsViewContactData*) _tmp9_;
			_tmp10_ = data;
			_tmp11_ = _tmp10_->selector_button;
			gtk_widget_show ((GtkWidget*) _tmp11_);
			_contacts_view_contact_data_unref0 (data);
		}
		_g_object_unref0 (_data_it);
	}
	self->priv->selectors_visible = TRUE;
}


void contacts_view_hide_selectors (ContactsView* self) {
	g_return_if_fail (self != NULL);
	{
		GeeHashMap* _tmp0_;
		GeeCollection* _tmp1_;
		GeeCollection* _tmp2_;
		GeeCollection* _tmp3_;
		GeeIterator* _tmp4_ = NULL;
		GeeIterator* _tmp5_;
		GeeIterator* _data_it;
		_tmp0_ = self->priv->contacts;
		_tmp1_ = gee_abstract_map_get_values ((GeeMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_data_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			gboolean _tmp7_ = FALSE;
			GeeIterator* _tmp8_;
			gpointer _tmp9_ = NULL;
			ContactsViewContactData* data;
			ContactsViewContactData* _tmp10_;
			GtkCheckButton* _tmp11_;
			ContactsViewContactData* _tmp12_;
			GtkCheckButton* _tmp13_;
			_tmp6_ = _data_it;
			_tmp7_ = gee_iterator_next (_tmp6_);
			if (!_tmp7_) {
				break;
			}
			_tmp8_ = _data_it;
			_tmp9_ = gee_iterator_get (_tmp8_);
			data = (ContactsViewContactData*) _tmp9_;
			_tmp10_ = data;
			_tmp11_ = _tmp10_->selector_button;
			gtk_widget_hide ((GtkWidget*) _tmp11_);
			_tmp12_ = data;
			_tmp13_ = _tmp12_->selector_button;
			gtk_toggle_button_set_active ((GtkToggleButton*) _tmp13_, FALSE);
			_contacts_view_contact_data_unref0 (data);
		}
		_g_object_unref0 (_data_it);
	}
	self->priv->selectors_visible = FALSE;
	self->priv->nr_contacts_marked = 0;
}


GeeLinkedList* contacts_view_get_marked_contacts (ContactsView* self) {
	GeeLinkedList* result = NULL;
	GeeLinkedList* _tmp0_;
	GeeLinkedList* cs;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_linked_list_new (CONTACTS_TYPE_CONTACT, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	cs = _tmp0_;
	{
		GeeHashMap* _tmp1_;
		GeeCollection* _tmp2_;
		GeeCollection* _tmp3_;
		GeeCollection* _tmp4_;
		GeeIterator* _tmp5_ = NULL;
		GeeIterator* _tmp6_;
		GeeIterator* _data_it;
		_tmp1_ = self->priv->contacts;
		_tmp2_ = gee_abstract_map_get_values ((GeeMap*) _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		_tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
		_tmp6_ = _tmp5_;
		_g_object_unref0 (_tmp4_);
		_data_it = _tmp6_;
		while (TRUE) {
			GeeIterator* _tmp7_;
			gboolean _tmp8_ = FALSE;
			GeeIterator* _tmp9_;
			gpointer _tmp10_ = NULL;
			ContactsViewContactData* data;
			ContactsViewContactData* _tmp11_;
			GtkCheckButton* _tmp12_;
			gboolean _tmp13_;
			gboolean _tmp14_;
			_tmp7_ = _data_it;
			_tmp8_ = gee_iterator_next (_tmp7_);
			if (!_tmp8_) {
				break;
			}
			_tmp9_ = _data_it;
			_tmp10_ = gee_iterator_get (_tmp9_);
			data = (ContactsViewContactData*) _tmp10_;
			_tmp11_ = data;
			_tmp12_ = _tmp11_->selector_button;
			_tmp13_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp12_);
			_tmp14_ = _tmp13_;
			if (_tmp14_) {
				GeeLinkedList* _tmp15_;
				ContactsViewContactData* _tmp16_;
				ContactsContact* _tmp17_;
				_tmp15_ = cs;
				_tmp16_ = data;
				_tmp17_ = _tmp16_->contact;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp17_);
			}
			_contacts_view_contact_data_unref0 (data);
		}
		_g_object_unref0 (_data_it);
	}
	result = cs;
	return result;
}


static ContactsViewContactData* contacts_view_contact_data_construct (GType object_type) {
	ContactsViewContactData* self = NULL;
	self = (ContactsViewContactData*) g_type_create_instance (object_type);
	return self;
}


static ContactsViewContactData* contacts_view_contact_data_new (void) {
	return contacts_view_contact_data_construct (CONTACTS_VIEW_TYPE_CONTACT_DATA);
}


static void contacts_view_value_contact_data_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void contacts_view_value_contact_data_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		contacts_view_contact_data_unref (value->data[0].v_pointer);
	}
}


static void contacts_view_value_contact_data_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = contacts_view_contact_data_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer contacts_view_value_contact_data_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* contacts_view_value_contact_data_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		ContactsViewContactData* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = contacts_view_contact_data_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* contacts_view_value_contact_data_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	ContactsViewContactData** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = contacts_view_contact_data_ref (value->data[0].v_pointer);
	}
	return NULL;
}


static GParamSpec* contacts_view_param_spec_contact_data (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	ContactsViewParamSpecContactData* spec;
	g_return_val_if_fail (g_type_is_a (object_type, CONTACTS_VIEW_TYPE_CONTACT_DATA), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


static gpointer contacts_view_value_get_contact_data (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CONTACTS_VIEW_TYPE_CONTACT_DATA), NULL);
	return value->data[0].v_pointer;
}


static void contacts_view_value_set_contact_data (GValue* value, gpointer v_object) {
	ContactsViewContactData* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CONTACTS_VIEW_TYPE_CONTACT_DATA));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, CONTACTS_VIEW_TYPE_CONTACT_DATA));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		contacts_view_contact_data_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		contacts_view_contact_data_unref (old);
	}
}


static void contacts_view_value_take_contact_data (GValue* value, gpointer v_object) {
	ContactsViewContactData* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CONTACTS_VIEW_TYPE_CONTACT_DATA));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, CONTACTS_VIEW_TYPE_CONTACT_DATA));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		contacts_view_contact_data_unref (old);
	}
}


static void contacts_view_contact_data_class_init (ContactsViewContactDataClass * klass) {
	contacts_view_contact_data_parent_class = g_type_class_peek_parent (klass);
	CONTACTS_VIEW_CONTACT_DATA_CLASS (klass)->finalize = contacts_view_contact_data_finalize;
}


static void contacts_view_contact_data_instance_init (ContactsViewContactData * self) {
	self->ref_count = 1;
}


static void contacts_view_contact_data_finalize (ContactsViewContactData* obj) {
	ContactsViewContactData * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_VIEW_TYPE_CONTACT_DATA, ContactsViewContactData);
	_g_object_unref0 (self->contact);
	_g_object_unref0 (self->grid);
	_g_object_unref0 (self->label);
	_g_object_unref0 (self->image_frame);
	_g_object_unref0 (self->selector_button);
	_g_free0 (self->display_name);
}


static GType contacts_view_contact_data_get_type (void) {
	static volatile gsize contacts_view_contact_data_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_view_contact_data_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { contacts_view_value_contact_data_init, contacts_view_value_contact_data_free_value, contacts_view_value_contact_data_copy_value, contacts_view_value_contact_data_peek_pointer, "p", contacts_view_value_contact_data_collect_value, "p", contacts_view_value_contact_data_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (ContactsViewContactDataClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_view_contact_data_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsViewContactData), 0, (GInstanceInitFunc) contacts_view_contact_data_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType contacts_view_contact_data_type_id;
		contacts_view_contact_data_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ContactsViewContactData", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&contacts_view_contact_data_type_id__volatile, contacts_view_contact_data_type_id);
	}
	return contacts_view_contact_data_type_id__volatile;
}


static gpointer contacts_view_contact_data_ref (gpointer instance) {
	ContactsViewContactData* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


static void contacts_view_contact_data_unref (gpointer instance) {
	ContactsViewContactData* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		CONTACTS_VIEW_CONTACT_DATA_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


static void contacts_view_class_init (ContactsViewClass * klass) {
	contacts_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ContactsViewPrivate));
	EGG_LIST_BOX_CLASS (klass)->child_selected = contacts_view_real_child_selected;
	G_OBJECT_CLASS (klass)->finalize = contacts_view_finalize;
	g_signal_new ("selection_changed", CONTACTS_TYPE_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, CONTACTS_TYPE_CONTACT);
	g_signal_new ("contacts_marked", CONTACTS_TYPE_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
}


static void contacts_view_instance_init (ContactsView * self) {
	self->priv = CONTACTS_VIEW_GET_PRIVATE (self);
}


static void contacts_view_finalize (GObject* obj) {
	ContactsView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_VIEW, ContactsView);
	_g_object_unref0 (self->priv->contacts_store);
	_g_object_unref0 (self->priv->contacts);
	_g_object_unref0 (self->priv->hidden_contacts);
	self->priv->filter_values = (_vala_array_free (self->priv->filter_values, self->priv->filter_values_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (self->priv->last_selected);
	G_OBJECT_CLASS (contacts_view_parent_class)->finalize (obj);
}


GType contacts_view_get_type (void) {
	static volatile gsize contacts_view_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_view_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsView), 0, (GInstanceInitFunc) contacts_view_instance_init, NULL };
		GType contacts_view_type_id;
		contacts_view_type_id = g_type_register_static (EGG_TYPE_LIST_BOX, "ContactsView", &g_define_type_info, 0);
		g_once_init_leave (&contacts_view_type_id__volatile, contacts_view_type_id);
	}
	return contacts_view_type_id__volatile;
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



