/* vtgsymbolcompletion.c generated by valac 0.12.1.1-323029-dirty, the Vala compiler
 * generated from vtgsymbolcompletion.vala, do not modify */

/*
 *  vtgsymbolcompletionhelper.vala - Vala developer toys for GEdit
 *  
 *  Copyright (C) 2008 - Andrea Del Signore <sejerpz@tin.it>
 *  
 *  This program 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 2 of the License, or
 *  (at your option) any later version.
 *   
 *  This program 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 this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330,
 *  Boston, MA 02111-1307, USA.
 */

#include <glib.h>
#include <glib-object.h>
#include <afrodite.h>
#include <gedit/gedit-view.h>
#include <gtksourceview/gtksourceview.h>
#include <gtk/gtk.h>
#include <valagee.h>
#include <stdlib.h>
#include <string.h>
#include <gedit/gedit-window.h>
#include <gedit/gedit-document.h>
#include <gedit/gedit-tab.h>


#define VTG_TYPE_SYMBOL_COMPLETION (vtg_symbol_completion_get_type ())
#define VTG_SYMBOL_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_SYMBOL_COMPLETION, VtgSymbolCompletion))
#define VTG_SYMBOL_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_SYMBOL_COMPLETION, VtgSymbolCompletionClass))
#define VTG_IS_SYMBOL_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_SYMBOL_COMPLETION))
#define VTG_IS_SYMBOL_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_SYMBOL_COMPLETION))
#define VTG_SYMBOL_COMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_SYMBOL_COMPLETION, VtgSymbolCompletionClass))

typedef struct _VtgSymbolCompletion VtgSymbolCompletion;
typedef struct _VtgSymbolCompletionClass VtgSymbolCompletionClass;
typedef struct _VtgSymbolCompletionPrivate VtgSymbolCompletionPrivate;

#define VTG_TYPE_PLUGIN_INSTANCE (vtg_plugin_instance_get_type ())
#define VTG_PLUGIN_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_PLUGIN_INSTANCE, VtgPluginInstance))
#define VTG_PLUGIN_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_PLUGIN_INSTANCE, VtgPluginInstanceClass))
#define VTG_IS_PLUGIN_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_PLUGIN_INSTANCE))
#define VTG_IS_PLUGIN_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_PLUGIN_INSTANCE))
#define VTG_PLUGIN_INSTANCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_PLUGIN_INSTANCE, VtgPluginInstanceClass))

typedef struct _VtgPluginInstance VtgPluginInstance;
typedef struct _VtgPluginInstanceClass VtgPluginInstanceClass;

#define VTG_TYPE_SYMBOL_COMPLETION_PROVIDER (vtg_symbol_completion_provider_get_type ())
#define VTG_SYMBOL_COMPLETION_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_SYMBOL_COMPLETION_PROVIDER, VtgSymbolCompletionProvider))
#define VTG_SYMBOL_COMPLETION_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_SYMBOL_COMPLETION_PROVIDER, VtgSymbolCompletionProviderClass))
#define VTG_IS_SYMBOL_COMPLETION_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_SYMBOL_COMPLETION_PROVIDER))
#define VTG_IS_SYMBOL_COMPLETION_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_SYMBOL_COMPLETION_PROVIDER))
#define VTG_SYMBOL_COMPLETION_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_SYMBOL_COMPLETION_PROVIDER, VtgSymbolCompletionProviderClass))

typedef struct _VtgSymbolCompletionProvider VtgSymbolCompletionProvider;
typedef struct _VtgSymbolCompletionProviderClass VtgSymbolCompletionProviderClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _afrodite_source_reference_unref0(var) ((var == NULL) ? NULL : (var = (afrodite_source_reference_unref (var), NULL)))

#define VTG_TYPE_SOURCE_BOOKMARK (vtg_source_bookmark_get_type ())
#define VTG_SOURCE_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_SOURCE_BOOKMARK, VtgSourceBookmark))
#define VTG_SOURCE_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_SOURCE_BOOKMARK, VtgSourceBookmarkClass))
#define VTG_IS_SOURCE_BOOKMARK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_SOURCE_BOOKMARK))
#define VTG_IS_SOURCE_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_SOURCE_BOOKMARK))
#define VTG_SOURCE_BOOKMARK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_SOURCE_BOOKMARK, VtgSourceBookmarkClass))

