/* contacts-window.c generated by valac 0.21.2.6-90bab, the Vala compiler
 * generated from contacts-window.vala, do not modify */

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

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


#define CONTACTS_TYPE_WINDOW (contacts_window_get_type ())
#define CONTACTS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_WINDOW, ContactsWindow))
#define CONTACTS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_WINDOW, ContactsWindowClass))
#define CONTACTS_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_WINDOW))
#define CONTACTS_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_WINDOW))
#define CONTACTS_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_WINDOW, ContactsWindowClass))

typedef struct _ContactsWindow ContactsWindow;
typedef struct _ContactsWindowClass ContactsWindowClass;
typedef struct _ContactsWindowPrivate ContactsWindowPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ContactsWindow {
	GtkApplicationWindow parent_instance;
	ContactsWindowPrivate * priv;
	GtkButton* add_button;
	GtkToggleButton* select_button;
	GtkButton* edit_button;
	GtkButton* done_button;
};

struct _ContactsWindowClass {
	GtkApplicationWindowClass parent_class;
};

struct _ContactsWindowPrivate {
	GtkHeaderBar* left_toolbar;
	GtkHeaderBar* right_toolbar;
	GtkOverlay* overlay;
	GtkGrid* grid;
	GtkOverlay* right_overlay;
};


static gpointer contacts_window_parent_class = NULL;

GType contacts_window_get_type (void) G_GNUC_CONST;
#define CONTACTS_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_WINDOW, ContactsWindowPrivate))
enum  {
	CONTACTS_WINDOW_DUMMY_PROPERTY,
	CONTACTS_WINDOW_LEFT_TITLE,
	CONTACTS_WINDOW_RIGHT_TITLE
};
ContactsWindow* contacts_window_new (GtkApplication* app);
ContactsWindow* contacts_window_construct (GType object_type, GtkApplication* app);
void contacts_window_activate_selection_mode (ContactsWindow* self, gboolean active);
void contacts_window_add_left_child (ContactsWindow* self, GtkWidget* child);
void contacts_window_add_right_child (ContactsWindow* self, GtkWidget* child);
void contacts_window_add_notification (ContactsWindow* self, GtkWidget* notification);
const gchar* contacts_window_get_left_title (ContactsWindow* self);
void contacts_window_set_left_title (ContactsWindow* self, const gchar* value);
const gchar* contacts_window_get_right_title (ContactsWindow* self);
void contacts_window_set_right_title (ContactsWindow* self, const gchar* value);
static void contacts_window_finalize (GObject* obj);
static void _vala_contacts_window_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_contacts_window_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


ContactsWindow* contacts_window_construct (GType object_type, GtkApplication* app) {
	ContactsWindow * self = NULL;
	GtkApplication* _tmp0_ = NULL;
	g_return_val_if_fail (app != NULL, NULL);
	_tmp0_ = app;
	self = (ContactsWindow*) g_object_new (object_type, "application", _tmp0_, NULL);
	return self;
}


ContactsWindow* contacts_window_new (GtkApplication* app) {
	return contacts_window_construct (CONTACTS_TYPE_WINDOW, app);
}


