/* email-autocompleter.c generated by valac 0.56.19, the Vala compiler
 * generated from email-autocompleter.vala, do not modify */

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 4 -*-
 *
 * Copyright (C) 2012 Canonical Ltd
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 3 as
 * published by the Free Software Foundation.
 *
 * 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-object.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gobject/gvaluecollector.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_EMAIL_AUTOCOMPLETER (email_autocompleter_get_type ())
#define EMAIL_AUTOCOMPLETER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EMAIL_AUTOCOMPLETER, EmailAutocompleter))
#define EMAIL_AUTOCOMPLETER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EMAIL_AUTOCOMPLETER, EmailAutocompleterClass))
#define IS_EMAIL_AUTOCOMPLETER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EMAIL_AUTOCOMPLETER))
#define IS_EMAIL_AUTOCOMPLETER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_EMAIL_AUTOCOMPLETER))
#define EMAIL_AUTOCOMPLETER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_EMAIL_AUTOCOMPLETER, EmailAutocompleterClass))

typedef struct _EmailAutocompleter EmailAutocompleter;
typedef struct _EmailAutocompleterClass EmailAutocompleterClass;
typedef struct _EmailAutocompleterPrivate EmailAutocompleterPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block1Data Block1Data;
#define _email_autocompleter_unref0(var) ((var == NULL) ? NULL : (var = (email_autocompleter_unref (var), NULL)))
typedef struct _ParamSpecEmailAutocompleter ParamSpecEmailAutocompleter;

struct _EmailAutocompleter {
	GTypeInstance parent_instance;
	volatile int ref_count;
	EmailAutocompleterPrivate * priv;
};

struct _EmailAutocompleterClass {
	GTypeClass parent_class;
	void (*finalize) (EmailAutocompleter *self);
};

struct _EmailAutocompleterPrivate {
	GtkEntry* entry;
	gchar** domains;
	gint domains_length1;
	gint _domains_size_;
	gchar* prevText;
};

struct _Block1Data {
	int _ref_count_;
	EmailAutocompleter* self;
	gchar* text_to_add;
};

struct _ParamSpecEmailAutocompleter {
	GParamSpec parent_instance;
};

static gint EmailAutocompleter_private_offset;
static gpointer email_autocompleter_parent_class = NULL;

VALA_EXTERN gpointer email_autocompleter_ref (gpointer instance);
VALA_EXTERN void email_autocompleter_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_email_autocompleter (const gchar* name,
                                            const gchar* nick,
                                            const gchar* blurb,
                                            GType object_type,
                                            GParamFlags flags);
VALA_EXTERN void value_set_email_autocompleter (GValue* value,
                                    gpointer v_object);
VALA_EXTERN void value_take_email_autocompleter (GValue* value,
                                     gpointer v_object);
VALA_EXTERN gpointer value_get_email_autocompleter (const GValue* value);
VALA_EXTERN GType email_autocompleter_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (EmailAutocompleter, email_autocompleter_unref)
static void email_autocompleter_entry_changed (EmailAutocompleter* self);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static gboolean ______lambda41_ (Block1Data* _data1_);
static gboolean _______lambda41__gsource_func (gpointer self);
VALA_EXTERN EmailAutocompleter* email_autocompleter_new (GtkEntry* e,
                                             gchar** email_domains,
                                             gint email_domains_length1);
VALA_EXTERN EmailAutocompleter* email_autocompleter_construct (GType object_type,
                                                   GtkEntry* e,
                                                   gchar** email_domains,
                                                   gint email_domains_length1);
static gchar** _vala_array_dup3 (gchar** self,
                          gssize length);
static void _email_autocompleter_entry_changed_gtk_editable_changed (GtkEditable* _sender,
                                                              gpointer self);
static void email_autocompleter_finalize (EmailAutocompleter * obj);
static GType email_autocompleter_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
email_autocompleter_get_instance_private (EmailAutocompleter* self)
{
	return G_STRUCT_MEMBER_P (self, EmailAutocompleter_private_offset);
}

static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
#line 1184 "glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, -1);
#line 1184 "glib-2.0.vapi"
	g_return_val_if_fail (needle != NULL, -1);
#line 1185 "glib-2.0.vapi"
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
#line 1185 "glib-2.0.vapi"
	_result_ = _tmp0_;
#line 1187 "glib-2.0.vapi"
	_tmp1_ = _result_;
#line 1187 "glib-2.0.vapi"
	if (_tmp1_ != NULL) {
#line 164 "email-autocompleter.c"
		gchar* _tmp2_;
#line 1188 "glib-2.0.vapi"
		_tmp2_ = _result_;
#line 1188 "glib-2.0.vapi"
		result = (gint) (_tmp2_ - ((gchar*) self));
#line 1188 "glib-2.0.vapi"
		return result;
#line 172 "email-autocompleter.c"
	} else {
#line 1190 "glib-2.0.vapi"
		result = -1;
#line 1190 "glib-2.0.vapi"
		return result;
#line 178 "email-autocompleter.c"
	}
}

