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

/*
  This file is part of GNOME Reversi

  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>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.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_GAME_SELECT_LABEL (game_select_label_get_type ())
#define GAME_SELECT_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GAME_SELECT_LABEL, GameSelectLabel))
#define GAME_SELECT_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GAME_SELECT_LABEL, GameSelectLabelClass))
#define IS_GAME_SELECT_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GAME_SELECT_LABEL))
#define IS_GAME_SELECT_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GAME_SELECT_LABEL))
#define GAME_SELECT_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GAME_SELECT_LABEL, GameSelectLabelClass))

typedef struct _GameSelectLabel GameSelectLabel;
typedef struct _GameSelectLabelClass GameSelectLabelClass;
typedef struct _GameSelectLabelPrivate GameSelectLabelPrivate;
enum  {
	GAME_SELECT_LABEL_0_PROPERTY,
	GAME_SELECT_LABEL_GAME_TYPE_PROPERTY,
	GAME_SELECT_LABEL_WITH_IMAGE_PROPERTY,
	GAME_SELECT_LABEL_NUM_PROPERTIES
};
static GParamSpec* game_select_label_properties[GAME_SELECT_LABEL_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GameSelectLabel {
	GtkGrid parent_instance;
	GameSelectLabelPrivate * priv;
};

struct _GameSelectLabelClass {
	GtkGridClass parent_class;
};

struct _GameSelectLabelPrivate {
	GtkLabel* label;
	GtkImage* image;
	gboolean _with_image;
};

static gint GameSelectLabel_private_offset;
static gpointer game_select_label_parent_class = NULL;

VALA_EXTERN GType game_select_label_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GameSelectLabel, g_object_unref)
VALA_EXTERN GameSelectLabel* game_select_label_new (void);
VALA_EXTERN GameSelectLabel* game_select_label_construct (GType object_type);
static void game_select_label_set_game_type (GameSelectLabel* self,
                                      const gchar* value);
VALA_EXTERN gboolean game_select_label_get_with_image (GameSelectLabel* self);
VALA_EXTERN void game_select_label_set_with_image (GameSelectLabel* self,
                                       gboolean value);
static GObject * game_select_label_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties);
static void game_select_label_finalize (GObject * obj);
static GType game_select_label_get_type_once (void);
static void _vala_game_select_label_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec);
static void _vala_game_select_label_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec);

static inline gpointer
game_select_label_get_instance_private (GameSelectLabel* self)
{
	return G_STRUCT_MEMBER_P (self, GameSelectLabel_private_offset);
}

GameSelectLabel*
game_select_label_construct (GType object_type)
{
	GameSelectLabel * self = NULL;
	self = (GameSelectLabel*) g_object_new (object_type, NULL);
	return self;
}

GameSelectLabel*
game_select_label_new (void)
{
	return game_select_label_construct (TYPE_GAME_SELECT_LABEL);
}

static void
game_select_label_set_game_type (GameSelectLabel* self,
                                 const gchar* value)
{
	GtkImage* _tmp4_;
	g_return_if_fail (self != NULL);
	if (g_strcmp0 (value, "classic") == 0) {
		GtkLabel* _tmp0_;
		GtkImage* _tmp1_;
		_tmp0_ = (GtkLabel*) gtk_label_new (_ ("Classic Reversi"));
		g_object_ref_sink (_tmp0_);
		_g_object_unref0 (self->priv->label);
		self->priv->label = _tmp0_;
		_tmp1_ = (GtkImage*) gtk_image_new_from_resource ("/org/gnome/Reversi/images/reversi.png");
		g_object_ref_sink (_tmp1_);
		_g_object_unref0 (self->priv->image);
		self->priv->image = _tmp1_;
	} else {
		if (g_strcmp0 (value, "reverse") == 0) {
			GtkLabel* _tmp2_;
			GtkImage* _tmp3_;
			_tmp2_ = (GtkLabel*) gtk_label_new (_ ("Reverse Reversi"));
			g_object_ref_sink (_tmp2_);
			_g_object_unref0 (self->priv->label);
			self->priv->label = _tmp2_;
			_tmp3_ = (GtkImage*) gtk_image_new_from_resource ("/org/gnome/Reversi/images/reverse.png");
			g_object_ref_sink (_tmp3_);
			_g_object_unref0 (self->priv->image);
			self->priv->image = _tmp3_;
		} else {
			g_assert_not_reached ();
		}
	}
	_tmp4_ = self->priv->image;
	gtk_widget_add_css_class ((GtkWidget*) _tmp4_, "game-select");
	g_object_notify_by_pspec ((GObject *) self, game_select_label_properties[GAME_SELECT_LABEL_GAME_TYPE_PROPERTY]);
}

gboolean
game_select_label_get_with_image (GameSelectLabel* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_with_image;
	return result;
}

void
game_select_label_set_with_image (GameSelectLabel* self,
                                  gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = game_select_label_get_with_image (self);
	if (old_value != value) {
		self->priv->_with_image = value;
		g_object_notify_by_pspec ((GObject *) self, game_select_label_properties[GAME_SELECT_LABEL_WITH_IMAGE_PROPERTY]);
	}
}

static GObject *
game_select_label_constructor (GType type,
                               guint n_construct_properties,
                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GameSelectLabel * self;
	GtkLabel* _tmp0_;
	GtkLabel* _tmp1_;
	GtkLabel* _tmp2_;
	GtkImage* _tmp3_;
	GtkImage* _tmp4_;
	GtkImage* _tmp5_;
	GtkImage* _tmp6_;
	GtkImage* _tmp7_;
	GtkImage* _tmp8_;
	GtkLabel* _tmp9_;
	parent_class = G_OBJECT_CLASS (game_select_label_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GAME_SELECT_LABEL, GameSelectLabel);
	gtk_widget_set_margin_top ((GtkWidget*) self, 6);
	gtk_widget_set_margin_bottom ((GtkWidget*) self, 6);
	gtk_widget_set_margin_start ((GtkWidget*) self, 6);
	gtk_widget_set_margin_end ((GtkWidget*) self, 6);
	gtk_grid_set_row_homogeneous ((GtkGrid*) self, FALSE);
	_tmp0_ = self->priv->label;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp0_, TRUE);
	_tmp1_ = self->priv->label;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp1_, FALSE);
	_tmp2_ = self->priv->label;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp2_, 0, 0, 1, 1);
	_tmp3_ = self->priv->image;
	gtk_widget_set_halign ((GtkWidget*) _tmp3_, GTK_ALIGN_CENTER);
	_tmp4_ = self->priv->image;
	gtk_widget_set_valign ((GtkWidget*) _tmp4_, GTK_ALIGN_START);
	_tmp5_ = self->priv->image;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp5_, TRUE);
	_tmp6_ = self->priv->image;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp6_, TRUE);
	_tmp7_ = self->priv->image;
	gtk_grid_attach ((GtkGrid*) self, (GtkWidget*) _tmp7_, 0, 1, 1, 1);
	_tmp8_ = self->priv->image;
	g_object_bind_property_with_closures ((GObject*) self, "with-image", (GObject*) _tmp8_, "visible", 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_ = self->priv->label;
	g_object_bind_property_with_closures ((GObject*) self, "with-image", (GObject*) _tmp9_, "vexpand", G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN, (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
game_select_label_class_init (GameSelectLabelClass * klass,
                              gpointer klass_data)
{
	game_select_label_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GameSelectLabel_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_game_select_label_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_game_select_label_set_property;
	G_OBJECT_CLASS (klass)->constructor = game_select_label_constructor;
	G_OBJECT_CLASS (klass)->finalize = game_select_label_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAME_SELECT_LABEL_GAME_TYPE_PROPERTY, game_select_label_properties[GAME_SELECT_LABEL_GAME_TYPE_PROPERTY] = g_param_spec_string ("game-type", "game-type", "game-type", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAME_SELECT_LABEL_WITH_IMAGE_PROPERTY, game_select_label_properties[GAME_SELECT_LABEL_WITH_IMAGE_PROPERTY] = g_param_spec_boolean ("with-image", "with-image", "with-image", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
game_select_label_instance_init (GameSelectLabel * self,
                                 gpointer klass)
{
	self->priv = game_select_label_get_instance_private (self);
	self->priv->_with_image = TRUE;
}

static void
game_select_label_finalize (GObject * obj)
{
	GameSelectLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_GAME_SELECT_LABEL, GameSelectLabel);
	_g_object_unref0 (self->priv->label);
	_g_object_unref0 (self->priv->image);
	G_OBJECT_CLASS (game_select_label_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
game_select_label_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GameSelectLabelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) game_select_label_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GameSelectLabel), 0, (GInstanceInitFunc) game_select_label_instance_init, NULL };
	GType game_select_label_type_id;
	game_select_label_type_id = g_type_register_static (gtk_grid_get_type (), "GameSelectLabel", &g_define_type_info, G_TYPE_FLAG_NONE);
	GameSelectLabel_private_offset = g_type_add_instance_private (game_select_label_type_id, sizeof (GameSelectLabelPrivate));
	return game_select_label_type_id;
}

GType
game_select_label_get_type (void)
{
	static gsize game_select_label_type_id__once = 0;
	if (g_once_init_enter (&game_select_label_type_id__once)) {
		GType game_select_label_type_id;
		game_select_label_type_id = game_select_label_get_type_once ();
		g_once_init_leave (&game_select_label_type_id__once, game_select_label_type_id);
	}
	return game_select_label_type_id__once;
}

static void
_vala_game_select_label_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec)
{
	GameSelectLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_GAME_SELECT_LABEL, GameSelectLabel);
	switch (property_id) {
		case GAME_SELECT_LABEL_WITH_IMAGE_PROPERTY:
		g_value_set_boolean (value, game_select_label_get_with_image (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_game_select_label_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec)
{
	GameSelectLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_GAME_SELECT_LABEL, GameSelectLabel);
	switch (property_id) {
		case GAME_SELECT_LABEL_GAME_TYPE_PROPERTY:
		game_select_label_set_game_type (self, g_value_get_string (value));
		break;
		case GAME_SELECT_LABEL_WITH_IMAGE_PROPERTY:
		game_select_label_set_with_image (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

