/* preferences-page.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from preferences-page.vala, do not modify */

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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <handy.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "gnome-games.h"

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#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_PREFERENCES_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPageClass))
#define GAMES_IS_PREFERENCES_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_PREFERENCES_PAGE))
#define GAMES_IS_PREFERENCES_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_PREFERENCES_PAGE))
#define GAMES_PREFERENCES_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPageClass))

typedef struct _GamesPreferencesPage GamesPreferencesPage;
typedef struct _GamesPreferencesPageClass GamesPreferencesPageClass;
typedef struct _GamesPreferencesPagePrivate GamesPreferencesPagePrivate;

#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;
enum  {
	GAMES_PREFERENCES_PAGE_0_PROPERTY,
	GAMES_PREFERENCES_PAGE_WINDOW_PROPERTY,
	GAMES_PREFERENCES_PAGE_NUM_PROPERTIES
};
static GParamSpec* games_preferences_page_properties[GAMES_PREFERENCES_PAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GamesPreferencesPage {
	GtkBin parent_instance;
	GamesPreferencesPagePrivate * priv;
};

struct _GamesPreferencesPageClass {
	GtkBinClass parent_class;
};

struct _GamesPreferencesPagePrivate {
	GamesPreferencesWindow* _window;
	GtkLabel* error_label;
	GtkRevealer* error_notification_revealer;
	GtkBox* box;
};

static gint GamesPreferencesPage_private_offset;
static gpointer games_preferences_page_parent_class = NULL;
static GtkBuildableIface * games_preferences_page_gtk_buildable_parent_iface = NULL;

VALA_EXTERN GType games_preferences_page_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType games_preferences_window_get_type (void) G_GNUC_CONST ;
static void games_preferences_page_on_error_notification_closed (GamesPreferencesPage* self);
static void _games_preferences_page_on_error_notification_closed_gtk_button_clicked (GtkButton* _sender,
                                                                              gpointer self);
VALA_EXTERN void games_preferences_page_show_error_message (GamesPreferencesPage* self,
                                                const gchar* error_message);
static void games_preferences_page_real_add_child (GtkBuildable* base,
                                            GtkBuilder* builder,
                                            GObject* child,
                                            const gchar* type);
VALA_EXTERN GamesPreferencesPage* games_preferences_page_new (void);
VALA_EXTERN GamesPreferencesPage* games_preferences_page_construct (GType object_type);
VALA_EXTERN GamesPreferencesWindow* games_preferences_page_get_window (GamesPreferencesPage* self);
static void games_preferences_page_set_window (GamesPreferencesPage* self,
                                        GamesPreferencesWindow* value);
static void games_preferences_page_finalize (GObject * obj);
static GType games_preferences_page_get_type_once (void);
static void _vala_games_preferences_page_get_property (GObject * object,
                                                guint property_id,
                                                GValue * value,
                                                GParamSpec * pspec);
static void _vala_games_preferences_page_set_property (GObject * object,
                                                guint property_id,
                                                const GValue * value,
                                                GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
games_preferences_page_get_instance_private (GamesPreferencesPage* self)
{
	return G_STRUCT_MEMBER_P (self, GamesPreferencesPage_private_offset);
}

static void
games_preferences_page_on_error_notification_closed (GamesPreferencesPage* self)
{
	GtkRevealer* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->error_notification_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, FALSE);
}

static void
_games_preferences_page_on_error_notification_closed_gtk_button_clicked (GtkButton* _sender,
                                                                         gpointer self)
{
	games_preferences_page_on_error_notification_closed ((GamesPreferencesPage*) self);
}

void
games_preferences_page_show_error_message (GamesPreferencesPage* self,
                                           const gchar* error_message)
{
	GtkLabel* _tmp0_;
	GtkRevealer* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (error_message != NULL);
	_tmp0_ = self->priv->error_label;
	gtk_label_set_label (_tmp0_, error_message);
	_tmp1_ = self->priv->error_notification_revealer;
	gtk_revealer_set_reveal_child (_tmp1_, TRUE);
}

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

static void
games_preferences_page_real_add_child (GtkBuildable* base,
                                       GtkBuilder* builder,
                                       GObject* child,
                                       const gchar* type)
{
	GamesPreferencesPage * self;
	GtkWidget* widget = NULL;
	GtkWidget* _tmp0_;
	GtkBox* _tmp1_;
	self = (GamesPreferencesPage*) base;
	g_return_if_fail (builder != NULL);
	g_return_if_fail (child != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (child, gtk_widget_get_type ()) ? ((GtkWidget*) child) : NULL);
	widget = _tmp0_;
	_tmp1_ = self->priv->box;
	if (_tmp1_ != NULL) {
		GtkBox* _tmp2_;
		GtkWidget* _tmp3_;
		_tmp2_ = self->priv->box;
		_tmp3_ = widget;
		gtk_container_add ((GtkContainer*) _tmp2_, _tmp3_);
	} else {
		GtkWidget* _tmp4_;
		_tmp4_ = widget;
		gtk_container_add ((GtkContainer*) self, _tmp4_);
	}
	_g_object_unref0 (widget);
}

GamesPreferencesPage*
games_preferences_page_construct (GType object_type)
{
	GamesPreferencesPage * self = NULL;
	self = (GamesPreferencesPage*) g_object_new (object_type, NULL);
	return self;
}

GamesPreferencesPage*
games_preferences_page_new (void)
{
	return games_preferences_page_construct (GAMES_TYPE_PREFERENCES_PAGE);
}

GamesPreferencesWindow*
games_preferences_page_get_window (GamesPreferencesPage* self)
{
	GamesPreferencesWindow* result;
	GamesPreferencesWindow* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_window;
	result = _tmp0_;
	return result;
}

static void
games_preferences_page_set_window (GamesPreferencesPage* self,
                                   GamesPreferencesWindow* value)
{
	GamesPreferencesWindow* old_value;
	g_return_if_fail (self != NULL);
	old_value = games_preferences_page_get_window (self);
	if (old_value != value) {
		GamesPreferencesWindow* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_window);
		self->priv->_window = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, games_preferences_page_properties[GAMES_PREFERENCES_PAGE_WINDOW_PROPERTY]);
	}
}