typedef struct _VtgSourceBookmark VtgSourceBookmark;
typedef struct _VtgSourceBookmarkClass VtgSourceBookmarkClass;
#define _vtg_source_bookmark_unref0(var) ((var == NULL) ? NULL : (var = (vtg_source_bookmark_unref (var), NULL)))
typedef struct _VtgSourceBookmarkPrivate VtgSourceBookmarkPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

#define VTG_TYPE_SOURCE_BOOKMARKS (vtg_source_bookmarks_get_type ())
#define VTG_SOURCE_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTG_TYPE_SOURCE_BOOKMARKS, VtgSourceBookmarks))
#define VTG_SOURCE_BOOKMARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTG_TYPE_SOURCE_BOOKMARKS, VtgSourceBookmarksClass))
#define VTG_IS_SOURCE_BOOKMARKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTG_TYPE_SOURCE_BOOKMARKS))
#define VTG_IS_SOURCE_BOOKMARKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTG_TYPE_SOURCE_BOOKMARKS))
#define VTG_SOURCE_BOOKMARKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTG_TYPE_SOURCE_BOOKMARKS, VtgSourceBookmarksClass))

typedef struct _VtgSourceBookmarks VtgSourceBookmarks;
typedef struct _VtgSourceBookmarksClass VtgSourceBookmarksClass;

struct _VtgSymbolCompletion {
	GObject parent_instance;
	VtgSymbolCompletionPrivate * priv;
};

struct _VtgSymbolCompletionClass {
	GObjectClass parent_class;
};

struct _VtgSymbolCompletionPrivate {
	VtgPluginInstance* _plugin_instance;
	AfroditeCompletionEngine* _completion_engine;
	GeditView* _view;
	VtgSymbolCompletionProvider* _provider;
	GtkSourceCompletion* _manager;
};

struct _VtgSourceBookmark {
	GTypeInstance parent_instance;
	volatile int ref_count;
	VtgSourceBookmarkPrivate * priv;
	gchar* uri;
	gint line;
	gint column;
};

struct _VtgSourceBookmarkClass {
	GTypeClass parent_class;
	void (*finalize) (VtgSourceBookmark *self);
};


static gpointer vtg_symbol_completion_parent_class = NULL;
static GType vtg_symbol_completion_type_id = 0;