void contacts_window_activate_selection_mode (ContactsWindow* self, gboolean active) {
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = active;
	if (_tmp0_) {
		GtkButton* _tmp1_ = NULL;
		GtkHeaderBar* _tmp2_ = NULL;
		GtkStyleContext* _tmp3_ = NULL;
		GtkHeaderBar* _tmp4_ = NULL;
		GtkStyleContext* _tmp5_ = NULL;
		GtkHeaderBar* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
		_tmp1_ = self->add_button;
		gtk_widget_hide ((GtkWidget*) _tmp1_);
		_tmp2_ = self->priv->left_toolbar;
		_tmp3_ = gtk_widget_get_style_context ((GtkWidget*) _tmp2_);
		gtk_style_context_add_class (_tmp3_, "selection-mode");
		_tmp4_ = self->priv->right_toolbar;
		_tmp5_ = gtk_widget_get_style_context ((GtkWidget*) _tmp4_);
		gtk_style_context_add_class (_tmp5_, "selection-mode");
		_tmp6_ = self->priv->left_toolbar;
		_tmp7_ = _ ("Select");
		gtk_header_bar_set_title (_tmp6_, _tmp7_);
	} else {
		GtkButton* _tmp8_ = NULL;
		GtkHeaderBar* _tmp9_ = NULL;
		GtkStyleContext* _tmp10_ = NULL;
		GtkHeaderBar* _tmp11_ = NULL;
		GtkStyleContext* _tmp12_ = NULL;
		GtkHeaderBar* _tmp13_ = NULL;
		const gchar* _tmp14_ = NULL;
		_tmp8_ = self->add_button;
		gtk_widget_show ((GtkWidget*) _tmp8_);
		_tmp9_ = self->priv->left_toolbar;
		_tmp10_ = gtk_widget_get_style_context ((GtkWidget*) _tmp9_);
		gtk_style_context_remove_class (_tmp10_, "selection-mode");
		_tmp11_ = self->priv->right_toolbar;
		_tmp12_ = gtk_widget_get_style_context ((GtkWidget*) _tmp11_);
		gtk_style_context_remove_class (_tmp12_, "selection-mode");
		_tmp13_ = self->priv->left_toolbar;
		_tmp14_ = _ ("All Contacts");
		gtk_header_bar_set_title (_tmp13_, _tmp14_);
	}
}


void contacts_window_add_left_child (ContactsWindow* self, GtkWidget* child) {
	GtkGrid* _tmp0_ = NULL;
	GtkWidget* _tmp1_ = NULL;
	GtkSizeGroup* hsize_group = NULL;
	GtkSizeGroup* _tmp2_ = NULL;
	GtkHeaderBar* _tmp3_ = NULL;
	GtkWidget* _tmp4_ = NULL;
	GtkWidget* _tmp5_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (child != NULL);
	_tmp0_ = self->priv->grid;
	_tmp1_ = child;
	gtk_grid_attach (_tmp0_, _tmp1_, 0, 0, 1, 1);
	_tmp2_ = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
	hsize_group = _tmp2_;
	_tmp3_ = self->priv->left_toolbar;
	gtk_size_group_add_widget (hsize_group, (GtkWidget*) _tmp3_);
	_tmp4_ = child;
	gtk_size_group_add_widget (hsize_group, _tmp4_);
	_tmp5_ = child;
	gtk_widget_show (_tmp5_);
	_g_object_unref0 (hsize_group);
}


void contacts_window_add_right_child (ContactsWindow* self, GtkWidget* child) {
	GtkOverlay* _tmp0_ = NULL;
	GtkWidget* _tmp1_ = NULL;
	GtkWidget* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (child != NULL);
	_tmp0_ = self->priv->right_overlay;
	_tmp1_ = child;
	gtk_container_add ((GtkContainer*) _tmp0_, _tmp1_);
	_tmp2_ = child;
	gtk_widget_show (_tmp2_);
}


void contacts_window_add_notification (ContactsWindow* self, GtkWidget* notification) {
	GtkOverlay* _tmp0_ = NULL;
	GtkWidget* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (notification != NULL);
	_tmp0_ = self->priv->overlay;
	_tmp1_ = notification;
	gtk_overlay_add_overlay (_tmp0_, _tmp1_);
}


const gchar* contacts_window_get_left_title (ContactsWindow* self) {
	const gchar* result;
	GtkHeaderBar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->left_toolbar;
	_tmp1_ = gtk_header_bar_get_title (_tmp0_);
	result = _tmp1_;
	return result;
}


void contacts_window_set_left_title (ContactsWindow* self, const gchar* value) {
	GtkHeaderBar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->left_toolbar;
	_tmp1_ = value;
	gtk_header_bar_set_title (_tmp0_, _tmp1_);
	g_object_notify ((GObject *) self, "left-title");
}


const gchar* contacts_window_get_right_title (ContactsWindow* self) {
	const gchar* result;
	GtkHeaderBar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->right_toolbar;
	_tmp1_ = gtk_header_bar_get_title (_tmp0_);
	result = _tmp1_;
	return result;
}