static void
games_preferences_page_class_init (GamesPreferencesPageClass * klass,
                                   gpointer klass_data)
{
	games_preferences_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesPreferencesPage_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_games_preferences_page_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_preferences_page_set_property;
	G_OBJECT_CLASS (klass)->finalize = games_preferences_page_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_PREFERENCES_PAGE_WINDOW_PROPERTY, games_preferences_page_properties[GAMES_PREFERENCES_PAGE_WINDOW_PROPERTY] = g_param_spec_object ("window", "window", "window", GAMES_TYPE_PREFERENCES_WINDOW, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Games/preferences/preferences-page.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "error_label", FALSE, GamesPreferencesPage_private_offset + G_STRUCT_OFFSET (GamesPreferencesPagePrivate, error_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "error_notification_revealer", FALSE, GamesPreferencesPage_private_offset + G_STRUCT_OFFSET (GamesPreferencesPagePrivate, error_notification_revealer));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "box", FALSE, GamesPreferencesPage_private_offset + G_STRUCT_OFFSET (GamesPreferencesPagePrivate, box));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_error_notification_closed", G_CALLBACK(_games_preferences_page_on_error_notification_closed_gtk_button_clicked));
}

static void
games_preferences_page_gtk_buildable_interface_init (GtkBuildableIface * iface,
                                                     gpointer iface_data)
{
	games_preferences_page_gtk_buildable_parent_iface = g_type_interface_peek_parent (iface);
	iface->add_child = (void (*) (GtkBuildable*, GtkBuilder*, GObject*, const gchar*)) games_preferences_page_real_add_child;
}

static void
games_preferences_page_instance_init (GamesPreferencesPage * self,
                                      gpointer klass)
{
	self->priv = games_preferences_page_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
games_preferences_page_finalize (GObject * obj)
{
	GamesPreferencesPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPage);
	_g_object_unref0 (self->priv->_window);
	G_OBJECT_CLASS (games_preferences_page_parent_class)->finalize (obj);
}

static GType
games_preferences_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesPreferencesPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_preferences_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesPreferencesPage), 0, (GInstanceInitFunc) games_preferences_page_instance_init, NULL };
	static const GInterfaceInfo gtk_buildable_info = { (GInterfaceInitFunc) games_preferences_page_gtk_buildable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType games_preferences_page_type_id;
	games_preferences_page_type_id = g_type_register_static (gtk_bin_get_type (), "GamesPreferencesPage", &g_define_type_info, 0);
	g_type_add_interface_static (games_preferences_page_type_id, gtk_buildable_get_type (), &gtk_buildable_info);
	GamesPreferencesPage_private_offset = g_type_add_instance_private (games_preferences_page_type_id, sizeof (GamesPreferencesPagePrivate));
	return games_preferences_page_type_id;
}

GType
games_preferences_page_get_type (void)
{
	static volatile gsize games_preferences_page_type_id__once = 0;
	if (g_once_init_enter (&games_preferences_page_type_id__once)) {
		GType games_preferences_page_type_id;
		games_preferences_page_type_id = games_preferences_page_get_type_once ();
		g_once_init_leave (&games_preferences_page_type_id__once, games_preferences_page_type_id);
	}
	return games_preferences_page_type_id__once;
}

static void
_vala_games_preferences_page_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec)
{
	GamesPreferencesPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPage);
	switch (property_id) {
		case GAMES_PREFERENCES_PAGE_WINDOW_PROPERTY:
		g_value_set_object (value, games_preferences_page_get_window (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_games_preferences_page_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec)
{
	GamesPreferencesPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_PREFERENCES_PAGE, GamesPreferencesPage);
	switch (property_id) {
		case GAMES_PREFERENCES_PAGE_WINDOW_PROPERTY:
		games_preferences_page_set_window (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