GType vtg_symbol_completion_get_type (void) G_GNUC_CONST;
GType vtg_symbol_completion_register_type (GTypeModule * module);
GType vtg_plugin_instance_get_type (void) G_GNUC_CONST;
GType vtg_plugin_instance_register_type (GTypeModule * module);
GType vtg_symbol_completion_provider_get_type (void) G_GNUC_CONST;
GType vtg_symbol_completion_provider_register_type (GTypeModule * module);
#define VTG_SYMBOL_COMPLETION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VTG_TYPE_SYMBOL_COMPLETION, VtgSymbolCompletionPrivate))
enum  {
	VTG_SYMBOL_COMPLETION_DUMMY_PROPERTY,
	VTG_SYMBOL_COMPLETION_PLUGIN_INSTANCE,
	VTG_SYMBOL_COMPLETION_VIEW,
	VTG_SYMBOL_COMPLETION_COMPLETION_ENGINE
};
void vtg_symbol_completion_deactivate (VtgSymbolCompletion* self);
VtgSymbolCompletion* vtg_symbol_completion_new (VtgPluginInstance* plugin_instance, GeditView* view, AfroditeCompletionEngine* completion_engine);
VtgSymbolCompletion* vtg_symbol_completion_construct (GType object_type, VtgPluginInstance* plugin_instance, GeditView* view, AfroditeCompletionEngine* completion_engine);
static void vtg_symbol_completion_setup_gsc_completion (VtgSymbolCompletion* self, GeditView* view);
GeditView* vtg_symbol_completion_get_view (VtgSymbolCompletion* self);
static void vtg_symbol_completion_on_realized (VtgSymbolCompletion* self, GtkWidget* sender);
static void _vtg_symbol_completion_on_realized_gtk_widget_realize (GtkWidget* _sender, gpointer self);
static void vtg_symbol_completion_on_completion_lock_failed (VtgSymbolCompletion* self, VtgSymbolCompletionProvider* sender);
static void _vtg_symbol_completion_on_completion_lock_failed_vtg_symbol_completion_provider_completion_lock_failed (VtgSymbolCompletionProvider* _sender, gpointer self);
VtgSymbolCompletionProvider* vtg_symbol_completion_provider_new (VtgSymbolCompletion* symbol_completion);
VtgSymbolCompletionProvider* vtg_symbol_completion_provider_construct (GType object_type, VtgSymbolCompletion* symbol_completion);
void vtg_symbol_completion_complete_word (VtgSymbolCompletion* self);
void vtg_symbol_completion_goto_definition (VtgSymbolCompletion* self);
AfroditeSymbol* vtg_symbol_completion_provider_get_current_symbol_item (VtgSymbolCompletionProvider* self);
gpointer vtg_source_bookmark_ref (gpointer instance);
void vtg_source_bookmark_unref (gpointer instance);
GParamSpec* vtg_param_spec_source_bookmark (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void vtg_value_set_source_bookmark (GValue* value, gpointer v_object);
void vtg_value_take_source_bookmark (GValue* value, gpointer v_object);
gpointer vtg_value_get_source_bookmark (const GValue* value);
GType vtg_source_bookmark_get_type (void) G_GNUC_CONST;
GType vtg_source_bookmark_register_type (GTypeModule * module);
GeditWindow* vtg_plugin_instance_get_window (VtgPluginInstance* self);
VtgSourceBookmark* vtg_source_bookmark_new (void);
VtgSourceBookmark* vtg_source_bookmark_construct (GType object_type);
gchar* vtg_utils_get_document_uri (GeditDocument* doc);
GType vtg_source_bookmarks_get_type (void) G_GNUC_CONST;
GType vtg_source_bookmarks_register_type (GTypeModule * module);
VtgSourceBookmarks* vtg_plugin_instance_get_bookmarks (VtgPluginInstance* self);
void vtg_source_bookmarks_add_bookmark (VtgSourceBookmarks* self, VtgSourceBookmark* item, gboolean _auto_);
GeditTab* vtg_plugin_instance_activate_uri (VtgPluginInstance* self, const gchar* uri, gint line, gint col);
static void vtg_symbol_completion_display_completion_lock_failed_message (VtgSymbolCompletion* self);
void vtg_symbol_completion_goto_outerscope (VtgSymbolCompletion* self);
AfroditeSymbol* vtg_symbol_completion_provider_get_symbol_containing_cursor (VtgSymbolCompletionProvider* self);
gchar* vtg_utils_get_document_name (GeditDocument* doc);
void vtg_utils_trace (const gchar* format, ...);
VtgPluginInstance* vtg_symbol_completion_get_plugin_instance (VtgSymbolCompletion* self);
AfroditeCompletionEngine* vtg_symbol_completion_get_completion_engine (VtgSymbolCompletion* self);
void vtg_symbol_completion_set_completion_engine (VtgSymbolCompletion* self, AfroditeCompletionEngine* value);
static void vtg_symbol_completion_finalize (GObject* obj);
static void _vala_vtg_symbol_completion_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_vtg_symbol_completion_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 _vtg_symbol_completion_on_realized_gtk_widget_realize (GtkWidget* _sender, gpointer self) {
	vtg_symbol_completion_on_realized (self, _sender);
}


VtgSymbolCompletion* vtg_symbol_completion_construct (GType object_type, VtgPluginInstance* plugin_instance, GeditView* view, AfroditeCompletionEngine* completion_engine) {
	VtgSymbolCompletion * self = NULL;
	GeditView* _tmp0_;
	gboolean _tmp1_;
	g_return_val_if_fail (plugin_instance != NULL, NULL);
	g_return_val_if_fail (view != NULL, NULL);
	g_return_val_if_fail (completion_engine != NULL, NULL);
	self = (VtgSymbolCompletion*) g_object_new (object_type, NULL);
	self->priv->_plugin_instance = plugin_instance;
	_tmp0_ = _g_object_ref0 (view);
	_g_object_unref0 (self->priv->_view);
	self->priv->_view = _tmp0_;
	self->priv->_completion_engine = completion_engine;
	_tmp1_ = gtk_widget_get_realized ((GtkWidget*) self->priv->_view);
	if (_tmp1_) {
		vtg_symbol_completion_setup_gsc_completion (self, self->priv->_view);
	} else {
		GeditView* _tmp2_ = NULL;
		_tmp2_ = vtg_symbol_completion_get_view (self);
		g_signal_connect_object ((GtkWidget*) _tmp2_, "realize", (GCallback) _vtg_symbol_completion_on_realized_gtk_widget_realize, self, 0);
	}
	return self;
}


VtgSymbolCompletion* vtg_symbol_completion_new (VtgPluginInstance* plugin_instance, GeditView* view, AfroditeCompletionEngine* completion_engine) {
	return vtg_symbol_completion_construct (VTG_TYPE_SYMBOL_COMPLETION, plugin_instance, view, completion_engine);
}


static void vtg_symbol_completion_on_realized (VtgSymbolCompletion* self, GtkWidget* sender) {
	guint _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sender != NULL);
	g_signal_parse_name ("realize", GTK_TYPE_WIDGET, &_tmp0_, NULL, FALSE);
	g_signal_handlers_disconnect_matched ((GtkWidget*) self->priv->_view, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _vtg_symbol_completion_on_realized_gtk_widget_realize, self);
	vtg_symbol_completion_setup_gsc_completion (self, self->priv->_view);
}


