/* model.c generated by valac 0.56.17, the Vala compiler
 * generated from model.vala, do not modify */

/*
 * Copyright (C) 2010 Michal Hruby <michal.mhr@gmail.com>
 * Copyright (C) 2010 Alberto Aldegheri <albyrock87+dev@gmail.com>
 *
 * 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/>.
 *
 * Authored by Alberto Aldegheri <albyrock87+dev@gmail.com>
 *
 */

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include <synapse-core.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 SYNAPSE_GUI_TYPE_MODEL (synapse_gui_model_get_type ())
#define SYNAPSE_GUI_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYNAPSE_GUI_TYPE_MODEL, SynapseGuiModel))
#define SYNAPSE_GUI_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYNAPSE_GUI_TYPE_MODEL, SynapseGuiModelClass))
#define SYNAPSE_GUI_IS_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYNAPSE_GUI_TYPE_MODEL))
#define SYNAPSE_GUI_IS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYNAPSE_GUI_TYPE_MODEL))
#define SYNAPSE_GUI_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYNAPSE_GUI_TYPE_MODEL, SynapseGuiModelClass))

typedef struct _SynapseGuiModel SynapseGuiModel;
typedef struct _SynapseGuiModelClass SynapseGuiModelClass;
typedef struct _SynapseGuiModelPrivate SynapseGuiModelPrivate;

#define SYNAPSE_GUI_TYPE_ENTRY (synapse_gui_entry_get_type ())
#define SYNAPSE_GUI_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYNAPSE_GUI_TYPE_ENTRY, SynapseGuiEntry))
#define SYNAPSE_GUI_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYNAPSE_GUI_TYPE_ENTRY, SynapseGuiEntryClass))
#define SYNAPSE_GUI_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYNAPSE_GUI_TYPE_ENTRY))
#define SYNAPSE_GUI_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYNAPSE_GUI_TYPE_ENTRY))
#define SYNAPSE_GUI_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYNAPSE_GUI_TYPE_ENTRY, SynapseGuiEntryClass))

typedef struct _SynapseGuiEntry SynapseGuiEntry;
typedef struct _SynapseGuiEntryClass SynapseGuiEntryClass;
typedef enum  {
	SYNAPSE_GUI_SEARCHING_FOR_SOURCES,
	SYNAPSE_GUI_SEARCHING_FOR_ACTIONS,
	SYNAPSE_GUI_SEARCHING_FOR_TARGETS,
	SYNAPSE_GUI_SEARCHING_FOR_COUNT
} SynapseGuiSearchingFor;

#define SYNAPSE_GUI_TYPE_SEARCHING_FOR (synapse_gui_searching_for_get_type ())
enum  {
	SYNAPSE_GUI_MODEL_0_PROPERTY,
	SYNAPSE_GUI_MODEL_NUM_PROPERTIES
};
static GParamSpec* synapse_gui_model_properties[SYNAPSE_GUI_MODEL_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _synapse_gui_entry_unref0(var) ((var == NULL) ? NULL : (var = (synapse_gui_entry_unref (var), NULL)))

struct _SynapseGuiModel {
	GObject parent_instance;
	SynapseGuiModelPrivate * priv;
	gchar** query;
	gint query_length1;
	GeeList** results;
	gint results_length1;
	SynapseGuiEntry** focus;
	gint focus_length1;
	gint selected_category;
	SynapseGuiSearchingFor searching_for;
};

struct _SynapseGuiModelClass {
	GObjectClass parent_class;
};

static gpointer synapse_gui_model_parent_class = NULL;

VALA_EXTERN GType synapse_gui_model_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SynapseGuiModel, g_object_unref)
VALA_EXTERN gpointer synapse_gui_entry_ref (gpointer instance);
VALA_EXTERN void synapse_gui_entry_unref (gpointer instance);
VALA_EXTERN GParamSpec* synapse_gui_param_spec_entry (const gchar* name,
                                          const gchar* nick,
                                          const gchar* blurb,
                                          GType object_type,
                                          GParamFlags flags);
VALA_EXTERN void synapse_gui_value_set_entry (GValue* value,
                                  gpointer v_object);
VALA_EXTERN void synapse_gui_value_take_entry (GValue* value,
                                   gpointer v_object);
