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

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

#include <gtk/gtk.h>
#include <glib-object.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_CHECKMARK_ITEM (games_checkmark_item_get_type ())
#define GAMES_CHECKMARK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_CHECKMARK_ITEM, GamesCheckmarkItem))
#define GAMES_CHECKMARK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_CHECKMARK_ITEM, GamesCheckmarkItemClass))
#define GAMES_IS_CHECKMARK_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_CHECKMARK_ITEM))
#define GAMES_IS_CHECKMARK_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_CHECKMARK_ITEM))
#define GAMES_CHECKMARK_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_CHECKMARK_ITEM, GamesCheckmarkItemClass))

typedef struct _GamesCheckmarkItem GamesCheckmarkItem;
typedef struct _GamesCheckmarkItemClass GamesCheckmarkItemClass;
typedef struct _GamesCheckmarkItemPrivate GamesCheckmarkItemPrivate;
enum  {
	GAMES_CHECKMARK_ITEM_0_PROPERTY,
	GAMES_CHECKMARK_ITEM_CHECKMARK_VISIBLE_PROPERTY,
	GAMES_CHECKMARK_ITEM_LABEL_PROPERTY,
	GAMES_CHECKMARK_ITEM_NUM_PROPERTIES
};
static GParamSpec* games_checkmark_item_properties[GAMES_CHECKMARK_ITEM_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GamesCheckmarkItem {
	GtkListBoxRow parent_instance;
	GamesCheckmarkItemPrivate * priv;
};

struct _GamesCheckmarkItemClass {
	GtkListBoxRowClass parent_class;
};

struct _GamesCheckmarkItemPrivate {
	gboolean _checkmark_visible;
	gchar* _label;
};

static gint GamesCheckmarkItem_private_offset;
static gpointer games_checkmark_item_parent_class = NULL;

VALA_EXTERN GType games_checkmark_item_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GamesCheckmarkItem* games_checkmark_item_new (const gchar* label);
VALA_EXTERN GamesCheckmarkItem* games_checkmark_item_construct (GType object_type,
                                                    const gchar* label);
VALA_EXTERN gboolean games_checkmark_item_get_checkmark_visible (GamesCheckmarkItem* self);
VALA_EXTERN void games_checkmark_item_set_checkmark_visible (GamesCheckmarkItem* self,
                                                 gboolean value);
VALA_EXTERN const gchar* games_checkmark_item_get_label (GamesCheckmarkItem* self);
static void games_checkmark_item_set_label (GamesCheckmarkItem* self,
                                     const gchar* value);
static void games_checkmark_item_finalize (GObject * obj);
static GType games_checkmark_item_get_type_once (void);
static void _vala_games_checkmark_item_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_games_checkmark_item_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_checkmark_item_get_instance_private (GamesCheckmarkItem* self)
{
	return G_STRUCT_MEMBER_P (self, GamesCheckmarkItem_private_offset);
}

GamesCheckmarkItem*
games_checkmark_item_construct (GType object_type,
                                const gchar* label)
{
	GamesCheckmarkItem * self = NULL;
	g_return_val_if_fail (label != NULL, NULL);
	self = (GamesCheckmarkItem*) g_object_new (object_type, "label", label, NULL);
	return self;
}

GamesCheckmarkItem*
games_checkmark_item_new (const gchar* label)
{
	return games_checkmark_item_construct (GAMES_TYPE_CHECKMARK_ITEM, label);
}

gboolean
games_checkmark_item_get_checkmark_visible (GamesCheckmarkItem* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_checkmark_visible;
	return result;
}

void
games_checkmark_item_set_checkmark_visible (GamesCheckmarkItem* self,
                                            gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = games_checkmark_item_get_checkmark_visible (self);
	if (old_value != value) {
		self->priv->_checkmark_visible = value;
		g_object_notify_by_pspec ((GObject *) self, games_checkmark_item_properties[GAMES_CHECKMARK_ITEM_CHECKMARK_VISIBLE_PROPERTY]);
	}
}

const gchar*
games_checkmark_item_get_label (GamesCheckmarkItem* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_label;
	result = _tmp0_;
	return result;
}

static void
games_checkmark_item_set_label (GamesCheckmarkItem* self,
                                const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = games_checkmark_item_get_label (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_label);
		self->priv->_label = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, games_checkmark_item_properties[GAMES_CHECKMARK_ITEM_LABEL_PROPERTY]);
	}
}

