/* tracker-taglist.c generated by valac 0.13.4.8-6faa4, the Vala compiler
 * generated from tracker-taglist.vala, do not modify */

/**/
/* Copyright 2010, Martyn Russell <martyn@lanedo.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 2*/
/* of the License, or (at your option) any later version.*/
/**/
/* This program is distributed in the hope that it will be useful,*/
/* but WITHOUT ANY WARRANTY; without even the implied warranty of*/
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the*/
/* GNU General Public License for more details.*/
/**/
/* You should have received a copy of the GNU General Public License*/
/* along with this program; if not, write to the Free Software*/
/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA*/
/* 02110-1301, USA.*/
/**/

#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <libtracker-sparql/tracker-sparql.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>


#define TRACKER_TYPE_TAG_LIST (tracker_tag_list_get_type ())
#define TRACKER_TAG_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_TYPE_TAG_LIST, TrackerTagList))
#define TRACKER_TAG_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TYPE_TAG_LIST, TrackerTagListClass))
#define TRACKER_IS_TAG_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_TYPE_TAG_LIST))
#define TRACKER_IS_TAG_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TYPE_TAG_LIST))
#define TRACKER_TAG_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TYPE_TAG_LIST, TrackerTagListClass))

typedef struct _TrackerTagList TrackerTagList;
typedef struct _TrackerTagListClass TrackerTagListClass;
typedef struct _TrackerTagListPrivate TrackerTagListPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TRACKER_TYPE_CELL_RENDERER_TEXT (tracker_cell_renderer_text_get_type ())
#define TRACKER_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_TYPE_CELL_RENDERER_TEXT, TrackerCellRendererText))
#define TRACKER_CELL_RENDERER_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TYPE_CELL_RENDERER_TEXT, TrackerCellRendererTextClass))
#define TRACKER_IS_CELL_RENDERER_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_TYPE_CELL_RENDERER_TEXT))
#define TRACKER_IS_CELL_RENDERER_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TYPE_CELL_RENDERER_TEXT))
#define TRACKER_CELL_RENDERER_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TYPE_CELL_RENDERER_TEXT, TrackerCellRendererTextClass))

typedef struct _TrackerCellRendererText TrackerCellRendererText;
typedef struct _TrackerCellRendererTextClass TrackerCellRendererTextClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _TrackerTagListGetTagsData TrackerTagListGetTagsData;

struct _TrackerTagList {
	GtkScrolledWindow parent_instance;
	TrackerTagListPrivate * priv;
};

struct _TrackerTagListClass {
	GtkScrolledWindowClass parent_class;
};

struct _TrackerTagListPrivate {
	GtkTreeView* treeview;
	GtkListStore* store;
	gint offset;
	gint limit;
};

struct _TrackerTagListGetTagsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	TrackerTagList* self;
	gint _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gint _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* query;
	TrackerSparqlCursor* cursor;
	TrackerSparqlConnection* _tmp8_;
	const gchar* _tmp9_;
	TrackerSparqlCursor* _tmp10_;
	TrackerSparqlCursor* _tmp11_;
	TrackerSparqlCursor* _tmp12_;
	gboolean _tmp13_;
	gboolean _tmp14_;
	gint i;
	gboolean _tmp15_;
	gboolean _tmp16_;
	gint _tmp17_;
	gint _tmp18_;
	TrackerSparqlCursor* _tmp19_;
	gint _tmp20_;
	gint _tmp21_;
	gint _tmp22_;
	TrackerSparqlCursor* _tmp23_;
	gint _tmp24_;
	const gchar* _tmp25_;
	TrackerSparqlCursor* _tmp26_;
	gint _tmp27_;
	const gchar* _tmp28_;
	GtkTreeIter iter;
	GtkListStore* _tmp29_;
	GtkTreeIter _tmp30_;
	GtkListStore* _tmp31_;
	GtkTreeIter _tmp32_;
	TrackerSparqlCursor* _tmp33_;
	const gchar* _tmp34_;
	TrackerSparqlCursor* _tmp35_;
	const gchar* _tmp36_;
	TrackerSparqlCursor* _tmp37_;
	const gchar* _tmp38_;
	GError* e;
	GError* _tmp39_;
	const gchar* _tmp40_;
	GError * _inner_error_;
};


