/* tracker-entry.c generated by valac, the Vala compiler
 * generated from tracker-entry.gs, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>
#include <glib/gstdio.h>


#define TYPE_TRACKER_SEARCH_ENTRY (tracker_search_entry_get_type ())
#define TRACKER_SEARCH_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRACKER_SEARCH_ENTRY, TrackerSearchEntry))
#define TRACKER_SEARCH_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRACKER_SEARCH_ENTRY, TrackerSearchEntryClass))
#define IS_TRACKER_SEARCH_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRACKER_SEARCH_ENTRY))
#define IS_TRACKER_SEARCH_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRACKER_SEARCH_ENTRY))
#define TRACKER_SEARCH_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRACKER_SEARCH_ENTRY, TrackerSearchEntryClass))

typedef struct _TrackerSearchEntry TrackerSearchEntry;
typedef struct _TrackerSearchEntryClass TrackerSearchEntryClass;
typedef struct _TrackerSearchEntryPrivate TrackerSearchEntryPrivate;

#define TYPE_TRACKER_QUERY (tracker_query_get_type ())
#define TRACKER_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRACKER_QUERY, TrackerQuery))
#define TRACKER_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRACKER_QUERY, TrackerQueryClass))
#define IS_TRACKER_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRACKER_QUERY))
#define IS_TRACKER_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRACKER_QUERY))
#define TRACKER_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRACKER_QUERY, TrackerQueryClass))

typedef struct _TrackerQuery TrackerQuery;
typedef struct _TrackerQueryClass TrackerQueryClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _fclose0(var) ((var == NULL) ? NULL : (var = (fclose (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _TrackerSearchEntry {
	GtkComboBoxEntry parent_instance;
	TrackerSearchEntryPrivate * priv;
	guint id_invoker;
	GtkEntry* entry;
	GeeArrayList* history;
	char* histfilename;
	FILE* histfile;
};

struct _TrackerSearchEntryClass {
	GtkComboBoxEntryClass parent_class;
};

struct _TrackerSearchEntryPrivate {
	TrackerQuery* _Query;
};


static gpointer tracker_search_entry_parent_class = NULL;
static GtkActivatableIface* tracker_search_entry_gtk_activatable_parent_iface = NULL;

#define RUN_DELAY 500
#define TOO_SHORT 2
GType tracker_search_entry_get_type (void) G_GNUC_CONST;
GType tracker_query_get_type (void) G_GNUC_CONST;
#define TRACKER_SEARCH_ENTRY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_TRACKER_SEARCH_ENTRY, TrackerSearchEntryPrivate))
enum  {
	TRACKER_SEARCH_ENTRY_DUMMY_PROPERTY,
	TRACKER_SEARCH_ENTRY_QUERY
};
void tracker_query_set_SearchTerms (TrackerQuery* self, const char* value);
TrackerQuery* tracker_search_entry_get_Query (TrackerSearchEntry* self);
static gboolean tracker_search_entry_run_query (TrackerSearchEntry* self);
static gboolean _tracker_search_entry_run_query_gsource_func (gpointer self);
static void tracker_search_entry_entry_changed (TrackerSearchEntry* self);
static void tracker_search_entry_entry_activate (TrackerSearchEntry* self);
char* tracker_utils_EscapeSparql (const char* sparql, gboolean add_wildcard);
void tracker_search_entry_history_handler (TrackerSearchEntry* self, const char* text);
static void tracker_search_entry_real_sync_action_properties (GtkActivatable* base, GtkAction* action);
static void tracker_search_entry_real_update (GtkActivatable* base, GtkAction* action, const char* prop);
TrackerSearchEntry* tracker_search_entry_new (void);
TrackerSearchEntry* tracker_search_entry_construct (GType object_type);
void tracker_search_entry_set_Query (TrackerSearchEntry* self, TrackerQuery* value);
static void _tracker_search_entry_entry_activate_gtk_entry_activate (GtkEntry* _sender, gpointer self);
static void _tracker_search_entry_entry_changed_gtk_editable_changed (GtkEntry* _sender, gpointer self);
static void _lambda1_ (GtkEntryIconPosition p0, TrackerSearchEntry* self);
static void __lambda1__gtk_entry_icon_press (GtkEntry* _sender, GtkEntryIconPosition p0, GdkEvent* p1, gpointer self);
static GObject * tracker_search_entry_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void tracker_search_entry_finalize (GObject* obj);
static void tracker_search_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void tracker_search_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);
static int _vala_strcmp0 (const char * str1, const char * str2);



#line 93 "tracker-entry.gs"
static gboolean _tracker_search_entry_run_query_gsource_func (gpointer self) {
#line 104 "tracker-entry.c"
	gboolean result;
	result = tracker_search_entry_run_query (self);
	return result;
}


#line 79 "tracker-entry.gs"
static void tracker_search_entry_entry_changed (TrackerSearchEntry* self) {
#line 79 "tracker-entry.gs"
	g_return_if_fail (self != NULL);
#line 80 "tracker-entry.gs"
	if (gtk_entry_get_text (self->entry) == NULL) {
#line 81 "tracker-entry.gs"
		tracker_query_set_SearchTerms (self->priv->_Query, "");
#line 82 "tracker-entry.gs"
		if (self->id_invoker != 0) {
#line 83 "tracker-entry.gs"
			g_source_remove (self->id_invoker);
#line 84 "tracker-entry.gs"
			self->id_invoker = (guint) 0;
#line 125 "tracker-entry.c"
		}
	} else {
#line 86 "tracker-entry.gs"
		if (self->id_invoker != 0) {
#line 87 "tracker-entry.gs"
			g_source_remove (self->id_invoker);
#line 132 "tracker-entry.c"
		}
#line 88 "tracker-entry.gs"
		self->id_invoker = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) RUN_DELAY, _tracker_search_entry_run_query_gsource_func, g_object_ref (self), g_object_unref);
#line 136 "tracker-entry.c"
	}
}


#line 90 "tracker-entry.gs"
static void tracker_search_entry_entry_activate (TrackerSearchEntry* self) {
#line 90 "tracker-entry.gs"
	g_return_if_fail (self != NULL);
#line 91 "tracker-entry.gs"
	gtk_widget_grab_focus ((GtkWidget*) self->entry);
#line 147 "tracker-entry.c"
}


#line 93 "tracker-entry.gs"
static gboolean tracker_search_entry_run_query (TrackerSearchEntry* self) {
#line 153 "tracker-entry.c"
	gboolean result = FALSE;
	char* txt;
	gboolean _tmp0_ = FALSE;
	char* _tmp1_;
#line 93 "tracker-entry.gs"
	g_return_val_if_fail (self != NULL, FALSE);
#line 94 "tracker-entry.gs"
	txt = g_strdup (gtk_entry_get_text (self->entry));
#line 95 "tracker-entry.gs"
	if (txt == NULL) {
#line 95 "tracker-entry.gs"
		_tmp0_ = TRUE;
#line 166 "tracker-entry.c"
	} else {
#line 95 "tracker-entry.gs"
		_tmp0_ = _vala_strcmp0 (txt, "") == 0;
#line 170 "tracker-entry.c"
	}
#line 95 "tracker-entry.gs"
	if (_tmp0_) {
#line 96 "tracker-entry.gs"
		tracker_query_set_SearchTerms (self->priv->_Query, "");
#line 176 "tracker-entry.c"
		result = FALSE;
		_g_free0 (txt);
#line 97 "tracker-entry.gs"
		return result;
#line 181 "tracker-entry.c"
	}
#line 99 "tracker-entry.gs"
	tracker_query_set_SearchTerms (self->priv->_Query, _tmp1_ = tracker_utils_EscapeSparql (txt, TRUE));
#line 185 "tracker-entry.c"
	_g_free0 (_tmp1_);
#line 101 "tracker-entry.gs"
	tracker_search_entry_history_handler (self, txt);
#line 189 "tracker-entry.c"
	result = FALSE;
	_g_free0 (txt);
#line 102 "tracker-entry.gs"
	return result;
#line 194 "tracker-entry.c"
}


#line 1026 "glib-2.0.vapi"
static char* string_strip (const char* self) {
#line 200 "tracker-entry.c"
	char* result = NULL;
	char* _result_;
#line 1026 "glib-2.0.vapi"
	g_return_val_if_fail (self != NULL, NULL);
#line 1027 "glib-2.0.vapi"
	_result_ = g_strdup (self);
#line 1028 "glib-2.0.vapi"
	g_strstrip (_result_);
#line 209 "tracker-entry.c"
	result = _result_;
#line 1029 "glib-2.0.vapi"
	return result;
#line 213 "tracker-entry.c"
}


#line 104 "tracker-entry.gs"
void tracker_search_entry_history_handler (TrackerSearchEntry* self, const char* text) {
#line 219 "tracker-entry.c"
	char* txt;
	char* _tmp0_;
#line 104 "tracker-entry.gs"
	g_return_if_fail (self != NULL);
#line 104 "tracker-entry.gs"
	g_return_if_fail (text != NULL);
#line 108 "tracker-entry.gs"
	txt = string_strip (text);
#line 113 "tracker-entry.gs"
	txt = (_tmp0_ = g_utf8_normalize (txt, (gssize) (-1), G_NORMALIZE_NFC), _g_free0 (txt), _tmp0_);
#line 115 "tracker-entry.gs"
	if (g_utf8_strlen (txt, -1) > TOO_SHORT) {
#line 232 "tracker-entry.c"
		FILE* _tmp1_;
		FILE* _tmp2_;
		gboolean _tmp3_;
		{
			GeeIterator* _item_it;
#line 118 "tracker-entry.gs"
			_item_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) self->history);
#line 118 "tracker-entry.gs"
			while (TRUE) {
#line 242 "tracker-entry.c"
				char* item;
#line 118 "tracker-entry.gs"
				if (!gee_iterator_next (_item_it)) {
#line 118 "tracker-entry.gs"
					break;
#line 248 "tracker-entry.c"
				}
#line 118 "tracker-entry.gs"
				item = (char*) gee_iterator_get (_item_it);
#line 119 "tracker-entry.gs"
				if (_vala_strcmp0 (txt, item) == 0) {
#line 254 "tracker-entry.c"
					_g_free0 (item);
					_g_object_unref0 (_item_it);
					_g_free0 (txt);
#line 120 "tracker-entry.gs"
					return;
#line 260 "tracker-entry.c"
				}
				_g_free0 (item);
			}
			_g_object_unref0 (_item_it);
		}
#line 122 "tracker-entry.gs"
		gee_abstract_collection_add ((GeeAbstractCollection*) self->history, txt);
#line 123 "tracker-entry.gs"
		gtk_combo_box_prepend_text ((GtkComboBox*) self, txt);
#line 124 "tracker-entry.gs"
		self->histfile = (_tmp1_ = fopen (self->histfilename, "a"), _fclose0 (self->histfile), _tmp1_);
#line 125 "tracker-entry.gs"
		if ((_tmp3_ = (_tmp2_ = fopen (self->histfilename, "a")) != NULL, _fclose0 (_tmp2_), _tmp3_)) {
#line 126 "tracker-entry.gs"
			fprintf (self->histfile, "%s\n", txt);
#line 276 "tracker-entry.c"
		} else {
#line 128 "tracker-entry.gs"
			g_print ("error: '%s' is not writable\n", self->histfilename);
#line 280 "tracker-entry.c"
		}
	}
	_g_free0 (txt);
}


#line 130 "tracker-entry.gs"
static void tracker_search_entry_real_sync_action_properties (GtkActivatable* base, GtkAction* action) {
#line 289 "tracker-entry.c"
	TrackerSearchEntry * self;
	self = (TrackerSearchEntry*) base;
#line 130 "tracker-entry.gs"
	g_return_if_fail (action != NULL);
#line 131 "tracker-entry.gs"
	return;
#line 296 "tracker-entry.c"
}


#line 133 "tracker-entry.gs"
static void tracker_search_entry_real_update (GtkActivatable* base, GtkAction* action, const char* prop) {
#line 302 "tracker-entry.c"
	TrackerSearchEntry * self;
	self = (TrackerSearchEntry*) base;
#line 133 "tracker-entry.gs"
	g_return_if_fail (action != NULL);
#line 133 "tracker-entry.gs"
	g_return_if_fail (prop != NULL);
#line 134 "tracker-entry.gs"
	return;
#line 311 "tracker-entry.c"
}


#line 33 "tracker-entry.gs"
TrackerSearchEntry* tracker_search_entry_construct (GType object_type) {
#line 317 "tracker-entry.c"
	TrackerSearchEntry * self;
	self = g_object_newv (object_type, 0, NULL);
	return self;
}


#line 33 "tracker-entry.gs"
TrackerSearchEntry* tracker_search_entry_new (void) {
#line 33 "tracker-entry.gs"
	return tracker_search_entry_construct (TYPE_TRACKER_SEARCH_ENTRY);
#line 328 "tracker-entry.c"
}


TrackerQuery* tracker_search_entry_get_Query (TrackerSearchEntry* self) {
	TrackerQuery* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self->priv->_Query;
#line 40 "tracker-entry.gs"
	return result;
#line 338 "tracker-entry.c"
}


void tracker_search_entry_set_Query (TrackerSearchEntry* self, TrackerQuery* value) {
	g_return_if_fail (self != NULL);
	self->priv->_Query = value;
	g_object_notify ((GObject *) self, "Query");
}


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


#line 90 "tracker-entry.gs"
static void _tracker_search_entry_entry_activate_gtk_entry_activate (GtkEntry* _sender, gpointer self) {
#line 356 "tracker-entry.c"
	tracker_search_entry_entry_activate (self);
}


#line 79 "tracker-entry.gs"
static void _tracker_search_entry_entry_changed_gtk_editable_changed (GtkEntry* _sender, gpointer self) {
#line 363 "tracker-entry.c"
	tracker_search_entry_entry_changed (self);
}


#line 60 "tracker-entry.gs"
static void _lambda1_ (GtkEntryIconPosition p0, TrackerSearchEntry* self) {
#line 61 "tracker-entry.gs"
	if (p0 == GTK_ENTRY_ICON_SECONDARY) {
#line 62 "tracker-entry.gs"
		gtk_entry_set_text (self->entry, "");
#line 374 "tracker-entry.c"
	}
}


#line 60 "tracker-entry.gs"
static void __lambda1__gtk_entry_icon_press (GtkEntry* _sender, GtkEntryIconPosition p0, GdkEvent* p1, gpointer self) {
#line 381 "tracker-entry.c"
	_lambda1_ (p0, self);
}


static GObject * tracker_search_entry_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	TrackerSearchEntry * self;
	GError * _inner_error_;
	parent_class = G_OBJECT_CLASS (tracker_search_entry_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = TRACKER_SEARCH_ENTRY (obj);
	_inner_error_ = NULL;
	{
		GtkEntry* _tmp1_;
		GtkWidget* _tmp0_;
		GtkListStore* model;
		GtkEntryCompletion* completion;
		char* _tmp2_;
		char* temp;
		GeeArrayList* _tmp3_;
#line 43 "tracker-entry.gs"
		self->entry = (_tmp1_ = _g_object_ref0 ((_tmp0_ = gtk_bin_get_child ((GtkBin*) self), GTK_IS_ENTRY (_tmp0_) ? ((GtkEntry*) _tmp0_) : NULL)), _g_object_unref0 (self->entry), _tmp1_);
#line 44 "tracker-entry.gs"
		gtk_entry_set_icon_from_stock (self->entry, GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR);
#line 45 "tracker-entry.gs"
		gtk_entry_set_icon_sensitive (self->entry, GTK_ENTRY_ICON_SECONDARY, TRUE);
#line 46 "tracker-entry.gs"
		gtk_entry_set_icon_tooltip_text (self->entry, GTK_ENTRY_ICON_SECONDARY, _ ("Clear the search text"));
#line 49 "tracker-entry.gs"
		model = gtk_list_store_new (1, G_TYPE_STRING, NULL);
#line 50 "tracker-entry.gs"
		gtk_combo_box_set_model ((GtkComboBox*) self, (GtkTreeModel*) model);
#line 51 "tracker-entry.gs"
		gtk_combo_box_entry_set_text_column ((GtkComboBoxEntry*) self, 0);
#line 53 "tracker-entry.gs"
		completion = gtk_entry_completion_new ();
#line 54 "tracker-entry.gs"
		gtk_entry_completion_set_model (completion, (GtkTreeModel*) model);
#line 55 "tracker-entry.gs"
		gtk_entry_completion_set_text_column (completion, 0);
#line 56 "tracker-entry.gs"
		gtk_entry_set_completion (self->entry, completion);
#line 58 "tracker-entry.gs"
		g_signal_connect_object (self->entry, "activate", (GCallback) _tracker_search_entry_entry_activate_gtk_entry_activate, self, 0);
#line 59 "tracker-entry.gs"
		g_signal_connect_object ((GtkEditable*) self->entry, "changed", (GCallback) _tracker_search_entry_entry_changed_gtk_editable_changed, self, 0);
#line 60 "tracker-entry.gs"
		g_signal_connect_object (self->entry, "icon-press", (GCallback) __lambda1__gtk_entry_icon_press, self, 0);
#line 64 "tracker-entry.gs"
		self->histfilename = (_tmp2_ = g_build_filename (g_get_user_data_dir (), "tracker", "history", NULL, NULL), _g_free0 (self->histfilename), _tmp2_);
#line 66 "tracker-entry.gs"
		temp = g_strdup ("");
#line 67 "tracker-entry.gs"
		self->history = (_tmp3_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, g_str_equal), _g_object_unref0 (self->history), _tmp3_);
#line 437 "tracker-entry.c"
		{
			char* _tmp5_;
			char* _tmp4_ = NULL;
#line 71 "tracker-entry.gs"
			g_file_get_contents (self->histfilename, &_tmp4_, NULL, &_inner_error_);
#line 71 "tracker-entry.gs"
			temp = (_tmp5_ = _tmp4_, _g_free0 (temp), _tmp5_);
#line 445 "tracker-entry.c"
			if (_inner_error_ != NULL) {
				if (_inner_error_->domain == G_FILE_ERROR) {
					goto __catch3_g_file_error;
				}
				_g_free0 (temp);
				_g_object_unref0 (completion);
				_g_object_unref0 (model);
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
			}
			{
				char** _tmp6_;
				char** item_collection;
				int item_collection_length1;
				int item_it;
#line 72 "tracker-entry.gs"
				item_collection = _tmp6_ = g_strsplit (temp, "\n", 0);
#line 463 "tracker-entry.c"
				item_collection_length1 = _vala_array_length (_tmp6_);
				for (item_it = 0; item_it < _vala_array_length (_tmp6_); item_it = item_it + 1) {
					char* item;
					item = g_strdup (item_collection[item_it]);
					{
#line 73 "tracker-entry.gs"
						if (g_utf8_strlen (item, -1) > TOO_SHORT) {
#line 74 "tracker-entry.gs"
							gtk_combo_box_prepend_text ((GtkComboBox*) self, item);
#line 75 "tracker-entry.gs"
							gee_abstract_collection_add ((GeeAbstractCollection*) self->history, item);
#line 475 "tracker-entry.c"
						}
						_g_free0 (item);
					}
				}
#line 72 "tracker-entry.gs"
				item_collection = (_vala_array_free (item_collection, item_collection_length1, (GDestroyNotify) g_free), NULL);
#line 482 "tracker-entry.c"
			}
		}
		goto __finally3;
		__catch3_g_file_error:
		{
			GError * e;
			e = _inner_error_;
			_inner_error_ = NULL;
			{
				char* _tmp7_;
#line 77 "tracker-entry.gs"
				g_print ("%s", _tmp7_ = g_strconcat (e->message, "\n", NULL));
#line 495 "tracker-entry.c"
				_g_free0 (_tmp7_);
				_g_error_free0 (e);
			}
		}
		__finally3:
		if (_inner_error_ != NULL) {
			_g_free0 (temp);
			_g_object_unref0 (completion);
			_g_object_unref0 (model);
			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_);
		}
		_g_free0 (temp);
		_g_object_unref0 (completion);
		_g_object_unref0 (model);
	}
	return obj;
}


static void tracker_search_entry_class_init (TrackerSearchEntryClass * klass) {
	tracker_search_entry_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (TrackerSearchEntryPrivate));
	G_OBJECT_CLASS (klass)->get_property = tracker_search_entry_get_property;
	G_OBJECT_CLASS (klass)->set_property = tracker_search_entry_set_property;
	G_OBJECT_CLASS (klass)->constructor = tracker_search_entry_constructor;
	G_OBJECT_CLASS (klass)->finalize = tracker_search_entry_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TRACKER_SEARCH_ENTRY_QUERY, g_param_spec_object ("Query", "Query", "Query", TYPE_TRACKER_QUERY, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
}


static void tracker_search_entry_gtk_activatable_interface_init (GtkActivatableIface * iface) {
	tracker_search_entry_gtk_activatable_parent_iface = g_type_interface_peek_parent (iface);
	iface->sync_action_properties = tracker_search_entry_real_sync_action_properties;
	iface->update = tracker_search_entry_real_update;
}


static void tracker_search_entry_instance_init (TrackerSearchEntry * self) {
	self->priv = TRACKER_SEARCH_ENTRY_GET_PRIVATE (self);
	self->id_invoker = (guint) 0;
}


static void tracker_search_entry_finalize (GObject* obj) {
	TrackerSearchEntry * self;
	self = TRACKER_SEARCH_ENTRY (obj);
	_g_object_unref0 (self->entry);
	_g_object_unref0 (self->history);
	_g_free0 (self->histfilename);
	_fclose0 (self->histfile);
	G_OBJECT_CLASS (tracker_search_entry_parent_class)->finalize (obj);
}


GType tracker_search_entry_get_type (void) {
	static volatile gsize tracker_search_entry_type_id__volatile = 0;
	if (g_once_init_enter (&tracker_search_entry_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TrackerSearchEntryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_search_entry_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerSearchEntry), 0, (GInstanceInitFunc) tracker_search_entry_instance_init, NULL };
		static const GInterfaceInfo gtk_activatable_info = { (GInterfaceInitFunc) tracker_search_entry_gtk_activatable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType tracker_search_entry_type_id;
		tracker_search_entry_type_id = g_type_register_static (GTK_TYPE_COMBO_BOX_ENTRY, "TrackerSearchEntry", &g_define_type_info, 0);
		g_type_add_interface_static (tracker_search_entry_type_id, GTK_TYPE_ACTIVATABLE, &gtk_activatable_info);
		g_once_init_leave (&tracker_search_entry_type_id__volatile, tracker_search_entry_type_id);
	}
	return tracker_search_entry_type_id__volatile;
}


static void tracker_search_entry_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	TrackerSearchEntry * self;
	self = TRACKER_SEARCH_ENTRY (object);
	switch (property_id) {
		case TRACKER_SEARCH_ENTRY_QUERY:
		g_value_set_object (value, tracker_search_entry_get_Query (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void tracker_search_entry_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	TrackerSearchEntry * self;
	self = TRACKER_SEARCH_ENTRY (object);
	switch (property_id) {
		case TRACKER_SEARCH_ENTRY_QUERY:
		tracker_search_entry_set_Query (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


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


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


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}


static int _vala_strcmp0 (const char * str1, const char * str2) {
	if (str1 == NULL) {
		return -(str1 != str2);
	}
	if (str2 == NULL) {
		return str1 != str2;
	}
	return strcmp (str1, str2);
}