VALA_EXTERN gpointer synapse_gui_value_get_entry (const GValue* value);
VALA_EXTERN GType synapse_gui_entry_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SynapseGuiEntry, synapse_gui_entry_unref)
VALA_EXTERN GType synapse_gui_searching_for_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gboolean synapse_gui_model_has_results (SynapseGuiModel* self);
VALA_EXTERN SynapseGuiEntry* synapse_gui_model_get_actual_focus (SynapseGuiModel* self);
VALA_EXTERN void synapse_gui_model_set_actual_focus (SynapseGuiModel* self,
                                         gint i);
VALA_EXTERN void synapse_gui_entry_set_key (SynapseGuiEntry* self,
                                gconstpointer value);
VALA_EXTERN void synapse_gui_entry_set_value (SynapseGuiEntry* self,
                                  gconstpointer value);
VALA_EXTERN gboolean synapse_gui_model_needs_target (SynapseGuiModel* self);
VALA_EXTERN gconstpointer synapse_gui_entry_get_value (SynapseGuiEntry* self);
VALA_EXTERN void synapse_gui_model_clear (SynapseGuiModel* self,
                              gint default_category);
VALA_EXTERN void synapse_gui_model_clear_searching_for (SynapseGuiModel* self,
                                            SynapseGuiSearchingFor i,
                                            gboolean clear_query);
VALA_EXTERN SynapseGuiModel* synapse_gui_model_new (void);
VALA_EXTERN SynapseGuiModel* synapse_gui_model_construct (GType object_type);
static GObject * synapse_gui_model_constructor (GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam * construct_properties);
VALA_EXTERN SynapseGuiEntry* synapse_gui_entry_new (GType k_type,
                                        GBoxedCopyFunc k_dup_func,
                                        GDestroyNotify k_destroy_func,
                                        GType v_type,
                                        GBoxedCopyFunc v_dup_func,
                                        GDestroyNotify v_destroy_func);
VALA_EXTERN SynapseGuiEntry* synapse_gui_entry_construct (GType object_type,
                                              GType k_type,
                                              GBoxedCopyFunc k_dup_func,
                                              GDestroyNotify k_destroy_func,
                                              GType v_type,
                                              GBoxedCopyFunc v_dup_func,
                                              GDestroyNotify v_destroy_func);
static void synapse_gui_model_finalize (GObject * obj);
static GType synapse_gui_model_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);

gboolean
synapse_gui_model_has_results (SynapseGuiModel* self)
{
	gboolean _tmp0_ = FALSE;
	GeeList** _tmp1_;
	gint _tmp1__length1;
	GeeList* _tmp2_;
	gboolean result;
#line 42 "model.vala"
	g_return_val_if_fail (self != NULL, FALSE);
#line 44 "model.vala"
	_tmp1_ = self->results;
#line 44 "model.vala"
	_tmp1__length1 = self->results_length1;
#line 44 "model.vala"
	_tmp2_ = _tmp1_[self->searching_for];
#line 44 "model.vala"
	if (_tmp2_ != NULL) {
#line 184 "model.c"
		GeeList** _tmp3_;
		gint _tmp3__length1;
		GeeList* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
#line 44 "model.vala"
		_tmp3_ = self->results;
#line 44 "model.vala"
		_tmp3__length1 = self->results_length1;
#line 44 "model.vala"
		_tmp4_ = _tmp3_[self->searching_for];
#line 44 "model.vala"
		_tmp5_ = gee_collection_get_size ((GeeCollection*) _tmp4_);
#line 44 "model.vala"
		_tmp6_ = _tmp5_;
#line 44 "model.vala"
		_tmp0_ = _tmp6_ > 0;
#line 202 "model.c"
	} else {
#line 44 "model.vala"
		_tmp0_ = FALSE;
#line 206 "model.c"
	}
#line 44 "model.vala"
	result = _tmp0_;
#line 44 "model.vala"
	return result;
#line 212 "model.c"
}

static gpointer
_synapse_gui_entry_ref0 (gpointer self)
{
#line 49 "model.vala"
	return self ? synapse_gui_entry_ref (self) : NULL;
#line 220 "model.c"
}