static gpointer tracker_tag_list_parent_class = NULL;
static TrackerSparqlConnection* tracker_tag_list_connection;
static TrackerSparqlConnection* tracker_tag_list_connection = NULL;

GType tracker_tag_list_get_type (void) G_GNUC_CONST;
#define TRACKER_TAG_LIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_TAG_LIST, TrackerTagListPrivate))
enum  {
	TRACKER_TAG_LIST_DUMMY_PROPERTY
};
TrackerTagList* tracker_tag_list_new (void);
TrackerTagList* tracker_tag_list_construct (GType object_type);
TrackerCellRendererText* tracker_cell_renderer_text_new (void);
TrackerCellRendererText* tracker_cell_renderer_text_construct (GType object_type);
GType tracker_cell_renderer_text_get_type (void) G_GNUC_CONST;
static void tracker_tag_list_get_tags (TrackerTagList* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void tracker_tag_list_get_tags_finish (TrackerTagList* self, GAsyncResult* _res_);
static void tracker_tag_list_get_tags_data_free (gpointer _data);
static gboolean tracker_tag_list_get_tags_co (TrackerTagListGetTagsData* _data_);
static void tracker_tag_list_get_tags_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void tracker_tag_list_finalize (GObject* obj);


TrackerTagList* tracker_tag_list_construct (GType object_type) {
	TrackerTagList * self = NULL;
	GtkListStore* _tmp0_;
	GtkListStore* _tmp1_;
	GtkTreeView* _tmp2_;
	GtkTreeView* _tmp3_;
	GtkTreeView* _tmp4_;
	GtkTreeViewColumn* col = NULL;
	GtkCellRenderer* renderer = NULL;
	GtkTreeViewColumn* _tmp5_;
	GtkTreeViewColumn* _tmp6_;
	GtkTreeViewColumn* _tmp7_;
	const gchar* _tmp8_ = NULL;
	GtkTreeViewColumn* _tmp9_;
	GtkTreeViewColumn* _tmp10_;
	GtkTreeViewColumn* _tmp11_;
	TrackerCellRendererText* _tmp12_;
	GtkCellRenderer* _tmp13_;
	GtkTreeViewColumn* _tmp14_;
	GtkCellRenderer* _tmp15_;
	GtkTreeViewColumn* _tmp16_;
	GtkCellRenderer* _tmp17_;
	GtkTreeViewColumn* _tmp18_;
	GtkCellRenderer* _tmp19_;
	TrackerCellRendererText* _tmp20_;
	GtkCellRenderer* _tmp21_;
	GtkCellRenderer* _tmp22_;
	GtkCellRenderer* _tmp23_;
	GtkTreeViewColumn* _tmp24_;
	GtkCellRenderer* _tmp25_;
	GtkTreeViewColumn* _tmp26_;
	GtkCellRenderer* _tmp27_;
	GtkTreeView* _tmp28_;
	GtkTreeViewColumn* _tmp29_;
	GtkTreeView* _tmp30_;
	GError * _inner_error_ = NULL;
#line 29 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	self = (TrackerTagList*) g_object_new (object_type, NULL);
#line 30 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	self->priv->limit = 100;
#line 33 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_scrolled_window_set_policy ((GtkScrolledWindow*) self, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
#line 34 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_widget_set_size_request ((GtkWidget*) self, 175, -1);
#line 37 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp0_ = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
#line 37 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_object_unref0 (self->priv->store);
#line 37 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	self->priv->store = _tmp0_;
#line 42 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp1_ = self->priv->store;
#line 42 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp2_ = (GtkTreeView*) gtk_tree_view_new_with_model ((GtkTreeModel*) _tmp1_);
#line 42 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp3_ = g_object_ref_sink (_tmp2_);
#line 42 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_object_unref0 (self->priv->treeview);
#line 42 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	self->priv->treeview = _tmp3_;
#line 44 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp4_ = self->priv->treeview;
#line 44 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_tree_view_set_headers_visible (_tmp4_, TRUE);
#line 49 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp5_ = gtk_tree_view_column_new ();
#line 49 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp6_ = g_object_ref_sink (_tmp5_);
#line 49 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_object_unref0 (col);
#line 49 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	col = _tmp6_;
#line 50 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp7_ = col;
#line 50 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp8_ = _ ("Tags");
#line 50 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_tree_view_column_set_title (_tmp7_, _tmp8_);
#line 51 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp9_ = col;
#line 51 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_tree_view_column_set_resizable (_tmp9_, TRUE);
#line 52 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp10_ = col;
#line 52 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_tree_view_column_set_expand (_tmp10_, TRUE);
#line 53 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp11_ = col;
#line 53 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_tree_view_column_set_sizing (_tmp11_, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
#line 62 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp12_ = tracker_cell_renderer_text_new ();
#line 62 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp13_ = (GtkCellRenderer*) g_object_ref_sink (_tmp12_);
#line 62 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_object_unref0 (renderer);
#line 62 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	renderer = _tmp13_;
#line 63 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp14_ = col;
#line 63 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp15_ = renderer;
#line 63 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_cell_layout_pack_start ((GtkCellLayout*) _tmp14_, _tmp15_, TRUE);
#line 64 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp16_ = col;
#line 64 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp17_ = renderer;
#line 64 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp16_, _tmp17_, "text", 1);
#line 65 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp18_ = col;
#line 65 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp19_ = renderer;
#line 65 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp18_, _tmp19_, "subtext", 2);
#line 67 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp20_ = tracker_cell_renderer_text_new ();
#line 67 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp21_ = (GtkCellRenderer*) g_object_ref_sink (_tmp20_);
#line 67 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_object_unref0 (renderer);
#line 67 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	renderer = _tmp21_;
#line 68 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp22_ = renderer;
#line 68 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	g_object_set (_tmp22_, "xpad", (guint) 5, NULL);
#line 69 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp23_ = renderer;
#line 69 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	g_object_set (_tmp23_, "ypad", (guint) 5, NULL);
#line 70 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp24_ = col;
#line 70 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp25_ = renderer;
#line 70 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_cell_layout_pack_end ((GtkCellLayout*) _tmp24_, _tmp25_, FALSE);
#line 71 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp26_ = col;
#line 71 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp27_ = renderer;
#line 71 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_cell_layout_add_attribute ((GtkCellLayout*) _tmp26_, _tmp27_, "text", 3);
#line 72 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp28_ = self->priv->treeview;
#line 72 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp29_ = col;
#line 72 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_tree_view_append_column (_tmp28_, _tmp29_);
#line 74 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp30_ = self->priv->treeview;
#line 74 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp30_);
#line 75 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	GTK_WIDGET_CLASS (tracker_tag_list_parent_class)->show_all ((GtkWidget*) GTK_SCROLLED_WINDOW (self));
#line 309 "tracker-taglist.c"
	{
		TrackerSparqlConnection* _tmp31_ = NULL;
		TrackerSparqlConnection* _tmp32_;
#line 79 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_tmp31_ = tracker_sparql_connection_get (NULL, &_inner_error_);
#line 79 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_tmp32_ = _tmp31_;
#line 79 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		if (_inner_error_ != NULL) {
#line 319 "tracker-taglist.c"
			goto __catch13_g_error;
		}
#line 79 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_g_object_unref0 (tracker_tag_list_connection);
#line 79 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		tracker_tag_list_connection = _tmp32_;
#line 326 "tracker-taglist.c"
	}
	goto __finally13;
	__catch13_g_error:
	{
		GError* e = NULL;
		GError* _tmp33_;
		const gchar* _tmp34_;
#line 78 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		e = _inner_error_;
#line 78 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_inner_error_ = NULL;
#line 81 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_tmp33_ = e;
#line 81 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_tmp34_ = _tmp33_->message;
#line 81 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		g_warning ("tracker-taglist.vala:81: Could not get Sparql connection: %s", _tmp34_);
#line 82 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_g_error_free0 (e);
#line 82 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_g_object_unref0 (renderer);
#line 82 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_g_object_unref0 (col);
#line 82 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		return self;
#line 352 "tracker-taglist.c"
	}
	__finally13:
#line 78 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	if (_inner_error_ != NULL) {
#line 78 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_g_object_unref0 (renderer);
#line 78 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_g_object_unref0 (col);
#line 78 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		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);
#line 78 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		g_clear_error (&_inner_error_);
#line 78 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		return NULL;
#line 367 "tracker-taglist.c"
	}