static void
games_checkmark_item_class_init (GamesCheckmarkItemClass * klass,
                                 gpointer klass_data)
{
	games_checkmark_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GamesCheckmarkItem_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_games_checkmark_item_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_games_checkmark_item_set_property;
	G_OBJECT_CLASS (klass)->finalize = games_checkmark_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_CHECKMARK_ITEM_CHECKMARK_VISIBLE_PROPERTY, games_checkmark_item_properties[GAMES_CHECKMARK_ITEM_CHECKMARK_VISIBLE_PROPERTY] = g_param_spec_boolean ("checkmark-visible", "checkmark-visible", "checkmark-visible", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_CHECKMARK_ITEM_LABEL_PROPERTY, games_checkmark_item_properties[GAMES_CHECKMARK_ITEM_LABEL_PROPERTY] = g_param_spec_string ("label", "label", "label", NULL, 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/ui/checkmark-item.ui");
}

static void
games_checkmark_item_instance_init (GamesCheckmarkItem * self,
                                    gpointer klass)
{
	self->priv = games_checkmark_item_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
games_checkmark_item_finalize (GObject * obj)
{
	GamesCheckmarkItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_CHECKMARK_ITEM, GamesCheckmarkItem);
	_g_free0 (self->priv->_label);
	G_OBJECT_CLASS (games_checkmark_item_parent_class)->finalize (obj);
}

static GType
games_checkmark_item_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GamesCheckmarkItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_checkmark_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesCheckmarkItem), 0, (GInstanceInitFunc) games_checkmark_item_instance_init, NULL };
	GType games_checkmark_item_type_id;
	games_checkmark_item_type_id = g_type_register_static (gtk_list_box_row_get_type (), "GamesCheckmarkItem", &g_define_type_info, 0);
	GamesCheckmarkItem_private_offset = g_type_add_instance_private (games_checkmark_item_type_id, sizeof (GamesCheckmarkItemPrivate));
	return games_checkmark_item_type_id;
}

GType
games_checkmark_item_get_type (void)
{
	static volatile gsize games_checkmark_item_type_id__once = 0;
	if (g_once_init_enter (&games_checkmark_item_type_id__once)) {
		GType games_checkmark_item_type_id;
		games_checkmark_item_type_id = games_checkmark_item_get_type_once ();
		g_once_init_leave (&games_checkmark_item_type_id__once, games_checkmark_item_type_id);
	}
	return games_checkmark_item_type_id__once;
}

static void
_vala_games_checkmark_item_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	GamesCheckmarkItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_CHECKMARK_ITEM, GamesCheckmarkItem);
	switch (property_id) {
		case GAMES_CHECKMARK_ITEM_CHECKMARK_VISIBLE_PROPERTY:
		g_value_set_boolean (value, games_checkmark_item_get_checkmark_visible (self));
		break;
		case GAMES_CHECKMARK_ITEM_LABEL_PROPERTY:
		g_value_set_string (value, games_checkmark_item_get_label (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_games_checkmark_item_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	GamesCheckmarkItem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GAMES_TYPE_CHECKMARK_ITEM, GamesCheckmarkItem);
	switch (property_id) {
		case GAMES_CHECKMARK_ITEM_CHECKMARK_VISIBLE_PROPERTY:
		games_checkmark_item_set_checkmark_visible (self, g_value_get_boolean (value));
		break;
		case GAMES_CHECKMARK_ITEM_LABEL_PROPERTY:
		games_checkmark_item_set_label (self, g_value_get_string (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;
}