static gchar*
string_slice (const gchar* self,
              glong start,
              glong end)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gchar* _tmp4_;
	gchar* result;
#line 1534 "glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1535 "glib-2.0.vapi"
	_tmp0_ = strlen (self);
#line 1535 "glib-2.0.vapi"
	_tmp1_ = _tmp0_;
#line 1535 "glib-2.0.vapi"
	string_length = (glong) _tmp1_;
#line 1536 "glib-2.0.vapi"
	if (start < ((glong) 0)) {
#line 1537 "glib-2.0.vapi"
		start = string_length + start;
#line 206 "email-autocompleter.c"
	}
#line 1539 "glib-2.0.vapi"
	if (end < ((glong) 0)) {
#line 1540 "glib-2.0.vapi"
		end = string_length + end;
#line 212 "email-autocompleter.c"
	}
#line 1542 "glib-2.0.vapi"
	if (start >= ((glong) 0)) {
#line 1542 "glib-2.0.vapi"
		_tmp2_ = start <= string_length;
#line 218 "email-autocompleter.c"
	} else {
#line 1542 "glib-2.0.vapi"
		_tmp2_ = FALSE;
#line 222 "email-autocompleter.c"
	}
#line 1542 "glib-2.0.vapi"
	g_return_val_if_fail (_tmp2_, NULL);
#line 1543 "glib-2.0.vapi"
	if (end >= ((glong) 0)) {
#line 1543 "glib-2.0.vapi"
		_tmp3_ = end <= string_length;
#line 230 "email-autocompleter.c"
	} else {
#line 1543 "glib-2.0.vapi"
		_tmp3_ = FALSE;
#line 234 "email-autocompleter.c"
	}
#line 1543 "glib-2.0.vapi"
	g_return_val_if_fail (_tmp3_, NULL);
#line 1544 "glib-2.0.vapi"
	g_return_val_if_fail (start <= end, NULL);
#line 1545 "glib-2.0.vapi"
	_tmp4_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
#line 1545 "glib-2.0.vapi"
	result = _tmp4_;
#line 1545 "glib-2.0.vapi"
	return result;
#line 246 "email-autocompleter.c"
}

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
#line 53 "../src/email-autocompleter.vala"
	g_atomic_int_inc (&_data1_->_ref_count_);
#line 53 "../src/email-autocompleter.vala"
	return _data1_;
#line 256 "email-autocompleter.c"
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
#line 53 "../src/email-autocompleter.vala"
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
#line 266 "email-autocompleter.c"
		EmailAutocompleter* self;
#line 53 "../src/email-autocompleter.vala"
		self = _data1_->self;
#line 53 "../src/email-autocompleter.vala"
		_g_free0 (_data1_->text_to_add);
#line 53 "../src/email-autocompleter.vala"
		_email_autocompleter_unref0 (self);
#line 53 "../src/email-autocompleter.vala"
		g_slice_free (Block1Data, _data1_);
#line 276 "email-autocompleter.c"
	}
}

static gboolean
______lambda41_ (Block1Data* _data1_)
{
	EmailAutocompleter* self;
	GtkEntry* _tmp0_;
	GtkEntry* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	const gchar* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	GtkEntry* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	gboolean result;
#line 62 "../src/email-autocompleter.vala"
	self = _data1_->self;
#line 64 "../src/email-autocompleter.vala"
	_tmp0_ = self->priv->entry;
#line 64 "../src/email-autocompleter.vala"
	_tmp1_ = self->priv->entry;
#line 64 "../src/email-autocompleter.vala"
	_tmp2_ = gtk_entry_get_text (_tmp1_);
#line 64 "../src/email-autocompleter.vala"
	_tmp3_ = _tmp2_;
#line 64 "../src/email-autocompleter.vala"
	_tmp4_ = strlen (_tmp3_);
#line 64 "../src/email-autocompleter.vala"
	_tmp5_ = _tmp4_;
#line 64 "../src/email-autocompleter.vala"
	_tmp6_ = _data1_->text_to_add;
#line 64 "../src/email-autocompleter.vala"
	_tmp7_ = strlen (_tmp6_);
#line 64 "../src/email-autocompleter.vala"
	_tmp8_ = _tmp7_;
#line 64 "../src/email-autocompleter.vala"
	_tmp9_ = self->priv->entry;
#line 64 "../src/email-autocompleter.vala"
	_tmp10_ = gtk_entry_get_text (_tmp9_);
#line 64 "../src/email-autocompleter.vala"
	_tmp11_ = _tmp10_;
#line 64 "../src/email-autocompleter.vala"
	_tmp12_ = strlen (_tmp11_);
#line 64 "../src/email-autocompleter.vala"
	_tmp13_ = _tmp12_;
#line 64 "../src/email-autocompleter.vala"
	gtk_editable_select_region ((GtkEditable*) _tmp0_, _tmp5_ - _tmp8_, _tmp13_);
#line 65 "../src/email-autocompleter.vala"
	result = FALSE;
#line 65 "../src/email-autocompleter.vala"
	return result;
#line 335 "email-autocompleter.c"
}