#line 85 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	tracker_tag_list_get_tags (self, NULL, NULL);
#line 29 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_object_unref0 (renderer);
#line 29 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_object_unref0 (col);
#line 29 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	return self;
#line 377 "tracker-taglist.c"
}


TrackerTagList* tracker_tag_list_new (void) {
#line 29 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	return tracker_tag_list_construct (TRACKER_TYPE_TAG_LIST);
#line 384 "tracker-taglist.c"
}


static void tracker_tag_list_get_tags_data_free (gpointer _data) {
	TrackerTagListGetTagsData* _data_;
	_data_ = _data;
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_object_unref0 (_data_->self);
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	g_slice_free (TrackerTagListGetTagsData, _data_);
#line 395 "tracker-taglist.c"
}


static gpointer _g_object_ref0 (gpointer self) {
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	return self ? g_object_ref (self) : NULL;
#line 402 "tracker-taglist.c"
}


static void tracker_tag_list_get_tags (TrackerTagList* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	TrackerTagListGetTagsData* _data_;
	TrackerTagList* _tmp0_;
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_ = g_slice_new0 (TrackerTagListGetTagsData);
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, tracker_tag_list_get_tags);
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, tracker_tag_list_get_tags_data_free);
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_tmp0_ = _g_object_ref0 (self);
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->self = _tmp0_;
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	tracker_tag_list_get_tags_co (_data_);
#line 421 "tracker-taglist.c"
}