static void _vtg_symbol_completion_on_completion_lock_failed_vtg_symbol_completion_provider_completion_lock_failed (VtgSymbolCompletionProvider* _sender, gpointer self) {
	vtg_symbol_completion_on_completion_lock_failed (self, _sender);
}


void vtg_symbol_completion_deactivate (VtgSymbolCompletion* self) {
	guint _tmp0_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_signal_parse_name ("completion-lock-failed", VTG_TYPE_SYMBOL_COMPLETION_PROVIDER, &_tmp0_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (self->priv->_provider, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, 0, NULL, (GCallback) _vtg_symbol_completion_on_completion_lock_failed_vtg_symbol_completion_provider_completion_lock_failed, self);
	gtk_source_completion_remove_provider (self->priv->_manager, (GtkSourceCompletionProvider*) self->priv->_provider, &_inner_error_);
	if (_inner_error_ != NULL) {
		goto __catch1_g_error;
	}
	_g_object_unref0 (self->priv->_manager);
	self->priv->_manager = NULL;
	goto __finally1;
	__catch1_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		g_critical ("vtgsymbolcompletion.vala:78: error: %s", err->message);
		_g_error_free0 (err);
	}
	__finally1:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


static void vtg_symbol_completion_setup_gsc_completion (VtgSymbolCompletion* self, GeditView* view) {
	GtkSourceCompletion* _tmp0_ = NULL;
	GtkSourceCompletion* _tmp1_;
	VtgSymbolCompletionProvider* _tmp2_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (view != NULL);
	_tmp0_ = gtk_source_view_get_completion ((GtkSourceView*) view);
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_manager);
	self->priv->_manager = _tmp1_;
	_tmp2_ = vtg_symbol_completion_provider_new (self);
	_g_object_unref0 (self->priv->_provider);
	self->priv->_provider = _tmp2_;
	g_signal_connect_object (self->priv->_provider, "completion-lock-failed", (GCallback) _vtg_symbol_completion_on_completion_lock_failed_vtg_symbol_completion_provider_completion_lock_failed, self, 0);
	g_object_set (self->priv->_manager, "remember-info-visibility", TRUE, NULL);
	g_object_set (self->priv->_manager, "select-on-show", TRUE, NULL);
	gtk_source_completion_add_provider (self->priv->_manager, (GtkSourceCompletionProvider*) self->priv->_provider, &_inner_error_);
	if (_inner_error_ != NULL) {
		goto __catch2_g_error;
	}
	goto __finally2;
	__catch2_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		g_critical ("vtgsymbolcompletion.vala:92: error: %s", err->message);
		_g_error_free0 (err);
	}
	__finally2:
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
}


void vtg_symbol_completion_complete_word (VtgSymbolCompletion* self) {
	g_return_if_fail (self != NULL);
}