static gboolean
_______lambda41__gsource_func (gpointer self)
{
	gboolean result;
	result = ______lambda41_ (self);
#line 62 "../src/email-autocompleter.vala"
	return result;
#line 345 "email-autocompleter.c"
}

static void
email_autocompleter_entry_changed (EmailAutocompleter* self)
{
	GtkEntry* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	const gchar* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	GtkEntry* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	gint first_at = 0;
	GtkEntry* _tmp16_;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
#line 25 "../src/email-autocompleter.vala"
	g_return_if_fail (self != NULL);
#line 27 "../src/email-autocompleter.vala"
	_tmp0_ = self->priv->entry;
#line 27 "../src/email-autocompleter.vala"
	_tmp1_ = gtk_entry_get_text (_tmp0_);
#line 27 "../src/email-autocompleter.vala"
	_tmp2_ = _tmp1_;
#line 27 "../src/email-autocompleter.vala"
	_tmp3_ = strlen (_tmp2_);
#line 27 "../src/email-autocompleter.vala"
	_tmp4_ = _tmp3_;
#line 27 "../src/email-autocompleter.vala"
	_tmp5_ = self->priv->prevText;
#line 27 "../src/email-autocompleter.vala"
	_tmp6_ = strlen (_tmp5_);
#line 27 "../src/email-autocompleter.vala"
	_tmp7_ = _tmp6_;
#line 27 "../src/email-autocompleter.vala"
	if (_tmp4_ < _tmp7_) {
#line 387 "email-autocompleter.c"
		GtkEntry* _tmp8_;
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		gchar* _tmp11_;
#line 30 "../src/email-autocompleter.vala"
		_tmp8_ = self->priv->entry;
#line 30 "../src/email-autocompleter.vala"
		_tmp9_ = gtk_entry_get_text (_tmp8_);
#line 30 "../src/email-autocompleter.vala"
		_tmp10_ = _tmp9_;
#line 30 "../src/email-autocompleter.vala"
		_tmp11_ = g_strdup (_tmp10_);
#line 30 "../src/email-autocompleter.vala"
		_g_free0 (self->priv->prevText);
#line 30 "../src/email-autocompleter.vala"
		self->priv->prevText = _tmp11_;
#line 31 "../src/email-autocompleter.vala"
		return;
#line 406 "email-autocompleter.c"
	}
#line 34 "../src/email-autocompleter.vala"
	_tmp12_ = self->priv->entry;
#line 34 "../src/email-autocompleter.vala"
	_tmp13_ = gtk_entry_get_text (_tmp12_);
#line 34 "../src/email-autocompleter.vala"
	_tmp14_ = _tmp13_;
#line 34 "../src/email-autocompleter.vala"
	_tmp15_ = g_strdup (_tmp14_);
#line 34 "../src/email-autocompleter.vala"
	_g_free0 (self->priv->prevText);
#line 34 "../src/email-autocompleter.vala"
	self->priv->prevText = _tmp15_;
#line 36 "../src/email-autocompleter.vala"
	_tmp16_ = self->priv->entry;
#line 36 "../src/email-autocompleter.vala"
	_tmp17_ = gtk_entry_get_text (_tmp16_);
#line 36 "../src/email-autocompleter.vala"
	_tmp18_ = _tmp17_;
#line 36 "../src/email-autocompleter.vala"
	first_at = string_index_of (_tmp18_, "@", 0);
#line 37 "../src/email-autocompleter.vala"
	if (first_at != -1) {
#line 430 "email-autocompleter.c"
		gint second_at = 0;
		GtkEntry* _tmp19_;
		const gchar* _tmp20_;
		const gchar* _tmp21_;
#line 39 "../src/email-autocompleter.vala"
		_tmp19_ = self->priv->entry;
#line 39 "../src/email-autocompleter.vala"
		_tmp20_ = gtk_entry_get_text (_tmp19_);
#line 39 "../src/email-autocompleter.vala"
		_tmp21_ = _tmp20_;
#line 39 "../src/email-autocompleter.vala"
		second_at = string_index_of (_tmp21_, "@", first_at + 1);
#line 40 "../src/email-autocompleter.vala"
		if (second_at == -1) {
#line 445 "email-autocompleter.c"
			gchar* text_after_at = NULL;
			GtkEntry* _tmp22_;
			const gchar* _tmp23_;
			const gchar* _tmp24_;
			GtkEntry* _tmp25_;
			const gchar* _tmp26_;
			const gchar* _tmp27_;
			gint _tmp28_;
			gint _tmp29_;
			gchar* _tmp30_;
			gint match = 0;
#line 43 "../src/email-autocompleter.vala"
			_tmp22_ = self->priv->entry;
#line 43 "../src/email-autocompleter.vala"
			_tmp23_ = gtk_entry_get_text (_tmp22_);
#line 43 "../src/email-autocompleter.vala"
			_tmp24_ = _tmp23_;
#line 43 "../src/email-autocompleter.vala"
			_tmp25_ = self->priv->entry;
#line 43 "../src/email-autocompleter.vala"
			_tmp26_ = gtk_entry_get_text (_tmp25_);
#line 43 "../src/email-autocompleter.vala"
			_tmp27_ = _tmp26_;
#line 43 "../src/email-autocompleter.vala"
			_tmp28_ = strlen (_tmp27_);
#line 43 "../src/email-autocompleter.vala"
			_tmp29_ = _tmp28_;
#line 43 "../src/email-autocompleter.vala"
			_tmp30_ = string_slice (_tmp24_, (glong) (first_at + 1), (glong) _tmp29_);
#line 43 "../src/email-autocompleter.vala"
			text_after_at = _tmp30_;
#line 46 "../src/email-autocompleter.vala"
			match = -1;
#line 479 "email-autocompleter.c"
			{
				gint i = 0;
#line 47 "../src/email-autocompleter.vala"
				i = 0;
#line 484 "email-autocompleter.c"
				{
					gboolean _tmp31_ = FALSE;
#line 47 "../src/email-autocompleter.vala"
					_tmp31_ = TRUE;
#line 47 "../src/email-autocompleter.vala"
					while (TRUE) {
#line 491 "email-autocompleter.c"
						gboolean _tmp33_ = FALSE;
						gchar** _tmp35_;
						gint _tmp35__length1;
						const gchar* _tmp36_;
						const gchar* _tmp37_;
#line 47 "../src/email-autocompleter.vala"
						if (!_tmp31_) {
#line 499 "email-autocompleter.c"
							gint _tmp32_;
#line 47 "../src/email-autocompleter.vala"
							i = i + 1;
#line 47 "../src/email-autocompleter.vala"
							_tmp32_ = i;
#line 505 "email-autocompleter.c"
						}
#line 47 "../src/email-autocompleter.vala"
						_tmp31_ = FALSE;
#line 47 "../src/email-autocompleter.vala"
						if (match == -1) {
#line 511 "email-autocompleter.c"
							gchar** _tmp34_;
							gint _tmp34__length1;
#line 47 "../src/email-autocompleter.vala"
							_tmp34_ = self->priv->domains;
#line 47 "../src/email-autocompleter.vala"
							_tmp34__length1 = self->priv->domains_length1;
#line 47 "../src/email-autocompleter.vala"
							_tmp33_ = i < _tmp34__length1;
#line 520 "email-autocompleter.c"
						} else {
#line 47 "../src/email-autocompleter.vala"
							_tmp33_ = FALSE;
#line 524 "email-autocompleter.c"
						}
#line 47 "../src/email-autocompleter.vala"
						if (!_tmp33_) {
#line 47 "../src/email-autocompleter.vala"
							break;
#line 530 "email-autocompleter.c"
						}
#line 49 "../src/email-autocompleter.vala"
						_tmp35_ = self->priv->domains;
#line 49 "../src/email-autocompleter.vala"
						_tmp35__length1 = self->priv->domains_length1;
#line 49 "../src/email-autocompleter.vala"
						_tmp36_ = _tmp35_[i];
#line 49 "../src/email-autocompleter.vala"
						_tmp37_ = text_after_at;
#line 49 "../src/email-autocompleter.vala"
						if (g_str_has_prefix (_tmp36_, _tmp37_)) {
#line 50 "../src/email-autocompleter.vala"
							match = i;
#line 544 "email-autocompleter.c"
						}
					}
				}
			}
#line 53 "../src/email-autocompleter.vala"
			if (match != -1) {
#line 551 "email-autocompleter.c"
				Block1Data* _data1_;
				gchar* best_match = NULL;
				gchar** _tmp38_;
				gint _tmp38__length1;
				const gchar* _tmp39_;
				gchar* _tmp40_;
				const gchar* _tmp41_;
				const gchar* _tmp42_;
				gint _tmp43_;
				gint _tmp44_;
				const gchar* _tmp45_;
				gint _tmp46_;
				gint _tmp47_;
				gchar* _tmp48_;
				const gchar* _tmp49_;
				gint _tmp50_;
				gint _tmp51_;
#line 53 "../src/email-autocompleter.vala"
				_data1_ = g_slice_new0 (Block1Data);
#line 53 "../src/email-autocompleter.vala"
				_data1_->_ref_count_ = 1;
#line 53 "../src/email-autocompleter.vala"
				_data1_->self = email_autocompleter_ref (self);
#line 56 "../src/email-autocompleter.vala"
				_tmp38_ = self->priv->domains;
#line 56 "../src/email-autocompleter.vala"
				_tmp38__length1 = self->priv->domains_length1;
#line 56 "../src/email-autocompleter.vala"
				_tmp39_ = _tmp38_[match];
#line 56 "../src/email-autocompleter.vala"
				_tmp40_ = g_strdup (_tmp39_);
#line 56 "../src/email-autocompleter.vala"
				best_match = _tmp40_;
#line 57 "../src/email-autocompleter.vala"
				_tmp41_ = best_match;
#line 57 "../src/email-autocompleter.vala"
				_tmp42_ = text_after_at;
#line 57 "../src/email-autocompleter.vala"
				_tmp43_ = strlen (_tmp42_);
#line 57 "../src/email-autocompleter.vala"
				_tmp44_ = _tmp43_;
#line 57 "../src/email-autocompleter.vala"
				_tmp45_ = best_match;
#line 57 "../src/email-autocompleter.vala"
				_tmp46_ = strlen (_tmp45_);
#line 57 "../src/email-autocompleter.vala"
				_tmp47_ = _tmp46_;
#line 57 "../src/email-autocompleter.vala"
				_tmp48_ = string_slice (_tmp41_, (glong) _tmp44_, (glong) _tmp47_);
#line 57 "../src/email-autocompleter.vala"
				_data1_->text_to_add = _tmp48_;
#line 58 "../src/email-autocompleter.vala"
				_tmp49_ = _data1_->text_to_add;
#line 58 "../src/email-autocompleter.vala"
				_tmp50_ = strlen (_tmp49_);
#line 58 "../src/email-autocompleter.vala"
				_tmp51_ = _tmp50_;
#line 58 "../src/email-autocompleter.vala"
				if (_tmp51_ > 0) {
#line 611 "email-autocompleter.c"
					GtkEntry* _tmp52_;
					GtkEntry* _tmp53_;
					const gchar* _tmp54_;
					const gchar* _tmp55_;
					const gchar* _tmp56_;
					gchar* _tmp57_;
					gchar* _tmp58_;
#line 60 "../src/email-autocompleter.vala"
					_tmp52_ = self->priv->entry;
#line 60 "../src/email-autocompleter.vala"
					_tmp53_ = self->priv->entry;
#line 60 "../src/email-autocompleter.vala"
					_tmp54_ = gtk_entry_get_text (_tmp53_);
#line 60 "../src/email-autocompleter.vala"
					_tmp55_ = _tmp54_;
#line 60 "../src/email-autocompleter.vala"
					_tmp56_ = _data1_->text_to_add;
#line 60 "../src/email-autocompleter.vala"
					_tmp57_ = g_strconcat (_tmp55_, _tmp56_, NULL);
#line 60 "../src/email-autocompleter.vala"
					_tmp58_ = _tmp57_;
#line 60 "../src/email-autocompleter.vala"
					gtk_entry_set_text (_tmp52_, _tmp58_);
#line 60 "../src/email-autocompleter.vala"
					_g_free0 (_tmp58_);
#line 62 "../src/email-autocompleter.vala"
					g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 0, _______lambda41__gsource_func, block1_data_ref (_data1_), block1_data_unref);
#line 639 "email-autocompleter.c"
				}
#line 53 "../src/email-autocompleter.vala"
				_g_free0 (best_match);
#line 53 "../src/email-autocompleter.vala"
				block1_data_unref (_data1_);
#line 53 "../src/email-autocompleter.vala"
				_data1_ = NULL;
#line 647 "email-autocompleter.c"
			}
#line 40 "../src/email-autocompleter.vala"
			_g_free0 (text_after_at);
#line 651 "email-autocompleter.c"
		}
	}
}