static void tracker_tag_list_get_tags_finish (TrackerTagList* self, GAsyncResult* _res_) {
	TrackerTagListGetTagsData* _data_;
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
#line 429 "tracker-taglist.c"
}


static void tracker_tag_list_get_tags_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	TrackerTagListGetTagsData* _data_;
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_ = _user_data_;
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_source_object_ = source_object;
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_res_ = _res_;
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	tracker_tag_list_get_tags_co (_data_);
#line 443 "tracker-taglist.c"
}


static gboolean tracker_tag_list_get_tags_co (TrackerTagListGetTagsData* _data_) {
#line 88 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	switch (_data_->_state_) {
#line 88 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		case 0:
#line 452 "tracker-taglist.c"
		goto _state_0;
#line 88 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		case 1:
#line 456 "tracker-taglist.c"
		goto _state_1;
#line 88 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		case 2:
#line 460 "tracker-taglist.c"
		goto _state_2;
		default:
#line 88 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		g_assert_not_reached ();
#line 465 "tracker-taglist.c"
	}
	_state_0:
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_tmp0_ = _data_->self->priv->offset;
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_tmp1_ = NULL;
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_tmp1_ = g_strdup_printf ("%i", _data_->_tmp0_);
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_tmp2_ = _data_->_tmp1_;
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_tmp3_ = _data_->self->priv->limit;
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_tmp4_ = NULL;
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_tmp4_ = g_strdup_printf ("%i", _data_->_tmp3_);
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_tmp5_ = _data_->_tmp4_;
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_tmp6_ = NULL;
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_tmp6_ = g_strconcat ("\n" \
"		               SELECT \n" \
"		                 ?tag \n" \
"		                 ?label\n" \
"		                 nao:description(?tag)\n" \
"		                 COUNT(?urns) AS urns\n" \
"		               WHERE {\n" \
"		                 ?tag a nao:Tag ;\n" \
"		                 nao:prefLabel ?label .\n" \
"		                 OPTIONAL {\n" \
"		                   ?urns nao:hasTag ?tag\n" \
"		                 }\n" \
"		               } \n" \
"		               GROUP BY ?tag \n" \
"		               ORDER BY ASC(?label) \n" \
"		               OFFSET ", _data_->_tmp2_, " \n		               LIMIT ", _data_->_tmp5_, "\n		               ", NULL);
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->_tmp7_ = _data_->_tmp6_;
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_free0 (_data_->_tmp5_);
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_free0 (_data_->_tmp2_);
#line 89 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->query = _data_->_tmp7_;
#line 108 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	g_debug ("tracker-taglist.vala:108: Getting tags");
#line 110 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_data_->cursor = NULL;
#line 500 "tracker-taglist.c"
	{
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_data_->_tmp8_ = tracker_tag_list_connection;
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_data_->_tmp9_ = _data_->query;
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_data_->_state_ = 1;
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		tracker_sparql_connection_query_async (_data_->_tmp8_, _data_->_tmp9_, NULL, tracker_tag_list_get_tags_ready, _data_);
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		return FALSE;
#line 512 "tracker-taglist.c"
		_state_1:
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_data_->_tmp10_ = NULL;
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_data_->_tmp10_ = tracker_sparql_connection_query_finish (_data_->_tmp8_, _data_->_res_, &_data_->_inner_error_);
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_data_->_tmp11_ = _data_->_tmp10_;
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		if (_data_->_inner_error_ != NULL) {
#line 522 "tracker-taglist.c"
			goto __catch14_g_error;
		}
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_g_object_unref0 (_data_->cursor);
#line 113 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_data_->cursor = _data_->_tmp11_;
#line 115 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		while (TRUE) {
#line 115 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp12_ = _data_->cursor;
#line 115 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_state_ = 2;
#line 115 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			tracker_sparql_cursor_next_async (_data_->_tmp12_, NULL, tracker_tag_list_get_tags_ready, _data_);
#line 115 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			return FALSE;
#line 539 "tracker-taglist.c"
			_state_2:
#line 115 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp13_ = FALSE;
#line 115 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp13_ = tracker_sparql_cursor_next_finish (_data_->_tmp12_, _data_->_res_, &_data_->_inner_error_);
#line 115 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp14_ = _data_->_tmp13_;
#line 115 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			if (_data_->_inner_error_ != NULL) {
#line 549 "tracker-taglist.c"
				goto __catch14_g_error;
			}