void vtg_symbol_completion_goto_definition (VtgSymbolCompletion* self) {
	AfroditeSymbol* _tmp0_ = NULL;
	AfroditeSymbol* item;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = vtg_symbol_completion_provider_get_current_symbol_item (self->priv->_provider);
	item = _tmp0_;
	if (item != NULL) {
		gboolean _tmp1_;
		_tmp1_ = afrodite_symbol_get_has_source_references (item);
		if (_tmp1_) {
			ValaList* _tmp2_ = NULL;
			gpointer _tmp3_ = NULL;
			AfroditeSourceReference* _tmp4_;
			AfroditeSourceFile* _tmp5_ = NULL;
			const gchar* _tmp6_ = NULL;
			gchar* _tmp7_ = NULL;
			gchar* _tmp8_;
			gchar* uri;
			ValaList* _tmp9_ = NULL;
			gpointer _tmp10_ = NULL;
			AfroditeSourceReference* _tmp11_;
			gint _tmp12_;
			gint _tmp13_;
			gint line;
			ValaList* _tmp14_ = NULL;
			gpointer _tmp15_ = NULL;
			AfroditeSourceReference* _tmp16_;
			gint _tmp17_;
			gint _tmp18_;
			gint col;
			VtgSourceBookmark* bookmark = NULL;
			GeditWindow* _tmp19_ = NULL;
			GeditView* _tmp20_ = NULL;
			GeditView* _tmp21_;
			GeditView* view;
			VtgSourceBookmark* _tmp31_ = NULL;
			gchar* _tmp32_;
			VtgSourceBookmarks* _tmp33_ = NULL;
			GeditTab* _tmp34_ = NULL;
			GeditTab* _tmp35_;
			_tmp2_ = afrodite_symbol_get_source_references (item);
			_tmp3_ = vala_list_get (_tmp2_, 0);
			_tmp4_ = (AfroditeSourceReference*) _tmp3_;
			_tmp5_ = afrodite_source_reference_get_file (_tmp4_);
			_tmp6_ = afrodite_source_file_get_filename (_tmp5_);
			_tmp7_ = g_filename_to_uri (_tmp6_, NULL, &_inner_error_);
			_tmp8_ = _tmp7_;
			_afrodite_source_reference_unref0 (_tmp4_);
			uri = _tmp8_;
			if (_inner_error_ != NULL) {
				goto __catch3_g_error;
			}
			_tmp9_ = afrodite_symbol_get_source_references (item);
			_tmp10_ = vala_list_get (_tmp9_, 0);
			_tmp11_ = (AfroditeSourceReference*) _tmp10_;
			_tmp12_ = afrodite_source_reference_get_first_line (_tmp11_);
			_tmp13_ = _tmp12_;
			_afrodite_source_reference_unref0 (_tmp11_);
			line = _tmp13_;
			_tmp14_ = afrodite_symbol_get_source_references (item);
			_tmp15_ = vala_list_get (_tmp14_, 0);
			_tmp16_ = (AfroditeSourceReference*) _tmp15_;
			_tmp17_ = afrodite_source_reference_get_first_column (_tmp16_);
			_tmp18_ = _tmp17_;
			_afrodite_source_reference_unref0 (_tmp16_);
			col = _tmp18_;
			_tmp19_ = vtg_plugin_instance_get_window (self->priv->_plugin_instance);
			_tmp20_ = gedit_window_get_active_view (_tmp19_);
			_tmp21_ = _g_object_ref0 (_tmp20_);
			view = _tmp21_;
			if (view != NULL) {
				GtkTextBuffer* _tmp22_ = NULL;
				GeditDocument* _tmp23_;
				GeditDocument* doc;
				GtkTextMark* _tmp24_ = NULL;
				GtkTextMark* mark;
				GtkTextIter start = {0};
				GtkTextIter _tmp25_ = {0};
				VtgSourceBookmark* _tmp26_ = NULL;
				gchar* _tmp27_ = NULL;
				gint _tmp28_;
				gint _tmp29_;
				VtgSourceBookmarks* _tmp30_ = NULL;
				_tmp22_ = gtk_text_view_get_buffer ((GtkTextView*) view);
				_tmp23_ = _g_object_ref0 (GEDIT_DOCUMENT (_tmp22_));
				doc = _tmp23_;
				_tmp24_ = gtk_text_buffer_get_insert ((GtkTextBuffer*) doc);
				mark = GTK_TEXT_MARK (_tmp24_);
				gtk_text_buffer_get_iter_at_mark ((GtkTextBuffer*) doc, &_tmp25_, mark);
				start = _tmp25_;
				_tmp26_ = vtg_source_bookmark_new ();
				_vtg_source_bookmark_unref0 (bookmark);
				bookmark = _tmp26_;
				_tmp27_ = vtg_utils_get_document_uri (doc);
				_g_free0 (bookmark->uri);
				bookmark->uri = _tmp27_;
				_tmp28_ = gtk_text_iter_get_line (&start);
				bookmark->line = _tmp28_ + 1;
				_tmp29_ = gtk_text_iter_get_line_offset (&start);
				bookmark->column = _tmp29_ + 1;
				_tmp30_ = vtg_plugin_instance_get_bookmarks (self->priv->_plugin_instance);
				vtg_source_bookmarks_add_bookmark (_tmp30_, bookmark, FALSE);
				_g_object_unref0 (doc);
			}
			_tmp31_ = vtg_source_bookmark_new ();
			_vtg_source_bookmark_unref0 (bookmark);
			bookmark = _tmp31_;
			_tmp32_ = g_strdup (uri);
			_g_free0 (bookmark->uri);
			bookmark->uri = _tmp32_;
			bookmark->line = line + 1;
			bookmark->column = col + 1;
			_tmp33_ = vtg_plugin_instance_get_bookmarks (self->priv->_plugin_instance);
			vtg_source_bookmarks_add_bookmark (_tmp33_, bookmark, FALSE);
			_tmp34_ = vtg_plugin_instance_activate_uri (self->priv->_plugin_instance, uri, line, col);
			_tmp35_ = _tmp34_;
			_g_object_unref0 (_tmp35_);
			_g_object_unref0 (view);
			_vtg_source_bookmark_unref0 (bookmark);
			_g_free0 (uri);
			goto __finally3;
			__catch3_g_error:
			{
				GError * e;
				ValaList* _tmp36_ = NULL;
				gpointer _tmp37_ = NULL;
				AfroditeSourceReference* _tmp38_;
				AfroditeSourceFile* _tmp39_ = NULL;
				const gchar* _tmp40_ = NULL;
				e = _inner_error_;
				_inner_error_ = NULL;
				_tmp36_ = afrodite_symbol_get_source_references (item);
				_tmp37_ = vala_list_get (_tmp36_, 0);
				_tmp38_ = (AfroditeSourceReference*) _tmp37_;
				_tmp39_ = afrodite_source_reference_get_file (_tmp38_);
				_tmp40_ = afrodite_source_file_get_filename (_tmp39_);
				g_warning ("vtgsymbolcompletion.vala:135: error %s converting file %s to uri", e->message, _tmp40_);
				_afrodite_source_reference_unref0 (_tmp38_);
				_g_error_free0 (e);
			}
			__finally3:
			if (_inner_error_ != NULL) {
				_g_object_unref0 (item);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return;
			}
		}
	} else {
		vtg_symbol_completion_display_completion_lock_failed_message (self);
	}
	_g_object_unref0 (item);
}