static gpointer
_g_object_ref0 (gpointer self)
{
#line 75 "../src/email-autocompleter.vala"
	return self ? g_object_ref (self) : NULL;
#line 661 "email-autocompleter.c"
}

static gchar**
_vala_array_dup3 (gchar** self,
                  gssize length)
{
#line 76 "../src/email-autocompleter.vala"
	if (length >= 0) {
#line 670 "email-autocompleter.c"
		gchar** result;
		gssize i;
#line 76 "../src/email-autocompleter.vala"
		result = g_new0 (gchar*, length + 1);
#line 76 "../src/email-autocompleter.vala"
		for (i = 0; i < length; i++) {
#line 677 "email-autocompleter.c"
			gchar* _tmp0_;
#line 76 "../src/email-autocompleter.vala"
			_tmp0_ = g_strdup (self[i]);
#line 76 "../src/email-autocompleter.vala"
			result[i] = _tmp0_;
#line 683 "email-autocompleter.c"
		}
#line 76 "../src/email-autocompleter.vala"
		return result;
#line 687 "email-autocompleter.c"
	}
#line 76 "../src/email-autocompleter.vala"
	return NULL;
#line 691 "email-autocompleter.c"
}

static void
_email_autocompleter_entry_changed_gtk_editable_changed (GtkEditable* _sender,
                                                         gpointer self)
{
#line 77 "../src/email-autocompleter.vala"
	email_autocompleter_entry_changed ((EmailAutocompleter*) self);
#line 700 "email-autocompleter.c"
}