SynapseGuiEntry*
synapse_gui_model_get_actual_focus (SynapseGuiModel* self)
{
	SynapseGuiEntry** _tmp0_;
	gint _tmp0__length1;
	SynapseGuiEntry* _tmp1_;
	SynapseGuiEntry* _tmp2_;
	SynapseGuiEntry* result;
#line 47 "model.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 49 "model.vala"
	_tmp0_ = self->focus;
#line 49 "model.vala"
	_tmp0__length1 = self->focus_length1;
#line 49 "model.vala"
	_tmp1_ = _tmp0_[self->searching_for];
#line 49 "model.vala"
	_tmp2_ = _synapse_gui_entry_ref0 (_tmp1_);
#line 49 "model.vala"
	result = _tmp2_;
#line 49 "model.vala"
	return result;
#line 245 "model.c"
}

void
synapse_gui_model_set_actual_focus (SynapseGuiModel* self,
                                    gint i)
{
	SynapseGuiEntry** _tmp0_;
	gint _tmp0__length1;
	SynapseGuiEntry* _tmp1_;
	SynapseGuiEntry** _tmp2_;
	gint _tmp2__length1;
	SynapseGuiEntry* _tmp3_;
	GeeList** _tmp4_;
	gint _tmp4__length1;
	GeeList* _tmp5_;
	gpointer _tmp6_;
	SynapseMatch* _tmp7_;
#line 52 "model.vala"
	g_return_if_fail (self != NULL);
#line 54 "model.vala"
	_tmp0_ = self->focus;
#line 54 "model.vala"
	_tmp0__length1 = self->focus_length1;
#line 54 "model.vala"
	_tmp1_ = _tmp0_[self->searching_for];
#line 54 "model.vala"
	synapse_gui_entry_set_key (_tmp1_, (gpointer) ((gintptr) i));
#line 55 "model.vala"
	_tmp2_ = self->focus;
#line 55 "model.vala"
	_tmp2__length1 = self->focus_length1;
#line 55 "model.vala"
	_tmp3_ = _tmp2_[self->searching_for];
#line 55 "model.vala"
	_tmp4_ = self->results;
#line 55 "model.vala"
	_tmp4__length1 = self->results_length1;
#line 55 "model.vala"
	_tmp5_ = _tmp4_[self->searching_for];
#line 55 "model.vala"
	_tmp6_ = gee_list_get (_tmp5_, i);
#line 55 "model.vala"
	_tmp7_ = (SynapseMatch*) _tmp6_;
#line 55 "model.vala"
	synapse_gui_entry_set_value (_tmp3_, _tmp7_);
#line 55 "model.vala"
	_g_object_unref0 (_tmp7_);
#line 293 "model.c"
}

gboolean
synapse_gui_model_needs_target (SynapseGuiModel* self)
{
	gboolean _tmp0_ = FALSE;
	SynapseGuiEntry** _tmp1_;
	gint _tmp1__length1;
	SynapseGuiEntry* _tmp2_;
	gconstpointer _tmp3_;
	gconstpointer _tmp4_;
	gboolean result;
#line 58 "model.vala"
	g_return_val_if_fail (self != NULL, FALSE);
#line 60 "model.vala"
	_tmp1_ = self->focus;
#line 60 "model.vala"
	_tmp1__length1 = self->focus_length1;
#line 60 "model.vala"
	_tmp2_ = _tmp1_[SYNAPSE_GUI_SEARCHING_FOR_ACTIONS];
#line 60 "model.vala"
	_tmp3_ = synapse_gui_entry_get_value (_tmp2_);
#line 60 "model.vala"
	_tmp4_ = _tmp3_;
#line 60 "model.vala"
	if (((SynapseMatch*) _tmp4_) != NULL) {
#line 320 "model.c"
		SynapseGuiEntry** _tmp5_;
		gint _tmp5__length1;
		SynapseGuiEntry* _tmp6_;
		gconstpointer _tmp7_;
		gconstpointer _tmp8_;
#line 61 "model.vala"
		_tmp5_ = self->focus;
#line 61 "model.vala"
		_tmp5__length1 = self->focus_length1;
#line 61 "model.vala"
		_tmp6_ = _tmp5_[SYNAPSE_GUI_SEARCHING_FOR_ACTIONS];
#line 61 "model.vala"
		_tmp7_ = synapse_gui_entry_get_value (_tmp6_);
#line 61 "model.vala"
		_tmp8_ = _tmp7_;
#line 61 "model.vala"
		_tmp0_ = synapse_match_needs_target ((SynapseMatch*) _tmp8_);
#line 338 "model.c"
	} else {
#line 60 "model.vala"
		_tmp0_ = FALSE;
#line 342 "model.c"
	}
#line 60 "model.vala"
	result = _tmp0_;
#line 60 "model.vala"
	return result;
#line 348 "model.c"
}