void contacts_window_set_right_title (ContactsWindow* self, const gchar* value) {
	GtkHeaderBar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->right_toolbar;
	_tmp1_ = value;
	gtk_header_bar_set_title (_tmp0_, _tmp1_);
	g_object_notify ((GObject *) self, "right-title");
}


static void contacts_window_class_init (ContactsWindowClass * klass) {
	gint ContactsWindow_private_offset;
	contacts_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ContactsWindowPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_contacts_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_contacts_window_set_property;
	G_OBJECT_CLASS (klass)->finalize = contacts_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CONTACTS_WINDOW_LEFT_TITLE, g_param_spec_string ("left-title", "left-title", "left-title", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), CONTACTS_WINDOW_RIGHT_TITLE, g_param_spec_string ("right-title", "right-title", "right-title", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	ContactsWindow_private_offset = g_type_class_get_instance_private_offset (klass);
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/contacts/contacts-window.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "left_toolbar", FALSE, ContactsWindow_private_offset + G_STRUCT_OFFSET (ContactsWindowPrivate, left_toolbar));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "right_toolbar", FALSE, ContactsWindow_private_offset + G_STRUCT_OFFSET (ContactsWindowPrivate, right_toolbar));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "overlay", FALSE, ContactsWindow_private_offset + G_STRUCT_OFFSET (ContactsWindowPrivate, overlay));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "grid", FALSE, ContactsWindow_private_offset + G_STRUCT_OFFSET (ContactsWindowPrivate, grid));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "right_overlay", FALSE, ContactsWindow_private_offset + G_STRUCT_OFFSET (ContactsWindowPrivate, right_overlay));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "add_button", FALSE, G_STRUCT_OFFSET (ContactsWindow, add_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "select_button", FALSE, G_STRUCT_OFFSET (ContactsWindow, select_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "edit_button", FALSE, G_STRUCT_OFFSET (ContactsWindow, edit_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "done_button", FALSE, G_STRUCT_OFFSET (ContactsWindow, done_button));
}


static void contacts_window_instance_init (ContactsWindow * self) {
	self->priv = CONTACTS_WINDOW_GET_PRIVATE (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void contacts_window_finalize (GObject* obj) {
	ContactsWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_WINDOW, ContactsWindow);
	_g_object_unref0 (self->priv->left_toolbar);
	_g_object_unref0 (self->priv->right_toolbar);
	_g_object_unref0 (self->priv->overlay);
	_g_object_unref0 (self->priv->grid);
	_g_object_unref0 (self->priv->right_overlay);
	_g_object_unref0 (self->add_button);
	_g_object_unref0 (self->select_button);
	_g_object_unref0 (self->edit_button);
	_g_object_unref0 (self->done_button);
	G_OBJECT_CLASS (contacts_window_parent_class)->finalize (obj);
}


GType contacts_window_get_type (void) {
	static volatile gsize contacts_window_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_window_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsWindow), 0, (GInstanceInitFunc) contacts_window_instance_init, NULL };
		GType contacts_window_type_id;
		contacts_window_type_id = g_type_register_static (GTK_TYPE_APPLICATION_WINDOW, "ContactsWindow", &g_define_type_info, 0);
		g_once_init_leave (&contacts_window_type_id__volatile, contacts_window_type_id);
	}
	return contacts_window_type_id__volatile;
}


static void _vala_contacts_window_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	ContactsWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CONTACTS_TYPE_WINDOW, ContactsWindow);
	switch (property_id) {
		case CONTACTS_WINDOW_LEFT_TITLE:
		g_value_set_string (value, contacts_window_get_left_title (self));
		break;
		case CONTACTS_WINDOW_RIGHT_TITLE:
		g_value_set_string (value, contacts_window_get_right_title (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_contacts_window_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	ContactsWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, CONTACTS_TYPE_WINDOW, ContactsWindow);
	switch (property_id) {
		case CONTACTS_WINDOW_LEFT_TITLE:
		contacts_window_set_left_title (self, g_value_get_string (value));
		break;
		case CONTACTS_WINDOW_RIGHT_TITLE:
		contacts_window_set_right_title (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