EmailAutocompleter*
email_autocompleter_construct (GType object_type,
                               GtkEntry* e,
                               gchar** email_domains,
                               gint email_domains_length1)
{
	EmailAutocompleter* self = NULL;
	GtkEntry* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	GtkEntry* _tmp2_;
#line 73 "../src/email-autocompleter.vala"
	g_return_val_if_fail (e != NULL, NULL);
#line 73 "../src/email-autocompleter.vala"
	self = (EmailAutocompleter*) g_type_create_instance (object_type);
#line 75 "../src/email-autocompleter.vala"
	_tmp0_ = _g_object_ref0 (e);
#line 75 "../src/email-autocompleter.vala"
	_g_object_unref0 (self->priv->entry);
#line 75 "../src/email-autocompleter.vala"
	self->priv->entry = _tmp0_;
#line 76 "../src/email-autocompleter.vala"
	_tmp1_ = (email_domains != NULL) ? _vala_array_dup3 (email_domains, email_domains_length1) : email_domains;
#line 76 "../src/email-autocompleter.vala"
	_tmp1__length1 = email_domains_length1;
#line 76 "../src/email-autocompleter.vala"
	self->priv->domains = (_vala_array_free (self->priv->domains, self->priv->domains_length1, (GDestroyNotify) g_free), NULL);
#line 76 "../src/email-autocompleter.vala"
	self->priv->domains = _tmp1_;
#line 76 "../src/email-autocompleter.vala"
	self->priv->domains_length1 = _tmp1__length1;
#line 76 "../src/email-autocompleter.vala"
	self->priv->_domains_size_ = self->priv->domains_length1;
#line 77 "../src/email-autocompleter.vala"
	_tmp2_ = self->priv->entry;
#line 77 "../src/email-autocompleter.vala"
	g_signal_connect ((GtkEditable*) _tmp2_, "changed", (GCallback) _email_autocompleter_entry_changed_gtk_editable_changed, self);
#line 73 "../src/email-autocompleter.vala"
	return self;
#line 742 "email-autocompleter.c"
}

