/* history-button-label.c generated by valac 0.56.19, the Vala compiler
 * generated from history-button-label.vala, do not modify */

/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
   This file is part of GNOME Reversi, also known as Iagno.

   Copyright 2026 Andrey Kutejko

   GNOME Reversi 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 3 of the License, or
   (at your option) any later version.

   GNOME Reversi 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 GNOME Reversi.  If not, see <https://www.gnu.org/licenses/>.
*/

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_HISTORY_BUTTON_LABEL (history_button_label_get_type ())
#define HISTORY_BUTTON_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HISTORY_BUTTON_LABEL, HistoryButtonLabel))
#define HISTORY_BUTTON_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HISTORY_BUTTON_LABEL, HistoryButtonLabelClass))
#define IS_HISTORY_BUTTON_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HISTORY_BUTTON_LABEL))
#define IS_HISTORY_BUTTON_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HISTORY_BUTTON_LABEL))
#define HISTORY_BUTTON_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HISTORY_BUTTON_LABEL, HistoryButtonLabelClass))

typedef struct _HistoryButtonLabel HistoryButtonLabel;
typedef struct _HistoryButtonLabelClass HistoryButtonLabelClass;
typedef struct _HistoryButtonLabelPrivate HistoryButtonLabelPrivate;

#define TYPE_THEME (theme_get_type ())
#define THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THEME, Theme))
#define THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THEME, ThemeClass))
#define IS_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THEME))
#define IS_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THEME))
#define THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THEME, ThemeClass))

typedef struct _Theme Theme;
typedef struct _ThemeClass ThemeClass;
typedef enum  {
	PLAYER_NONE,
	PLAYER_DARK,
	PLAYER_LIGHT
} Player;

#define TYPE_PLAYER (player_get_type ())

#define TYPE_ARROW (arrow_get_type ())
#define ARROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ARROW, Arrow))
#define ARROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ARROW, ArrowClass))
#define IS_ARROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ARROW))
#define IS_ARROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ARROW))
#define ARROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ARROW, ArrowClass))

typedef struct _Arrow Arrow;
typedef struct _ArrowClass ArrowClass;

#define TYPE_PIECE (piece_get_type ())
#define PIECE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PIECE, Piece))
#define PIECE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PIECE, PieceClass))
#define IS_PIECE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PIECE))
#define IS_PIECE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PIECE))
#define PIECE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PIECE, PieceClass))

typedef struct _Piece Piece;
typedef struct _PieceClass PieceClass;
enum  {
	HISTORY_BUTTON_LABEL_0_PROPERTY,
	HISTORY_BUTTON_LABEL_THEME_PROPERTY,
	HISTORY_BUTTON_LABEL_PLAYER_PROPERTY,
	HISTORY_BUTTON_LABEL_NUM_PROPERTIES
};
static GParamSpec* history_button_label_properties[HISTORY_BUTTON_LABEL_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _HistoryButtonLabel {
	GtkWidget parent_instance;
	HistoryButtonLabelPrivate * priv;
};

struct _HistoryButtonLabelClass {
	GtkWidgetClass parent_class;
};

struct _HistoryButtonLabelPrivate {
	Theme* _theme;
	Player _player;
	GtkStack* stack;
	GtkWidget* prompt;
	Arrow* prompt_arrow;
	Piece* prompt_piece;
	GtkWidget* end;
};

static gint HistoryButtonLabel_private_offset;
static gpointer history_button_label_parent_class = NULL;

VALA_EXTERN GType history_button_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (HistoryButtonLabel, g_object_unref)
VALA_EXTERN GType theme_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Theme, g_object_unref)
VALA_EXTERN GType player_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType arrow_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Arrow, g_object_unref)
VALA_EXTERN GType piece_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Piece, g_object_unref)
VALA_EXTERN HistoryButtonLabel* history_button_label_new (void);
VALA_EXTERN HistoryButtonLabel* history_button_label_construct (GType object_type);
VALA_EXTERN Theme* history_button_label_get_theme (HistoryButtonLabel* self);
VALA_EXTERN void history_button_label_set_theme (HistoryButtonLabel* self,
                                     Theme* value);
VALA_EXTERN Player history_button_label_get_player (HistoryButtonLabel* self);
VALA_EXTERN void history_button_label_set_player (HistoryButtonLabel* self,
                                      Player value);