void
synapse_gui_model_clear (SynapseGuiModel* self,
                         gint default_category)
{
#line 64 "model.vala"
	g_return_if_fail (self != NULL);
#line 66 "model.vala"
	self->searching_for = SYNAPSE_GUI_SEARCHING_FOR_SOURCES;
#line 359 "model.c"
	{
		gint i = 0;
#line 67 "model.vala"
		i = 0;
#line 364 "model.c"
		{
			gboolean _tmp0_ = FALSE;
#line 67 "model.vala"
			_tmp0_ = TRUE;
#line 67 "model.vala"
			while (TRUE) {
#line 371 "model.c"
				SynapseGuiEntry** _tmp2_;
				gint _tmp2__length1;
				SynapseGuiEntry* _tmp3_;
				SynapseGuiEntry** _tmp4_;
				gint _tmp4__length1;
				SynapseGuiEntry* _tmp5_;
				GeeList** _tmp6_;
				gint _tmp6__length1;
				gchar** _tmp7_;
				gint _tmp7__length1;
				gchar* _tmp8_;
#line 67 "model.vala"
				if (!_tmp0_) {
#line 385 "model.c"
					gint _tmp1_;
#line 67 "model.vala"
					_tmp1_ = i;
#line 67 "model.vala"
					i = _tmp1_ + 1;
#line 391 "model.c"
				}
#line 67 "model.vala"
				_tmp0_ = FALSE;
#line 67 "model.vala"
				if (!(i < ((gint) SYNAPSE_GUI_SEARCHING_FOR_COUNT))) {
#line 67 "model.vala"
					break;
#line 399 "model.c"
				}
#line 69 "model.vala"
				_tmp2_ = self->focus;
#line 69 "model.vala"
				_tmp2__length1 = self->focus_length1;
#line 69 "model.vala"
				_tmp3_ = _tmp2_[i];
#line 69 "model.vala"
				synapse_gui_entry_set_key (_tmp3_, (gpointer) ((gintptr) 0));
#line 70 "model.vala"
				_tmp4_ = self->focus;
#line 70 "model.vala"
				_tmp4__length1 = self->focus_length1;
#line 70 "model.vala"
				_tmp5_ = _tmp4_[i];
#line 70 "model.vala"
				synapse_gui_entry_set_value (_tmp5_, NULL);
#line 71 "model.vala"
				_tmp6_ = self->results;
#line 71 "model.vala"
				_tmp6__length1 = self->results_length1;
#line 71 "model.vala"
				_g_object_unref0 (_tmp6_[i]);
#line 71 "model.vala"
				_tmp6_[i] = NULL;
#line 72 "model.vala"
				_tmp7_ = self->query;
#line 72 "model.vala"
				_tmp7__length1 = self->query_length1;
#line 72 "model.vala"
				_tmp8_ = g_strdup ("");
#line 72 "model.vala"
				_g_free0 (_tmp7_[i]);
#line 72 "model.vala"
				_tmp7_[i] = _tmp8_;
#line 435 "model.c"
			}
		}
	}
#line 74 "model.vala"
	if (default_category >= 0) {
#line 75 "model.vala"
		self->selected_category = default_category;
#line 443 "model.c"
	}
}