EmailAutocompleter*
email_autocompleter_new (GtkEntry* e,
                         gchar** email_domains,
                         gint email_domains_length1)
{
#line 73 "../src/email-autocompleter.vala"
	return email_autocompleter_construct (TYPE_EMAIL_AUTOCOMPLETER, e, email_domains, email_domains_length1);
#line 752 "email-autocompleter.c"
}

static void
value_email_autocompleter_init (GValue* value)
{
#line 19 "../src/email-autocompleter.vala"
	value->data[0].v_pointer = NULL;
#line 760 "email-autocompleter.c"
}

static void
value_email_autocompleter_free_value (GValue* value)
{
#line 19 "../src/email-autocompleter.vala"
	if (value->data[0].v_pointer) {
#line 19 "../src/email-autocompleter.vala"
		email_autocompleter_unref (value->data[0].v_pointer);
#line 770 "email-autocompleter.c"
	}
}

static void
value_email_autocompleter_copy_value (const GValue* src_value,
                                      GValue* dest_value)
{
#line 19 "../src/email-autocompleter.vala"
	if (src_value->data[0].v_pointer) {
#line 19 "../src/email-autocompleter.vala"
		dest_value->data[0].v_pointer = email_autocompleter_ref (src_value->data[0].v_pointer);
#line 782 "email-autocompleter.c"
	} else {
#line 19 "../src/email-autocompleter.vala"
		dest_value->data[0].v_pointer = NULL;
#line 786 "email-autocompleter.c"
	}
}

static gpointer
value_email_autocompleter_peek_pointer (const GValue* value)
{
#line 19 "../src/email-autocompleter.vala"
	return value->data[0].v_pointer;
#line 795 "email-autocompleter.c"
}

