/* gcp-view-activatable.c generated by valac 0.19.0, the Vala compiler
 * generated from gcp-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 GCP_TYPE_VIEW_ACTIVATABLE (gcp_view_activatable_get_type ())
#define GCP_VIEW_ACTIVATABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_TYPE_VIEW_ACTIVATABLE, GcpViewActivatable))
#define GCP_VIEW_ACTIVATABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_TYPE_VIEW_ACTIVATABLE, GcpViewActivatableClass))
#define GCP_IS_VIEW_ACTIVATABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_TYPE_VIEW_ACTIVATABLE))
#define GCP_IS_VIEW_ACTIVATABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_TYPE_VIEW_ACTIVATABLE))
#define GCP_VIEW_ACTIVATABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_TYPE_VIEW_ACTIVATABLE, GcpViewActivatableClass))

typedef struct _GcpViewActivatable GcpViewActivatable;
typedef struct _GcpViewActivatableClass GcpViewActivatableClass;
typedef struct _GcpViewActivatablePrivate GcpViewActivatablePrivate;

#define GCP_TYPE_VIEW (gcp_view_get_type ())
#define GCP_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCP_TYPE_VIEW, GcpView))
#define GCP_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCP_TYPE_VIEW, GcpViewClass))
#define GCP_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCP_TYPE_VIEW))
#define GCP_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCP_TYPE_VIEW))
#define GCP_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCP_TYPE_VIEW, GcpViewClass))

typedef struct _GcpView GcpView;
typedef struct _GcpViewClass GcpViewClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GcpViewActivatable {
	GObject parent_instance;
	GcpViewActivatablePrivate * priv;
};

struct _GcpViewActivatableClass {
	GObjectClass parent_class;
};

struct _GcpViewActivatablePrivate {
	GeditView* _view;
	GcpView* d_view;
};


static gpointer gcp_view_activatable_parent_class = NULL;
static GeditViewActivatableInterface* gcp_view_activatable_gedit_view_activatable_parent_iface = NULL;

GType gcp_view_activatable_get_type (void) G_GNUC_CONST;
GType gcp_view_get_type (void) G_GNUC_CONST;
#define GCP_VIEW_ACTIVATABLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCP_TYPE_VIEW_ACTIVATABLE, GcpViewActivatablePrivate))
enum  {
	GCP_VIEW_ACTIVATABLE_DUMMY_PROPERTY,
	GCP_VIEW_ACTIVATABLE_VIEW
};
static void gcp_view_activatable_real_activate (GeditViewActivatable* base);
GeditView* gcp_view_activatable_get_view (GcpViewActivatable* self);
GcpView* gcp_view_new (GeditView* view);
GcpView* gcp_view_construct (GType object_type, GeditView* view);
static void gcp_view_activatable_real_deactivate (GeditViewActivatable* base);
void gcp_view_deactivate (GcpView* self);
GcpViewActivatable* gcp_view_activatable_new (void);
GcpViewActivatable* gcp_view_activatable_construct (GType object_type);
void gcp_view_activatable_set_view (GcpViewActivatable* self, GeditView* value);
static void gcp_view_activatable_finalize (GObject* obj);
static void _vala_gcp_view_activatable_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gcp_view_activatable_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static void gcp_view_activatable_real_activate (GeditViewActivatable* base) {
	GcpViewActivatable * self;
	GeditView* _tmp0_;
	GcpView* _tmp1_;
	self = (GcpViewActivatable*) base;
	_tmp0_ = self->priv->_view;
	_tmp1_ = gcp_view_new (_tmp0_);
	_g_object_unref0 (self->priv->d_view);
	self->priv->d_view = _tmp1_;
}


static void gcp_view_activatable_real_deactivate (GeditViewActivatable* base) {
	GcpViewActivatable * self;
	GcpView* _tmp0_;
	self = (GcpViewActivatable*) base;
	_tmp0_ = self->priv->d_view;
	gcp_view_deactivate (_tmp0_);
	_g_object_unref0 (self->priv->d_view);
	self->priv->d_view = NULL;
}


GcpViewActivatable* gcp_view_activatable_construct (GType object_type) {
	GcpViewActivatable * self = NULL;
	self = (GcpViewActivatable*) g_object_new (object_type, NULL);
	return self;
}


GcpViewActivatable* gcp_view_activatable_new (void) {
	return gcp_view_activatable_construct (GCP_TYPE_VIEW_ACTIVATABLE);
}


GeditView* gcp_view_activatable_get_view (GcpViewActivatable* self) {
	GeditView* result;
	GeditView* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_view;
	result = _tmp0_;
	return result;
}


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


void gcp_view_activatable_set_view (GcpViewActivatable* self, GeditView* value) {
	GeditView* _tmp0_;
	GeditView* _tmp1_;
	g_return_if_fail (self != NULL);
	_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 gcp_view_activatable_class_init (GcpViewActivatableClass * klass) {
	gcp_view_activatable_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GcpViewActivatablePrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_gcp_view_activatable_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gcp_view_activatable_set_property;
	G_OBJECT_CLASS (klass)->finalize = gcp_view_activatable_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCP_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));
}


static void gcp_view_activatable_gedit_view_activatable_interface_init (GeditViewActivatableInterface * iface) {
	gcp_view_activatable_gedit_view_activatable_parent_iface = g_type_interface_peek_parent (iface);
	iface->activate = (void (*)(GeditViewActivatable*)) gcp_view_activatable_real_activate;
	iface->deactivate = (void (*)(GeditViewActivatable*)) gcp_view_activatable_real_deactivate;
}


static void gcp_view_activatable_instance_init (GcpViewActivatable * self) {
	self->priv = GCP_VIEW_ACTIVATABLE_GET_PRIVATE (self);
}


static void gcp_view_activatable_finalize (GObject* obj) {
	GcpViewActivatable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCP_TYPE_VIEW_ACTIVATABLE, GcpViewActivatable);
	_g_object_unref0 (self->priv->_view);
	_g_object_unref0 (self->priv->d_view);
	G_OBJECT_CLASS (gcp_view_activatable_parent_class)->finalize (obj);
}


GType gcp_view_activatable_get_type (void) {
	static volatile gsize gcp_view_activatable_type_id__volatile = 0;
	if (g_once_init_enter (&gcp_view_activatable_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GcpViewActivatableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gcp_view_activatable_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcpViewActivatable), 0, (GInstanceInitFunc) gcp_view_activatable_instance_init, NULL };
		static const GInterfaceInfo gedit_view_activatable_info = { (GInterfaceInitFunc) gcp_view_activatable_gedit_view_activatable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType gcp_view_activatable_type_id;
		gcp_view_activatable_type_id = g_type_register_static (G_TYPE_OBJECT, "GcpViewActivatable", &g_define_type_info, 0);
		g_type_add_interface_static (gcp_view_activatable_type_id, gedit_view_activatable_get_type (), &gedit_view_activatable_info);
		g_once_init_leave (&gcp_view_activatable_type_id__volatile, gcp_view_activatable_type_id);
	}
	return gcp_view_activatable_type_id__volatile;
}


static void _vala_gcp_view_activatable_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GcpViewActivatable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCP_TYPE_VIEW_ACTIVATABLE, GcpViewActivatable);
	switch (property_id) {
		case GCP_VIEW_ACTIVATABLE_VIEW:
		g_value_set_object (value, gcp_view_activatable_get_view (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_gcp_view_activatable_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GcpViewActivatable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCP_TYPE_VIEW_ACTIVATABLE, GcpViewActivatable);
	switch (property_id) {
		case GCP_VIEW_ACTIVATABLE_VIEW:
		gcp_view_activatable_set_view (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