void
synapse_gui_model_clear_searching_for (SynapseGuiModel* self,
                                       SynapseGuiSearchingFor i,
                                       gboolean clear_query)
{
	SynapseGuiEntry** _tmp0_;
	gint _tmp0__length1;
	SynapseGuiEntry* _tmp1_;
	SynapseGuiEntry** _tmp2_;
	gint _tmp2__length1;
	SynapseGuiEntry* _tmp3_;
	GeeList** _tmp4_;
	gint _tmp4__length1;
#line 78 "model.vala"
	g_return_if_fail (self != NULL);
#line 81 "model.vala"
	_tmp0_ = self->focus;
#line 81 "model.vala"
	_tmp0__length1 = self->focus_length1;
#line 81 "model.vala"
	_tmp1_ = _tmp0_[i];
#line 81 "model.vala"
	synapse_gui_entry_set_key (_tmp1_, (gpointer) ((gintptr) 0));
#line 82 "model.vala"
	_tmp2_ = self->focus;
#line 82 "model.vala"
	_tmp2__length1 = self->focus_length1;
#line 82 "model.vala"
	_tmp3_ = _tmp2_[i];
#line 82 "model.vala"
	synapse_gui_entry_set_value (_tmp3_, NULL);
#line 83 "model.vala"
	_tmp4_ = self->results;
#line 83 "model.vala"
	_tmp4__length1 = self->results_length1;
#line 83 "model.vala"
	_g_object_unref0 (_tmp4_[i]);
#line 83 "model.vala"
	_tmp4_[i] = NULL;
#line 84 "model.vala"
	if (clear_query) {
#line 488 "model.c"
		gchar** _tmp5_;
		gint _tmp5__length1;
		gchar* _tmp6_;
#line 84 "model.vala"
		_tmp5_ = self->query;
#line 84 "model.vala"
		_tmp5__length1 = self->query_length1;
#line 84 "model.vala"
		_tmp6_ = g_strdup ("");
#line 84 "model.vala"
		_g_free0 (_tmp5_[i]);
#line 84 "model.vala"
		_tmp5_[i] = _tmp6_;
#line 502 "model.c"
	}
}

SynapseGuiModel*
synapse_gui_model_construct (GType object_type)
{
	SynapseGuiModel * self = NULL;
#line 24 "model.vala"
	self = (SynapseGuiModel*) g_object_new (object_type, NULL);
#line 24 "model.vala"
	return self;
#line 514 "model.c"
}

SynapseGuiModel*
synapse_gui_model_new (void)
{
#line 24 "model.vala"
	return synapse_gui_model_construct (SYNAPSE_GUI_TYPE_MODEL);
#line 522 "model.c"
}