static gpointer _afrodite_source_reference_ref0 (gpointer self) {
	return self ? afrodite_source_reference_ref (self) : NULL;
}


void vtg_symbol_completion_goto_outerscope (VtgSymbolCompletion* self) {
	AfroditeSymbol* _tmp0_ = NULL;
	AfroditeSymbol* item;
	GeditWindow* _tmp1_ = NULL;
	GeditView* _tmp2_ = NULL;
	GeditView* _tmp3_;
	GeditView* view;
	gboolean _tmp4_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = vtg_symbol_completion_provider_get_symbol_containing_cursor (self->priv->_provider);
	item = _tmp0_;
	_tmp1_ = vtg_plugin_instance_get_window (self->priv->_plugin_instance);
	_tmp2_ = gedit_window_get_active_view (_tmp1_);
	_tmp3_ = _g_object_ref0 (_tmp2_);
	view = _tmp3_;
	if (item != NULL) {
		_tmp4_ = view != NULL;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		gboolean _tmp5_;
		_tmp5_ = afrodite_symbol_get_has_source_references (item);
		if (_tmp5_) {
			GtkTextBuffer* _tmp6_ = NULL;
			GeditDocument* _tmp7_;
			GeditDocument* doc;
			gchar* _tmp8_ = NULL;
			gchar* name;
			AfroditeSourceReference* _tmp20_ = NULL;
			AfroditeSourceReference* _tmp21_;
			AfroditeSourceReference* sr;
			_tmp6_ = gtk_text_view_get_buffer ((GtkTextView*) view);
			_tmp7_ = _g_object_ref0 (GEDIT_DOCUMENT (_tmp6_));
			doc = _tmp7_;
			_tmp8_ = vtg_utils_get_document_name (doc);
			name = _tmp8_;
			{
				gboolean _tmp9_;
				_tmp9_ = TRUE;
				while (TRUE) {
					AfroditeSymbol* _tmp18_ = NULL;
					AfroditeSymbol* _tmp19_;
					if (!_tmp9_) {
						gboolean _tmp10_ = FALSE;
						gchar* _tmp11_ = NULL;
						gchar* _tmp12_;
						gboolean _tmp13_;
						_tmp11_ = afrodite_symbol_get_fully_qualified_name (item);
						_tmp12_ = _tmp11_;
						_tmp13_ = _tmp12_ != NULL;
						_g_free0 (_tmp12_);
						if (_tmp13_) {
							gboolean _tmp14_ = FALSE;
							const gchar* _tmp15_ = NULL;
							gboolean _tmp16_;
							_tmp15_ = afrodite_symbol_get_name (item);
							_tmp16_ = g_str_has_prefix (_tmp15_, "!");
							if (_tmp16_) {
								_tmp14_ = TRUE;
							} else {
								AfroditeMemberType _tmp17_;
								_tmp17_ = afrodite_symbol_get_member_type (item);
								_tmp14_ = _tmp17_ == AFRODITE_MEMBER_TYPE_ENUM;
							}
							_tmp10_ = _tmp14_;
						} else {
							_tmp10_ = FALSE;
						}
						if (!_tmp10_) {
							break;
						}
					}
					_tmp9_ = FALSE;
					_tmp18_ = afrodite_symbol_get_parent (item);
					_tmp19_ = _g_object_ref0 (_tmp18_);
					_g_object_unref0 (item);
					item = _tmp19_;
				}
			}
			_tmp20_ = afrodite_symbol_lookup_source_reference_filename (item, name);
			_tmp21_ = _afrodite_source_reference_ref0 (_tmp20_);
			sr = _tmp21_;
			if (sr != NULL) {
				gint _tmp22_;
				gint line;
				gint _tmp23_;
				gint col;
				VtgSourceBookmark* bookmark = NULL;
				GtkTextMark* _tmp24_ = NULL;
				GtkTextMark* mark;
				GtkTextIter start = {0};
				GtkTextIter _tmp25_ = {0};
				VtgSourceBookmark* _tmp26_ = NULL;
				gchar* _tmp27_ = NULL;
				gint _tmp28_;
				gint _tmp29_;
				VtgSourceBookmarks* _tmp30_ = NULL;
				_tmp22_ = afrodite_source_reference_get_first_line (sr);
				line = _tmp22_;
				_tmp23_ = afrodite_source_reference_get_first_column (sr);
				col = _tmp23_ - 1;
				if (col < 0) {
					col = 0;
				}
				_tmp24_ = gtk_text_buffer_get_insert ((GtkTextBuffer*) doc);
				mark = GTK_TEXT_MARK (_tmp24_);
				gtk_text_buffer_get_iter_at_mark ((GtkTextBuffer*) doc, &_tmp25_, mark);
				start = _tmp25_;
				_tmp26_ = vtg_source_bookmark_new ();
				_vtg_source_bookmark_unref0 (bookmark);
				bookmark = _tmp26_;
				_tmp27_ = vtg_utils_get_document_uri (doc);
				_g_free0 (bookmark->uri);
				bookmark->uri = _tmp27_;
				_tmp28_ = gtk_text_iter_get_line (&start);
				bookmark->line = _tmp28_ + 1;
				_tmp29_ = gtk_text_iter_get_line_offset (&start);
				bookmark->column = _tmp29_ + 1;
				_tmp30_ = vtg_plugin_instance_get_bookmarks (self->priv->_plugin_instance);
				vtg_source_bookmarks_add_bookmark (_tmp30_, bookmark, FALSE);
				gedit_document_goto_line_offset (doc, line, col);
				gedit_view_scroll_to_cursor (view);
				_vtg_source_bookmark_unref0 (bookmark);
			} else {
				gchar* _tmp31_ = NULL;
				gchar* _tmp32_;
				_tmp31_ = afrodite_symbol_get_fully_qualified_name (item);
				_tmp32_ = _tmp31_;
				vtg_utils_trace ("vtgsymbolcompletion.vala:178: no source reference for outer symbol %s:" \
" %s", _tmp32_, name);
				_g_free0 (_tmp32_);
			}
			_afrodite_source_reference_unref0 (sr);
			_g_free0 (name);
			_g_object_unref0 (doc);
		}
	} else {
		vtg_symbol_completion_display_completion_lock_failed_message (self);
	}
	_g_object_unref0 (view);
	_g_object_unref0 (item);
}