static GObject * history_button_label_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties);
static gboolean _history_button_label___lambda9_ (HistoryButtonLabel* self,
                                           GBinding* binding,
                                           GValue* srcval,
                                           GValue* targetval);
static gboolean __history_button_label___lambda9__gbinding_transform_func (GBinding* binding,
                                                                    GValue* from_value,
                                                                    GValue* to_value,
                                                                    gpointer self);
static void history_button_label_finalize (GObject * obj);
static GType history_button_label_get_type_once (void);
static void _vala_history_button_label_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_history_button_label_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);

static inline gpointer
history_button_label_get_instance_private (HistoryButtonLabel* self)
{
	return G_STRUCT_MEMBER_P (self, HistoryButtonLabel_private_offset);
}

HistoryButtonLabel*
history_button_label_construct (GType object_type)
{
	HistoryButtonLabel * self = NULL;
	self = (HistoryButtonLabel*) g_object_new (object_type, NULL);
	return self;
}

HistoryButtonLabel*
history_button_label_new (void)
{
	return history_button_label_construct (TYPE_HISTORY_BUTTON_LABEL);
}

Theme*
history_button_label_get_theme (HistoryButtonLabel* self)
{
	Theme* result;
	Theme* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_theme;
	result = _tmp0_;
	return result;
}

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

void
history_button_label_set_theme (HistoryButtonLabel* self,
                                Theme* value)
{
	Theme* old_value;
	g_return_if_fail (self != NULL);
	old_value = history_button_label_get_theme (self);
	if (old_value != value) {
		Theme* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_theme);
		self->priv->_theme = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, history_button_label_properties[HISTORY_BUTTON_LABEL_THEME_PROPERTY]);
	}
}

Player
history_button_label_get_player (HistoryButtonLabel* self)
{
	Player result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_player;
	return result;
}

void
history_button_label_set_player (HistoryButtonLabel* self,
                                 Player value)
{
	Player old_value;
	g_return_if_fail (self != NULL);
	old_value = history_button_label_get_player (self);
	if (old_value != value) {
		self->priv->_player = value;
		g_object_notify_by_pspec ((GObject *) self, history_button_label_properties[HISTORY_BUTTON_LABEL_PLAYER_PROPERTY]);
	}
}

static gboolean
_history_button_label___lambda9_ (HistoryButtonLabel* self,
                                  GBinding* binding,
                                  GValue* srcval,
                                  GValue* targetval)
{
	GtkWidget* _tmp0_ = NULL;
	GValue _tmp1_;
	gboolean result;
	g_return_val_if_fail (binding != NULL, FALSE);
	g_return_val_if_fail (srcval != NULL, FALSE);
	g_return_val_if_fail (targetval != NULL, FALSE);
	_tmp1_ = *srcval;
	if (g_value_get_enum (&_tmp1_) == PLAYER_NONE) {
		GtkWidget* _tmp2_;
		_tmp2_ = self->priv->end;
		_tmp0_ = _tmp2_;
	} else {
		GtkWidget* _tmp3_;
		_tmp3_ = self->priv->prompt;
		_tmp0_ = _tmp3_;
	}
	g_value_set_object (targetval, (GObject*) _tmp0_);
	result = TRUE;
	return result;
}

static gboolean
__history_button_label___lambda9__gbinding_transform_func (GBinding* binding,
                                                           GValue* from_value,
                                                           GValue* to_value,
                                                           gpointer self)
{
	gboolean result;
	result = _history_button_label___lambda9_ ((HistoryButtonLabel*) self, binding, from_value, to_value);
	return result;
}

static GObject *
history_button_label_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	HistoryButtonLabel * self;
	GtkStack* _tmp0_;
	Piece* _tmp1_;
	Piece* _tmp2_;
	parent_class = G_OBJECT_CLASS (history_button_label_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_HISTORY_BUTTON_LABEL, HistoryButtonLabel);
	_tmp0_ = self->priv->stack;
	g_object_bind_property_with_closures ((GObject*) self, "player", (GObject*) _tmp0_, "visible-child", G_BINDING_SYNC_CREATE, (GClosure*) ((__history_button_label___lambda9__gbinding_transform_func == NULL) ? NULL : g_cclosure_new ((GCallback) __history_button_label___lambda9__gbinding_transform_func, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp1_ = self->priv->prompt_piece;
	g_object_bind_property_with_closures ((GObject*) self, "theme", (GObject*) _tmp1_, "theme", 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)));
	_tmp2_ = self->priv->prompt_piece;
	g_object_bind_property_with_closures ((GObject*) self, "player", (GObject*) _tmp2_, "player", 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)));
	return obj;
}

