/* preferences-window.c generated by valac 0.35.5, the Vala compiler
 * generated from preferences-window.vala, do not modify */

/* This file is part of GNOME Games. License: GPLv3*/

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.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;
#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 {
	GtkHeaderBar* right_header_bar;
	GtkStack* stack;
};

struct _GamesPreferencesPageIface {
	GTypeInterface parent_iface;
	const gchar* (*get_title) (GamesPreferencesPage* self);
};


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))
enum  {
	GAMES_PREFERENCES_WINDOW_DUMMY_PROPERTY
};
GamesPreferencesWindow* games_preferences_window_new (void);
GamesPreferencesWindow* games_preferences_window_construct (GType object_type);
static void __lambda12_ (GamesPreferencesWindow* self, GtkWidget* child);
GType games_preferences_page_get_type (void) G_GNUC_CONST;
static void games_preferences_window_update_title (GamesPreferencesWindow* self);
static void _games_preferences_window_update_title_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void ___lambda12__gtk_callback (GtkWidget* widget, gpointer self);
const gchar* games_preferences_page_get_title (GamesPreferencesPage* self);
static void games_preferences_window_finalize (GObject * obj);


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


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


static void __lambda12_ (GamesPreferencesWindow* self, GtkWidget* child) {
	GamesPreferencesPage* page;
	GtkWidget* _tmp0_;
	GamesPreferencesPage* _tmp1_;
	g_return_if_fail (child != NULL);
	_tmp0_ = child;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GAMES_TYPE_PREFERENCES_PAGE) ? ((GamesPreferencesPage*) _tmp0_) : NULL);
	page = _tmp1_;
	g_signal_connect_object ((GObject*) page, "notify::title", (GCallback) _games_preferences_window_update_title_g_object_notify, self, 0);
	_g_object_unref0 (page);
}


static void ___lambda12__gtk_callback (GtkWidget* widget, gpointer self) {
	__lambda12_ ((GamesPreferencesWindow*) self, widget);
}


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_, ___lambda12__gtk_callback, self);
	_tmp1_ = self->priv->stack;
	g_signal_connect_object ((GObject*) _tmp1_, "notify::visible-child-name", (GCallback) _games_preferences_window_update_title_g_object_notify, self, 0);
	games_preferences_window_update_title (self);
	return self;
}


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


static void games_preferences_window_update_title (GamesPreferencesWindow* self) {
	GamesPreferencesPage* page;
	GtkStack* _tmp0_;
	GtkWidget* _tmp1_;
	GamesPreferencesPage* _tmp2_;
	const gchar* _tmp3_ = NULL;
	GamesPreferencesPage* _tmp4_;
	GtkHeaderBar* _tmp8_;
	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_;
	_tmp4_ = page;
	if (_tmp4_ == NULL) {
		_tmp3_ = "";
	} else {
		GamesPreferencesPage* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp5_ = page;
		_tmp6_ = games_preferences_page_get_title (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp3_ = _tmp7_;
	}
	_tmp8_ = self->priv->right_header_bar;
	gtk_header_bar_set_title (_tmp8_, _tmp3_);
	_g_object_unref0 (page);
}


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)->finalize = games_preferences_window_finalize;
	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), "right_header_bar", FALSE, GamesPreferencesWindow_private_offset + G_STRUCT_OFFSET (GamesPreferencesWindowPrivate, right_header_bar));
	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->right_header_bar);
	_g_object_unref0 (self->priv->stack);
	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;
}



