/* gca-view-activatable.c generated by valac 0.28.0.11-bbdd, the Vala compiler
 * generated from gca-view-activatable.vala, do not modify */

/*
 * This file is part of gedit-code-assistant.
 *
 * Copyright (C) 2011 - Jesse van den Kieboom
 *
 * gedit-code-assistant 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.
 *
 * gedit-code-assistant 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 gedit-code-assistant.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <gedit/gedit-view-activatable.h>
#include <gedit/gedit-view.h>


#define GCA_TYPE_VIEW_ACTIVATABLE (gca_view_activatable_get_type ())
#define GCA_VIEW_ACTIVATABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_VIEW_ACTIVATABLE, GcaViewActivatable))
#define GCA_VIEW_ACTIVATABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_VIEW_ACTIVATABLE, GcaViewActivatableClass))
#define GCA_IS_VIEW_ACTIVATABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_VIEW_ACTIVATABLE))
#define GCA_IS_VIEW_ACTIVATABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_VIEW_ACTIVATABLE))
#define GCA_VIEW_ACTIVATABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_VIEW_ACTIVATABLE, GcaViewActivatableClass))

typedef struct _GcaViewActivatable GcaViewActivatable;
typedef struct _GcaViewActivatableClass GcaViewActivatableClass;
typedef struct _GcaViewActivatablePrivate GcaViewActivatablePrivate;

#define GCA_TYPE_VIEW (gca_view_get_type ())
#define GCA_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_VIEW, GcaView))
#define GCA_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_VIEW, GcaViewClass))
#define GCA_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_VIEW))
#define GCA_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_VIEW))
#define GCA_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_VIEW, GcaViewClass))

typedef struct _GcaView GcaView;
typedef struct _GcaViewClass GcaViewClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GcaViewActivatable {
	GObject parent_instance;
	GcaViewActivatablePrivate * priv;
};

struct _GcaViewActivatableClass {
	GObjectClass parent_class;
};

struct _GcaViewActivatablePrivate {
	GeditView* _view;
	GcaView* d_view;
};


static gpointer gca_view_activatable_parent_class = NULL;
static GeditViewActivatableInterface* gca_view_activatable_gedit_view_activatable_parent_iface = NULL;

GType gca_view_activatable_get_type (void) G_GNUC_CONST;
GType gca_view_get_type (void) G_GNUC_CONST;
#define GCA_VIEW_ACTIVATABLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCA_TYPE_VIEW_ACTIVATABLE, GcaViewActivatablePrivate))
enum  {
	GCA_VIEW_ACTIVATABLE_DUMMY_PROPERTY,
	GCA_VIEW_ACTIVATABLE_VIEW
};
static void gca_view_activatable_real_activate (GeditViewActivatable* base);
GcaView* gca_view_new (GeditView* view);
GcaView* gca_view_construct (GType object_type, GeditView* view);
static void gca_view_activatable_real_deactivate (GeditViewActivatable* base);
void gca_view_deactivate (GcaView* self);
GcaViewActivatable* gca_view_activatable_new (void);
GcaViewActivatable* gca_view_activatable_construct (GType object_type);
static void gca_view_activatable_finalize (GObject* obj);
static void _vala_gca_view_activatable_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gca_view_activatable_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


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


static void gca_view_activatable_real_activate (GeditViewActivatable* base) {
	GcaViewActivatable * self;
	GeditView* _tmp0_ = NULL;
	GeditView* _tmp1_ = NULL;
	GeditView* _tmp2_ = NULL;
	GcaView* _tmp3_ = NULL;
	GeditView* _tmp4_ = NULL;
	GeditView* _tmp5_ = NULL;
	GeditView* _tmp6_ = NULL;
	GcaView* _tmp7_ = NULL;
	GcaView* _tmp8_ = NULL;
	self = (GcaViewActivatable*) base;
	g_object_get ((GeditViewActivatable*) self, "view", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gca_view_new (_tmp2_);
	_g_object_unref0 (self->priv->d_view);
	self->priv->d_view = _tmp3_;
	_g_object_unref0 (_tmp2_);
	g_object_get ((GeditViewActivatable*) self, "view", &_tmp4_, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp7_ = self->priv->d_view;
	_tmp8_ = _g_object_ref0 (_tmp7_);
	g_object_set_data_full ((GObject*) _tmp6_, "GcaView", _tmp8_, g_object_unref);
	_g_object_unref0 (_tmp6_);
}


static void gca_view_activatable_real_deactivate (GeditViewActivatable* base) {
	GcaViewActivatable * self;
	GeditView* _tmp0_ = NULL;
	GeditView* _tmp1_ = NULL;
	GeditView* _tmp2_ = NULL;
	GcaView* _tmp3_ = NULL;
	self = (GcaViewActivatable*) base;
	g_object_get ((GeditViewActivatable*) self, "view", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	g_object_set_data_full ((GObject*) _tmp2_, "GcaView", NULL, NULL);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = self->priv->d_view;
	gca_view_deactivate (_tmp3_);
	_g_object_unref0 (self->priv->d_view);
	self->priv->d_view = NULL;
}


GcaViewActivatable* gca_view_activatable_construct (GType object_type) {
	GcaViewActivatable * self = NULL;
	self = (GcaViewActivatable*) g_object_new (object_type, NULL);
	return self;
}


GcaViewActivatable* gca_view_activatable_new (void) {
	return gca_view_activatable_construct (GCA_TYPE_VIEW_ACTIVATABLE);
}


static GeditView* gca_view_activatable_real_get_view (GeditViewActivatable* base) {
	GeditView* result;
	GcaViewActivatable* self;
	GeditView* _tmp0_ = NULL;
	GeditView* _tmp1_ = NULL;
	self = (GcaViewActivatable*) base;
	_tmp0_ = self->priv->_view;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}


static void gca_view_activatable_real_set_view (GeditViewActivatable* base, GeditView* value) {
	GcaViewActivatable* self;
	GeditView* _tmp0_ = NULL;
	GeditView* _tmp1_ = NULL;
	self = (GcaViewActivatable*) base;
	_tmp0_ = value;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_view);
	self->priv->_view = _tmp1_;
	g_object_notify ((GObject *) self, "view");
}


static void gca_view_activatable_class_init (GcaViewActivatableClass * klass) {
	gca_view_activatable_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GcaViewActivatablePrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_gca_view_activatable_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gca_view_activatable_set_property;
	G_OBJECT_CLASS (klass)->finalize = gca_view_activatable_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCA_VIEW_ACTIVATABLE_VIEW, g_param_spec_object ("view", "view", "view", gedit_view_get_type (), G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}


static void gca_view_activatable_gedit_view_activatable_interface_init (GeditViewActivatableInterface * iface) {
	gca_view_activatable_gedit_view_activatable_parent_iface = g_type_interface_peek_parent (iface);
	iface->activate = (void (*)(GeditViewActivatable*)) gca_view_activatable_real_activate;
	iface->deactivate = (void (*)(GeditViewActivatable*)) gca_view_activatable_real_deactivate;
}


static void gca_view_activatable_instance_init (GcaViewActivatable * self) {
	self->priv = GCA_VIEW_ACTIVATABLE_GET_PRIVATE (self);
}


static void gca_view_activatable_finalize (GObject* obj) {
	GcaViewActivatable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCA_TYPE_VIEW_ACTIVATABLE, GcaViewActivatable);
	_g_object_unref0 (self->priv->_view);
	_g_object_unref0 (self->priv->d_view);
	G_OBJECT_CLASS (gca_view_activatable_parent_class)->finalize (obj);
}


GType gca_view_activatable_get_type (void) {
	static volatile gsize gca_view_activatable_type_id__volatile = 0;
	if (g_once_init_enter (&gca_view_activatable_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GcaViewActivatableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gca_view_activatable_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcaViewActivatable), 0, (GInstanceInitFunc) gca_view_activatable_instance_init, NULL };
		static const GInterfaceInfo gedit_view_activatable_info = { (GInterfaceInitFunc) gca_view_activatable_gedit_view_activatable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType gca_view_activatable_type_id;
		gca_view_activatable_type_id = g_type_register_static (G_TYPE_OBJECT, "GcaViewActivatable", &g_define_type_info, 0);
		g_type_add_interface_static (gca_view_activatable_type_id, gedit_view_activatable_get_type (), &gedit_view_activatable_info);
		g_once_init_leave (&gca_view_activatable_type_id__volatile, gca_view_activatable_type_id);
	}
	return gca_view_activatable_type_id__volatile;
}


static void _vala_gca_view_activatable_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GcaViewActivatable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCA_TYPE_VIEW_ACTIVATABLE, GcaViewActivatable);
	switch (property_id) {
		case GCA_VIEW_ACTIVATABLE_VIEW:
		g_value_take_object (value, gca_view_activatable_real_get_view ((GeditViewActivatable*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_gca_view_activatable_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GcaViewActivatable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCA_TYPE_VIEW_ACTIVATABLE, GcaViewActivatable);
	switch (property_id) {
		case GCA_VIEW_ACTIVATABLE_VIEW:
		gca_view_activatable_real_set_view ((GeditViewActivatable*) self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