static gchar*
value_email_autocompleter_collect_value (GValue* value,
                                         guint n_collect_values,
                                         GTypeCValue* collect_values,
                                         guint collect_flags)
{
#line 19 "../src/email-autocompleter.vala"
	if (collect_values[0].v_pointer) {
#line 806 "email-autocompleter.c"
		EmailAutocompleter * object;
		object = collect_values[0].v_pointer;
#line 19 "../src/email-autocompleter.vala"
		if (object->parent_instance.g_class == NULL) {
#line 19 "../src/email-autocompleter.vala"
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 813 "email-autocompleter.c"
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
#line 19 "../src/email-autocompleter.vala"
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 817 "email-autocompleter.c"
		}
#line 19 "../src/email-autocompleter.vala"
		value->data[0].v_pointer = email_autocompleter_ref (object);
#line 821 "email-autocompleter.c"
	} else {
#line 19 "../src/email-autocompleter.vala"
		value->data[0].v_pointer = NULL;
#line 825 "email-autocompleter.c"
	}
#line 19 "../src/email-autocompleter.vala"
	return NULL;
#line 829 "email-autocompleter.c"
}

static gchar*
value_email_autocompleter_lcopy_value (const GValue* value,
                                       guint n_collect_values,
                                       GTypeCValue* collect_values,
                                       guint collect_flags)
{
	EmailAutocompleter ** object_p;
	object_p = collect_values[0].v_pointer;
#line 19 "../src/email-autocompleter.vala"
	if (!object_p) {
#line 19 "../src/email-autocompleter.vala"
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
#line 844 "email-autocompleter.c"
	}
#line 19 "../src/email-autocompleter.vala"
	if (!value->data[0].v_pointer) {
#line 19 "../src/email-autocompleter.vala"
		*object_p = NULL;
#line 850 "email-autocompleter.c"
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
#line 19 "../src/email-autocompleter.vala"
		*object_p = value->data[0].v_pointer;
#line 854 "email-autocompleter.c"
	} else {
#line 19 "../src/email-autocompleter.vala"
		*object_p = email_autocompleter_ref (value->data[0].v_pointer);
#line 858 "email-autocompleter.c"
	}
#line 19 "../src/email-autocompleter.vala"
	return NULL;
#line 862 "email-autocompleter.c"
}

GParamSpec*
param_spec_email_autocompleter (const gchar* name,
                                const gchar* nick,
                                const gchar* blurb,
                                GType object_type,
                                GParamFlags flags)
{
	ParamSpecEmailAutocompleter* spec;
#line 19 "../src/email-autocompleter.vala"
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_EMAIL_AUTOCOMPLETER), NULL);
#line 19 "../src/email-autocompleter.vala"
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
#line 19 "../src/email-autocompleter.vala"
	G_PARAM_SPEC (spec)->value_type = object_type;
#line 19 "../src/email-autocompleter.vala"
	return G_PARAM_SPEC (spec);
#line 881 "email-autocompleter.c"
}

gpointer
value_get_email_autocompleter (const GValue* value)
{
#line 19 "../src/email-autocompleter.vala"
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_EMAIL_AUTOCOMPLETER), NULL);
#line 19 "../src/email-autocompleter.vala"
	return value->data[0].v_pointer;
#line 891 "email-autocompleter.c"
}

void
value_set_email_autocompleter (GValue* value,
                               gpointer v_object)
{
	EmailAutocompleter * old;
#line 19 "../src/email-autocompleter.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_EMAIL_AUTOCOMPLETER));
#line 19 "../src/email-autocompleter.vala"
	old = value->data[0].v_pointer;
#line 19 "../src/email-autocompleter.vala"
	if (v_object) {
#line 19 "../src/email-autocompleter.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_EMAIL_AUTOCOMPLETER));
#line 19 "../src/email-autocompleter.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 19 "../src/email-autocompleter.vala"
		value->data[0].v_pointer = v_object;
#line 19 "../src/email-autocompleter.vala"
		email_autocompleter_ref (value->data[0].v_pointer);
#line 913 "email-autocompleter.c"
	} else {
#line 19 "../src/email-autocompleter.vala"
		value->data[0].v_pointer = NULL;
#line 917 "email-autocompleter.c"
	}
#line 19 "../src/email-autocompleter.vala"
	if (old) {
#line 19 "../src/email-autocompleter.vala"
		email_autocompleter_unref (old);
#line 923 "email-autocompleter.c"
	}
}