#line 115 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			if (!_data_->_tmp14_) {
#line 115 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
				break;
#line 556 "tracker-taglist.c"
			}
			{
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
				_data_->i = 0;
#line 561 "tracker-taglist.c"
				{
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
					_data_->_tmp15_ = TRUE;
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
					while (TRUE) {
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
						_data_->_tmp16_ = _data_->_tmp15_;
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
						if (!_data_->_tmp16_) {
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
							_data_->_tmp17_ = _data_->i;
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
							_data_->i = _data_->_tmp17_ + 1;
#line 575 "tracker-taglist.c"
						}
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
						_data_->_tmp15_ = FALSE;
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
						_data_->_tmp18_ = _data_->i;
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
						_data_->_tmp19_ = _data_->cursor;
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
						_data_->_tmp20_ = tracker_sparql_cursor_get_n_columns (_data_->_tmp19_);
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
						_data_->_tmp21_ = _data_->_tmp20_;
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
						if (!(_data_->_tmp18_ < _data_->_tmp21_)) {
#line 116 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
							break;
#line 591 "tracker-taglist.c"
						}
#line 117 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
						_data_->_tmp22_ = _data_->i;
#line 117 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
						if (_data_->_tmp22_ == 0) {
#line 118 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
							_data_->_tmp23_ = _data_->cursor;
#line 118 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
							_data_->_tmp24_ = _data_->i;
#line 118 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
							_data_->_tmp25_ = NULL;
#line 118 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
							_data_->_tmp25_ = tracker_sparql_cursor_get_string (_data_->_tmp23_, _data_->_tmp24_, NULL);
#line 118 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
							g_debug ("tracker-taglist.vala:118: --> %s", _data_->_tmp25_);
#line 607 "tracker-taglist.c"
						} else {
#line 120 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
							_data_->_tmp26_ = _data_->cursor;
#line 120 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
							_data_->_tmp27_ = _data_->i;
#line 120 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
							_data_->_tmp28_ = NULL;
#line 120 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
							_data_->_tmp28_ = tracker_sparql_cursor_get_string (_data_->_tmp26_, _data_->_tmp27_, NULL);
#line 120 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
							g_debug ("tracker-taglist.vala:120:   --> %s", _data_->_tmp28_);
#line 619 "tracker-taglist.c"
						}
					}
				}
			}
