/* ide-vala-completion-provider.c generated by valac 0.30.0, the Vala compiler
 * generated from ide-vala-completion-provider.vala, do not modify */

/* ide-vala-completion-provider.vala
 *
 * Copyright (C) 2015 Christian Hergert <christian@hergert.me>
 *
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <ide.h>
#include <gtksourceview/gtksource.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gio/gio.h>


#define IDE_TYPE_VALA_COMPLETION_PROVIDER (ide_vala_completion_provider_get_type ())
#define IDE_VALA_COMPLETION_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_VALA_COMPLETION_PROVIDER, IdeValaCompletionProvider))
#define IDE_VALA_COMPLETION_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDE_TYPE_VALA_COMPLETION_PROVIDER, IdeValaCompletionProviderClass))
#define IDE_IS_VALA_COMPLETION_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_VALA_COMPLETION_PROVIDER))
#define IDE_IS_VALA_COMPLETION_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDE_TYPE_VALA_COMPLETION_PROVIDER))
#define IDE_VALA_COMPLETION_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDE_TYPE_VALA_COMPLETION_PROVIDER, IdeValaCompletionProviderClass))

typedef struct _IdeValaCompletionProvider IdeValaCompletionProvider;
typedef struct _IdeValaCompletionProviderClass IdeValaCompletionProviderClass;
typedef struct _IdeValaCompletionProviderPrivate IdeValaCompletionProviderPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define IDE_TYPE_VALA_INDEX (ide_vala_index_get_type ())
#define IDE_VALA_INDEX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_VALA_INDEX, IdeValaIndex))
#define IDE_VALA_INDEX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDE_TYPE_VALA_INDEX, IdeValaIndexClass))
#define IDE_IS_VALA_INDEX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_VALA_INDEX))
#define IDE_IS_VALA_INDEX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDE_TYPE_VALA_INDEX))
#define IDE_VALA_INDEX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDE_TYPE_VALA_INDEX, IdeValaIndexClass))

typedef struct _IdeValaIndex IdeValaIndex;
typedef struct _IdeValaIndexClass IdeValaIndexClass;
typedef struct _Block1Data Block1Data;

#define IDE_TYPE_VALA_SERVICE (ide_vala_service_get_type ())
#define IDE_VALA_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_VALA_SERVICE, IdeValaService))
#define IDE_VALA_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDE_TYPE_VALA_SERVICE, IdeValaServiceClass))
#define IDE_IS_VALA_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_VALA_SERVICE))
#define IDE_IS_VALA_SERVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDE_TYPE_VALA_SERVICE))
#define IDE_VALA_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDE_TYPE_VALA_SERVICE, IdeValaServiceClass))

typedef struct _IdeValaService IdeValaService;
typedef struct _IdeValaServiceClass IdeValaServiceClass;

struct _IdeValaCompletionProvider {
	IdeObject parent_instance;
	IdeValaCompletionProviderPrivate * priv;
	gchar* query;
};

struct _IdeValaCompletionProviderClass {
	IdeObjectClass parent_class;
};

struct _IdeValaCompletionProviderPrivate {
	gint line;
	gint column;
	IdeCompletionResults* results;
};

struct _Block1Data {
	int _ref_count_;
	IdeValaCompletionProvider* self;
	GtkTextIter iter;
	gchar* line;
	IdeFile* file;
	IdeValaIndex* index;
	IdeUnsavedFiles* unsaved_files;
	GCancellable* cancellable;
	GtkSourceCompletionContext* context;
};


static gpointer ide_vala_completion_provider_parent_class = NULL;
static GtkSourceCompletionProviderIface* ide_vala_completion_provider_gtk_source_completion_provider_parent_iface = NULL;
static IdeCompletionProviderInterface* ide_vala_completion_provider_ide_completion_provider_parent_iface = NULL;
static GType ide_vala_completion_provider_type_id = 0;

GType ide_vala_completion_provider_get_type (void) G_GNUC_CONST;
GType ide_vala_completion_provider_register_type (GTypeModule * module);
#define IDE_VALA_COMPLETION_PROVIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IDE_TYPE_VALA_COMPLETION_PROVIDER, IdeValaCompletionProviderPrivate))
enum  {
	IDE_VALA_COMPLETION_PROVIDER_DUMMY_PROPERTY
};
static void ide_vala_completion_provider_real_populate (GtkSourceCompletionProvider* base, GtkSourceCompletionContext* context);
GType ide_vala_index_get_type (void) G_GNUC_CONST;
GType ide_vala_index_register_type (GTypeModule * module);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
GType ide_vala_service_get_type (void) G_GNUC_CONST;
GType ide_vala_service_register_type (GTypeModule * module);
IdeValaIndex* ide_vala_service_get_index (IdeValaService* self);
static void __lambda7_ (Block1Data* _data1_);
static void ___lambda7__gtk_source_completion_context_cancelled (GtkSourceCompletionContext* _sender, gpointer self);
static void __lambda8_ (Block1Data* _data1_);
IdeCompletionResults* ide_vala_index_code_complete (IdeValaIndex* self, GFile* file, gint line, gint column, const gchar* line_text, IdeUnsavedFiles* unsaved_files, IdeValaCompletionProvider* provider, GCancellable* cancellable, gint* result_line, gint* result_column);
static gboolean __lambda9_ (Block1Data* _data1_);
static gboolean ___lambda9__gsource_func (gpointer self);
static void ___lambda8__ide_thread_func (gpointer self);
static gboolean ide_vala_completion_provider_real_match (GtkSourceCompletionProvider* base, GtkSourceCompletionContext* context);
static gchar* ide_vala_completion_provider_real_get_name (GtkSourceCompletionProvider* base);
static gint ide_vala_completion_provider_real_get_priority (GtkSourceCompletionProvider* base);
IdeValaCompletionProvider* ide_vala_completion_provider_new (void);
IdeValaCompletionProvider* ide_vala_completion_provider_construct (GType object_type);
static void ide_vala_completion_provider_finalize (GObject* obj);


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


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_)) {
		IdeValaCompletionProvider* self;
		self = _data1_->self;
		_g_object_unref0 (_data1_->cancellable);
		_g_object_unref0 (_data1_->unsaved_files);
		_g_object_unref0 (_data1_->index);
		_g_object_unref0 (_data1_->file);
		_g_free0 (_data1_->line);
		_g_object_unref0 (_data1_->context);
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}


static void __lambda7_ (Block1Data* _data1_) {
	IdeValaCompletionProvider* self;
	GCancellable* _tmp0_ = NULL;
	self = _data1_->self;
	_tmp0_ = _data1_->cancellable;
	g_cancellable_cancel (_tmp0_);
}


static void ___lambda7__gtk_source_completion_context_cancelled (GtkSourceCompletionContext* _sender, gpointer self) {
	__lambda7_ (self);
}


static gboolean __lambda9_ (Block1Data* _data1_) {
	IdeValaCompletionProvider* self;
	gboolean result = FALSE;
	GCancellable* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	self = _data1_->self;
	_tmp0_ = _data1_->cancellable;
	_tmp1_ = g_cancellable_is_cancelled (_tmp0_);
	if (!_tmp1_) {
		IdeCompletionResults* _tmp2_ = NULL;
		GtkSourceCompletionContext* _tmp3_ = NULL;
		_tmp2_ = self->priv->results;
		_tmp3_ = _data1_->context;
		ide_completion_results_present (_tmp2_, (GtkSourceCompletionProvider*) self, _tmp3_);
	}
	result = FALSE;
	return result;
}


static gboolean ___lambda9__gsource_func (gpointer self) {
	gboolean result;
	result = __lambda9_ (self);
	return result;
}


static void __lambda8_ (Block1Data* _data1_) {
	IdeValaCompletionProvider* self;
	gint res_line = 0;
	gint res_column = 0;
	IdeValaIndex* _tmp0_ = NULL;
	IdeFile* _tmp1_ = NULL;
	GFile* _tmp2_ = NULL;
	GFile* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	gint _tmp5_ = 0;
	const gchar* _tmp6_ = NULL;
	IdeUnsavedFiles* _tmp7_ = NULL;
	GCancellable* _tmp8_ = NULL;
	gint _tmp9_ = 0;
	gint _tmp10_ = 0;
	IdeCompletionResults* _tmp11_ = NULL;
	gboolean _tmp12_ = FALSE;
	gint _tmp13_ = 0;
	self = _data1_->self;
	res_line = -1;
	res_column = -1;
	_tmp0_ = _data1_->index;
	_tmp1_ = _data1_->file;
	_tmp2_ = ide_file_get_file (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = gtk_text_iter_get_line (&_data1_->iter);
	_tmp5_ = gtk_text_iter_get_line_offset (&_data1_->iter);
	_tmp6_ = _data1_->line;
	_tmp7_ = _data1_->unsaved_files;
	_tmp8_ = _data1_->cancellable;
	_tmp11_ = ide_vala_index_code_complete (_tmp0_, _tmp3_, _tmp4_ + 1, _tmp5_ + 1, _tmp6_, _tmp7_, self, _tmp8_, &_tmp9_, &_tmp10_);
	res_line = _tmp9_;
	res_column = _tmp10_;
	_g_object_unref0 (self->priv->results);
	self->priv->results = _tmp11_;
	_tmp13_ = res_line;
	if (_tmp13_ > 0) {
		gint _tmp14_ = 0;
		_tmp14_ = res_column;
		_tmp12_ = _tmp14_ > 0;
	} else {
		_tmp12_ = FALSE;
	}
	if (_tmp12_) {
		gint _tmp15_ = 0;
		gint _tmp16_ = 0;
		_tmp15_ = res_line;
		self->priv->line = _tmp15_ - 1;
		_tmp16_ = res_column;
		self->priv->column = _tmp16_ - 1;
	}
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda9__gsource_func, block1_data_ref (_data1_), block1_data_unref);
}


static void ___lambda8__ide_thread_func (gpointer self) {
	__lambda8_ (self);
	block1_data_unref (self);
}


static void ide_vala_completion_provider_real_populate (GtkSourceCompletionProvider* base, GtkSourceCompletionContext* context) {
	IdeValaCompletionProvider * self;
	Block1Data* _data1_;
	GtkSourceCompletionContext* _tmp0_ = NULL;
	GtkSourceCompletionContext* _tmp1_ = NULL;
	GtkTextIter begin = {0};
	GtkSourceCompletionContext* _tmp2_ = NULL;
	GtkTextIter _tmp3_ = {0};
	gboolean _tmp4_ = FALSE;
	GtkSourceCompletionContext* _tmp6_ = NULL;
	gchar* _tmp7_ = NULL;
	GtkTextIter _tmp8_ = {0};
	GtkTextIter _tmp9_ = {0};
	gchar* _tmp10_ = NULL;
	IdeCompletionResults* _tmp11_ = NULL;
	IdeBuffer* buffer = NULL;
	GtkTextBuffer* _tmp20_ = NULL;
	IdeBuffer* _tmp21_ = NULL;
	IdeBuffer* _tmp22_ = NULL;
	IdeFile* _tmp23_ = NULL;
	IdeFile* _tmp24_ = NULL;
	IdeFile* _tmp25_ = NULL;
	gboolean _tmp26_ = FALSE;
	IdeFile* _tmp27_ = NULL;
	IdeBuffer* _tmp32_ = NULL;
	IdeValaService* service = NULL;
	IdeContext* _tmp33_ = NULL;
	void* _tmp34_ = NULL;
	IdeValaService* _tmp35_ = NULL;
	IdeValaService* _tmp36_ = NULL;
	IdeValaIndex* _tmp37_ = NULL;
	IdeValaIndex* _tmp38_ = NULL;
	IdeValaIndex* _tmp39_ = NULL;
	IdeContext* _tmp40_ = NULL;
	IdeUnsavedFiles* _tmp41_ = NULL;
	IdeUnsavedFiles* _tmp42_ = NULL;
	GCancellable* _tmp43_ = NULL;
	GtkSourceCompletionContext* _tmp44_ = NULL;
	self = (IdeValaCompletionProvider*) base;
	g_return_if_fail (context != NULL);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = g_object_ref (self);
	_tmp0_ = context;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data1_->context);
	_data1_->context = _tmp1_;
	_tmp2_ = _data1_->context;
	_tmp4_ = gtk_source_completion_context_get_iter (_tmp2_, &_tmp3_);
	_data1_->iter = _tmp3_;
	if (!_tmp4_) {
		GtkSourceCompletionContext* _tmp5_ = NULL;
		_tmp5_ = _data1_->context;
		gtk_source_completion_context_add_proposals (_tmp5_, (GtkSourceCompletionProvider*) self, NULL, TRUE);
		block1_data_unref (_data1_);
		_data1_ = NULL;
		return;
	}
	_tmp6_ = _data1_->context;
	_tmp7_ = ide_completion_provider_context_current_word (_tmp6_);
	_g_free0 (self->query);
	self->query = _tmp7_;
	_tmp8_ = _data1_->iter;
	begin = _tmp8_;
	gtk_text_iter_set_line_offset (&begin, 0);
	_tmp9_ = _data1_->iter;
	_tmp10_ = gtk_text_iter_get_slice (&begin, &_tmp9_);
	_data1_->line = _tmp10_;
	_tmp11_ = self->priv->results;
	if (_tmp11_ != NULL) {
		gboolean _tmp12_ = FALSE;
		gint _tmp13_ = 0;
		gint _tmp14_ = 0;
		_tmp13_ = self->priv->line;
		_tmp14_ = gtk_text_iter_get_line (&_data1_->iter);
		if (_tmp13_ == _tmp14_) {
			IdeCompletionResults* _tmp15_ = NULL;
			const gchar* _tmp16_ = NULL;
			gboolean _tmp17_ = FALSE;
			_tmp15_ = self->priv->results;
			_tmp16_ = self->query;
			_tmp17_ = ide_completion_results_replay (_tmp15_, _tmp16_);
			_tmp12_ = _tmp17_;
		} else {
			_tmp12_ = FALSE;
		}
		if (_tmp12_) {
			IdeCompletionResults* _tmp18_ = NULL;
			GtkSourceCompletionContext* _tmp19_ = NULL;
			_tmp18_ = self->priv->results;
			_tmp19_ = _data1_->context;
			ide_completion_results_present (_tmp18_, (GtkSourceCompletionProvider*) self, _tmp19_);
			block1_data_unref (_data1_);
			_data1_ = NULL;
			return;
		}
		_g_object_unref0 (self->priv->results);
		self->priv->results = NULL;
	}
	self->priv->line = -1;
	self->priv->column = -1;
	_tmp20_ = gtk_text_iter_get_buffer (&_data1_->iter);
	_tmp21_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp20_, ide_buffer_get_type ()) ? ((IdeBuffer*) _tmp20_) : NULL);
	buffer = _tmp21_;
	_tmp22_ = buffer;
	_tmp23_ = ide_buffer_get_file (_tmp22_);
	_tmp24_ = _tmp23_;
	_tmp25_ = _g_object_ref0 (_tmp24_);
	_data1_->file = _tmp25_;
	_tmp27_ = _data1_->file;
	if (_tmp27_ == NULL) {
		_tmp26_ = TRUE;
	} else {
		IdeFile* _tmp28_ = NULL;
		gboolean _tmp29_ = FALSE;
		gboolean _tmp30_ = FALSE;
		_tmp28_ = _data1_->file;
		_tmp29_ = ide_file_get_is_temporary (_tmp28_);
		_tmp30_ = _tmp29_;
		_tmp26_ = _tmp30_;
	}
	if (_tmp26_) {
		GtkSourceCompletionContext* _tmp31_ = NULL;
		_tmp31_ = _data1_->context;
		gtk_source_completion_context_add_proposals (_tmp31_, (GtkSourceCompletionProvider*) self, NULL, TRUE);
		_g_object_unref0 (buffer);
		block1_data_unref (_data1_);
		_data1_ = NULL;
		return;
	}
	_tmp32_ = buffer;
	ide_buffer_sync_to_unsaved_files (_tmp32_);
	_tmp33_ = ide_object_get_context ((IdeObject*) self);
	_tmp34_ = ide_context_get_service_typed (_tmp33_, IDE_TYPE_VALA_SERVICE);
	_tmp35_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp34_, IDE_TYPE_VALA_SERVICE) ? ((IdeValaService*) _tmp34_) : NULL);
	service = _tmp35_;
	_tmp36_ = service;
	_tmp37_ = ide_vala_service_get_index (_tmp36_);
	_tmp38_ = _tmp37_;
	_tmp39_ = _g_object_ref0 (_tmp38_);
	_data1_->index = _tmp39_;
	_tmp40_ = ide_object_get_context ((IdeObject*) self);
	_tmp41_ = ide_context_get_unsaved_files (_tmp40_);
	_tmp42_ = _g_object_ref0 (_tmp41_);
	_data1_->unsaved_files = _tmp42_;
	_tmp43_ = g_cancellable_new ();
	_data1_->cancellable = _tmp43_;
	_tmp44_ = _data1_->context;
	g_signal_connect_data (_tmp44_, "cancelled", (GCallback) ___lambda7__gtk_source_completion_context_cancelled, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
	ide_thread_pool_push (IDE_THREAD_POOL_INDEXER, ___lambda8__ide_thread_func, block1_data_ref (_data1_));
	_g_object_unref0 (service);
	_g_object_unref0 (buffer);
	block1_data_unref (_data1_);
	_data1_ = NULL;
}


static gboolean ide_vala_completion_provider_real_match (GtkSourceCompletionProvider* base, GtkSourceCompletionContext* context) {
	IdeValaCompletionProvider * self;
	gboolean result = FALSE;
	GtkTextIter iter = {0};
	GtkSourceCompletionContext* _tmp0_ = NULL;
	GtkTextIter _tmp1_ = {0};
	gboolean _tmp2_ = FALSE;
	IdeBuffer* buffer = NULL;
	GtkTextBuffer* _tmp3_ = NULL;
	IdeBuffer* _tmp4_ = NULL;
	gboolean _tmp5_ = FALSE;
	IdeBuffer* _tmp6_ = NULL;
	IdeFile* _tmp7_ = NULL;
	IdeFile* _tmp8_ = NULL;
	GtkSourceCompletionContext* _tmp14_ = NULL;
	GtkSourceCompletionActivation _tmp15_ = 0;
	GtkSourceCompletionActivation _tmp16_ = 0;
	GtkSourceCompletionContext* _tmp23_ = NULL;
	gboolean _tmp24_ = FALSE;
	self = (IdeValaCompletionProvider*) base;
	g_return_val_if_fail (context != NULL, FALSE);
	_tmp0_ = context;
	_tmp2_ = gtk_source_completion_context_get_iter (_tmp0_, &_tmp1_);
	iter = _tmp1_;
	if (!_tmp2_) {
		result = FALSE;
		return result;
	}
	_tmp3_ = gtk_text_iter_get_buffer (&iter);
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, ide_buffer_get_type ()) ? ((IdeBuffer*) _tmp3_) : NULL);
	buffer = _tmp4_;
	_tmp6_ = buffer;
	_tmp7_ = ide_buffer_get_file (_tmp6_);
	_tmp8_ = _tmp7_;
	if (_tmp8_ == NULL) {
		_tmp5_ = TRUE;
	} else {
		IdeBuffer* _tmp9_ = NULL;
		IdeFile* _tmp10_ = NULL;
		IdeFile* _tmp11_ = NULL;
		GFile* _tmp12_ = NULL;
		GFile* _tmp13_ = NULL;
		_tmp9_ = buffer;
		_tmp10_ = ide_buffer_get_file (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = ide_file_get_file (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp5_ = _tmp13_ == NULL;
	}
	if (_tmp5_) {
		result = FALSE;
		_g_object_unref0 (buffer);
		return result;
	}
	_tmp14_ = context;
	g_object_get (_tmp14_, "activation", &_tmp15_, NULL);
	_tmp16_ = _tmp15_;
	if (_tmp16_ != GTK_SOURCE_COMPLETION_ACTIVATION_USER_REQUESTED) {
		gboolean _tmp17_ = FALSE;
		gboolean _tmp18_ = FALSE;
		gboolean _tmp19_ = FALSE;
		_tmp19_ = gtk_text_iter_starts_line (&iter);
		if (_tmp19_) {
			_tmp18_ = TRUE;
		} else {
			gboolean _tmp20_ = FALSE;
			_tmp20_ = gtk_text_iter_backward_char (&iter);
			_tmp18_ = !_tmp20_;
		}
		if (_tmp18_) {
			_tmp17_ = TRUE;
		} else {
			gunichar _tmp21_ = 0U;
			gboolean _tmp22_ = FALSE;
			_tmp21_ = gtk_text_iter_get_char (&iter);
			_tmp22_ = g_unichar_isspace (_tmp21_);
			_tmp17_ = _tmp22_;
		}
		if (_tmp17_) {
			result = FALSE;
			_g_object_unref0 (buffer);
			return result;
		}
	}
	_tmp23_ = context;
	_tmp24_ = ide_completion_provider_context_in_comment_or_string (_tmp23_);
	if (_tmp24_) {
		result = FALSE;
		_g_object_unref0 (buffer);
		return result;
	}
	result = TRUE;
	_g_object_unref0 (buffer);
	return result;
}


static gchar* ide_vala_completion_provider_real_get_name (GtkSourceCompletionProvider* base) {
	IdeValaCompletionProvider * self;
	gchar* result = NULL;
	gchar* _tmp0_ = NULL;
	self = (IdeValaCompletionProvider*) base;
	_tmp0_ = g_strdup ("Vala");
	result = _tmp0_;
	return result;
}


static gint ide_vala_completion_provider_real_get_priority (GtkSourceCompletionProvider* base) {
	IdeValaCompletionProvider * self;
	gint result = 0;
	self = (IdeValaCompletionProvider*) base;
	result = 200;
	return result;
}


IdeValaCompletionProvider* ide_vala_completion_provider_construct (GType object_type) {
	IdeValaCompletionProvider * self = NULL;
	self = (IdeValaCompletionProvider*) g_object_new (object_type, NULL);
	return self;
}


IdeValaCompletionProvider* ide_vala_completion_provider_new (void) {
	return ide_vala_completion_provider_construct (IDE_TYPE_VALA_COMPLETION_PROVIDER);
}


static void ide_vala_completion_provider_class_init (IdeValaCompletionProviderClass * klass) {
	ide_vala_completion_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (IdeValaCompletionProviderPrivate));
	G_OBJECT_CLASS (klass)->finalize = ide_vala_completion_provider_finalize;
}


static void ide_vala_completion_provider_gtk_source_completion_provider_interface_init (GtkSourceCompletionProviderIface * iface) {
	ide_vala_completion_provider_gtk_source_completion_provider_parent_iface = g_type_interface_peek_parent (iface);
	iface->populate = (void (*)(GtkSourceCompletionProvider*, GtkSourceCompletionContext*)) ide_vala_completion_provider_real_populate;
	iface->match = (gboolean (*)(GtkSourceCompletionProvider*, GtkSourceCompletionContext*)) ide_vala_completion_provider_real_match;
	iface->get_name = (gchar* (*)(GtkSourceCompletionProvider*)) ide_vala_completion_provider_real_get_name;
	iface->get_priority = (gint (*)(GtkSourceCompletionProvider*)) ide_vala_completion_provider_real_get_priority;
}


static void ide_vala_completion_provider_ide_completion_provider_interface_init (IdeCompletionProviderInterface * iface) {
	ide_vala_completion_provider_ide_completion_provider_parent_iface = g_type_interface_peek_parent (iface);
	iface->set_context = (void (*)(IdeCompletionProvider*, IdeContext*)) ide_object_set_context;
	iface->set_context = (void (*) (IdeCompletionProvider *, IdeContext*)) ide_object_set_context;
}


static void ide_vala_completion_provider_instance_init (IdeValaCompletionProvider * self) {
	self->priv = IDE_VALA_COMPLETION_PROVIDER_GET_PRIVATE (self);
	self->priv->line = -1;
	self->priv->column = -1;
}


static void ide_vala_completion_provider_finalize (GObject* obj) {
	IdeValaCompletionProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, IDE_TYPE_VALA_COMPLETION_PROVIDER, IdeValaCompletionProvider);
	_g_free0 (self->query);
	_g_object_unref0 (self->priv->results);
	G_OBJECT_CLASS (ide_vala_completion_provider_parent_class)->finalize (obj);
}


GType ide_vala_completion_provider_get_type (void) {
	return ide_vala_completion_provider_type_id;
}


GType ide_vala_completion_provider_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (IdeValaCompletionProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ide_vala_completion_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (IdeValaCompletionProvider), 0, (GInstanceInitFunc) ide_vala_completion_provider_instance_init, NULL };
	static const GInterfaceInfo gtk_source_completion_provider_info = { (GInterfaceInitFunc) ide_vala_completion_provider_gtk_source_completion_provider_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo ide_completion_provider_info = { (GInterfaceInitFunc) ide_vala_completion_provider_ide_completion_provider_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	ide_vala_completion_provider_type_id = g_type_module_register_type (module, ide_object_get_type (), "IdeValaCompletionProvider", &g_define_type_info, 0);
	g_type_module_add_interface (module, ide_vala_completion_provider_type_id, gtk_source_completion_provider_get_type (), &gtk_source_completion_provider_info);
	g_type_module_add_interface (module, ide_vala_completion_provider_type_id, ide_completion_provider_get_type (), &ide_completion_provider_info);
	return ide_vala_completion_provider_type_id;
}



