/* contacts-list-pane.c generated by valac 0.30.0.38-a55d, the Vala compiler
 * generated from contacts-list-pane.vala, do not modify */

/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 8 -*- */
/*
 * Copyright (C) 2011 Alexander Larsson <alexl@redhat.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>


#define CONTACTS_TYPE_LIST_PANE (contacts_list_pane_get_type ())
#define CONTACTS_LIST_PANE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_LIST_PANE, ContactsListPane))
#define CONTACTS_LIST_PANE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_LIST_PANE, ContactsListPaneClass))
#define CONTACTS_IS_LIST_PANE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_LIST_PANE))
#define CONTACTS_IS_LIST_PANE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_LIST_PANE))
#define CONTACTS_LIST_PANE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_LIST_PANE, ContactsListPaneClass))

typedef struct _ContactsListPane ContactsListPane;
typedef struct _ContactsListPaneClass ContactsListPaneClass;
typedef struct _ContactsListPanePrivate ContactsListPanePrivate;

#define CONTACTS_TYPE_STORE (contacts_store_get_type ())
#define CONTACTS_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_STORE, ContactsStore))
#define CONTACTS_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_STORE, ContactsStoreClass))
#define CONTACTS_IS_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_STORE))
#define CONTACTS_IS_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_STORE))
#define CONTACTS_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_STORE, ContactsStoreClass))

typedef struct _ContactsStore ContactsStore;
typedef struct _ContactsStoreClass ContactsStoreClass;

#define CONTACTS_TYPE_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;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

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

struct _ContactsListPane {
	GtkFrame parent_instance;
	ContactsListPanePrivate * priv;
	GtkToolItem* search_tool_item;
	GtkSearchEntry* filter_entry;
	GtkButton* link_button;
	GtkButton* delete_button;
	GtkActionBar* actions_bar;
};

struct _ContactsListPaneClass {
	GtkFrameClass parent_class;
};

struct _ContactsListPanePrivate {
	ContactsStore* _store;
	ContactsView* contacts_view;
	guint filter_entry_changed_id;
	gboolean ignore_selection_change;
};


static gpointer contacts_list_pane_parent_class = NULL;

GType contacts_list_pane_get_type (void) G_GNUC_CONST;
GType contacts_store_get_type (void) G_GNUC_CONST;
GType contacts_view_get_type (void) G_GNUC_CONST;
#define CONTACTS_LIST_PANE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_LIST_PANE, ContactsListPanePrivate))
enum  {
	CONTACTS_LIST_PANE_DUMMY_PROPERTY,
	CONTACTS_LIST_PANE_STORE
};
void contacts_list_pane_refilter (ContactsListPane* self);
gboolean contacts_utils_string_is_empty (const gchar* str);
gchar* contacts_utils_canonicalize_for_search (const gchar* str);
void contacts_view_set_filter_values (ContactsView* self, gchar** values, int values_length1);
static gboolean contacts_list_pane_filter_entry_changed_timeout (ContactsListPane* self);
static void contacts_list_pane_filter_entry_changed (ContactsListPane* self, GtkEditable* editable);
static gboolean _contacts_list_pane_filter_entry_changed_timeout_gsource_func (gpointer self);
static void _contacts_list_pane_filter_entry_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self);
ContactsListPane* contacts_list_pane_new (ContactsStore* contacts_store);
ContactsListPane* contacts_list_pane_construct (GType object_type, ContactsStore* contacts_store);
GType contacts_contact_get_type (void) G_GNUC_CONST;
void contacts_list_pane_select_contact (ContactsListPane* self, ContactsContact* contact, gboolean ignore_change);
void contacts_view_select_contact (ContactsView* self, ContactsContact* contact);
void contacts_list_pane_show_selection (ContactsListPane* self);
void contacts_view_show_selectors (ContactsView* self);
void contacts_list_pane_hide_selection (ContactsListPane* self);
void contacts_view_hide_selectors (ContactsView* self);
static void contacts_list_pane_real_get_preferred_width (GtkWidget* base, gint* minimum_width, gint* natural_width);
ContactsStore* contacts_list_pane_get_store (ContactsListPane* self);
void contacts_list_pane_set_store (ContactsListPane* self, ContactsStore* value);
void contacts_view_set_store (ContactsView* self, ContactsStore* value);
static GObject * contacts_list_pane_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _contacts_list_pane___lambda87_ (ContactsListPane* self, ContactsView* l, ContactsContact* contact);
static void __contacts_list_pane___lambda87__contacts_view_selection_changed (ContactsView* _sender, ContactsContact* contact, gpointer self);
static void _contacts_list_pane___lambda88_ (ContactsListPane* self, gint nr_contacts_marked);
static void __contacts_list_pane___lambda88__contacts_view_contacts_marked (ContactsView* _sender, gint contacts_marked, gpointer self);
static void _contacts_list_pane___lambda89_ (ContactsListPane* self);
GeeLinkedList* contacts_view_get_marked_contacts (ContactsView* self);
static void __contacts_list_pane___lambda89__gtk_button_clicked (GtkButton* _sender, gpointer self);
static void _contacts_list_pane___lambda90_ (ContactsListPane* self);
void contacts_contact_hide (ContactsContact* self);
static void __contacts_list_pane___lambda90__gtk_button_clicked (GtkButton* _sender, gpointer self);
static void contacts_list_pane_finalize (GObject* obj);
static void _vala_contacts_list_pane_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_contacts_list_pane_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
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);
static gint _vala_array_length (gpointer array);


void contacts_list_pane_refilter (ContactsListPane* self) {
	gchar** values = NULL;
	gint values_length1 = 0;
	gint _values_size_ = 0;
	gchar* str = NULL;
	GtkSearchEntry* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	gboolean _tmp4_ = FALSE;
	ContactsView* _tmp10_ = NULL;
	gchar** _tmp11_ = NULL;
	gint _tmp11__length1 = 0;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->filter_entry;
	_tmp1_ = gtk_entry_get_text ((GtkEntry*) _tmp0_);
	_tmp2_ = g_strdup (_tmp1_);
	str = _tmp2_;
	_tmp3_ = str;
	_tmp4_ = contacts_utils_string_is_empty (_tmp3_);
	if (_tmp4_) {
		values = (_vala_array_free (values, values_length1, (GDestroyNotify) g_free), NULL);
		values = NULL;
		values_length1 = 0;
		_values_size_ = values_length1;
	} else {
		const gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
		gchar** _tmp8_ = NULL;
		gchar** _tmp9_ = NULL;
		_tmp5_ = str;
		_tmp6_ = contacts_utils_canonicalize_for_search (_tmp5_);
		_g_free0 (str);
		str = _tmp6_;
		_tmp7_ = str;
		_tmp9_ = _tmp8_ = g_strsplit (_tmp7_, " ", 0);
		values = (_vala_array_free (values, values_length1, (GDestroyNotify) g_free), NULL);
		values = _tmp9_;
		values_length1 = _vala_array_length (_tmp8_);
		_values_size_ = values_length1;
	}
	_tmp10_ = self->priv->contacts_view;
	_tmp11_ = values;
	_tmp11__length1 = values_length1;
	contacts_view_set_filter_values (_tmp10_, _tmp11_, _tmp11__length1);
	_g_free0 (str);
	values = (_vala_array_free (values, values_length1, (GDestroyNotify) g_free), NULL);
}


static gboolean contacts_list_pane_filter_entry_changed_timeout (ContactsListPane* self) {
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	self->priv->filter_entry_changed_id = (guint) 0;
	contacts_list_pane_refilter (self);
	result = FALSE;
	return result;
}


static gboolean _contacts_list_pane_filter_entry_changed_timeout_gsource_func (gpointer self) {
	gboolean result;
	result = contacts_list_pane_filter_entry_changed_timeout ((ContactsListPane*) self);
	return result;
}


static void contacts_list_pane_filter_entry_changed (ContactsListPane* self, GtkEditable* editable) {
	guint _tmp0_ = 0U;
	guint _tmp2_ = 0U;
	g_return_if_fail (self != NULL);
	g_return_if_fail (editable != NULL);
	_tmp0_ = self->priv->filter_entry_changed_id;
	if (_tmp0_ != ((guint) 0)) {
		guint _tmp1_ = 0U;
		_tmp1_ = self->priv->filter_entry_changed_id;
		g_source_remove (_tmp1_);
	}
	_tmp2_ = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 300, _contacts_list_pane_filter_entry_changed_timeout_gsource_func, g_object_ref (self), g_object_unref);
	self->priv->filter_entry_changed_id = _tmp2_;
}


static void _contacts_list_pane_filter_entry_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self) {
	contacts_list_pane_filter_entry_changed ((ContactsListPane*) self, _sender);
}


ContactsListPane* contacts_list_pane_construct (GType object_type, ContactsStore* contacts_store) {
	ContactsListPane * self = NULL;
	ContactsStore* _tmp0_ = NULL;
	g_return_val_if_fail (contacts_store != NULL, NULL);
	_tmp0_ = contacts_store;
	self = (ContactsListPane*) g_object_new (object_type, "store", _tmp0_, NULL);
	return self;
}


ContactsListPane* contacts_list_pane_new (ContactsStore* contacts_store) {
	return contacts_list_pane_construct (CONTACTS_TYPE_LIST_PANE, contacts_store);
}


void contacts_list_pane_select_contact (ContactsListPane* self, ContactsContact* contact, gboolean ignore_change) {
	gboolean _tmp0_ = FALSE;
	ContactsView* _tmp1_ = NULL;
	ContactsContact* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = ignore_change;
	if (_tmp0_) {
		self->priv->ignore_selection_change = TRUE;
	}
	_tmp1_ = self->priv->contacts_view;
	_tmp2_ = contact;
	contacts_view_select_contact (_tmp1_, _tmp2_);
	self->priv->ignore_selection_change = FALSE;
}


void contacts_list_pane_show_selection (ContactsListPane* self) {
	ContactsView* _tmp0_ = NULL;
	GtkActionBar* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->contacts_view;
	contacts_view_show_selectors (_tmp0_);
	_tmp1_ = self->actions_bar;
	gtk_widget_show ((GtkWidget*) _tmp1_);
}


void contacts_list_pane_hide_selection (ContactsListPane* self) {
	ContactsView* _tmp0_ = NULL;
	GtkActionBar* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->contacts_view;
	contacts_view_hide_selectors (_tmp0_);
	_tmp1_ = self->actions_bar;
	gtk_widget_hide ((GtkWidget*) _tmp1_);
}


static void contacts_list_pane_real_get_preferred_width (GtkWidget* base, gint* minimum_width, gint* natural_width) {
	ContactsListPane * self;
	gint _vala_minimum_width = 0;
	gint _vala_natural_width = 0;
	self = (ContactsListPane*) base;
	_vala_natural_width = 300;
	_vala_minimum_width = _vala_natural_width;
	if (minimum_width) {
		*minimum_width = _vala_minimum_width;
	}
	if (natural_width) {
		*natural_width = _vala_natural_width;
	}
}


ContactsStore* contacts_list_pane_get_store (ContactsListPane* self) {
	ContactsStore* result;
	ContactsStore* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_store;
	result = _tmp0_;
	return result;
}


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


void contacts_list_pane_set_store (ContactsListPane* self, ContactsStore* value) {
	ContactsStore* _tmp0_ = NULL;
	ContactsStore* _tmp1_ = NULL;
	ContactsView* _tmp2_ = NULL;
	ContactsStore* _tmp3_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_store);
	self->priv->_store = _tmp1_;
	_tmp2_ = self->priv->contacts_view;
	_tmp3_ = self->priv->_store;
	contacts_view_set_store (_tmp2_, _tmp3_);
	g_object_notify ((GObject *) self, "store");
}


static void _contacts_list_pane___lambda87_ (ContactsListPane* self, ContactsView* l, ContactsContact* contact) {
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (l != NULL);
	_tmp0_ = self->priv->ignore_selection_change;
	if (!_tmp0_) {
		ContactsContact* _tmp1_ = NULL;
		_tmp1_ = contact;
		g_signal_emit_by_name (self, "selection-changed", _tmp1_);
	}
}


static void __contacts_list_pane___lambda87__contacts_view_selection_changed (ContactsView* _sender, ContactsContact* contact, gpointer self) {
	_contacts_list_pane___lambda87_ ((ContactsListPane*) self, _sender, contact);
}


static void _contacts_list_pane___lambda88_ (ContactsListPane* self, gint nr_contacts_marked) {
	gint _tmp0_ = 0;
	gint _tmp3_ = 0;
	gint _tmp6_ = 0;
	_tmp0_ = nr_contacts_marked;
	if (_tmp0_ > 0) {
		GtkButton* _tmp1_ = NULL;
		_tmp1_ = self->delete_button;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp1_, TRUE);
	} else {
		GtkButton* _tmp2_ = NULL;
		_tmp2_ = self->delete_button;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp2_, FALSE);
	}
	_tmp3_ = nr_contacts_marked;
	if (_tmp3_ > 1) {
		GtkButton* _tmp4_ = NULL;
		_tmp4_ = self->link_button;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp4_, TRUE);
	} else {
		GtkButton* _tmp5_ = NULL;
		_tmp5_ = self->link_button;
		gtk_widget_set_sensitive ((GtkWidget*) _tmp5_, FALSE);
	}
	_tmp6_ = nr_contacts_marked;
	g_signal_emit_by_name (self, "contacts-marked", _tmp6_);
}


static void __contacts_list_pane___lambda88__contacts_view_contacts_marked (ContactsView* _sender, gint contacts_marked, gpointer self) {
	_contacts_list_pane___lambda88_ ((ContactsListPane*) self, contacts_marked);
}


static void _contacts_list_pane___lambda89_ (ContactsListPane* self) {
	GeeLinkedList* marked_contacts = NULL;
	ContactsView* _tmp0_ = NULL;
	GeeLinkedList* _tmp1_ = NULL;
	GeeLinkedList* _tmp2_ = NULL;
	_tmp0_ = self->priv->contacts_view;
	_tmp1_ = contacts_view_get_marked_contacts (_tmp0_);
	marked_contacts = _tmp1_;
	_tmp2_ = marked_contacts;
	g_signal_emit_by_name (self, "link-contacts", _tmp2_);
	_g_object_unref0 (marked_contacts);
}


static void __contacts_list_pane___lambda89__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	_contacts_list_pane___lambda89_ ((ContactsListPane*) self);
}


static void _contacts_list_pane___lambda90_ (ContactsListPane* self) {
	GeeLinkedList* marked_contacts = NULL;
	ContactsView* _tmp0_ = NULL;
	GeeLinkedList* _tmp1_ = NULL;
	GeeLinkedList* _tmp14_ = NULL;
	_tmp0_ = self->priv->contacts_view;
	_tmp1_ = contacts_view_get_marked_contacts (_tmp0_);
	marked_contacts = _tmp1_;
	{
		GeeLinkedList* _c_list = NULL;
		GeeLinkedList* _tmp2_ = NULL;
		GeeLinkedList* _tmp3_ = NULL;
		gint _c_size = 0;
		GeeLinkedList* _tmp4_ = NULL;
		gint _tmp5_ = 0;
		gint _tmp6_ = 0;
		gint _c_index = 0;
		_tmp2_ = marked_contacts;
		_tmp3_ = _g_object_ref0 (_tmp2_);
		_c_list = _tmp3_;
		_tmp4_ = _c_list;
		_tmp5_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_c_size = _tmp6_;
		_c_index = -1;
		while (TRUE) {
			gint _tmp7_ = 0;
			gint _tmp8_ = 0;
			gint _tmp9_ = 0;
			ContactsContact* c = NULL;
			GeeLinkedList* _tmp10_ = NULL;
			gint _tmp11_ = 0;
			gpointer _tmp12_ = NULL;
			ContactsContact* _tmp13_ = NULL;
			_tmp7_ = _c_index;
			_c_index = _tmp7_ + 1;
			_tmp8_ = _c_index;
			_tmp9_ = _c_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _c_list;
			_tmp11_ = _c_index;
			_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _tmp11_);
			c = (ContactsContact*) _tmp12_;
			_tmp13_ = c;
			contacts_contact_hide (_tmp13_);
			_g_object_unref0 (c);
		}
		_g_object_unref0 (_c_list);
	}
	_tmp14_ = marked_contacts;
	g_signal_emit_by_name (self, "delete-contacts", _tmp14_);
	_g_object_unref0 (marked_contacts);
}


static void __contacts_list_pane___lambda90__gtk_button_clicked (GtkButton* _sender, gpointer self) {
	_contacts_list_pane___lambda90_ ((ContactsListPane*) self);
}


static GObject * contacts_list_pane_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	ContactsListPane * self;
	GtkToolItem* _tmp0_ = NULL;
	ContactsView* _tmp1_ = NULL;
	ContactsView* _tmp2_ = NULL;
	GtkButton* _tmp3_ = NULL;
	GtkButton* _tmp4_ = NULL;
	parent_class = G_OBJECT_CLASS (contacts_list_pane_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_LIST_PANE, ContactsListPane);
	_tmp0_ = self->search_tool_item;
	gtk_tool_item_set_expand (_tmp0_, TRUE);
	_tmp1_ = self->priv->contacts_view;
	g_signal_connect_object (_tmp1_, "selection-changed", (GCallback) __contacts_list_pane___lambda87__contacts_view_selection_changed, self, 0);
	_tmp2_ = self->priv->contacts_view;
	g_signal_connect_object (_tmp2_, "contacts-marked", (GCallback) __contacts_list_pane___lambda88__contacts_view_contacts_marked, self, 0);
	_tmp3_ = self->link_button;
	g_signal_connect_object (_tmp3_, "clicked", (GCallback) __contacts_list_pane___lambda89__gtk_button_clicked, self, 0);
	_tmp4_ = self->delete_button;
	g_signal_connect_object (_tmp4_, "clicked", (GCallback) __contacts_list_pane___lambda90__gtk_button_clicked, self, 0);
	return obj;
}


static void contacts_list_pane_class_init (ContactsListPaneClass * klass) {
	gint ContactsListPane_private_offset;
	contacts_list_pane_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ContactsListPanePrivate));
	((GtkWidgetClass *) klass)->get_preferred_width = contacts_list_pane_real_get_preferred_width;
	G_OBJECT_CLASS (klass)->get_property = _vala_contacts_list_pane_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_contacts_list_pane_set_property;
	G_OBJECT_CLASS (klass)->constructor = contacts_list_pane_constructor;
	G_OBJECT_CLASS (klass)->finalize = contacts_list_pane_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CONTACTS_LIST_PANE_STORE, g_param_spec_object ("store", "store", "store", CONTACTS_TYPE_STORE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	ContactsListPane_private_offset = g_type_class_get_instance_private_offset (klass);
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/contacts/ui/contacts-list-pane.ui");
	g_signal_new ("selection_changed", CONTACTS_TYPE_LIST_PANE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, CONTACTS_TYPE_CONTACT);
	g_signal_new ("link_contacts", CONTACTS_TYPE_LIST_PANE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GEE_TYPE_LINKED_LIST);
	g_signal_new ("delete_contacts", CONTACTS_TYPE_LIST_PANE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GEE_TYPE_LINKED_LIST);
	g_signal_new ("contacts_marked", CONTACTS_TYPE_LIST_PANE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "contacts_view", FALSE, ContactsListPane_private_offset + G_STRUCT_OFFSET (ContactsListPanePrivate, contacts_view));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "search_tool_item", FALSE, G_STRUCT_OFFSET (ContactsListPane, search_tool_item));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "filter_entry", FALSE, G_STRUCT_OFFSET (ContactsListPane, filter_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "link_button", FALSE, G_STRUCT_OFFSET (ContactsListPane, link_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "delete_button", FALSE, G_STRUCT_OFFSET (ContactsListPane, delete_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "actions_bar", FALSE, G_STRUCT_OFFSET (ContactsListPane, actions_bar));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "filter_entry_changed", G_CALLBACK(_contacts_list_pane_filter_entry_changed_gtk_editable_changed));
}


static void contacts_list_pane_instance_init (ContactsListPane * self) {
	self->priv = CONTACTS_LIST_PANE_GET_PRIVATE (self);
	g_type_ensure (CONTACTS_TYPE_VIEW);
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void contacts_list_pane_finalize (GObject* obj) {
	ContactsListPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_LIST_PANE, ContactsListPane);
	_g_object_unref0 (self->priv->_store);
	_g_object_unref0 (self->priv->contacts_view);
	_g_object_unref0 (self->search_tool_item);
	_g_object_unref0 (self->filter_entry);
	_g_object_unref0 (self->link_button);
	_g_object_unref0 (self->delete_button);
	_g_object_unref0 (self->actions_bar);
	G_OBJECT_CLASS (contacts_list_pane_parent_class)->finalize (obj);
}


GType contacts_list_pane_get_type (void) {
	static volatile gsize contacts_list_pane_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_list_pane_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsListPaneClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_list_pane_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsListPane), 0, (GInstanceInitFunc) contacts_list_pane_instance_init, NULL };
		GType contacts_list_pane_type_id;
		contacts_list_pane_type_id = g_type_register_static (gtk_frame_get_type (), "ContactsListPane", &g_define_type_info, 0);
		g_once_init_leave (&contacts_list_pane_type_id__volatile, contacts_list_pane_type_id);
	}
	return contacts_list_pane_type_id__volatile;
}


static void _vala_contacts_list_pane_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	ContactsListPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CONTACTS_TYPE_LIST_PANE, ContactsListPane);
	switch (property_id) {
		case CONTACTS_LIST_PANE_STORE:
		g_value_set_object (value, contacts_list_pane_get_store (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_contacts_list_pane_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	ContactsListPane * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CONTACTS_TYPE_LIST_PANE, ContactsListPane);
	switch (property_id) {
		case CONTACTS_LIST_PANE_STORE:
		contacts_list_pane_set_store (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


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


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



