/* gca-view.c generated by valac 0.28.0.11-bbdd, the Vala compiler
 * generated from gca-view.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.h>
#include <stdlib.h>
#include <string.h>
#include <gedit/gedit-document.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gtksourceview/gtksource.h>
#include <gio/gio.h>
#include <libpeas/peas.h>


#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;
typedef struct _GcaViewPrivate GcaViewPrivate;

#define GCA_TYPE_DOCUMENT (gca_document_get_type ())
#define GCA_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_DOCUMENT, GcaDocument))
#define GCA_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_DOCUMENT, GcaDocumentClass))
#define GCA_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_DOCUMENT))
#define GCA_IS_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_DOCUMENT))
#define GCA_DOCUMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_DOCUMENT, GcaDocumentClass))

typedef struct _GcaDocument GcaDocument;
typedef struct _GcaDocumentClass GcaDocumentClass;

#define GCA_TYPE_BACKEND (gca_backend_get_type ())
#define GCA_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_BACKEND, GcaBackend))
#define GCA_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_BACKEND, GcaBackendClass))
#define GCA_IS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_BACKEND))
#define GCA_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_BACKEND))
#define GCA_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_BACKEND, GcaBackendClass))

typedef struct _GcaBackend GcaBackend;
typedef struct _GcaBackendClass GcaBackendClass;

#define GCA_TYPE_INDENT_BACKEND (gca_indent_backend_get_type ())
#define GCA_INDENT_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_INDENT_BACKEND, GcaIndentBackend))
#define GCA_IS_INDENT_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_INDENT_BACKEND))
#define GCA_INDENT_BACKEND_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GCA_TYPE_INDENT_BACKEND, GcaIndentBackendIface))

typedef struct _GcaIndentBackend GcaIndentBackend;
typedef struct _GcaIndentBackendIface GcaIndentBackendIface;

#define GCA_TYPE_INDENT_LEVEL (gca_indent_level_get_type ())
typedef struct _GcaIndentLevel GcaIndentLevel;

#define GCA_TYPE_SCROLLBAR_MARKER (gca_scrollbar_marker_get_type ())
#define GCA_SCROLLBAR_MARKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_SCROLLBAR_MARKER, GcaScrollbarMarker))
#define GCA_SCROLLBAR_MARKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_SCROLLBAR_MARKER, GcaScrollbarMarkerClass))
#define GCA_IS_SCROLLBAR_MARKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_SCROLLBAR_MARKER))
#define GCA_IS_SCROLLBAR_MARKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_SCROLLBAR_MARKER))
#define GCA_SCROLLBAR_MARKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_SCROLLBAR_MARKER, GcaScrollbarMarkerClass))

typedef struct _GcaScrollbarMarker GcaScrollbarMarker;
typedef struct _GcaScrollbarMarkerClass GcaScrollbarMarkerClass;

#define GCA_TYPE_REMOTE_SERVICE (gca_remote_service_get_type ())
#define GCA_REMOTE_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_REMOTE_SERVICE, GcaRemoteService))
#define GCA_IS_REMOTE_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_REMOTE_SERVICE))
#define GCA_REMOTE_SERVICE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GCA_TYPE_REMOTE_SERVICE, GcaRemoteServiceIface))

typedef struct _GcaRemoteService GcaRemoteService;
typedef struct _GcaRemoteServiceIface GcaRemoteServiceIface;

#define GCA_TYPE_REMOTE_SERVICES (gca_remote_services_get_type ())

#define GCA_TYPE_REMOTE_DOCUMENT (gca_remote_document_get_type ())
#define GCA_REMOTE_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_REMOTE_DOCUMENT, GcaRemoteDocument))
#define GCA_REMOTE_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_REMOTE_DOCUMENT, GcaRemoteDocumentClass))
#define GCA_IS_REMOTE_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_REMOTE_DOCUMENT))
#define GCA_IS_REMOTE_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_REMOTE_DOCUMENT))
#define GCA_REMOTE_DOCUMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_REMOTE_DOCUMENT, GcaRemoteDocumentClass))

typedef struct _GcaRemoteDocument GcaRemoteDocument;
typedef struct _GcaRemoteDocumentClass GcaRemoteDocumentClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _gca_scrollbar_marker_unref0(var) ((var == NULL) ? NULL : (var = (gca_scrollbar_marker_unref (var), NULL)))

#define GCA_TYPE_DIAGNOSTIC_SERVICE (gca_diagnostic_service_get_type ())
#define GCA_DIAGNOSTIC_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_DIAGNOSTIC_SERVICE, GcaDiagnosticService))
#define GCA_DIAGNOSTIC_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_DIAGNOSTIC_SERVICE, GcaDiagnosticServiceClass))
#define GCA_IS_DIAGNOSTIC_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_DIAGNOSTIC_SERVICE))
#define GCA_IS_DIAGNOSTIC_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_DIAGNOSTIC_SERVICE))
#define GCA_DIAGNOSTIC_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_DIAGNOSTIC_SERVICE, GcaDiagnosticServiceClass))

typedef struct _GcaDiagnosticService GcaDiagnosticService;
typedef struct _GcaDiagnosticServiceClass GcaDiagnosticServiceClass;

#define GCA_TYPE_BACKEND_MANAGER (gca_backend_manager_get_type ())
#define GCA_BACKEND_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_TYPE_BACKEND_MANAGER, GcaBackendManager))
#define GCA_BACKEND_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_TYPE_BACKEND_MANAGER, GcaBackendManagerClass))
#define GCA_IS_BACKEND_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_TYPE_BACKEND_MANAGER))
#define GCA_IS_BACKEND_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_TYPE_BACKEND_MANAGER))
#define GCA_BACKEND_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_TYPE_BACKEND_MANAGER, GcaBackendManagerClass))

typedef struct _GcaBackendManager GcaBackendManager;
typedef struct _GcaBackendManagerClass GcaBackendManagerClass;
typedef struct _Block1Data Block1Data;
#define _gca_backend_manager_unref0(var) ((var == NULL) ? NULL : (var = (gca_backend_manager_unref (var), NULL)))

#define GCA_BACKEND_MANAGER_TYPE_INDENT_BACKEND_INFO (gca_backend_manager_indent_backend_info_get_type ())
#define GCA_BACKEND_MANAGER_INDENT_BACKEND_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCA_BACKEND_MANAGER_TYPE_INDENT_BACKEND_INFO, GcaBackendManagerIndentBackendInfo))
#define GCA_BACKEND_MANAGER_INDENT_BACKEND_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCA_BACKEND_MANAGER_TYPE_INDENT_BACKEND_INFO, GcaBackendManagerIndentBackendInfoClass))
#define GCA_BACKEND_MANAGER_IS_INDENT_BACKEND_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCA_BACKEND_MANAGER_TYPE_INDENT_BACKEND_INFO))
#define GCA_BACKEND_MANAGER_IS_INDENT_BACKEND_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCA_BACKEND_MANAGER_TYPE_INDENT_BACKEND_INFO))
#define GCA_BACKEND_MANAGER_INDENT_BACKEND_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCA_BACKEND_MANAGER_TYPE_INDENT_BACKEND_INFO, GcaBackendManagerIndentBackendInfoClass))

typedef struct _GcaBackendManagerIndentBackendInfo GcaBackendManagerIndentBackendInfo;
typedef struct _GcaBackendManagerIndentBackendInfoClass GcaBackendManagerIndentBackendInfoClass;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _GcaView {
	GObject parent_instance;
	GcaViewPrivate * priv;
};

struct _GcaViewClass {
	GObjectClass parent_class;
};

struct _GcaIndentLevel {
	guint indent;
	guint alignment;
};

struct _GcaIndentBackendIface {
	GTypeInterface parent_iface;
	gchar** (*get_triggers) (GcaIndentBackend* self, int* result_length1);
	void (*get_indent) (GcaIndentBackend* self, GeditDocument* document, GtkTextIter* place, GcaIndentLevel* result);
	GeditView* (*get_view) (GcaIndentBackend* self);
	void (*set_view) (GcaIndentBackend* self, GeditView* value);
};

typedef enum  {
	GCA_REMOTE_SERVICES_DIAGNOSTICS = 1 << 0,
	GCA_REMOTE_SERVICES_SEMANTIC_VALUES = 1 << 1,
	GCA_REMOTE_SERVICES_SYMBOLS = 1 << 2
} GcaRemoteServices;

struct _GcaRemoteServiceIface {
	GTypeInterface parent_iface;
	GcaRemoteServices (*services) (GcaRemoteService* self);
	void (*update) (GcaRemoteService* self, GcaView* view, GcaRemoteDocument* document);
	void (*destroy) (GcaRemoteService* self);
};

struct _GcaViewPrivate {
	GeditView* d_view;
	GcaDocument* d_document;
	GcaBackend* d_backend;
	GcaIndentBackend* d_indent_backend;
	GcaScrollbarMarker* d_scrollbar_marker;
	guint d_timeout;
	GcaRemoteService** d_services;
	gint d_services_length1;
	gint _d_services_size_;
};

struct _Block1Data {
	int _ref_count_;
	GcaView* self;
	GcaBackendManager* manager;
};


static gpointer gca_view_parent_class = NULL;

GType gca_view_get_type (void) G_GNUC_CONST;
GType gca_document_get_type (void) G_GNUC_CONST;
GType gca_backend_get_type (void) G_GNUC_CONST;
GType gca_indent_level_get_type (void) G_GNUC_CONST;
GcaIndentLevel* gca_indent_level_dup (const GcaIndentLevel* self);
void gca_indent_level_free (GcaIndentLevel* self);
GType gca_indent_backend_get_type (void) G_GNUC_CONST;
gpointer gca_scrollbar_marker_ref (gpointer instance);
void gca_scrollbar_marker_unref (gpointer instance);
GParamSpec* gca_param_spec_scrollbar_marker (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void gca_value_set_scrollbar_marker (GValue* value, gpointer v_object);
void gca_value_take_scrollbar_marker (GValue* value, gpointer v_object);
gpointer gca_value_get_scrollbar_marker (const GValue* value);
GType gca_scrollbar_marker_get_type (void) G_GNUC_CONST;
GType gca_remote_services_get_type (void) G_GNUC_CONST;
gpointer gca_remote_document_ref (gpointer instance);
void gca_remote_document_unref (gpointer instance);
GParamSpec* gca_param_spec_remote_document (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void gca_value_set_remote_document (GValue* value, gpointer v_object);
void gca_value_take_remote_document (GValue* value, gpointer v_object);
gpointer gca_value_get_remote_document (const GValue* value);
GType gca_remote_document_get_type (void) G_GNUC_CONST;
GType gca_remote_service_get_type (void) G_GNUC_CONST;
#define GCA_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GCA_TYPE_VIEW, GcaViewPrivate))
enum  {
	GCA_VIEW_DUMMY_PROPERTY,
	GCA_VIEW_VIEW,
	GCA_VIEW_DOCUMENT,
	GCA_VIEW_SCROLLBAR_MARKER
};
GcaView* gca_view_new (GeditView* view);
GcaView* gca_view_construct (GType object_type, GeditView* view);
static void gca_view_on_notify_buffer (GcaView* self);
static void _gca_view_on_notify_buffer_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void gca_view_on_event_after (GcaView* self, GtkWidget* widget, GdkEvent* event);
static void _gca_view_on_event_after_gtk_widget_event_after (GtkWidget* _sender, GdkEvent* p0, gpointer self);
static void gca_view_connect_document (GcaView* self, GeditDocument* document);
GcaScrollbarMarker* gca_scrollbar_marker_new (GtkScrollbar* scrollbar);
GcaScrollbarMarker* gca_scrollbar_marker_construct (GType object_type, GtkScrollbar* scrollbar);
GcaDiagnosticService* gca_diagnostic_service_new (void);
GcaDiagnosticService* gca_diagnostic_service_construct (GType object_type);
GType gca_diagnostic_service_get_type (void) G_GNUC_CONST;
void gca_view_deactivate (GcaView* self);
static void gca_view_disconnect_document (GcaView* self);
void gca_view_update (GcaView* self, GcaRemoteDocument* doc);
gboolean gca_backend_supports (GcaBackend* self, GcaRemoteServices services);
GcaRemoteServices gca_remote_service_services (GcaRemoteService* self);
void gca_remote_service_update (GcaRemoteService* self, GcaView* view, GcaRemoteDocument* document);
GeditDocument* gca_document_get_document (GcaDocument* self);
static void gca_view_on_notify_language (GcaView* self);
static void _gca_view_on_notify_language_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
static void gca_view_on_document_changed (GcaView* self);
static void _gca_view_on_document_changed_gca_document_changed (GcaDocument* _sender, gpointer self);
static void gca_view_on_document_path_changed (GcaView* self, const gchar* prevpath);
static void _gca_view_on_document_path_changed_gca_document_path_changed (GcaDocument* _sender, const gchar* previous_path, gpointer self);
static void gca_view_unregister_backends (GcaView* self);
GcaDocument* gca_document_new (GeditDocument* document);
GcaDocument* gca_document_construct (GType object_type, GeditDocument* document);
static void gca_view_update_backends (GcaView* self);
void gca_view_reparse_now (GcaView* self);
void gca_view_reparse (GcaView* self);
static gboolean __lambda11_ (GcaView* self);
static gboolean ___lambda11__gsource_func (gpointer self);
void gca_scrollbar_marker_set_max_line (GcaScrollbarMarker* self, gint value);
gpointer gca_backend_manager_ref (gpointer instance);
void gca_backend_manager_unref (gpointer instance);
GParamSpec* gca_param_spec_backend_manager (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void gca_value_set_backend_manager (GValue* value, gpointer v_object);
void gca_value_take_backend_manager (GValue* value, gpointer v_object);
gpointer gca_value_get_backend_manager (const GValue* value);
GType gca_backend_manager_get_type (void) G_GNUC_CONST;
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
GcaBackendManager* gca_backend_manager_get_instance (void);
void gca_backend_manager_backend (GcaBackendManager* self, const gchar* language, GAsyncReadyCallback _callback_, gpointer _user_data_);
GcaBackend* gca_backend_manager_backend_finish (GcaBackendManager* self, GAsyncResult* _res_);
static void ___lambda10_ (Block1Data* _data1_, GObject* obj, GAsyncResult* res);
static void gca_view_register_backend (GcaView* self, GcaBackend* backend);
static void ____lambda10__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
GType gca_backend_manager_indent_backend_info_get_type (void) G_GNUC_CONST;
GcaBackendManagerIndentBackendInfo* gca_backend_manager_indent_backend_info (GcaBackendManager* self, const gchar* language);
PeasPluginInfo* gca_backend_manager_indent_backend_info_get_info (GcaBackendManagerIndentBackendInfo* self);
void gca_remote_service_destroy (GcaRemoteService* self);
void gca_backend_unregister (GcaBackend* self, GcaView* view);
void gca_backend_register (GcaBackend* self, GcaView* view);
static gunichar gca_view_get_introduced_char (GcaView* self, GtkTextBuffer* buf, GtkTextIter* cur);
static gboolean gca_view_is_whitespaces (GcaView* self, GtkTextBuffer* buf, GtkTextIter* cur);
static gchar* gca_view_get_indent_string_from_indent_level (GcaView* self, GcaIndentLevel* level);
guint gca_indent_backend_get_indent_width (GcaIndentBackend* self);
gchar** gca_indent_backend_get_triggers (GcaIndentBackend* self, int* result_length1);
void gca_indent_backend_get_indent (GcaIndentBackend* self, GeditDocument* document, GtkTextIter* place, GcaIndentLevel* result);
void gca_log_debug (const gchar* format, ...);
GeditView* gca_view_get_view (GcaView* self);
GcaDocument* gca_view_get_document (GcaView* self);
GcaScrollbarMarker* gca_view_get_scrollbar_marker (GcaView* self);
static void gca_view_finalize (GObject* obj);
static void _vala_gca_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


static void _gca_view_on_notify_buffer_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	gca_view_on_notify_buffer ((GcaView*) self);
}


static void _gca_view_on_event_after_gtk_widget_event_after (GtkWidget* _sender, GdkEvent* p0, gpointer self) {
	gca_view_on_event_after ((GcaView*) self, _sender, p0);
}


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


GcaView* gca_view_construct (GType object_type, GeditView* view) {
	GcaView * self = NULL;
	GeditView* _tmp0_ = NULL;
	GeditView* _tmp1_ = NULL;
	GeditView* _tmp2_ = NULL;
	GeditView* _tmp3_ = NULL;
	GtkTextBuffer* _tmp4_ = NULL;
	GtkTextBuffer* _tmp5_ = NULL;
	GtkScrolledWindow* sw = NULL;
	GeditView* _tmp6_ = NULL;
	GtkContainer* _tmp7_ = NULL;
	GtkContainer* _tmp8_ = NULL;
	GtkScrolledWindow* _tmp9_ = NULL;
	GtkScrolledWindow* _tmp10_ = NULL;
	GcaDiagnosticService* _tmp14_ = NULL;
	GcaRemoteService** _tmp15_ = NULL;
	g_return_val_if_fail (view != NULL, NULL);
	self = (GcaView*) g_object_new (object_type, NULL);
	_tmp0_ = view;
	self->priv->d_view = _tmp0_;
	_tmp1_ = self->priv->d_view;
	g_signal_connect_object ((GObject*) _tmp1_, "notify::buffer", (GCallback) _gca_view_on_notify_buffer_g_object_notify, self, 0);
	_tmp2_ = self->priv->d_view;
	g_signal_connect_object ((GtkWidget*) _tmp2_, "event-after", (GCallback) _gca_view_on_event_after_gtk_widget_event_after, self, G_CONNECT_AFTER);
	_tmp3_ = self->priv->d_view;
	_tmp4_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp3_);
	_tmp5_ = _tmp4_;
	gca_view_connect_document (self, G_TYPE_CHECK_INSTANCE_TYPE (_tmp5_, gedit_document_get_type ()) ? ((GeditDocument*) _tmp5_) : NULL);
	_tmp6_ = self->priv->d_view;
	_tmp7_ = gtk_widget_get_parent ((GtkWidget*) _tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, gtk_scrolled_window_get_type ()) ? ((GtkScrolledWindow*) _tmp8_) : NULL);
	sw = _tmp9_;
	_tmp10_ = sw;
	if (_tmp10_ != NULL) {
		GtkScrolledWindow* _tmp11_ = NULL;
		GtkWidget* _tmp12_ = NULL;
		GcaScrollbarMarker* _tmp13_ = NULL;
		_tmp11_ = sw;
		_tmp12_ = gtk_scrolled_window_get_vscrollbar (_tmp11_);
		_tmp13_ = gca_scrollbar_marker_new (G_TYPE_CHECK_INSTANCE_TYPE (_tmp12_, gtk_scrollbar_get_type ()) ? ((GtkScrollbar*) _tmp12_) : NULL);
		_gca_scrollbar_marker_unref0 (self->priv->d_scrollbar_marker);
		self->priv->d_scrollbar_marker = _tmp13_;
	}
	_tmp14_ = gca_diagnostic_service_new ();
	_tmp15_ = g_new0 (GcaRemoteService*, 1 + 1);
	_tmp15_[0] = (GcaRemoteService*) _tmp14_;
	self->priv->d_services = (_vala_array_free (self->priv->d_services, self->priv->d_services_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->d_services = _tmp15_;
	self->priv->d_services_length1 = 1;
	self->priv->_d_services_size_ = self->priv->d_services_length1;
	_g_object_unref0 (sw);
	return self;
}


GcaView* gca_view_new (GeditView* view) {
	return gca_view_construct (GCA_TYPE_VIEW, view);
}


void gca_view_deactivate (GcaView* self) {
	GeditView* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	GQuark _tmp2_ = 0U;
	GeditView* _tmp3_ = NULL;
	guint _tmp4_ = 0U;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->d_view;
	g_signal_parse_name ("notify::buffer", G_TYPE_OBJECT, &_tmp1_, &_tmp2_, TRUE);
	g_signal_handlers_disconnect_matched ((GObject*) _tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, _tmp2_, NULL, (GCallback) _gca_view_on_notify_buffer_g_object_notify, self);
	_tmp3_ = self->priv->d_view;
	g_signal_parse_name ("event-after", gtk_widget_get_type (), &_tmp4_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkWidget*) _tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _gca_view_on_event_after_gtk_widget_event_after, self);
	gca_view_disconnect_document (self);
	self->priv->d_view = NULL;
}


void gca_view_update (GcaView* self, GcaRemoteDocument* doc) {
	GcaRemoteService** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (doc != NULL);
	_tmp0_ = self->priv->d_services;
	_tmp0__length1 = self->priv->d_services_length1;
	{
		GcaRemoteService** service_collection = NULL;
		gint service_collection_length1 = 0;
		gint _service_collection_size_ = 0;
		gint service_it = 0;
		service_collection = _tmp0_;
		service_collection_length1 = _tmp0__length1;
		for (service_it = 0; service_it < _tmp0__length1; service_it = service_it + 1) {
			GcaRemoteService* _tmp1_ = NULL;
			GcaRemoteService* service = NULL;
			_tmp1_ = _g_object_ref0 (service_collection[service_it]);
			service = _tmp1_;
			{
				GcaBackend* _tmp2_ = NULL;
				GcaRemoteService* _tmp3_ = NULL;
				GcaRemoteServices _tmp4_ = 0;
				gboolean _tmp5_ = FALSE;
				_tmp2_ = self->priv->d_backend;
				_tmp3_ = service;
				_tmp4_ = gca_remote_service_services (_tmp3_);
				_tmp5_ = gca_backend_supports (_tmp2_, _tmp4_);
				if (_tmp5_) {
					GcaRemoteService* _tmp6_ = NULL;
					GcaRemoteDocument* _tmp7_ = NULL;
					_tmp6_ = service;
					_tmp7_ = doc;
					gca_remote_service_update (_tmp6_, self, _tmp7_);
				}
				_g_object_unref0 (service);
			}
		}
	}
}


static void _gca_view_on_notify_language_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
	gca_view_on_notify_language ((GcaView*) self);
}


static void _gca_view_on_document_changed_gca_document_changed (GcaDocument* _sender, gpointer self) {
	gca_view_on_document_changed ((GcaView*) self);
}


static void _gca_view_on_document_path_changed_gca_document_path_changed (GcaDocument* _sender, const gchar* previous_path, gpointer self) {
	gca_view_on_document_path_changed ((GcaView*) self, previous_path);
}


static void gca_view_disconnect_document (GcaView* self) {
	GcaDocument* _tmp0_ = NULL;
	GeditDocument* buf = NULL;
	GcaDocument* _tmp1_ = NULL;
	GeditDocument* _tmp2_ = NULL;
	GeditDocument* _tmp3_ = NULL;
	GeditDocument* _tmp4_ = NULL;
	GeditDocument* _tmp5_ = NULL;
	guint _tmp6_ = 0U;
	GQuark _tmp7_ = 0U;
	GcaDocument* _tmp8_ = NULL;
	guint _tmp9_ = 0U;
	GcaDocument* _tmp10_ = NULL;
	guint _tmp11_ = 0U;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->d_document;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->d_document;
	_tmp2_ = gca_document_get_document (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	buf = _tmp4_;
	_tmp5_ = buf;
	g_signal_parse_name ("notify::language", G_TYPE_OBJECT, &_tmp6_, &_tmp7_, TRUE);
	g_signal_handlers_disconnect_matched ((GObject*) _tmp5_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp6_, _tmp7_, NULL, (GCallback) _gca_view_on_notify_language_g_object_notify, self);
	_tmp8_ = self->priv->d_document;
	g_signal_parse_name ("changed", GCA_TYPE_DOCUMENT, &_tmp9_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp8_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp9_, 0, NULL, (GCallback) _gca_view_on_document_changed_gca_document_changed, self);
	_tmp10_ = self->priv->d_document;
	g_signal_parse_name ("path-changed", GCA_TYPE_DOCUMENT, &_tmp11_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp10_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp11_, 0, NULL, (GCallback) _gca_view_on_document_path_changed_gca_document_path_changed, self);
	gca_view_unregister_backends (self);
	_g_object_unref0 (self->priv->d_document);
	self->priv->d_document = NULL;
	_g_object_unref0 (buf);
}


static void gca_view_connect_document (GcaView* self, GeditDocument* document) {
	GeditDocument* _tmp0_ = NULL;
	GeditDocument* _tmp1_ = NULL;
	GcaDocument* _tmp2_ = NULL;
	GeditDocument* buf = NULL;
	GcaDocument* _tmp3_ = NULL;
	GeditDocument* _tmp4_ = NULL;
	GeditDocument* _tmp5_ = NULL;
	GeditDocument* _tmp6_ = NULL;
	GeditDocument* _tmp7_ = NULL;
	GcaDocument* _tmp8_ = NULL;
	GcaDocument* _tmp9_ = NULL;
	g_return_if_fail (self != NULL);
	gca_view_disconnect_document (self);
	_tmp0_ = document;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = document;
	_tmp2_ = gca_document_new (_tmp1_);
	_g_object_unref0 (self->priv->d_document);
	self->priv->d_document = _tmp2_;
	_tmp3_ = self->priv->d_document;
	_tmp4_ = gca_document_get_document (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	buf = _tmp6_;
	_tmp7_ = buf;
	g_signal_connect_object ((GObject*) _tmp7_, "notify::language", (GCallback) _gca_view_on_notify_language_g_object_notify, self, 0);
	_tmp8_ = self->priv->d_document;
	g_signal_connect_object (_tmp8_, "changed", (GCallback) _gca_view_on_document_changed_gca_document_changed, self, 0);
	_tmp9_ = self->priv->d_document;
	g_signal_connect_object (_tmp9_, "path-changed", (GCallback) _gca_view_on_document_path_changed_gca_document_path_changed, self, 0);
	gca_view_update_backends (self);
	_g_object_unref0 (buf);
}


static void gca_view_on_document_path_changed (GcaView* self, const gchar* prevpath) {
	const gchar* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = prevpath;
	g_signal_emit_by_name (self, "path-changed", _tmp0_);
}


void gca_view_reparse_now (GcaView* self) {
	guint _tmp0_ = 0U;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->d_timeout;
	if (_tmp0_ != ((guint) 0)) {
		guint _tmp1_ = 0U;
		_tmp1_ = self->priv->d_timeout;
		g_source_remove (_tmp1_);
		self->priv->d_timeout = (guint) 0;
	}
	g_signal_emit_by_name (self, "changed");
}


static gboolean __lambda11_ (GcaView* self) {
	gboolean result = FALSE;
	self->priv->d_timeout = (guint) 0;
	g_signal_emit_by_name (self, "changed");
	result = FALSE;
	return result;
}


static gboolean ___lambda11__gsource_func (gpointer self) {
	gboolean result;
	result = __lambda11_ ((GcaView*) self);
	return result;
}


void gca_view_reparse (GcaView* self) {
	guint _tmp0_ = 0U;
	guint _tmp2_ = 0U;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->d_timeout;
	if (_tmp0_ != ((guint) 0)) {
		guint _tmp1_ = 0U;
		_tmp1_ = self->priv->d_timeout;
		g_source_remove (_tmp1_);
	}
	_tmp2_ = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, ___lambda11__gsource_func, g_object_ref (self), g_object_unref);
	self->priv->d_timeout = _tmp2_;
}


static void gca_view_on_document_changed (GcaView* self) {
	GcaScrollbarMarker* _tmp0_ = NULL;
	GcaDocument* _tmp1_ = NULL;
	GeditDocument* _tmp2_ = NULL;
	GeditDocument* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->d_scrollbar_marker;
	_tmp1_ = self->priv->d_document;
	_tmp2_ = gca_document_get_document (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = gtk_text_buffer_get_line_count ((GtkTextBuffer*) _tmp3_);
	gca_scrollbar_marker_set_max_line (_tmp0_, _tmp4_);
	gca_view_reparse (self);
}


static Block1Data* block1_data_ref (Block1Data* _data1_) {
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}


static void block1_data_unref (void * _userdata_) {
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		GcaView* self;
		self = _data1_->self;
		_gca_backend_manager_unref0 (_data1_->manager);
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}


static gpointer _gca_backend_manager_ref0 (gpointer self) {
	return self ? gca_backend_manager_ref (self) : NULL;
}


static void ___lambda10_ (Block1Data* _data1_, GObject* obj, GAsyncResult* res) {
	GcaView* self;
	GcaBackend* backend = NULL;
	GcaBackendManager* _tmp0_ = NULL;
	GAsyncResult* _tmp1_ = NULL;
	GcaBackend* _tmp2_ = NULL;
	self = _data1_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data1_->manager;
	_tmp1_ = res;
	_tmp2_ = gca_backend_manager_backend_finish (_tmp0_, _tmp1_);
	backend = _tmp2_;
	gca_view_register_backend (self, backend);
	_g_object_unref0 (backend);
}


static void ____lambda10__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	___lambda10_ (self, source_object, res);
	block1_data_unref (self);
}


static void gca_view_update_backends (GcaView* self) {
	gboolean _tmp0_ = FALSE;
	GcaDocument* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	gca_view_unregister_backends (self);
	_tmp1_ = self->priv->d_document;
	if (_tmp1_ != NULL) {
		GcaDocument* _tmp2_ = NULL;
		GeditDocument* _tmp3_ = NULL;
		GeditDocument* _tmp4_ = NULL;
		GtkSourceLanguage* _tmp5_ = NULL;
		GtkSourceLanguage* _tmp6_ = NULL;
		_tmp2_ = self->priv->d_document;
		_tmp3_ = gca_document_get_document (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = gtk_source_buffer_get_language ((GtkSourceBuffer*) _tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_ != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		Block1Data* _data1_;
		GcaBackendManager* _tmp7_ = NULL;
		GcaBackendManager* _tmp8_ = NULL;
		GcaBackendManager* _tmp9_ = NULL;
		GcaBackendManager* _tmp10_ = NULL;
		GcaDocument* _tmp11_ = NULL;
		GeditDocument* _tmp12_ = NULL;
		GeditDocument* _tmp13_ = NULL;
		GtkSourceLanguage* _tmp14_ = NULL;
		GtkSourceLanguage* _tmp15_ = NULL;
		const gchar* _tmp16_ = NULL;
		const gchar* _tmp17_ = NULL;
		GcaBackendManagerIndentBackendInfo* info = NULL;
		GcaBackendManager* _tmp18_ = NULL;
		GcaDocument* _tmp19_ = NULL;
		GeditDocument* _tmp20_ = NULL;
		GeditDocument* _tmp21_ = NULL;
		GtkSourceLanguage* _tmp22_ = NULL;
		GtkSourceLanguage* _tmp23_ = NULL;
		const gchar* _tmp24_ = NULL;
		const gchar* _tmp25_ = NULL;
		GcaBackendManagerIndentBackendInfo* _tmp26_ = NULL;
		GcaBackendManagerIndentBackendInfo* _tmp27_ = NULL;
		_data1_ = g_slice_new0 (Block1Data);
		_data1_->_ref_count_ = 1;
		_data1_->self = g_object_ref (self);
		_tmp7_ = gca_backend_manager_get_instance ();
		_tmp8_ = _tmp7_;
		_tmp9_ = _gca_backend_manager_ref0 (_tmp8_);
		_data1_->manager = _tmp9_;
		_tmp10_ = _data1_->manager;
		_tmp11_ = self->priv->d_document;
		_tmp12_ = gca_document_get_document (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = gtk_source_buffer_get_language ((GtkSourceBuffer*) _tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = gtk_source_language_get_id (_tmp15_);
		_tmp17_ = _tmp16_;
		gca_backend_manager_backend (_tmp10_, _tmp17_, ____lambda10__gasync_ready_callback, block1_data_ref (_data1_));
		_tmp18_ = _data1_->manager;
		_tmp19_ = self->priv->d_document;
		_tmp20_ = gca_document_get_document (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = gtk_source_buffer_get_language ((GtkSourceBuffer*) _tmp21_);
		_tmp23_ = _tmp22_;
		_tmp24_ = gtk_source_language_get_id (_tmp23_);
		_tmp25_ = _tmp24_;
		_tmp26_ = gca_backend_manager_indent_backend_info (_tmp18_, _tmp25_);
		info = _tmp26_;
		_tmp27_ = info;
		if (_tmp27_ != NULL) {
			PeasEngine* _tmp28_ = NULL;
			GcaBackendManagerIndentBackendInfo* _tmp29_ = NULL;
			PeasPluginInfo* _tmp30_ = NULL;
			PeasPluginInfo* _tmp31_ = NULL;
			GeditView* _tmp32_ = NULL;
			PeasExtension* _tmp33_ = NULL;
			_tmp28_ = peas_engine_get_default ();
			_tmp29_ = info;
			_tmp30_ = gca_backend_manager_indent_backend_info_get_info (_tmp29_);
			_tmp31_ = _tmp30_;
			_tmp32_ = self->priv->d_view;
			_tmp33_ = peas_engine_create_extension (_tmp28_, _tmp31_, GCA_TYPE_INDENT_BACKEND, "view", _tmp32_, NULL);
			_g_object_unref0 (self->priv->d_indent_backend);
			self->priv->d_indent_backend = G_TYPE_CHECK_INSTANCE_CAST (_tmp33_, GCA_TYPE_INDENT_BACKEND, GcaIndentBackend);
		}
		_g_object_unref0 (info);
		block1_data_unref (_data1_);
		_data1_ = NULL;
	}
}


static void gca_view_unregister_backends (GcaView* self) {
	GcaBackend* _tmp0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->d_backend;
	if (_tmp0_ != NULL) {
		GcaRemoteService** _tmp1_ = NULL;
		gint _tmp1__length1 = 0;
		GcaBackend* _tmp4_ = NULL;
		_tmp1_ = self->priv->d_services;
		_tmp1__length1 = self->priv->d_services_length1;
		{
			GcaRemoteService** service_collection = NULL;
			gint service_collection_length1 = 0;
			gint _service_collection_size_ = 0;
			gint service_it = 0;
			service_collection = _tmp1_;
			service_collection_length1 = _tmp1__length1;
			for (service_it = 0; service_it < _tmp1__length1; service_it = service_it + 1) {
				GcaRemoteService* _tmp2_ = NULL;
				GcaRemoteService* service = NULL;
				_tmp2_ = _g_object_ref0 (service_collection[service_it]);
				service = _tmp2_;
				{
					GcaRemoteService* _tmp3_ = NULL;
					_tmp3_ = service;
					gca_remote_service_destroy (_tmp3_);
					_g_object_unref0 (service);
				}
			}
		}
		_tmp4_ = self->priv->d_backend;
		gca_backend_unregister (_tmp4_, self);
		_g_object_unref0 (self->priv->d_backend);
		self->priv->d_backend = NULL;
	}
	_g_object_unref0 (self->priv->d_indent_backend);
	self->priv->d_indent_backend = NULL;
}


static void gca_view_register_backend (GcaView* self, GcaBackend* backend) {
	GcaBackend* _tmp0_ = NULL;
	GcaBackend* _tmp1_ = NULL;
	GcaBackend* _tmp2_ = NULL;
	GcaBackend* _tmp3_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = backend;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->d_backend);
	self->priv->d_backend = _tmp1_;
	_tmp2_ = backend;
	if (_tmp2_ == NULL) {
		return;
	}
	_tmp3_ = backend;
	gca_backend_register (_tmp3_, self);
	gca_view_on_document_changed (self);
}


static void gca_view_on_notify_buffer (GcaView* self) {
	GeditView* _tmp0_ = NULL;
	GtkTextBuffer* _tmp1_ = NULL;
	GtkTextBuffer* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	gca_view_disconnect_document (self);
	_tmp0_ = self->priv->d_view;
	_tmp1_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp0_);
	_tmp2_ = _tmp1_;
	gca_view_connect_document (self, G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, gedit_document_get_type ()) ? ((GeditDocument*) _tmp2_) : NULL);
}


static void gca_view_on_notify_language (GcaView* self) {
	g_return_if_fail (self != NULL);
	gca_view_update_backends (self);
}


static gunichar gca_view_get_introduced_char (GcaView* self, GtkTextBuffer* buf, GtkTextIter* cur) {
	gunichar result = 0U;
	gunichar c = 0U;
	GtkTextIter start = {0};
	GtkTextIter _tmp0_ = {0};
	gboolean _tmp1_ = FALSE;
	GtkTextIter _tmp3_ = {0};
	g_return_val_if_fail (self != NULL, 0U);
	g_return_val_if_fail (buf != NULL, 0U);
	g_return_val_if_fail (cur != NULL, 0U);
	c = (gunichar) 0;
	_tmp0_ = *cur;
	start = _tmp0_;
	_tmp1_ = gtk_text_iter_backward_char (&start);
	if (_tmp1_) {
		gunichar _tmp2_ = 0U;
		_tmp2_ = gtk_text_iter_get_char (&start);
		c = _tmp2_;
	}
	_tmp3_ = start;
	*cur = _tmp3_;
	result = c;
	return result;
}


static gboolean gca_view_is_whitespaces (GcaView* self, GtkTextBuffer* buf, GtkTextIter* cur) {
	gboolean result = FALSE;
	gint _tmp0_ = 0;
	gboolean check = FALSE;
	GtkTextIter start = {0};
	GtkTextIter _tmp1_ = {0};
	gunichar c = 0U;
	gunichar _tmp2_ = 0U;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (buf != NULL, FALSE);
	g_return_val_if_fail (cur != NULL, FALSE);
	_tmp0_ = gtk_text_iter_get_line_offset (cur);
	if (_tmp0_ == 0) {
		result = TRUE;
		return result;
	}
	check = TRUE;
	_tmp1_ = *cur;
	start = _tmp1_;
	gtk_text_iter_set_line_offset (&start, 0);
	_tmp2_ = gtk_text_iter_get_char (&start);
	c = _tmp2_;
	while (TRUE) {
		GtkTextIter _tmp3_ = {0};
		gint _tmp4_ = 0;
		gunichar _tmp5_ = 0U;
		gboolean _tmp6_ = FALSE;
		gboolean _tmp7_ = FALSE;
		gunichar _tmp8_ = 0U;
		_tmp3_ = *cur;
		_tmp4_ = gtk_text_iter_compare (&start, &_tmp3_);
		if (!(_tmp4_ < 0)) {
			break;
		}
		_tmp5_ = c;
		_tmp6_ = g_unichar_isspace (_tmp5_);
		if (!_tmp6_) {
			check = FALSE;
			break;
		}
		_tmp7_ = gtk_text_iter_forward_char (&start);
		if (!_tmp7_) {
			check = FALSE;
			break;
		}
		_tmp8_ = gtk_text_iter_get_char (&start);
		c = _tmp8_;
	}
	result = check;
	return result;
}


static gchar* gca_view_get_indent_string_from_indent_level (GcaView* self, GcaIndentLevel* level) {
	gchar* result = NULL;
	gchar* indent = NULL;
	gchar* _tmp0_ = NULL;
	GeditView* _tmp1_ = NULL;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	const gchar* _tmp22_ = NULL;
	GcaIndentLevel _tmp23_ = {0};
	guint _tmp24_ = 0U;
	gchar* _tmp25_ = NULL;
	gchar* _tmp26_ = NULL;
	gchar* _tmp27_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (level != NULL, NULL);
	_tmp0_ = g_strdup ("");
	indent = _tmp0_;
	_tmp1_ = self->priv->d_view;
	_tmp2_ = gtk_source_view_get_insert_spaces_instead_of_tabs ((GtkSourceView*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		GcaIndentLevel _tmp4_ = {0};
		guint _tmp5_ = 0U;
		gchar* _tmp6_ = NULL;
		_tmp4_ = *level;
		_tmp5_ = _tmp4_.indent;
		_tmp6_ = g_strnfill ((gsize) _tmp5_, ' ');
		_g_free0 (indent);
		indent = _tmp6_;
	} else {
		guint indent_width = 0U;
		GcaIndentBackend* _tmp7_ = NULL;
		guint _tmp8_ = 0U;
		guint tabs = 0U;
		GcaIndentLevel _tmp9_ = {0};
		guint _tmp10_ = 0U;
		guint _tmp11_ = 0U;
		guint spaces = 0U;
		GcaIndentLevel _tmp12_ = {0};
		guint _tmp13_ = 0U;
		guint _tmp14_ = 0U;
		guint _tmp15_ = 0U;
		gchar* _tmp16_ = NULL;
		gchar* _tmp17_ = NULL;
		guint _tmp18_ = 0U;
		gchar* _tmp19_ = NULL;
		gchar* _tmp20_ = NULL;
		gchar* _tmp21_ = NULL;
		_tmp7_ = self->priv->d_indent_backend;
		_tmp8_ = gca_indent_backend_get_indent_width (_tmp7_);
		indent_width = _tmp8_;
		_tmp9_ = *level;
		_tmp10_ = _tmp9_.indent;
		_tmp11_ = indent_width;
		tabs = _tmp10_ / _tmp11_;
		_tmp12_ = *level;
		_tmp13_ = _tmp12_.indent;
		_tmp14_ = indent_width;
		spaces = _tmp13_ % _tmp14_;
		_tmp15_ = tabs;
		_tmp16_ = g_strnfill ((gsize) _tmp15_, '\t');
		_tmp17_ = _tmp16_;
		_tmp18_ = spaces;
		_tmp19_ = g_strnfill ((gsize) _tmp18_, ' ');
		_tmp20_ = _tmp19_;
		_tmp21_ = g_strconcat (_tmp17_, _tmp20_, NULL);
		_g_free0 (indent);
		indent = _tmp21_;
		_g_free0 (_tmp20_);
		_g_free0 (_tmp17_);
	}
	_tmp22_ = indent;
	_tmp23_ = *level;
	_tmp24_ = _tmp23_.alignment;
	_tmp25_ = g_strnfill ((gsize) _tmp24_, ' ');
	_tmp26_ = _tmp25_;
	_tmp27_ = g_strconcat (_tmp22_, _tmp26_, NULL);
	_g_free0 (indent);
	indent = _tmp27_;
	_g_free0 (_tmp26_);
	result = indent;
	return result;
}


static gunichar string_get_char (const gchar* self, glong index) {
	gunichar result = 0U;
	glong _tmp0_ = 0L;
	gunichar _tmp1_ = 0U;
	g_return_val_if_fail (self != NULL, 0U);
	_tmp0_ = index;
	_tmp1_ = g_utf8_get_char (((gchar*) self) + _tmp0_);
	result = _tmp1_;
	return result;
}


static void gca_view_on_event_after (GcaView* self, GtkWidget* widget, GdkEvent* event) {
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GcaDocument* _tmp2_ = NULL;
	GeditDocument* buf = NULL;
	GcaDocument* _tmp6_ = NULL;
	GeditDocument* _tmp7_ = NULL;
	GeditDocument* _tmp8_ = NULL;
	GeditDocument* _tmp9_ = NULL;
	GtkTextMark* insert = NULL;
	GeditDocument* _tmp10_ = NULL;
	GtkTextMark* _tmp11_ = NULL;
	GtkTextMark* _tmp12_ = NULL;
	GtkTextIter cur = {0};
	GeditDocument* _tmp13_ = NULL;
	GtkTextMark* _tmp14_ = NULL;
	GtkTextIter _tmp15_ = {0};
	gboolean indent = FALSE;
	gboolean _tmp16_ = FALSE;
	gboolean _tmp17_ = FALSE;
	GdkEvent* _tmp18_ = NULL;
	GdkEventKey* _tmp19_ = NULL;
	GdkEventKey* _tmp20_ = NULL;
	guint _tmp21_ = 0U;
	gboolean _tmp57_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (widget != NULL);
	g_return_if_fail (event != NULL);
	_tmp2_ = self->priv->d_document;
	if (_tmp2_ == NULL) {
		_tmp1_ = TRUE;
	} else {
		GcaIndentBackend* _tmp3_ = NULL;
		_tmp3_ = self->priv->d_indent_backend;
		_tmp1_ = _tmp3_ == NULL;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		GdkEvent* _tmp4_ = NULL;
		GdkEventType _tmp5_ = 0;
		_tmp4_ = event;
		_tmp5_ = _tmp4_->type;
		_tmp0_ = _tmp5_ != GDK_KEY_PRESS;
	}
	if (_tmp0_) {
		return;
	}
	_tmp6_ = self->priv->d_document;
	_tmp7_ = gca_document_get_document (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _g_object_ref0 (_tmp8_);
	buf = _tmp9_;
	_tmp10_ = buf;
	_tmp11_ = gtk_text_buffer_get_insert ((GtkTextBuffer*) _tmp10_);
	_tmp12_ = _g_object_ref0 (_tmp11_);
	insert = _tmp12_;
	_tmp13_ = buf;
	_tmp14_ = insert;
	gtk_text_buffer_get_iter_at_mark ((GtkTextBuffer*) _tmp13_, &_tmp15_, _tmp14_);
	cur = _tmp15_;
	indent = FALSE;
	_tmp18_ = event;
	_tmp19_ = (GdkEventKey *) (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = _tmp20_->keyval;
	if (_tmp21_ == ((guint) GDK_KEY_Return)) {
		_tmp17_ = TRUE;
	} else {
		GdkEvent* _tmp22_ = NULL;
		GdkEventKey* _tmp23_ = NULL;
		GdkEventKey* _tmp24_ = NULL;
		guint _tmp25_ = 0U;
		_tmp22_ = event;
		_tmp23_ = (GdkEventKey *) (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp25_ = _tmp24_->keyval;
		_tmp17_ = _tmp25_ == ((guint) GDK_KEY_KP_Enter);
	}
	if (_tmp17_) {
		GdkEvent* _tmp26_ = NULL;
		GdkEventKey* _tmp27_ = NULL;
		GdkEventKey* _tmp28_ = NULL;
		GdkModifierType _tmp29_ = 0;
		_tmp26_ = event;
		_tmp27_ = (GdkEventKey *) (_tmp26_);
		_tmp28_ = _tmp27_;
		_tmp29_ = _tmp28_->state;
		_tmp16_ = (_tmp29_ & GDK_SHIFT_MASK) == 0;
	} else {
		_tmp16_ = FALSE;
	}
	if (_tmp16_) {
		indent = TRUE;
	} else {
		GtkTextIter copy = {0};
		GtkTextIter _tmp30_ = {0};
		gunichar introduced_char = 0U;
		GeditDocument* _tmp31_ = NULL;
		gunichar _tmp32_ = 0U;
		GcaIndentBackend* _tmp33_ = NULL;
		gint _tmp34_ = 0;
		gchar** _tmp35_ = NULL;
		_tmp30_ = cur;
		copy = _tmp30_;
		_tmp31_ = buf;
		_tmp32_ = gca_view_get_introduced_char (self, (GtkTextBuffer*) _tmp31_, &copy);
		introduced_char = _tmp32_;
		_tmp33_ = self->priv->d_indent_backend;
		_tmp35_ = gca_indent_backend_get_triggers (_tmp33_, &_tmp34_);
		{
			gchar** trigger_collection = NULL;
			gint trigger_collection_length1 = 0;
			gint _trigger_collection_size_ = 0;
			gint trigger_it = 0;
			trigger_collection = _tmp35_;
			trigger_collection_length1 = _tmp34_;
			for (trigger_it = 0; trigger_it < _tmp34_; trigger_it = trigger_it + 1) {
				gchar* _tmp36_ = NULL;
				gchar* trigger = NULL;
				_tmp36_ = g_strdup (trigger_collection[trigger_it]);
				trigger = _tmp36_;
				{
					gunichar c = 0U;
					const gchar* _tmp37_ = NULL;
					const gchar* _tmp38_ = NULL;
					gint _tmp39_ = 0;
					gint _tmp40_ = 0;
					gunichar _tmp41_ = 0U;
					gboolean _tmp42_ = FALSE;
					gunichar _tmp43_ = 0U;
					gunichar _tmp44_ = 0U;
					gboolean _tmp51_ = FALSE;
					const gchar* _tmp52_ = NULL;
					gunichar _tmp53_ = 0U;
					_tmp37_ = trigger;
					_tmp38_ = trigger;
					_tmp39_ = strlen (_tmp38_);
					_tmp40_ = _tmp39_;
					_tmp41_ = string_get_char (_tmp37_, (glong) (_tmp40_ - 1));
					c = _tmp41_;
					_tmp43_ = c;
					_tmp44_ = introduced_char;
					if (_tmp43_ != _tmp44_) {
						_tmp42_ = TRUE;
					} else {
						GdkEvent* _tmp45_ = NULL;
						GdkEventKey* _tmp46_ = NULL;
						GdkEventKey* _tmp47_ = NULL;
						guint _tmp48_ = 0U;
						gunichar _tmp49_ = 0U;
						guint _tmp50_ = 0U;
						_tmp45_ = event;
						_tmp46_ = (GdkEventKey *) (_tmp45_);
						_tmp47_ = _tmp46_;
						_tmp48_ = _tmp47_->keyval;
						_tmp49_ = c;
						_tmp50_ = gdk_unicode_to_keyval ((guint32) _tmp49_);
						_tmp42_ = _tmp48_ != _tmp50_;
					}
					if (_tmp42_) {
						_g_free0 (trigger);
						continue;
					}
					_tmp52_ = trigger;
					_tmp53_ = string_get_char (_tmp52_, (glong) 0);
					if (_tmp53_ == ((gunichar) '0')) {
						GeditDocument* _tmp54_ = NULL;
						GtkTextIter _tmp55_ = {0};
						gboolean _tmp56_ = FALSE;
						_tmp54_ = buf;
						_tmp55_ = copy;
						_tmp56_ = gca_view_is_whitespaces (self, (GtkTextBuffer*) _tmp54_, &_tmp55_);
						_tmp51_ = !_tmp56_;
					} else {
						_tmp51_ = FALSE;
					}
					if (_tmp51_) {
						_g_free0 (trigger);
						break;
					}
					indent = TRUE;
					_g_free0 (trigger);
					break;
				}
			}
			trigger_collection = (_vala_array_free (trigger_collection, trigger_collection_length1, (GDestroyNotify) g_free), NULL);
		}
	}
	_tmp57_ = indent;
	if (_tmp57_) {
		GcaIndentLevel indent_level = {0};
		GcaIndentBackend* _tmp58_ = NULL;
		GeditDocument* _tmp59_ = NULL;
		GtkTextIter _tmp60_ = {0};
		GcaIndentLevel _tmp61_ = {0};
		GcaIndentLevel _tmp62_ = {0};
		guint _tmp63_ = 0U;
		GcaIndentLevel _tmp64_ = {0};
		guint _tmp65_ = 0U;
		GtkTextIter start = {0};
		GtkTextIter _tmp66_ = {0};
		GtkTextIter end = {0};
		GtkTextIter _tmp67_ = {0};
		gunichar c = 0U;
		gunichar _tmp68_ = 0U;
		gchar* indent_string = NULL;
		GcaIndentLevel _tmp75_ = {0};
		gchar* _tmp76_ = NULL;
		GeditDocument* _tmp77_ = NULL;
		GeditDocument* _tmp78_ = NULL;
		const gchar* _tmp79_ = NULL;
		_tmp58_ = self->priv->d_indent_backend;
		_tmp59_ = buf;
		_tmp60_ = cur;
		gca_indent_backend_get_indent (_tmp58_, _tmp59_, &_tmp60_, &_tmp61_);
		indent_level = _tmp61_;
		_tmp62_ = indent_level;
		_tmp63_ = _tmp62_.indent;
		_tmp64_ = indent_level;
		_tmp65_ = _tmp64_.alignment;
		gca_log_debug ("gca-view.vala:366: Indent level: (%u, %u)", _tmp63_, _tmp65_);
		_tmp66_ = cur;
		start = _tmp66_;
		gtk_text_iter_set_line_offset (&start, 0);
		_tmp67_ = start;
		end = _tmp67_;
		_tmp68_ = gtk_text_iter_get_char (&end);
		c = _tmp68_;
		while (TRUE) {
			gunichar _tmp69_ = 0U;
			gboolean _tmp70_ = FALSE;
			gboolean _tmp71_ = FALSE;
			gboolean _tmp72_ = FALSE;
			gunichar _tmp74_ = 0U;
			_tmp69_ = c;
			_tmp70_ = g_unichar_isspace (_tmp69_);
			if (!_tmp70_) {
				break;
			}
			_tmp72_ = gtk_text_iter_ends_line (&end);
			if (_tmp72_) {
				_tmp71_ = TRUE;
			} else {
				gboolean _tmp73_ = FALSE;
				_tmp73_ = gtk_text_iter_forward_char (&end);
				_tmp71_ = !_tmp73_;
			}
			if (_tmp71_) {
				break;
			}
			_tmp74_ = gtk_text_iter_get_char (&end);
			c = _tmp74_;
		}
		_tmp75_ = indent_level;
		_tmp76_ = gca_view_get_indent_string_from_indent_level (self, &_tmp75_);
		indent_string = _tmp76_;
		_tmp77_ = buf;
		gtk_text_buffer_delete ((GtkTextBuffer*) _tmp77_, &start, &end);
		_tmp78_ = buf;
		_tmp79_ = indent_string;
		gtk_text_buffer_insert ((GtkTextBuffer*) _tmp78_, &start, _tmp79_, -1);
		_g_free0 (indent_string);
	}
	_g_object_unref0 (insert);
	_g_object_unref0 (buf);
}


GeditView* gca_view_get_view (GcaView* self) {
	GeditView* result;
	GeditView* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->d_view;
	result = _tmp0_;
	return result;
}


GcaDocument* gca_view_get_document (GcaView* self) {
	GcaDocument* result;
	GcaDocument* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->d_document;
	result = _tmp0_;
	return result;
}


GcaScrollbarMarker* gca_view_get_scrollbar_marker (GcaView* self) {
	GcaScrollbarMarker* result;
	GcaScrollbarMarker* _tmp0_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->d_scrollbar_marker;
	result = _tmp0_;
	return result;
}


static void gca_view_class_init (GcaViewClass * klass) {
	gca_view_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GcaViewPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_gca_view_get_property;
	G_OBJECT_CLASS (klass)->finalize = gca_view_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCA_VIEW_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_object_class_install_property (G_OBJECT_CLASS (klass), GCA_VIEW_DOCUMENT, g_param_spec_object ("document", "document", "document", GCA_TYPE_DOCUMENT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GCA_VIEW_SCROLLBAR_MARKER, gca_param_spec_scrollbar_marker ("scrollbar-marker", "scrollbar-marker", "scrollbar-marker", GCA_TYPE_SCROLLBAR_MARKER, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_signal_new ("changed", GCA_TYPE_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	g_signal_new ("path_changed", GCA_TYPE_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}


static void gca_view_instance_init (GcaView * self) {
	self->priv = GCA_VIEW_GET_PRIVATE (self);
}


static void gca_view_finalize (GObject* obj) {
	GcaView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GCA_TYPE_VIEW, GcaView);
	_g_object_unref0 (self->priv->d_document);
	_g_object_unref0 (self->priv->d_backend);
	_g_object_unref0 (self->priv->d_indent_backend);
	_gca_scrollbar_marker_unref0 (self->priv->d_scrollbar_marker);
	self->priv->d_services = (_vala_array_free (self->priv->d_services, self->priv->d_services_length1, (GDestroyNotify) g_object_unref), NULL);
	G_OBJECT_CLASS (gca_view_parent_class)->finalize (obj);
}


/**
 * Wrapper around Gedit.View.
 *
 * View is a wrapper around Gedit.View. It keeps track of changes to the document
 * of the gedit view and of the language of the document and registers itself
 * with the appropriate assistance backend.
 */
GType gca_view_get_type (void) {
	static volatile gsize gca_view_type_id__volatile = 0;
	if (g_once_init_enter (&gca_view_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GcaViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gca_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GcaView), 0, (GInstanceInitFunc) gca_view_instance_init, NULL };
		GType gca_view_type_id;
		gca_view_type_id = g_type_register_static (G_TYPE_OBJECT, "GcaView", &g_define_type_info, 0);
		g_once_init_leave (&gca_view_type_id__volatile, gca_view_type_id);
	}
	return gca_view_type_id__volatile;
}


static void _vala_gca_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GcaView * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GCA_TYPE_VIEW, GcaView);
	switch (property_id) {
		case GCA_VIEW_VIEW:
		g_value_set_object (value, gca_view_get_view (self));
		break;
		case GCA_VIEW_DOCUMENT:
		g_value_set_object (value, gca_view_get_document (self));
		break;
		case GCA_VIEW_SCROLLBAR_MARKER:
		gca_value_set_scrollbar_marker (value, gca_view_get_scrollbar_marker (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



