/* preferences-window.c generated by valac 0.36.1.39-72bb2, the Vala compiler
 * generated from preferences-window.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_PREFERENCES_WINDOW (games_preferences_window_get_type ())
#define GAMES_PREFERENCES_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PREFERENCES_WINDOW, GamesPreferencesWindow))
#define GAMES_PREFERENCES_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PREFERENCES_WINDOW, GamesPreferencesWindowClass))
#define GAMES_IS_PREFERENCES_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PREFERENCES_WINDOW))
#define GAMES_IS_PREFERENCES_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PREFERENCES_WINDOW))
#define GAMES_PREFERENCES_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PREFERENCES_WINDOW, GamesPreferencesWindowClass))

typedef struct _GamesPreferencesWindow GamesPreferencesWindow;
typedef struct _GamesPreferencesWindowClass GamesPreferencesWindowClass;
typedef struct _GamesPreferencesWindowPrivate GamesPreferencesWindowPrivate;
enum  {
	GAMES_PREFERENCES_WINDOW_DUMMY_PROPERTY,
	GAMES_PREFERENCES_WINDOW_RIGHT_HEADER_BAR,
	GAMES_PREFERENCES_WINDOW_IMMERSIVE_MODE,
	GAMES_PREFERENCES_WINDOW_LAST_PROPERTY
};
static GParamSpec* games_preferences_window_properties[GAMES_PREFERENCES_WINDOW_LAST_PROPERTY];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GAMES_TYPE_PREFERENCES_PAGE (games_preferences_page_get_type ())
#define GAMES_PREFERENCES_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPage))
#define GAMES_IS_PREFERENCES_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PREFERENCES_PAGE))
#define GAMES_PREFERENCES_PAGE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPageIface))

typedef struct _GamesPreferencesPage GamesPreferencesPage;
typedef struct _GamesPreferencesPageIface GamesPreferencesPageIface;

struct _GamesPreferencesWindow {
	GtkWindow parent_instance;
	GamesPreferencesWindowPrivate * priv;
};

struct _GamesPreferencesWindowClass {
	GtkWindowClass parent_class;
};

struct _GamesPreferencesWindowPrivate {
	GtkBox* titlebar_box;
	GtkHeaderBar* left_header_bar;
	GtkSeparator* header_separator;
	GtkBox* sidebar_vbox;
	GtkSeparator* separator;
	GtkStack* stack;
	GtkHeaderBar* _right_header_bar;
	gboolean _immersive_mode;
	GBinding* right_header_bar_binding;
	GBinding* immersive_mode_binding;
};

struct _GamesPreferencesPageIface {
	GTypeInterface parent_iface;
	void (*visible_page_changed) (GamesPreferencesPage* self);
	GtkHeaderBar* (*get_header_bar) (GamesPreferencesPage* self);
	void (*set_header_bar) (GamesPreferencesPage* self, GtkHeaderBar* value);
	gboolean (*get_immersive_mode) (GamesPreferencesPage* self);
	void (*set_immersive_mode) (GamesPreferencesPage* self, gboolean value);
};


static gpointer games_preferences_window_parent_class = NULL;

GType games_preferences_window_get_type (void) G_GNUC_CONST;
#define GAMES_PREFERENCES_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_PREFERENCES_WINDOW, GamesPreferencesWindowPrivate))
GamesPreferencesWindow* games_preferences_window_new (void);
GamesPreferencesWindow* games_preferences_window_construct (GType object_type);
static void __lambda13_ (GamesPreferencesWindow* self, GtkWidget* child);
GType games_preferences_page_get_type (void) G_GNUC_CONST;
void games_preferences_page_visible_page_changed (GamesPreferencesPage* self);
static void _games_preferences_page_visible_page_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void ___lambda13__gtk_callback (GtkWidget* widget, gpointer self);
static void games_preferences_window_visible_child_changed (GamesPreferencesWindow* self);
static void _games_preferences_window_visible_child_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
void games_preferences_window_set_right_header_bar (GamesPreferencesWindow* self, GtkHeaderBar* value);
GtkHeaderBar* games_preferences_window_get_right_header_bar (GamesPreferencesWindow* self);
gboolean games_preferences_window_get_immersive_mode (GamesPreferencesWindow* self);
void games_preferences_window_set_immersive_mode (GamesPreferencesWindow* self, gboolean value);
static void games_preferences_window_finalize (GObject * obj);
static void _vala_games_preferences_window_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_games_preferences_window_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


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


static void _games_preferences_page_visible_page_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	games_preferences_page_visible_page_changed ((GamesPreferencesPage*) self);
}


static void __lambda13_ (GamesPreferencesWindow* self, GtkWidget* child) {
	GamesPreferencesPage* page = NULL;
	GtkWidget* _tmp0_;
	GamesPreferencesPage* _tmp1_;
	GtkStack* _tmp2_;
	g_return_if_fail (child != NULL);
	_tmp0_ = child;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPage));
	page = _tmp1_;
	_tmp2_ = self->priv->stack;
	g_signal_connect_object ((GObject*) _tmp2_, "notify::visible-child-name", (GCallback) _games_preferences_page_visible_page_changed_g_object_notify, page, 0);
	_g_object_unref0 (page);
}


static void ___lambda13__gtk_callback (GtkWidget* widget, gpointer self) {
	__lambda13_ ((GamesPreferencesWindow*) self, widget);
}


static void _games_preferences_window_visible_child_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	games_preferences_window_visible_child_changed ((GamesPreferencesWindow*) self);
}


GamesPreferencesWindow* games_preferences_window_construct (GType object_type) {
	GamesPreferencesWindow * self = NULL;
	GtkStack* _tmp0_;
	GtkStack* _tmp1_;
	self = (GamesPreferencesWindow*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->stack;
	gtk_container_foreach ((GtkContainer*) _tmp0_, ___lambda13__gtk_callback, self);
	_tmp1_ = self->priv->stack;
	g_signal_connect_object ((GObject*) _tmp1_, "notify::visible-child-name", (GCallback) _games_preferences_window_visible_child_changed_g_object_notify, self, 0);
	games_preferences_window_visible_child_changed (self);
	return self;
}


GamesPreferencesWindow* games_preferences_window_new (void) {
	return games_preferences_window_construct (GAMES_TYPE_PREFERENCES_WINDOW);
}


static void games_preferences_window_visible_child_changed (GamesPreferencesWindow* self) {
	GamesPreferencesPage* page = NULL;
	GtkStack* _tmp0_;
	GtkWidget* _tmp1_;
	GamesPreferencesPage* _tmp2_;
	GamesPreferencesPage* _tmp3_;
	GamesPreferencesPage* _tmp4_;
	GBinding* _tmp5_;
	GBinding* _tmp6_;
	GamesPreferencesPage* _tmp7_;
	GBinding* _tmp8_;
	GBinding* _tmp9_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->stack;
	_tmp1_ = gtk_stack_get_visible_child (_tmp0_);
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPage));
	page = _tmp2_;
	_tmp3_ = page;
	if (_tmp3_ == NULL) {
		games_preferences_window_set_right_header_bar (self, NULL);
		_g_object_unref0 (page);
		return;
	}
	_tmp4_ = page;
	_tmp5_ = g_object_bind_property_with_closures ((GObject*) _tmp4_, "header-bar", (GObject*) self, "right_header_bar", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp6_ = _g_object_ref0 (_tmp5_);
	_g_object_unref0 (self->priv->right_header_bar_binding);
	self->priv->right_header_bar_binding = _tmp6_;
	_tmp7_ = page;
	_tmp8_ = g_object_bind_property_with_closures ((GObject*) _tmp7_, "immersive-mode", (GObject*) self, "immersive-mode", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp9_ = _g_object_ref0 (_tmp8_);
	_g_object_unref0 (self->priv->immersive_mode_binding);
	self->priv->immersive_mode_binding = _tmp9_;
	_g_object_unref0 (page);
}


GtkHeaderBar* games_preferences_window_get_right_header_bar (GamesPreferencesWindow* self) {
	GtkHeaderBar* result;
	GtkHeaderBar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_right_header_bar;
	result = _tmp0_;
	return result;
}


void games_preferences_window_set_right_header_bar (GamesPreferencesWindow* self, GtkHeaderBar* value) {
	GtkHeaderBar* _tmp0_;
	GtkHeaderBar* _tmp3_;
	GtkHeaderBar* _tmp9_;
	GtkHeaderBar* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_right_header_bar;
	if (_tmp0_ != NULL) {
		GtkBox* _tmp1_;
		GtkHeaderBar* _tmp2_;
		_tmp1_ = self->priv->titlebar_box;
		_tmp2_ = self->priv->_right_header_bar;
		gtk_container_remove ((GtkContainer*) _tmp1_, (GtkWidget*) _tmp2_);
	}
	_tmp3_ = value;
	if (_tmp3_ != NULL) {
		GtkBox* _tmp4_;
		GtkHeaderBar* _tmp5_;
		GtkHeaderBar* _tmp6_;
		gboolean _tmp7_;
		gboolean _tmp8_;
		_tmp4_ = self->priv->titlebar_box;
		_tmp5_ = value;
		gtk_box_pack_end (_tmp4_, (GtkWidget*) _tmp5_, TRUE, TRUE, (guint) 0);
		_tmp6_ = value;
		_tmp7_ = games_preferences_window_get_immersive_mode (self);
		_tmp8_ = _tmp7_;
		gtk_header_bar_set_show_close_button (_tmp6_, !_tmp8_);
	}
	_tmp9_ = value;
	_tmp10_ = _g_object_ref0 (_tmp9_);
	_g_object_unref0 (self->priv->_right_header_bar);
	self->priv->_right_header_bar = _tmp10_;
	g_object_notify_by_pspec ((GObject *) self, games_preferences_window_properties[GAMES_PREFERENCES_WINDOW_RIGHT_HEADER_BAR]);
}


gboolean games_preferences_window_get_immersive_mode (GamesPreferencesWindow* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_immersive_mode;
	result = _tmp0_;
	return result;
}


void games_preferences_window_set_immersive_mode (GamesPreferencesWindow* self, gboolean value) {
	GtkSeparator* _tmp0_;
	gboolean _tmp1_;
	GtkHeaderBar* _tmp2_;
	gboolean _tmp3_;
	GtkSeparator* _tmp4_;
	gboolean _tmp5_;
	GtkBox* _tmp6_;
	gboolean _tmp7_;
	GtkHeaderBar* _tmp8_;
	GtkHeaderBar* _tmp9_;
	gboolean _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->header_separator;
	_tmp1_ = value;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, !_tmp1_);
	_tmp2_ = self->priv->left_header_bar;
	_tmp3_ = value;
	gtk_widget_set_visible ((GtkWidget*) _tmp2_, !_tmp3_);
	_tmp4_ = self->priv->separator;
	_tmp5_ = value;
	gtk_widget_set_visible ((GtkWidget*) _tmp4_, !_tmp5_);
	_tmp6_ = self->priv->sidebar_vbox;
	_tmp7_ = value;
	gtk_widget_set_visible ((GtkWidget*) _tmp6_, !_tmp7_);
	_tmp8_ = games_preferences_window_get_right_header_bar (self);
	_tmp9_ = _tmp8_;
	if (_tmp9_ != NULL) {
		GtkHeaderBar* _tmp10_;
		GtkHeaderBar* _tmp11_;
		gboolean _tmp12_;
		_tmp10_ = games_preferences_window_get_right_header_bar (self);
		_tmp11_ = _tmp10_;
		_tmp12_ = value;
		gtk_header_bar_set_show_close_button (_tmp11_, !_tmp12_);
	}
	_tmp13_ = value;
	self->priv->_immersive_mode = _tmp13_;
	g_object_notify_by_pspec ((GObject *) self, games_preferences_window_properties[GAMES_PREFERENCES_WINDOW_IMMERSIVE_MODE]);
}


static void games_preferences_window_class_init (GamesPreferencesWindowClass * klass) {
	gint GamesPreferencesWindow_private_offset;
	games_preferences_window_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesPreferencesWindowPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_games_preferences_window_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_preferences_window_set_property;
	G_OBJECT_CLASS (klass)->finalize = games_preferences_window_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_PREFERENCES_WINDOW_RIGHT_HEADER_BAR, games_preferences_window_properties[GAMES_PREFERENCES_WINDOW_RIGHT_HEADER_BAR] = g_param_spec_object ("right-header-bar", "right-header-bar", "right-header-bar", gtk_header_bar_get_type (), 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), GAMES_PREFERENCES_WINDOW_IMMERSIVE_MODE, games_preferences_window_properties[GAMES_PREFERENCES_WINDOW_IMMERSIVE_MODE] = g_param_spec_boolean ("immersive-mode", "immersive-mode", "immersive-mode", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	GamesPreferencesWindow_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/preferences-window.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "titlebar_box", FALSE, GamesPreferencesWindow_private_offset + G_STRUCT_OFFSET (GamesPreferencesWindowPrivate, titlebar_box));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "left_header_bar", FALSE, GamesPreferencesWindow_private_offset + G_STRUCT_OFFSET (GamesPreferencesWindowPrivate, left_header_bar));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "header_separator", FALSE, GamesPreferencesWindow_private_offset + G_STRUCT_OFFSET (GamesPreferencesWindowPrivate, header_separator));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "sidebar_vbox", FALSE, GamesPreferencesWindow_private_offset + G_STRUCT_OFFSET (GamesPreferencesWindowPrivate, sidebar_vbox));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "separator", FALSE, GamesPreferencesWindow_private_offset + G_STRUCT_OFFSET (GamesPreferencesWindowPrivate, separator));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "stack", FALSE, GamesPreferencesWindow_private_offset + G_STRUCT_OFFSET (GamesPreferencesWindowPrivate, stack));
}


static void games_preferences_window_instance_init (GamesPreferencesWindow * self) {
	self->priv = GAMES_PREFERENCES_WINDOW_GET_PRIVATE (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}


static void games_preferences_window_finalize (GObject * obj) {
	GamesPreferencesWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_PREFERENCES_WINDOW, GamesPreferencesWindow);
	_g_object_unref0 (self->priv->titlebar_box);
	_g_object_unref0 (self->priv->left_header_bar);
	_g_object_unref0 (self->priv->header_separator);
	_g_object_unref0 (self->priv->sidebar_vbox);
	_g_object_unref0 (self->priv->separator);
	_g_object_unref0 (self->priv->stack);
	_g_object_unref0 (self->priv->_right_header_bar);
	_g_object_unref0 (self->priv->right_header_bar_binding);
	_g_object_unref0 (self->priv->immersive_mode_binding);
	G_OBJECT_CLASS (games_preferences_window_parent_class)->finalize (obj);
}


GType games_preferences_window_get_type (void) {
	static volatile gsize games_preferences_window_type_id__volatile = 0;
	if (g_once_init_enter (&games_preferences_window_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesPreferencesWindowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_preferences_window_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesPreferencesWindow), 0, (GInstanceInitFunc) games_preferences_window_instance_init, NULL };
		GType games_preferences_window_type_id;
		games_preferences_window_type_id = g_type_register_static (gtk_window_get_type (), "GamesPreferencesWindow", &g_define_type_info, 0);
		g_once_init_leave (&games_preferences_window_type_id__volatile, games_preferences_window_type_id);
	}
	return games_preferences_window_type_id__volatile;
}


static void _vala_games_preferences_window_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GamesPreferencesWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_PREFERENCES_WINDOW, GamesPreferencesWindow);
	switch (property_id) {
		case GAMES_PREFERENCES_WINDOW_RIGHT_HEADER_BAR:
		g_value_set_object (value, games_preferences_window_get_right_header_bar (self));
		break;
		case GAMES_PREFERENCES_WINDOW_IMMERSIVE_MODE:
		g_value_set_boolean (value, games_preferences_window_get_immersive_mode (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_games_preferences_window_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GamesPreferencesWindow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_PREFERENCES_WINDOW, GamesPreferencesWindow);
	switch (property_id) {
		case GAMES_PREFERENCES_WINDOW_RIGHT_HEADER_BAR:
		games_preferences_window_set_right_header_bar (self, g_value_get_object (value));
		break;
		case GAMES_PREFERENCES_WINDOW_IMMERSIVE_MODE:
		games_preferences_window_set_immersive_mode (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



