/* chess-view.c generated by valac 0.16.0, the Vala compiler
 * generated from chess-view.vala, do not modify */


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


#define TYPE_CHESS_VIEW (chess_view_get_type ())
#define CHESS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CHESS_VIEW, ChessView))
#define CHESS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CHESS_VIEW, ChessViewClass))
#define IS_CHESS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CHESS_VIEW))
#define IS_CHESS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CHESS_VIEW))
#define CHESS_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CHESS_VIEW, ChessViewClass))

typedef struct _ChessView ChessView;
typedef struct _ChessViewClass ChessViewClass;
typedef struct _ChessViewPrivate ChessViewPrivate;

#define TYPE_CHESS_SCENE (chess_scene_get_type ())
#define CHESS_SCENE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CHESS_SCENE, ChessScene))
#define CHESS_SCENE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CHESS_SCENE, ChessSceneClass))
#define IS_CHESS_SCENE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CHESS_SCENE))
#define IS_CHESS_SCENE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CHESS_SCENE))
#define CHESS_SCENE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CHESS_SCENE, ChessSceneClass))

typedef struct _ChessScene ChessScene;
typedef struct _ChessSceneClass ChessSceneClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ChessView {
	GtkDrawingArea parent_instance;
	ChessViewPrivate * priv;
};

struct _ChessViewClass {
	GtkDrawingAreaClass parent_class;
};

struct _ChessViewPrivate {
	ChessScene* _scene;
};


static gpointer chess_view_parent_class = NULL;

GType chess_view_get_type (void) G_GNUC_CONST;
GType chess_scene_get_type (void) G_GNUC_CONST;
#define CHESS_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_CHESS_VIEW, ChessViewPrivate))
enum  {
	CHESS_VIEW_DUMMY_PROPERTY,
	CHESS_VIEW_SCENE
};
static void chess_view_scene_changed_cb (ChessView* self, ChessScene* scene);
ChessView* chess_view_new (void);
ChessView* chess_view_construct (GType object_type);
ChessScene* chess_view_get_scene (ChessView* self);
void chess_view_set_scene (ChessView* self, ChessScene* value);
static void _chess_view_scene_changed_cb_chess_scene_changed (ChessScene* _sender, gpointer self);
static void chess_view_finalize (GObject* obj);
static void _vala_chess_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_chess_view_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static void chess_view_scene_changed_cb (ChessView* self, ChessScene* scene) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (scene != NULL);
	gtk_widget_queue_draw ((GtkWidget*) self);
}


ChessView* chess_view_construct (GType object_type) {
	ChessView * self = NULL;
	self = (ChessView*) g_object_new (object_type, NULL);
	return self;
}


ChessView* chess_view_new (void) {
	return chess_view_construct (TYPE_CHESS_VIEW);
}


ChessScene* chess_view_get_scene (ChessView* self) {
	ChessScene* result;
	ChessScene* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_scene;
	result = _tmp0_;
	return result;
}


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


static void _chess_view_scene_changed_cb_chess_scene_changed (ChessScene* _sender, gpointer self) {
	chess_view_scene_changed_cb (self, _sender);
}


void chess_view_set_scene (ChessView* self, ChessScene* value) {
	ChessScene* _tmp0_;
	ChessScene* _tmp1_;
	ChessScene* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_scene);
	self->priv->_scene = _tmp1_;
	_tmp2_ = self->priv->_scene;
	g_signal_connect_object (_tmp2_, "changed", (GCallback) _chess_view_scene_changed_cb_chess_scene_changed, self, 0);
	gtk_widget_queue_draw ((GtkWidget*) self);
	g_object_notify ((GObject *) self, "scene");
}


static void chess_view_class_init (ChessViewClass * klass) {
	chess_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ChessViewPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_chess_view_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_chess_view_set_property;
	G_OBJECT_CLASS (klass)->finalize = chess_view_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), CHESS_VIEW_SCENE, g_param_spec_object ("scene", "scene", "scene", TYPE_CHESS_SCENE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void chess_view_instance_init (ChessView * self) {
	self->priv = CHESS_VIEW_GET_PRIVATE (self);
}


static void chess_view_finalize (GObject* obj) {
	ChessView * self;
	self = CHESS_VIEW (obj);
	_g_object_unref0 (self->priv->_scene);
	G_OBJECT_CLASS (chess_view_parent_class)->finalize (obj);
}


GType chess_view_get_type (void) {
	static volatile gsize chess_view_type_id__volatile = 0;
	if (g_once_init_enter (&chess_view_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ChessViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) chess_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ChessView), 0, (GInstanceInitFunc) chess_view_instance_init, NULL };
		GType chess_view_type_id;
		chess_view_type_id = g_type_register_static (GTK_TYPE_DRAWING_AREA, "ChessView", &g_define_type_info, 0);
		g_once_init_leave (&chess_view_type_id__volatile, chess_view_type_id);
	}
	return chess_view_type_id__volatile;
}


static void _vala_chess_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	ChessView * self;
	self = CHESS_VIEW (object);
	switch (property_id) {
		case CHESS_VIEW_SCENE:
		g_value_set_object (value, chess_view_get_scene (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_chess_view_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	ChessView * self;
	self = CHESS_VIEW (object);
	switch (property_id) {
		case CHESS_VIEW_SCENE:
		chess_view_set_scene (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



