/* checkmark-item.c generated by valac 0.36.12.13-3ae08, the Vala compiler
 * generated from checkmark-item.vala, do not modify */

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

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>


#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;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

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

struct _GamesCheckmarkItemClass {
	GtkBoxClass parent_class;
};

struct _GamesCheckmarkItemPrivate {
	GtkLabel* title_label;
	GtkImage* checkmark_image;
	gboolean _checkmark_visible;
	GBinding* checkmark_visible_binding;
};


static gpointer games_checkmark_item_parent_class = NULL;

GType games_checkmark_item_get_type (void) G_GNUC_CONST;
#define GAMES_CHECKMARK_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_CHECKMARK_ITEM, GamesCheckmarkItemPrivate))
enum  {
	GAMES_CHECKMARK_ITEM_0_PROPERTY,
	GAMES_CHECKMARK_ITEM_CHECKMARK_VISIBLE_PROPERTY
};
GamesCheckmarkItem* games_checkmark_item_new (const gchar* name);
GamesCheckmarkItem* games_checkmark_item_construct (GType object_type, const gchar* name);
gboolean games_checkmark_item_get_checkmark_visible (GamesCheckmarkItem* self);
void games_checkmark_item_set_checkmark_visible (GamesCheckmarkItem* self, gboolean value);
static GObject * games_checkmark_item_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void games_checkmark_item_finalize (GObject * obj);
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);


GamesCheckmarkItem* games_checkmark_item_construct (GType object_type, const gchar* name) {
	GamesCheckmarkItem * self = NULL;
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	g_return_val_if_fail (name != NULL, NULL);
	self = (GamesCheckmarkItem*) g_object_new (object_type, NULL);
	_tmp0_ = self->priv->title_label;
	_tmp1_ = name;
	gtk_label_set_label (_tmp0_, _tmp1_);
	return self;
}


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


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


void games_checkmark_item_set_checkmark_visible (GamesCheckmarkItem* self, gboolean value) {
	g_return_if_fail (self != NULL);
	if (games_checkmark_item_get_checkmark_visible (self) != value) {
		gboolean _tmp0_;
		_tmp0_ = value;
		self->priv->_checkmark_visible = _tmp0_;
		g_object_notify ((GObject *) self, "checkmark-visible");
	}
}


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


static GObject * games_checkmark_item_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	GamesCheckmarkItem * self;
	GtkImage* _tmp0_;
	GBinding* _tmp1_;
	GBinding* _tmp2_;
	parent_class = G_OBJECT_CLASS (games_checkmark_item_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_CHECKMARK_ITEM, GamesCheckmarkItem);
	_tmp0_ = self->priv->checkmark_image;
	_tmp1_ = g_object_bind_property_with_closures ((GObject*) self, "checkmark-visible", (GObject*) _tmp0_, "visible", G_BINDING_DEFAULT, (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_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (self->priv->checkmark_visible_binding);
	self->priv->checkmark_visible_binding = _tmp2_;
	return obj;
}


static void games_checkmark_item_class_init (GamesCheckmarkItemClass * klass) {
	gint GamesCheckmarkItem_private_offset;
	games_checkmark_item_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesCheckmarkItemPrivate));
	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)->constructor = games_checkmark_item_constructor;
	G_OBJECT_CLASS (klass)->finalize = games_checkmark_item_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GAMES_CHECKMARK_ITEM_CHECKMARK_VISIBLE_PROPERTY, g_param_spec_boolean ("checkmark-visible", "checkmark-visible", "checkmark-visible", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	GamesCheckmarkItem_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/checkmark-item.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "title_label", FALSE, GamesCheckmarkItem_private_offset + G_STRUCT_OFFSET (GamesCheckmarkItemPrivate, title_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "checkmark_image", FALSE, GamesCheckmarkItem_private_offset + G_STRUCT_OFFSET (GamesCheckmarkItemPrivate, checkmark_image));
}


static void games_checkmark_item_instance_init (GamesCheckmarkItem * self) {
	self->priv = GAMES_CHECKMARK_ITEM_GET_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_object_unref0 (self->priv->title_label);
	_g_object_unref0 (self->priv->checkmark_image);
	_g_object_unref0 (self->priv->checkmark_visible_binding);
	G_OBJECT_CLASS (games_checkmark_item_parent_class)->finalize (obj);
}


GType games_checkmark_item_get_type (void) {
	static volatile gsize games_checkmark_item_type_id__volatile = 0;
	if (g_once_init_enter (&games_checkmark_item_type_id__volatile)) {
		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_box_get_type (), "GamesCheckmarkItem", &g_define_type_info, 0);
		g_once_init_leave (&games_checkmark_item_type_id__volatile, games_checkmark_item_type_id);
	}
	return games_checkmark_item_type_id__volatile;
}


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;
		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;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