static void
history_button_label_class_init (HistoryButtonLabelClass * klass,
                                 gpointer klass_data)
{
	history_button_label_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &HistoryButtonLabel_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_history_button_label_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_history_button_label_set_property;
	G_OBJECT_CLASS (klass)->constructor = history_button_label_constructor;
	G_OBJECT_CLASS (klass)->finalize = history_button_label_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), HISTORY_BUTTON_LABEL_THEME_PROPERTY, history_button_label_properties[HISTORY_BUTTON_LABEL_THEME_PROPERTY] = g_param_spec_object ("theme", "theme", "theme", TYPE_THEME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), HISTORY_BUTTON_LABEL_PLAYER_PROPERTY, history_button_label_properties[HISTORY_BUTTON_LABEL_PLAYER_PROPERTY] = g_param_spec_enum ("player", "player", "player", TYPE_PLAYER, PLAYER_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/Reversi/ui/history-button-label.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "stack", FALSE, HistoryButtonLabel_private_offset + G_STRUCT_OFFSET (HistoryButtonLabelPrivate, stack));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "prompt", FALSE, HistoryButtonLabel_private_offset + G_STRUCT_OFFSET (HistoryButtonLabelPrivate, prompt));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "prompt_arrow", FALSE, HistoryButtonLabel_private_offset + G_STRUCT_OFFSET (HistoryButtonLabelPrivate, prompt_arrow));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "prompt_piece", FALSE, HistoryButtonLabel_private_offset + G_STRUCT_OFFSET (HistoryButtonLabelPrivate, prompt_piece));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "end", FALSE, HistoryButtonLabel_private_offset + G_STRUCT_OFFSET (HistoryButtonLabelPrivate, end));
}

static void
history_button_label_instance_init (HistoryButtonLabel * self,
                                    gpointer klass)
{
	self->priv = history_button_label_get_instance_private (self);
	self->priv->_player = PLAYER_NONE;
	g_type_ensure (TYPE_ARROW);
	g_type_ensure (TYPE_PIECE);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
history_button_label_finalize (GObject * obj)
{
	HistoryButtonLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_HISTORY_BUTTON_LABEL, HistoryButtonLabel);
	_g_object_unref0 (self->priv->_theme);
	G_OBJECT_CLASS (history_button_label_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
history_button_label_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (HistoryButtonLabelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) history_button_label_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HistoryButtonLabel), 0, (GInstanceInitFunc) history_button_label_instance_init, NULL };
	GType history_button_label_type_id;
	history_button_label_type_id = g_type_register_static (gtk_widget_get_type (), "HistoryButtonLabel", &g_define_type_info, G_TYPE_FLAG_NONE);
	HistoryButtonLabel_private_offset = g_type_add_instance_private (history_button_label_type_id, sizeof (HistoryButtonLabelPrivate));
	return history_button_label_type_id;
}

GType
history_button_label_get_type (void)
{
	static gsize history_button_label_type_id__once = 0;
	if (g_once_init_enter (&history_button_label_type_id__once)) {
		GType history_button_label_type_id;
		history_button_label_type_id = history_button_label_get_type_once ();
		g_once_init_leave (&history_button_label_type_id__once, history_button_label_type_id);
	}
	return history_button_label_type_id__once;
}

static void
_vala_history_button_label_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	HistoryButtonLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_HISTORY_BUTTON_LABEL, HistoryButtonLabel);
	switch (property_id) {
		case HISTORY_BUTTON_LABEL_THEME_PROPERTY:
		g_value_set_object (value, history_button_label_get_theme (self));
		break;
		case HISTORY_BUTTON_LABEL_PLAYER_PROPERTY:
		g_value_set_enum (value, history_button_label_get_player (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_history_button_label_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	HistoryButtonLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_HISTORY_BUTTON_LABEL, HistoryButtonLabel);
	switch (property_id) {
		case HISTORY_BUTTON_LABEL_THEME_PROPERTY:
		history_button_label_set_theme (self, g_value_get_object (value));
		break;
		case HISTORY_BUTTON_LABEL_PLAYER_PROPERTY:
		history_button_label_set_player (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

