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

/*
 * This file is part of gedit-code-assistant.
 *
 * Copyright (C) 2013 - 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-window-activatable.h>
#include <gedit/gedit-window.h>
#include <gedit/gedit-tab.h>


#define GCA_TYPE_WINDOW_ACTIVATABLE (gca_window_activatable_get_type ())
#define GCA_WINDOW_ACTIVATABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_WINDOW_ACTIVATABLE, GcaWindowActivatable))
#define GCA_WINDOW_ACTIVATABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_WINDOW_ACTIVATABLE, GcaWindowActivatableClass))
#define GCA_IS_WINDOW_ACTIVATABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_WINDOW_ACTIVATABLE))
#define GCA_IS_WINDOW_ACTIVATABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_WINDOW_ACTIVATABLE))
#define GCA_WINDOW_ACTIVATABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_WINDOW_ACTIVATABLE, GcaWindowActivatableClass))

typedef struct _GcaWindowActivatable GcaWindowActivatable;
typedef struct _GcaWindowActivatableClass GcaWindowActivatableClass;
typedef struct _GcaWindowActivatablePrivate GcaWindowActivatablePrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#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;

struct _GcaWindowActivatable {
	GObject parent_instance;
	GcaWindowActivatablePrivate * priv;
};

struct _GcaWindowActivatableClass {
	GObjectClass parent_class;
};

struct _GcaWindowActivatablePrivate {
	GeditWindow* _window;
};


static gpointer gca_window_activatable_parent_class = NULL;
static GeditWindowActivatableInterface* gca_window_activatable_gedit_window_activatable_parent_iface = NULL;

GType gca_window_activatable_get_type (void) G_GNUC_CONST;
#define GCA_WINDOW_ACTIVATABLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCA_TYPE_WINDOW_ACTIVATABLE, GcaWindowActivatablePrivate))
enum  {
	GCA_WINDOW_ACTIVATABLE_DUMMY_PROPERTY,
	GCA_WINDOW_ACTIVATABLE_WINDOW
};
static void gca_window_activatable_real_activate (GeditWindowActivatable* base);
static void gca_window_activatable_on_active_tab_changed (GcaWindowActivatable* self, GeditWindow* window, GeditTab* tab);
static void _gca_window_activatable_on_active_tab_changed_gedit_window_active_tab_changed (GeditWindow* _sender, GeditTab* tab, gpointer self);
static void gca_window_activatable_real_deactivate (GeditWindowActivatable* base);
static void gca_window_activatable_real_update_state (GeditWindowActivatable* base);
GType gca_view_get_type (void) G_GNUC_CONST;
void gca_view_reparse_now (GcaView* self);
GcaWindowActivatable* gca_window_activatable_new (void);
GcaWindowActivatable* gca_window_activatable_construct (GType object_type);
static void gca_window_activatable_finalize (GObject* obj);
static void _vala_gca_window_activatable_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_gca_window_activatable_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static void _gca_window_activatable_on_active_tab_changed_gedit_window_active_tab_changed (GeditWindow* _sender, GeditTab* tab, gpointer self) {
	gca_window_activatable_on_active_tab_changed ((GcaWindowActivatable*) self, _sender, tab);
}


static void gca_window_activatable_real_activate (GeditWindowActivatable* base) {
	GcaWindowActivatable * self;
	GeditWindow* _tmp0_ = NULL;
	GeditWindow* _tmp1_ = NULL;
	GeditWindow* _tmp2_ = NULL;
	self = (GcaWindowActivatable*) base;
	g_object_get ((GeditWindowActivatable*) self, "window", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	g_signal_connect_object (_tmp2_, "active-tab-changed", (GCallback) _gca_window_activatable_on_active_tab_changed_gedit_window_active_tab_changed, self, 0);
	_g_object_unref0 (_tmp2_);
}


static void gca_window_activatable_real_deactivate (GeditWindowActivatable* base) {
	GcaWindowActivatable * self;
	GeditWindow* _tmp0_ = NULL;
	GeditWindow* _tmp1_ = NULL;
	GeditWindow* _tmp2_ = NULL;
	guint _tmp3_ = 0U;
	self = (GcaWindowActivatable*) base;
	g_object_get ((GeditWindowActivatable*) self, "window", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	g_signal_parse_name ("active-tab-changed", gedit_window_get_type (), &_tmp3_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _gca_window_activatable_on_active_tab_changed_gedit_window_active_tab_changed, self);
	_g_object_unref0 (_tmp2_);
}


static void gca_window_activatable_real_update_state (GeditWindowActivatable* base) {
	GcaWindowActivatable * self;
	self = (GcaWindowActivatable*) base;
}


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


static void gca_window_activatable_on_active_tab_changed (GcaWindowActivatable* self, GeditWindow* window, GeditTab* tab) {
	GcaView* v = NULL;
	GeditTab* _tmp0_ = NULL;
	GeditView* _tmp1_ = NULL;
	gconstpointer _tmp2_ = NULL;
	GcaView* _tmp3_ = NULL;
	GcaView* _tmp4_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (window != NULL);
	g_return_if_fail (tab != NULL);
	_tmp0_ = tab;
	_tmp1_ = gedit_tab_get_view (_tmp0_);
	_tmp2_ = g_object_get_data ((GObject*) _tmp1_, "GcaView");
	_tmp3_ = _g_object_ref0 ((GcaView*) _tmp2_);
	v = _tmp3_;
	_tmp4_ = v;
	if (_tmp4_ != NULL) {
		GcaView* _tmp5_ = NULL;
		_tmp5_ = v;
		gca_view_reparse_now (_tmp5_);
	}
	_g_object_unref0 (v);
}


GcaWindowActivatable* gca_window_activatable_construct (GType object_type) {
	GcaWindowActivatable * self = NULL;
	self = (GcaWindowActivatable*) g_object_new (object_type, NULL);
	return self;
}


GcaWindowActivatable* gca_window_activatable_new (void) {
	return gca_window_activatable_construct (GCA_TYPE_WINDOW_ACTIVATABLE);
}


static GeditWindow* gca_window_activatable_real_get_window (GeditWindowActivatable* base) {
	GeditWindow* result;
	GcaWindowActivatable* self;
	GeditWindow* _tmp0_ = NULL;
	GeditWindow* _tmp1_ = NULL;
	self = (GcaWindowActivatable*) base;
	_tmp0_ = self->priv->_window;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}


static void gca_window_activatable_real_set_window (GeditWindowActivatable* base, GeditWindow* value) {
	GcaWindowActivatable* self;
	GeditWindow* _tmp0_ = NULL;
	GeditWindow* _tmp1_ = NULL;
	self = (GcaWindowActivatable*) base;
	_tmp0_ = value;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_window);
	self->priv->_window = _tmp1_;
	g_object_notify ((GObject *) self, "window");
}


static void gca_window_activatable_class_init (GcaWindowActivatableClass * klass) {
	gca_window_activatable_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GcaWindowActivatablePrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_gca_window_activatable_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gca_window_activatable_set_property;
	G_OBJECT_CLASS (klass)->finalize = gca_window_activatable_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCA_WINDOW_ACTIVATABLE_WINDOW, g_param_spec_object ("window", "window", "window", gedit_window_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_window_activatable_gedit_window_activatable_interface_init (GeditWindowActivatableInterface * iface) {
	gca_window_activatable_gedit_window_activatable_parent_iface = g_type_interface_peek_parent (iface);
	iface->activate = (void (*)(GeditWindowActivatable*)) gca_window_activatable_real_activate;
	iface->deactivate = (void (*)(GeditWindowActivatable*)) gca_window_activatable_real_deactivate;
	iface->update_state = (void (*)(GeditWindowActivatable*)) gca_window_activatable_real_update_state;
}


static void gca_window_activatable_instance_init (GcaWindowActivatable * self) {
	self->priv = GCA_WINDOW_ACTIVATABLE_GET_PRIVATE (self);
}


static void gca_window_activatable_finalize (GObject* obj) {
	GcaWindowActivatable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCA_TYPE_WINDOW_ACTIVATABLE, GcaWindowActivatable);
	_g_object_unref0 (self->priv->_window);
	G_OBJECT_CLASS (gca_window_activatable_parent_class)->finalize (obj);
}


GType gca_window_activatable_get_type (void) {
	static volatile gsize gca_window_activatable_type_id__volatile = 0;
	if (g_once_init_enter (&gca_window_activatable_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GcaWindowActivatableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gca_window_activatable_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcaWindowActivatable), 0, (GInstanceInitFunc) gca_window_activatable_instance_init, NULL };
		static const GInterfaceInfo gedit_window_activatable_info = { (GInterfaceInitFunc) gca_window_activatable_gedit_window_activatable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType gca_window_activatable_type_id;
		gca_window_activatable_type_id = g_type_register_static (G_TYPE_OBJECT, "GcaWindowActivatable", &g_define_type_info, 0);
		g_type_add_interface_static (gca_window_activatable_type_id, gedit_window_activatable_get_type (), &gedit_window_activatable_info);
		g_once_init_leave (&gca_window_activatable_type_id__volatile, gca_window_activatable_type_id);
	}
	return gca_window_activatable_type_id__volatile;
}


static void _vala_gca_window_activatable_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GcaWindowActivatable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCA_TYPE_WINDOW_ACTIVATABLE, GcaWindowActivatable);
	switch (property_id) {
		case GCA_WINDOW_ACTIVATABLE_WINDOW:
		g_value_take_object (value, gca_window_activatable_real_get_window ((GeditWindowActivatable*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_gca_window_activatable_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GcaWindowActivatable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCA_TYPE_WINDOW_ACTIVATABLE, GcaWindowActivatable);
	switch (property_id) {
		case GCA_WINDOW_ACTIVATABLE_WINDOW:
		gca_window_activatable_real_set_window ((GeditWindowActivatable*) self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