static GObject *
synapse_gui_model_constructor (GType type,
                               guint n_construct_properties,
                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SynapseGuiModel * self;
#line 87 "model.vala"
	parent_class = G_OBJECT_CLASS (synapse_gui_model_parent_class);
#line 87 "model.vala"
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
#line 87 "model.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SYNAPSE_GUI_TYPE_MODEL, SynapseGuiModel);
#line 539 "model.c"
	{
		gint i = 0;
#line 89 "model.vala"
		i = 0;
#line 544 "model.c"
		{
			gboolean _tmp0_ = FALSE;
#line 89 "model.vala"
			_tmp0_ = TRUE;
#line 89 "model.vala"
			while (TRUE) {
#line 551 "model.c"
				SynapseGuiEntry** _tmp2_;
				gint _tmp2__length1;
				SynapseGuiEntry* _tmp3_;
#line 89 "model.vala"
				if (!_tmp0_) {
#line 557 "model.c"
					gint _tmp1_;
#line 89 "model.vala"
					_tmp1_ = i;
#line 89 "model.vala"
					i = _tmp1_ + 1;
#line 563 "model.c"
				}
#line 89 "model.vala"
				_tmp0_ = FALSE;
#line 89 "model.vala"
				if (!(i < ((gint) SYNAPSE_GUI_SEARCHING_FOR_COUNT))) {
#line 89 "model.vala"
					break;
#line 571 "model.c"
				}
#line 91 "model.vala"
				_tmp2_ = self->focus;
#line 91 "model.vala"
				_tmp2__length1 = self->focus_length1;
#line 91 "model.vala"
				_tmp3_ = synapse_gui_entry_new (G_TYPE_INT, NULL, NULL, SYNAPSE_TYPE_MATCH, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
#line 91 "model.vala"
				_synapse_gui_entry_unref0 (_tmp2_[i]);
#line 91 "model.vala"
				_tmp2_[i] = _tmp3_;
#line 583 "model.c"
			}
		}
	}
#line 93 "model.vala"
	synapse_gui_model_clear (self, -1);
#line 87 "model.vala"
	return obj;
#line 591 "model.c"
}

static void
synapse_gui_model_class_init (SynapseGuiModelClass * klass,
                              gpointer klass_data)
{
#line 24 "model.vala"
	synapse_gui_model_parent_class = g_type_class_peek_parent (klass);
#line 24 "model.vala"
	G_OBJECT_CLASS (klass)->constructor = synapse_gui_model_constructor;
#line 24 "model.vala"
	G_OBJECT_CLASS (klass)->finalize = synapse_gui_model_finalize;
#line 604 "model.c"
}

static void
synapse_gui_model_instance_init (SynapseGuiModel * self,
                                 gpointer klass)
{
	gchar** _tmp0_;
	GeeList** _tmp1_;
	SynapseGuiEntry** _tmp2_;
#line 27 "model.vala"
	_tmp0_ = g_new0 (gchar*, SYNAPSE_GUI_SEARCHING_FOR_COUNT + 1);
#line 27 "model.vala"
	self->query = _tmp0_;
#line 27 "model.vala"
	self->query_length1 = SYNAPSE_GUI_SEARCHING_FOR_COUNT;
#line 30 "model.vala"
	_tmp1_ = g_new0 (GeeList*, SYNAPSE_GUI_SEARCHING_FOR_COUNT + 1);
#line 30 "model.vala"
	self->results = _tmp1_;
#line 30 "model.vala"
	self->results_length1 = SYNAPSE_GUI_SEARCHING_FOR_COUNT;
#line 33 "model.vala"
	_tmp2_ = g_new0 (SynapseGuiEntry*, SYNAPSE_GUI_SEARCHING_FOR_COUNT + 1);
#line 33 "model.vala"
	self->focus = _tmp2_;
#line 33 "model.vala"
	self->focus_length1 = SYNAPSE_GUI_SEARCHING_FOR_COUNT;
#line 36 "model.vala"
	self->selected_category = 0;
#line 39 "model.vala"
	self->searching_for = SYNAPSE_GUI_SEARCHING_FOR_SOURCES;
#line 636 "model.c"
}

static void
synapse_gui_model_finalize (GObject * obj)
{
	SynapseGuiModel * self;
#line 24 "model.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SYNAPSE_GUI_TYPE_MODEL, SynapseGuiModel);
#line 27 "model.vala"
	self->query = (_vala_array_free (self->query, self->query_length1, (GDestroyNotify) g_free), NULL);
#line 30 "model.vala"
	self->results = (_vala_array_free (self->results, self->results_length1, (GDestroyNotify) g_object_unref), NULL);
#line 33 "model.vala"
	self->focus = (_vala_array_free (self->focus, self->focus_length1, (GDestroyNotify) synapse_gui_entry_unref), NULL);
#line 24 "model.vala"
	G_OBJECT_CLASS (synapse_gui_model_parent_class)->finalize (obj);
#line 653 "model.c"
}

static GType
synapse_gui_model_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SynapseGuiModelClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) synapse_gui_model_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SynapseGuiModel), 0, (GInstanceInitFunc) synapse_gui_model_instance_init, NULL };
	GType synapse_gui_model_type_id;
	synapse_gui_model_type_id = g_type_register_static (G_TYPE_OBJECT, "SynapseGuiModel", &g_define_type_info, 0);
	return synapse_gui_model_type_id;
}

GType
synapse_gui_model_get_type (void)
{
	static volatile gsize synapse_gui_model_type_id__once = 0;
	if (g_once_init_enter (&synapse_gui_model_type_id__once)) {
		GType synapse_gui_model_type_id;
		synapse_gui_model_type_id = synapse_gui_model_get_type_once ();
		g_once_init_leave (&synapse_gui_model_type_id__once, synapse_gui_model_type_id);
	}
	return synapse_gui_model_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
#line 24 "controller.vala"
	if ((array != NULL) && (destroy_func != NULL)) {
#line 684 "model.c"
		gssize i;
#line 24 "controller.vala"
		for (i = 0; i < array_length; i = i + 1) {
#line 24 "controller.vala"
			if (((gpointer*) array)[i] != NULL) {
#line 24 "controller.vala"
				destroy_func (((gpointer*) array)[i]);
#line 692 "model.c"
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
#line 24 "controller.vala"
	_vala_array_destroy (array, array_length, destroy_func);
#line 24 "controller.vala"
	g_free (array);
#line 707 "model.c"
}