#line 126 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp29_ = _data_->self->priv->store;
#line 126 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			memset (&_data_->_tmp30_, 0, sizeof (GtkTreeIter));
#line 126 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			gtk_list_store_append (_data_->_tmp29_, &_data_->_tmp30_);
#line 126 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->iter = _data_->_tmp30_;
#line 128 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp31_ = _data_->self->priv->store;
#line 128 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp32_ = _data_->iter;
#line 128 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp33_ = _data_->cursor;
#line 128 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp34_ = NULL;
#line 128 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp34_ = tracker_sparql_cursor_get_string (_data_->_tmp33_, 1, NULL);
#line 128 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp35_ = _data_->cursor;
#line 128 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp36_ = NULL;
#line 128 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp36_ = tracker_sparql_cursor_get_string (_data_->_tmp35_, 2, NULL);
#line 128 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp37_ = _data_->cursor;
#line 128 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp38_ = NULL;
#line 128 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			_data_->_tmp38_ = tracker_sparql_cursor_get_string (_data_->_tmp37_, 3, NULL);
#line 128 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
			gtk_list_store_set (_data_->_tmp31_, &_data_->_tmp32_, 0, FALSE, 1, _data_->_tmp34_, 2, _data_->_tmp36_, 3, _data_->_tmp38_, -1, -1);
#line 656 "tracker-taglist.c"
		}
	}
	goto __finally14;
	__catch14_g_error:
	{
#line 112 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_data_->e = _data_->_inner_error_;
#line 112 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_data_->_inner_error_ = NULL;
#line 136 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_data_->_tmp39_ = _data_->e;
#line 136 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_data_->_tmp40_ = _data_->_tmp39_->message;
#line 136 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		g_warning ("tracker-taglist.vala:136: Could not run Sparql query: %s", _data_->_tmp40_);
#line 112 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_g_error_free0 (_data_->e);
#line 674 "tracker-taglist.c"
	}
	__finally14:
#line 112 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	if (_data_->_inner_error_ != NULL) {
#line 112 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_g_object_unref0 (_data_->cursor);
#line 112 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		_g_free0 (_data_->query);
#line 112 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
#line 112 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		g_clear_error (&_data_->_inner_error_);
#line 112 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		return FALSE;
#line 689 "tracker-taglist.c"
	}
#line 139 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	g_debug ("tracker-taglist.vala:139:   Done");
#line 88 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_object_unref0 (_data_->cursor);
#line 88 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_free0 (_data_->query);
#line 88 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	if (_data_->_state_ == 0) {
#line 88 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		g_simple_async_result_complete_in_idle (_data_->_async_result);
#line 701 "tracker-taglist.c"
	} else {
#line 88 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
		g_simple_async_result_complete (_data_->_async_result);
#line 705 "tracker-taglist.c"
	}
#line 88 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	g_object_unref (_data_->_async_result);
#line 88 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	return FALSE;
#line 711 "tracker-taglist.c"
}


static void tracker_tag_list_class_init (TrackerTagListClass * klass) {
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	tracker_tag_list_parent_class = g_type_class_peek_parent (klass);
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	g_type_class_add_private (klass, sizeof (TrackerTagListPrivate));
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	G_OBJECT_CLASS (klass)->finalize = tracker_tag_list_finalize;
#line 722 "tracker-taglist.c"
}


static void tracker_tag_list_instance_init (TrackerTagList * self) {
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	self->priv = TRACKER_TAG_LIST_GET_PRIVATE (self);
#line 729 "tracker-taglist.c"
}


static void tracker_tag_list_finalize (GObject* obj) {
	TrackerTagList * self;
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	self = TRACKER_TAG_LIST (obj);
#line 24 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_object_unref0 (self->priv->treeview);
#line 25 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	_g_object_unref0 (self->priv->store);
#line 22 "/home/martyn/Source/tracker/src/tracker-needle/tracker-taglist.vala"
	G_OBJECT_CLASS (tracker_tag_list_parent_class)->finalize (obj);
#line 743 "tracker-taglist.c"
}


GType tracker_tag_list_get_type (void) {
	static volatile gsize tracker_tag_list_type_id__volatile = 0;
	if (g_once_init_enter (&tracker_tag_list_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (TrackerTagListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_tag_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerTagList), 0, (GInstanceInitFunc) tracker_tag_list_instance_init, NULL };
		GType tracker_tag_list_type_id;
		tracker_tag_list_type_id = g_type_register_static (GTK_TYPE_SCROLLED_WINDOW, "TrackerTagList", &g_define_type_info, 0);
		g_once_init_leave (&tracker_tag_list_type_id__volatile, tracker_tag_list_type_id);
	}
	return tracker_tag_list_type_id__volatile;
}