void
value_take_email_autocompleter (GValue* value,
                                gpointer v_object)
{
	EmailAutocompleter * old;
#line 19 "../src/email-autocompleter.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_EMAIL_AUTOCOMPLETER));
#line 19 "../src/email-autocompleter.vala"
	old = value->data[0].v_pointer;
#line 19 "../src/email-autocompleter.vala"
	if (v_object) {
#line 19 "../src/email-autocompleter.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_EMAIL_AUTOCOMPLETER));
#line 19 "../src/email-autocompleter.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 19 "../src/email-autocompleter.vala"
		value->data[0].v_pointer = v_object;
#line 944 "email-autocompleter.c"
	} else {
#line 19 "../src/email-autocompleter.vala"
		value->data[0].v_pointer = NULL;
#line 948 "email-autocompleter.c"
	}
#line 19 "../src/email-autocompleter.vala"
	if (old) {
#line 19 "../src/email-autocompleter.vala"
		email_autocompleter_unref (old);
#line 954 "email-autocompleter.c"
	}
}

static void
email_autocompleter_class_init (EmailAutocompleterClass * klass,
                                gpointer klass_data)
{
#line 19 "../src/email-autocompleter.vala"
	email_autocompleter_parent_class = g_type_class_peek_parent (klass);
#line 19 "../src/email-autocompleter.vala"
	((EmailAutocompleterClass *) klass)->finalize = email_autocompleter_finalize;
#line 19 "../src/email-autocompleter.vala"
	g_type_class_adjust_private_offset (klass, &EmailAutocompleter_private_offset);
#line 968 "email-autocompleter.c"
}

static void
email_autocompleter_instance_init (EmailAutocompleter * self,
                                   gpointer klass)
{
	gchar* _tmp0_;
#line 19 "../src/email-autocompleter.vala"
	self->priv = email_autocompleter_get_instance_private (self);
#line 23 "../src/email-autocompleter.vala"
	_tmp0_ = g_strdup ("");
#line 23 "../src/email-autocompleter.vala"
	self->priv->prevText = _tmp0_;
#line 19 "../src/email-autocompleter.vala"
	self->ref_count = 1;
#line 984 "email-autocompleter.c"
}

static void
email_autocompleter_finalize (EmailAutocompleter * obj)
{
	EmailAutocompleter * self;
#line 19 "../src/email-autocompleter.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_EMAIL_AUTOCOMPLETER, EmailAutocompleter);
#line 19 "../src/email-autocompleter.vala"
	g_signal_handlers_destroy (self);
#line 21 "../src/email-autocompleter.vala"
	_g_object_unref0 (self->priv->entry);
#line 22 "../src/email-autocompleter.vala"
	self->priv->domains = (_vala_array_free (self->priv->domains, self->priv->domains_length1, (GDestroyNotify) g_free), NULL);
#line 23 "../src/email-autocompleter.vala"
	_g_free0 (self->priv->prevText);
#line 1001 "email-autocompleter.c"
}

static GType
email_autocompleter_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_email_autocompleter_init, value_email_autocompleter_free_value, value_email_autocompleter_copy_value, value_email_autocompleter_peek_pointer, "p", value_email_autocompleter_collect_value, "p", value_email_autocompleter_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (EmailAutocompleterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) email_autocompleter_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EmailAutocompleter), 0, (GInstanceInitFunc) email_autocompleter_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType email_autocompleter_type_id;
	email_autocompleter_type_id = g_type_register_fundamental (g_type_fundamental_next (), "EmailAutocompleter", &g_define_type_info, &g_define_type_fundamental_info, 0);
	EmailAutocompleter_private_offset = g_type_add_instance_private (email_autocompleter_type_id, sizeof (EmailAutocompleterPrivate));
	return email_autocompleter_type_id;
}

GType
email_autocompleter_get_type (void)
{
	static volatile gsize email_autocompleter_type_id__once = 0;
	if (g_once_init_enter (&email_autocompleter_type_id__once)) {
		GType email_autocompleter_type_id;
		email_autocompleter_type_id = email_autocompleter_get_type_once ();
		g_once_init_leave (&email_autocompleter_type_id__once, email_autocompleter_type_id);
	}
	return email_autocompleter_type_id__once;
}

gpointer
email_autocompleter_ref (gpointer instance)
{
	EmailAutocompleter * self;
	self = instance;
#line 19 "../src/email-autocompleter.vala"
	g_atomic_int_inc (&self->ref_count);
#line 19 "../src/email-autocompleter.vala"
	return instance;
#line 1037 "email-autocompleter.c"
}

void
email_autocompleter_unref (gpointer instance)
{
	EmailAutocompleter * self;
	self = instance;
#line 19 "../src/email-autocompleter.vala"
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
#line 19 "../src/email-autocompleter.vala"
		EMAIL_AUTOCOMPLETER_GET_CLASS (self)->finalize (self);
#line 19 "../src/email-autocompleter.vala"
		g_type_free_instance ((GTypeInstance *) self);
#line 1051 "email-autocompleter.c"
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize 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,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