static void vtg_symbol_completion_on_completion_lock_failed (VtgSymbolCompletion* self, VtgSymbolCompletionProvider* sender) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (sender != NULL);
	vtg_symbol_completion_display_completion_lock_failed_message (self);
}


static void vtg_symbol_completion_display_completion_lock_failed_message (VtgSymbolCompletion* self) {
	g_return_if_fail (self != NULL);
}


VtgPluginInstance* vtg_symbol_completion_get_plugin_instance (VtgSymbolCompletion* self) {
	VtgPluginInstance* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_plugin_instance;
	return result;
}


GeditView* vtg_symbol_completion_get_view (VtgSymbolCompletion* self) {
	GeditView* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_view;
	return result;
}


AfroditeCompletionEngine* vtg_symbol_completion_get_completion_engine (VtgSymbolCompletion* self) {
	AfroditeCompletionEngine* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_completion_engine;
	return result;
}


void vtg_symbol_completion_set_completion_engine (VtgSymbolCompletion* self, AfroditeCompletionEngine* value) {
	g_return_if_fail (self != NULL);
	self->priv->_completion_engine = value;
	g_object_notify ((GObject *) self, "completion-engine");
}


static void vtg_symbol_completion_class_init (VtgSymbolCompletionClass * klass) {
	vtg_symbol_completion_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (VtgSymbolCompletionPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_vtg_symbol_completion_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_vtg_symbol_completion_set_property;
	G_OBJECT_CLASS (klass)->finalize = vtg_symbol_completion_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), VTG_SYMBOL_COMPLETION_PLUGIN_INSTANCE, g_param_spec_object ("plugin-instance", "plugin-instance", "plugin-instance", VTG_TYPE_PLUGIN_INSTANCE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), VTG_SYMBOL_COMPLETION_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), VTG_SYMBOL_COMPLETION_COMPLETION_ENGINE, g_param_spec_object ("completion-engine", "completion-engine", "completion-engine", AFRODITE_TYPE_COMPLETION_ENGINE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void vtg_symbol_completion_instance_init (VtgSymbolCompletion * self) {
	self->priv = VTG_SYMBOL_COMPLETION_GET_PRIVATE (self);
	self->priv->_plugin_instance = NULL;
	self->priv->_completion_engine = NULL;
	self->priv->_view = NULL;
}


static void vtg_symbol_completion_finalize (GObject* obj) {
	VtgSymbolCompletion * self;
	self = VTG_SYMBOL_COMPLETION (obj);
	if (self->priv->_manager != NULL) {
		vtg_symbol_completion_deactivate (self);
	}
	_g_object_unref0 (self->priv->_provider);
	self->priv->_provider = NULL;
	_g_object_unref0 (self->priv->_view);
	self->priv->_view = NULL;
	_g_object_unref0 (self->priv->_view);
	_g_object_unref0 (self->priv->_provider);
	_g_object_unref0 (self->priv->_manager);
	G_OBJECT_CLASS (vtg_symbol_completion_parent_class)->finalize (obj);
}


GType vtg_symbol_completion_get_type (void) {
	return vtg_symbol_completion_type_id;
}


GType vtg_symbol_completion_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (VtgSymbolCompletionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vtg_symbol_completion_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (VtgSymbolCompletion), 0, (GInstanceInitFunc) vtg_symbol_completion_instance_init, NULL };
	vtg_symbol_completion_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "VtgSymbolCompletion", &g_define_type_info, 0);
	return vtg_symbol_completion_type_id;
}


static void _vala_vtg_symbol_completion_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	VtgSymbolCompletion * self;
	self = VTG_SYMBOL_COMPLETION (object);
	switch (property_id) {
		case VTG_SYMBOL_COMPLETION_PLUGIN_INSTANCE:
		g_value_set_object (value, vtg_symbol_completion_get_plugin_instance (self));
		break;
		case VTG_SYMBOL_COMPLETION_VIEW:
		g_value_set_object (value, vtg_symbol_completion_get_view (self));
		break;
		case VTG_SYMBOL_COMPLETION_COMPLETION_ENGINE:
		g_value_set_object (value, vtg_symbol_completion_get_completion_engine (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_vtg_symbol_completion_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	VtgSymbolCompletion * self;
	self = VTG_SYMBOL_COMPLETION (object);
	switch (property_id) {
		case VTG_SYMBOL_COMPLETION_COMPLETION_ENGINE:
		vtg_symbol_completion_set_completion_engine (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



