/* collection-header-bar.c generated by valac 0.36.6.6-c7bee, the Vala compiler
 * generated from collection-header-bar.vala, do not modify */

/* This file is part of GNOME Games. License: GPL-3.0+.*/

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>


#define GAMES_TYPE_COLLECTION_HEADER_BAR (games_collection_header_bar_get_type ())
#define GAMES_COLLECTION_HEADER_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_COLLECTION_HEADER_BAR, GamesCollectionHeaderBar))
#define GAMES_COLLECTION_HEADER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_COLLECTION_HEADER_BAR, GamesCollectionHeaderBarClass))
#define GAMES_IS_COLLECTION_HEADER_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_COLLECTION_HEADER_BAR))
#define GAMES_IS_COLLECTION_HEADER_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_COLLECTION_HEADER_BAR))
#define GAMES_COLLECTION_HEADER_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_COLLECTION_HEADER_BAR, GamesCollectionHeaderBarClass))

typedef struct _GamesCollectionHeaderBar GamesCollectionHeaderBar;
typedef struct _GamesCollectionHeaderBarClass GamesCollectionHeaderBarClass;
typedef struct _GamesCollectionHeaderBarPrivate GamesCollectionHeaderBarPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GamesCollectionHeaderBar {
	GtkHeaderBar parent_instance;
	GamesCollectionHeaderBarPrivate * priv;
};

struct _GamesCollectionHeaderBarClass {
	GtkHeaderBarClass parent_class;
};

struct _GamesCollectionHeaderBarPrivate {
	gboolean _search_mode;
	GtkToggleButton* search;
	GBinding* search_binding;
};


static gpointer games_collection_header_bar_parent_class = NULL;

GType games_collection_header_bar_get_type (void) G_GNUC_CONST;
#define GAMES_COLLECTION_HEADER_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_COLLECTION_HEADER_BAR, GamesCollectionHeaderBarPrivate))
enum  {
	GAMES_COLLECTION_HEADER_BAR_0_PROPERTY,
	GAMES_COLLECTION_HEADER_BAR_SEARCH_MODE_PROPERTY
};
GamesCollectionHeaderBar* games_collection_header_bar_new (void);
GamesCollectionHeaderBar* games_collection_header_bar_construct (GType object_type);
gboolean games_collection_header_bar_get_search_mode (GamesCollectionHeaderBar* self);
void games_collection_header_bar_set_search_mode (GamesCollectionHeaderBar* self, gboolean value);
static GObject * games_collection_header_bar_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void games_collection_header_bar_finalize (GObject * obj);
static void _vala_games_collection_header_bar_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_games_collection_header_bar_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


GamesCollectionHeaderBar* games_collection_header_bar_construct (GType object_type) {
	GamesCollectionHeaderBar * self = NULL;
	self = (GamesCollectionHeaderBar*) g_object_new (object_type, NULL);
	return self;
}


GamesCollectionHeaderBar* games_collection_header_bar_new (void) {
	return games_collection_header_bar_construct (GAMES_TYPE_COLLECTION_HEADER_BAR);
}


gboolean games_collection_header_bar_get_search_mode (GamesCollectionHeaderBar* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_search_mode;
	result = _tmp0_;
	return result;
}


void games_collection_header_bar_set_search_mode (GamesCollectionHeaderBar* self, gboolean value) {
	g_return_if_fail (self != NULL);
	if (games_collection_header_bar_get_search_mode (self) != value) {
		gboolean _tmp0_;
		_tmp0_ = value;
		self->priv->_search_mode = _tmp0_;
		g_object_notify ((GObject *) self, "search-mode");
	}
}


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


static GObject * games_collection_header_bar_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	GamesCollectionHeaderBar * self;
	GtkToggleButton* _tmp0_;
	GBinding* _tmp1_;
	GBinding* _tmp2_;
	parent_class = G_OBJECT_CLASS (games_collection_header_bar_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_COLLECTION_HEADER_BAR, GamesCollectionHeaderBar);
	_tmp0_ = self->priv->search;
	_tmp1_ = g_object_bind_property_with_closures ((GObject*) self, "search-mode", (GObject*) _tmp0_, "active", G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (self->priv->search_binding);
	self->priv->search_binding = _tmp2_;
	return obj;
}


static void games_collection_header_bar_class_init (GamesCollectionHeaderBarClass * klass) {
	gint GamesCollectionHeaderBar_private_offset;
	games_collection_header_bar_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesCollectionHeaderBarPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_games_collection_header_bar_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_collection_header_bar_set_property;
	G_OBJECT_CLASS (klass)->constructor = games_collection_header_bar_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_collection_header_bar_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_COLLECTION_HEADER_BAR_SEARCH_MODE_PROPERTY, g_param_spec_boolean ("search-mode", "search-mode", "search-mode", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	GamesCollectionHeaderBar_private_offset = g_type_class_get_instance_private_offset (klass);
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Games/ui/collection-header-bar.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "search", FALSE, GamesCollectionHeaderBar_private_offset + G_STRUCT_OFFSET (GamesCollectionHeaderBarPrivate, search));
}


static void games_collection_header_bar_instance_init (GamesCollectionHeaderBar * self) {
	self->priv = GAMES_COLLECTION_HEADER_BAR_GET_PRIVATE (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void games_collection_header_bar_finalize (GObject * obj) {
	GamesCollectionHeaderBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_COLLECTION_HEADER_BAR, GamesCollectionHeaderBar);
	_g_object_unref0 (self->priv->search);
	_g_object_unref0 (self->priv->search_binding);
	G_OBJECT_CLASS (games_collection_header_bar_parent_class)->finalize (obj);
}


GType games_collection_header_bar_get_type (void) {
	static volatile gsize games_collection_header_bar_type_id__volatile = 0;
	if (g_once_init_enter (&games_collection_header_bar_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesCollectionHeaderBarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_collection_header_bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesCollectionHeaderBar), 0, (GInstanceInitFunc) games_collection_header_bar_instance_init, NULL };
		GType games_collection_header_bar_type_id;
		games_collection_header_bar_type_id = g_type_register_static (gtk_header_bar_get_type (), "GamesCollectionHeaderBar", &g_define_type_info, 0);
		g_once_init_leave (&games_collection_header_bar_type_id__volatile, games_collection_header_bar_type_id);
	}
	return games_collection_header_bar_type_id__volatile;
}


static void _vala_games_collection_header_bar_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GamesCollectionHeaderBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_COLLECTION_HEADER_BAR, GamesCollectionHeaderBar);
	switch (property_id) {
		case GAMES_COLLECTION_HEADER_BAR_SEARCH_MODE_PROPERTY:
		g_value_set_boolean (value, games_collection_header_bar_get_search_mode (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_games_collection_header_bar_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GamesCollectionHeaderBar * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_COLLECTION_HEADER_BAR, GamesCollectionHeaderBar);
	switch (property_id) {
		case GAMES_COLLECTION_HEADER_BAR_SEARCH_MODE_PROPERTY:
		games_collection_header_bar_set_search_mode (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



