tracker-0.16.2/src/tracker-needle/tracker-query.c

No issues found

   1 /* tracker-query.c generated by valac 0.18.1, the Vala compiler
   2  * generated from tracker-query.vala, do not modify */
   3 
   4 /**/
   5 /* Copyright 2010, Martyn Russell <martyn@lanedo.com>*/
   6 /**/
   7 /* This program is free software; you can redistribute it and/or*/
   8 /* modify it under the terms of the GNU General Public License*/
   9 /* as published by the Free Software Foundation; either version 2*/
  10 /* of the License, or (at your option) any later version.*/
  11 /**/
  12 /* This program is distributed in the hope that it will be useful,*/
  13 /* but WITHOUT ANY WARRANTY; without even the implied warranty of*/
  14 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the*/
  15 /* GNU General Public License for more details.*/
  16 /**/
  17 /* You should have received a copy of the GNU General Public License*/
  18 /* along with this program; if not, write to the Free Software*/
  19 /* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA*/
  20 /* 02110-1301, USA.*/
  21 /**/
  22 
  23 #include <glib.h>
  24 #include <glib-object.h>
  25 #include <stdlib.h>
  26 #include <string.h>
  27 #include "libtracker-sparql/tracker-sparql.h"
  28 #include <gio/gio.h>
  29 #include <gobject/gvaluecollector.h>
  30 
  31 
  32 #define TRACKER_TYPE_QUERY (tracker_query_get_type ())
  33 #define TRACKER_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_TYPE_QUERY, TrackerQuery))
  34 #define TRACKER_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TYPE_QUERY, TrackerQueryClass))
  35 #define TRACKER_IS_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_TYPE_QUERY))
  36 #define TRACKER_IS_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TYPE_QUERY))
  37 #define TRACKER_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TYPE_QUERY, TrackerQueryClass))
  38 
  39 typedef struct _TrackerQuery TrackerQuery;
  40 typedef struct _TrackerQueryClass TrackerQueryClass;
  41 typedef struct _TrackerQueryPrivate TrackerQueryPrivate;
  42 
  43 #define TRACKER_QUERY_TYPE_TYPE (tracker_query_type_get_type ())
  44 
  45 #define TRACKER_QUERY_TYPE_MATCH (tracker_query_match_get_type ())
  46 #define _g_free0(var) (var = (g_free (var), NULL))
  47 #define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
  48 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
  49 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
  50 #define _tracker_query_unref0(var) ((var == NULL) ? NULL : (var = (tracker_query_unref (var), NULL)))
  51 typedef struct _TrackerQueryGetCountAsyncData TrackerQueryGetCountAsyncData;
  52 typedef struct _TrackerQueryPerformAsyncData TrackerQueryPerformAsyncData;
  53 typedef struct _TrackerParamSpecQuery TrackerParamSpecQuery;
  54 
  55 struct _TrackerQuery {
  56 	GTypeInstance parent_instance;
  57 	volatile int ref_count;
  58 	TrackerQueryPrivate * priv;
  59 };
  60 
  61 struct _TrackerQueryClass {
  62 	GTypeClass parent_class;
  63 	void (*finalize) (TrackerQuery *self);
  64 };
  65 
  66 struct _TrackerQueryPrivate {
  67 	gchar** match_clauses;
  68 	gint match_clauses_length1;
  69 	gint _match_clauses_size_;
  70 	gchar** where_clauses;
  71 	gint where_clauses_length1;
  72 	gint _where_clauses_size_;
  73 	gchar** sort_clauses;
  74 	gint sort_clauses_length1;
  75 	gint _sort_clauses_size_;
  76 	gchar* _criteria;
  77 	guint _offset;
  78 	guint _limit;
  79 	gchar* _query;
  80 	GPtrArray* _tags;
  81 };
  82 
  83 typedef enum  {
  84 	TRACKER_QUERY_TYPE_ALL,
  85 	TRACKER_QUERY_TYPE_CONTACTS,
  86 	TRACKER_QUERY_TYPE_APPLICATIONS,
  87 	TRACKER_QUERY_TYPE_MUSIC,
  88 	TRACKER_QUERY_TYPE_IMAGES,
  89 	TRACKER_QUERY_TYPE_VIDEOS,
  90 	TRACKER_QUERY_TYPE_DOCUMENTS,
  91 	TRACKER_QUERY_TYPE_MAIL,
  92 	TRACKER_QUERY_TYPE_CALENDAR,
  93 	TRACKER_QUERY_TYPE_FOLDERS,
  94 	TRACKER_QUERY_TYPE_BOOKMARKS
  95 } TrackerQueryType;
  96 
  97 typedef enum  {
  98 	TRACKER_QUERY_MATCH_NONE,
  99 	TRACKER_QUERY_MATCH_FTS,
 100 	TRACKER_QUERY_MATCH_FTS_INDIRECT,
 101 	TRACKER_QUERY_MATCH_TITLES,
 102 	TRACKER_QUERY_MATCH_TITLES_INDIRECT,
 103 	TRACKER_QUERY_MATCH_TAGS_ONLY,
 104 	TRACKER_QUERY_MATCH_TAGS_ONLY_INDIRECT
 105 } TrackerQueryMatch;
 106 
 107 struct _TrackerQueryGetCountAsyncData {
 108 	int _state_;
 109 	GObject* _source_object_;
 110 	GAsyncResult* _res_;
 111 	GSimpleAsyncResult* _async_result;
 112 	TrackerQuery* self;
 113 	TrackerQueryType query_type;
 114 	TrackerQueryMatch match_type;
 115 	GCancellable* cancellable;
 116 	guint result;
 117 	TrackerSparqlConnection* _tmp0_;
 118 	TrackerSparqlCursor* cursor;
 119 	TrackerQueryType _tmp1_;
 120 	TrackerQueryMatch _tmp2_;
 121 	gboolean _tmp3_;
 122 	gboolean _tmp4_;
 123 	GPtrArray* _tmp5_;
 124 	GPtrArray* _tmp6_;
 125 	gint _tmp7_;
 126 	gint _tmp8_;
 127 	gboolean _tmp9_;
 128 	gboolean _tmp10_;
 129 	TrackerQueryMatch _tmp11_;
 130 	TrackerQueryMatch _tmp12_;
 131 	gboolean _tmp13_;
 132 	TrackerQueryMatch _tmp14_;
 133 	gboolean _tmp15_;
 134 	gboolean _tmp16_;
 135 	gboolean _tmp17_;
 136 	TrackerQueryMatch _tmp18_;
 137 	TrackerQueryMatch _tmp19_;
 138 	gboolean _tmp20_;
 139 	TrackerQueryMatch _tmp21_;
 140 	gboolean _tmp22_;
 141 	gboolean _tmp23_;
 142 	const gchar* _tmp24_;
 143 	const gchar* _tmp25_;
 144 	gint _tmp26_;
 145 	gint _tmp27_;
 146 	gboolean _tmp28_;
 147 	gboolean _tmp29_;
 148 	gchar* match;
 149 	gboolean _tmp30_;
 150 	TrackerQueryMatch _tmp31_;
 151 	TrackerQueryMatch _tmp32_;
 152 	gboolean _tmp33_;
 153 	gchar** _tmp34_;
 154 	gint _tmp34__length1;
 155 	TrackerQueryMatch _tmp35_;
 156 	const gchar* _tmp36_;
 157 	gchar* _tmp37_;
 158 	gchar* _tmp38_;
 159 	gchar* _tmp39_;
 160 	const gchar* _tmp40_;
 161 	gchar* _tmp41_;
 162 	gchar* criteria_escaped;
 163 	gboolean _tmp42_;
 164 	TrackerQueryMatch _tmp43_;
 165 	TrackerQueryMatch _tmp44_;
 166 	gboolean _tmp45_;
 167 	gchar** _tmp46_;
 168 	gint _tmp46__length1;
 169 	TrackerQueryMatch _tmp47_;
 170 	const gchar* _tmp48_;
 171 	const gchar* _tmp49_;
 172 	const gchar* _tmp50_;
 173 	gchar* _tmp51_;
 174 	gchar** _tmp52_;
 175 	gint _tmp52__length1;
 176 	TrackerQueryMatch _tmp53_;
 177 	const gchar* _tmp54_;
 178 	const gchar* _tmp55_;
 179 	gchar* _tmp56_;
 180 	gchar** _tmp57_;
 181 	gint _tmp57__length1;
 182 	TrackerQueryType _tmp58_;
 183 	const gchar* _tmp59_;
 184 	gint _tmp60_;
 185 	gint _tmp61_;
 186 	const gchar* _tmp62_;
 187 	gchar** _tmp63_;
 188 	gint _tmp63__length1;
 189 	TrackerQueryType _tmp64_;
 190 	const gchar* _tmp65_;
 191 	const gchar* _tmp66_;
 192 	gchar* _tmp67_;
 193 	gchar* _tmp68_;
 194 	gchar* _tmp69_;
 195 	gchar* _tmp70_;
 196 	gchar* _tmp71_;
 197 	gchar* _tmp72_;
 198 	gchar** _tmp73_;
 199 	gint _tmp73__length1;
 200 	TrackerQueryType _tmp74_;
 201 	const gchar* _tmp75_;
 202 	gint _tmp76_;
 203 	gint _tmp77_;
 204 	const gchar* _tmp78_;
 205 	gchar** _tmp79_;
 206 	gint _tmp79__length1;
 207 	TrackerQueryType _tmp80_;
 208 	const gchar* _tmp81_;
 209 	gchar* _tmp82_;
 210 	gchar* _tmp83_;
 211 	gchar* _tmp84_;
 212 	gchar* _tmp85_;
 213 	TrackerSparqlConnection* _tmp86_;
 214 	const gchar* _tmp87_;
 215 	TrackerSparqlCursor* _tmp88_;
 216 	TrackerSparqlCursor* _tmp89_;
 217 	TrackerSparqlCursor* _tmp90_;
 218 	GError* e;
 219 	GError* _tmp91_;
 220 	const gchar* _tmp92_;
 221 	TrackerSparqlCursor* _tmp93_;
 222 	gint64 _tmp94_;
 223 	GError * _inner_error_;
 224 };
 225 
 226 struct _TrackerQueryPerformAsyncData {
 227 	int _state_;
 228 	GObject* _source_object_;
 229 	GAsyncResult* _res_;
 230 	GSimpleAsyncResult* _async_result;
 231 	TrackerQuery* self;
 232 	TrackerQueryType query_type;
 233 	TrackerQueryMatch match_type;
 234 	gchar** args;
 235 	gint args_length1;
 236 	GCancellable* cancellable;
 237 	TrackerSparqlCursor* result;
 238 	TrackerSparqlConnection* _tmp0_;
 239 	TrackerSparqlCursor* cursor;
 240 	TrackerQueryType _tmp1_;
 241 	TrackerQueryMatch _tmp2_;
 242 	gboolean _tmp3_;
 243 	gboolean _tmp4_;
 244 	GPtrArray* _tmp5_;
 245 	GPtrArray* _tmp6_;
 246 	gint _tmp7_;
 247 	gint _tmp8_;
 248 	gboolean _tmp9_;
 249 	gboolean _tmp10_;
 250 	TrackerQueryMatch _tmp11_;
 251 	TrackerQueryMatch _tmp12_;
 252 	gboolean _tmp13_;
 253 	gboolean _tmp14_;
 254 	gboolean _tmp15_;
 255 	gboolean _tmp16_;
 256 	TrackerQueryMatch _tmp17_;
 257 	TrackerQueryMatch _tmp18_;
 258 	gboolean _tmp19_;
 259 	TrackerQueryMatch _tmp20_;
 260 	gboolean _tmp21_;
 261 	gboolean _tmp22_;
 262 	const gchar* _tmp23_;
 263 	const gchar* _tmp24_;
 264 	gint _tmp25_;
 265 	gint _tmp26_;
 266 	gboolean _tmp27_;
 267 	gboolean _tmp28_;
 268 	guint _tmp29_;
 269 	gchar* match;
 270 	gboolean _tmp30_;
 271 	TrackerQueryMatch _tmp31_;
 272 	TrackerQueryMatch _tmp32_;
 273 	gboolean _tmp33_;
 274 	gchar** _tmp34_;
 275 	gint _tmp34__length1;
 276 	TrackerQueryMatch _tmp35_;
 277 	const gchar* _tmp36_;
 278 	gchar* _tmp37_;
 279 	gchar* _tmp38_;
 280 	gchar* _tmp39_;
 281 	const gchar* _tmp40_;
 282 	gchar* _tmp41_;
 283 	gchar* criteria_escaped;
 284 	gboolean _tmp42_;
 285 	TrackerQueryMatch _tmp43_;
 286 	TrackerQueryMatch _tmp44_;
 287 	gboolean _tmp45_;
 288 	gchar** _tmp46_;
 289 	gint _tmp46__length1;
 290 	TrackerQueryMatch _tmp47_;
 291 	const gchar* _tmp48_;
 292 	const gchar* _tmp49_;
 293 	const gchar* _tmp50_;
 294 	gchar* _tmp51_;
 295 	gchar** _tmp52_;
 296 	gint _tmp52__length1;
 297 	TrackerQueryMatch _tmp53_;
 298 	const gchar* _tmp54_;
 299 	const gchar* _tmp55_;
 300 	gchar* _tmp56_;
 301 	gchar** _tmp57_;
 302 	gint _tmp57__length1;
 303 	gchar* _tmp58_;
 304 	gchar* _tmp59_;
 305 	gchar* _tmp60_;
 306 	gchar* _tmp61_;
 307 	gchar** _tmp62_;
 308 	gint _tmp62__length1;
 309 	TrackerQueryType _tmp63_;
 310 	const gchar* _tmp64_;
 311 	gint _tmp65_;
 312 	gint _tmp66_;
 313 	const gchar* _tmp67_;
 314 	gchar** _tmp68_;
 315 	gint _tmp68__length1;
 316 	TrackerQueryType _tmp69_;
 317 	const gchar* _tmp70_;
 318 	const gchar* _tmp71_;
 319 	gchar* _tmp72_;
 320 	gchar* _tmp73_;
 321 	gchar* _tmp74_;
 322 	gchar* _tmp75_;
 323 	gchar* _tmp76_;
 324 	gchar* _tmp77_;
 325 	gchar** _tmp78_;
 326 	gint _tmp78__length1;
 327 	TrackerQueryType _tmp79_;
 328 	const gchar* _tmp80_;
 329 	gint _tmp81_;
 330 	gint _tmp82_;
 331 	const gchar* _tmp83_;
 332 	gchar** _tmp84_;
 333 	gint _tmp84__length1;
 334 	TrackerQueryType _tmp85_;
 335 	const gchar* _tmp86_;
 336 	gchar* _tmp87_;
 337 	gchar* _tmp88_;
 338 	gchar* _tmp89_;
 339 	gchar* _tmp90_;
 340 	const gchar* _tmp91_;
 341 	guint _tmp92_;
 342 	guint _tmp93_;
 343 	gchar* _tmp94_;
 344 	gchar* _tmp95_;
 345 	gchar* _tmp96_;
 346 	gchar* _tmp97_;
 347 	const gchar* _tmp98_;
 348 	TrackerSparqlConnection* _tmp99_;
 349 	const gchar* _tmp100_;
 350 	TrackerSparqlCursor* _tmp101_;
 351 	TrackerSparqlCursor* _tmp102_;
 352 	GError* e;
 353 	GError* _tmp103_;
 354 	const gchar* _tmp104_;
 355 	GError * _inner_error_;
 356 };
 357 
 358 struct _TrackerParamSpecQuery {
 359 	GParamSpec parent_instance;
 360 };
 361 
 362 
 363 static gpointer tracker_query_parent_class = NULL;
 364 static TrackerSparqlConnection* tracker_query_connection;
 365 static TrackerSparqlConnection* tracker_query_connection = NULL;
 366 
 367 gpointer tracker_query_ref (gpointer instance);
 368 void tracker_query_unref (gpointer instance);
 369 GParamSpec* tracker_param_spec_query (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
 370 void tracker_value_set_query (GValue* value, gpointer v_object);
 371 void tracker_value_take_query (GValue* value, gpointer v_object);
 372 gpointer tracker_value_get_query (const GValue* value);
 373 GType tracker_query_get_type (void) G_GNUC_CONST;
 374 #define TRACKER_QUERY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_QUERY, TrackerQueryPrivate))
 375 enum  {
 376 	TRACKER_QUERY_DUMMY_PROPERTY
 377 };
 378 GType tracker_query_type_get_type (void) G_GNUC_CONST;
 379 GType tracker_query_match_get_type (void) G_GNUC_CONST;
 380 TrackerQuery* tracker_query_new (void);
 381 TrackerQuery* tracker_query_construct (GType object_type);
 382 void tracker_query_set_tags (TrackerQuery* self, GPtrArray* value);
 383 static gchar* tracker_query_get_tags_filter (TrackerQuery* self);
 384 GPtrArray* tracker_query_get_tags (TrackerQuery* self);
 385 static gboolean tracker_query_check_query_and_match_type (TrackerQuery* self, TrackerQueryType query_type, TrackerQueryMatch match_type);
 386 static void tracker_query_get_count_async_data_free (gpointer _data);
 387 void tracker_query_get_count_async (TrackerQuery* self, TrackerQueryType query_type, TrackerQueryMatch match_type, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 388 guint tracker_query_get_count_finish (TrackerQuery* self, GAsyncResult* _res_, GError** error);
 389 static gboolean tracker_query_get_count_async_co (TrackerQueryGetCountAsyncData* _data_);
 390 const gchar* tracker_query_get_criteria (TrackerQuery* self);
 391 static void tracker_query_set_query (TrackerQuery* self, const gchar* value);
 392 const gchar* tracker_query_get_query (TrackerQuery* self);
 393 static void tracker_query_get_count_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
 394 static void tracker_query_perform_async_data_free (gpointer _data);
 395 void tracker_query_perform_async (TrackerQuery* self, TrackerQueryType query_type, TrackerQueryMatch match_type, gchar** args, int args_length1, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
 396 TrackerSparqlCursor* tracker_query_perform_finish (TrackerQuery* self, GAsyncResult* _res_, GError** error);
 397 static gboolean tracker_query_perform_async_co (TrackerQueryPerformAsyncData* _data_);
 398 guint tracker_query_get_limit (TrackerQuery* self);
 399 guint tracker_query_get_offset (TrackerQuery* self);
 400 static void tracker_query_perform_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
 401 void tracker_query_set_criteria (TrackerQuery* self, const gchar* value);
 402 void tracker_query_set_offset (TrackerQuery* self, guint value);
 403 void tracker_query_set_limit (TrackerQuery* self, guint value);
 404 static void tracker_query_finalize (TrackerQuery* obj);
 405 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
 406 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
 407 
 408 
 409 GType tracker_query_type_get_type (void) {
 410 	static volatile gsize tracker_query_type_type_id__volatile = 0;
 411 	if (g_once_init_enter (&tracker_query_type_type_id__volatile)) {
 412 		static const GEnumValue values[] = {{TRACKER_QUERY_TYPE_ALL, "TRACKER_QUERY_TYPE_ALL", "all"}, {TRACKER_QUERY_TYPE_CONTACTS, "TRACKER_QUERY_TYPE_CONTACTS", "contacts"}, {TRACKER_QUERY_TYPE_APPLICATIONS, "TRACKER_QUERY_TYPE_APPLICATIONS", "applications"}, {TRACKER_QUERY_TYPE_MUSIC, "TRACKER_QUERY_TYPE_MUSIC", "music"}, {TRACKER_QUERY_TYPE_IMAGES, "TRACKER_QUERY_TYPE_IMAGES", "images"}, {TRACKER_QUERY_TYPE_VIDEOS, "TRACKER_QUERY_TYPE_VIDEOS", "videos"}, {TRACKER_QUERY_TYPE_DOCUMENTS, "TRACKER_QUERY_TYPE_DOCUMENTS", "documents"}, {TRACKER_QUERY_TYPE_MAIL, "TRACKER_QUERY_TYPE_MAIL", "mail"}, {TRACKER_QUERY_TYPE_CALENDAR, "TRACKER_QUERY_TYPE_CALENDAR", "calendar"}, {TRACKER_QUERY_TYPE_FOLDERS, "TRACKER_QUERY_TYPE_FOLDERS", "folders"}, {TRACKER_QUERY_TYPE_BOOKMARKS, "TRACKER_QUERY_TYPE_BOOKMARKS", "bookmarks"}, {0, NULL, NULL}};
 413 		GType tracker_query_type_type_id;
 414 		tracker_query_type_type_id = g_enum_register_static ("TrackerQueryType", values);
 415 		g_once_init_leave (&tracker_query_type_type_id__volatile, tracker_query_type_type_id);
 416 	}
 417 	return tracker_query_type_type_id__volatile;
 418 }
 419 
 420 
 421 GType tracker_query_match_get_type (void) {
 422 	static volatile gsize tracker_query_match_type_id__volatile = 0;
 423 	if (g_once_init_enter (&tracker_query_match_type_id__volatile)) {
 424 		static const GEnumValue values[] = {{TRACKER_QUERY_MATCH_NONE, "TRACKER_QUERY_MATCH_NONE", "none"}, {TRACKER_QUERY_MATCH_FTS, "TRACKER_QUERY_MATCH_FTS", "fts"}, {TRACKER_QUERY_MATCH_FTS_INDIRECT, "TRACKER_QUERY_MATCH_FTS_INDIRECT", "fts-indirect"}, {TRACKER_QUERY_MATCH_TITLES, "TRACKER_QUERY_MATCH_TITLES", "titles"}, {TRACKER_QUERY_MATCH_TITLES_INDIRECT, "TRACKER_QUERY_MATCH_TITLES_INDIRECT", "titles-indirect"}, {TRACKER_QUERY_MATCH_TAGS_ONLY, "TRACKER_QUERY_MATCH_TAGS_ONLY", "tags-only"}, {TRACKER_QUERY_MATCH_TAGS_ONLY_INDIRECT, "TRACKER_QUERY_MATCH_TAGS_ONLY_INDIRECT", "tags-only-indirect"}, {0, NULL, NULL}};
 425 		GType tracker_query_match_type_id;
 426 		tracker_query_match_type_id = g_enum_register_static ("TrackerQueryMatch", values);
 427 		g_once_init_leave (&tracker_query_match_type_id__volatile, tracker_query_match_type_id);
 428 	}
 429 	return tracker_query_match_type_id__volatile;
 430 }
 431 
 432 
 433 TrackerQuery* tracker_query_construct (GType object_type) {
 434 	TrackerQuery* self = NULL;
 435 	GError * _inner_error_ = NULL;
 436 	self = (TrackerQuery*) g_type_create_instance (object_type);
 437 	{
 438 		TrackerSparqlConnection* _tmp0_ = NULL;
 439 		TrackerSparqlConnection* _tmp1_;
 440 		_tmp0_ = tracker_sparql_connection_get (NULL, &_inner_error_);
 441 		_tmp1_ = _tmp0_;
 442 		if (_inner_error_ != NULL) {
 443 			goto __catch3_g_error;
 444 		}
 445 		_g_object_unref0 (tracker_query_connection);
 446 		tracker_query_connection = _tmp1_;
 447 	}
 448 	goto __finally3;
 449 	__catch3_g_error:
 450 	{
 451 		GError* e = NULL;
 452 		GError* _tmp2_;
 453 		const gchar* _tmp3_;
 454 		e = _inner_error_;
 455 		_inner_error_ = NULL;
 456 		_tmp2_ = e;
 457 		_tmp3_ = _tmp2_->message;
 458 		g_warning ("tracker-query.vala:228: Could not get Sparql connection: %s", _tmp3_);
 459 		_g_error_free0 (e);
 460 	}
 461 	__finally3:
 462 	if (_inner_error_ != NULL) {
 463 		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);
 464 		g_clear_error (&_inner_error_);
 465 		return NULL;
 466 	}
 467 	tracker_query_set_tags (self, NULL);
 468 	return self;
 469 }
 470 
 471 
 472 TrackerQuery* tracker_query_new (void) {
 473 	return tracker_query_construct (TRACKER_TYPE_QUERY);
 474 }
 475 
 476 
 477 static gint g_ptr_array_get_length (GPtrArray* self) {
 478 	gint result;
 479 	guint _tmp0_;
 480 	g_return_val_if_fail (self != NULL, 0);
 481 	_tmp0_ = self->len;
 482 	result = (gint) _tmp0_;
 483 	return result;
 484 }
 485 
 486 
 487 static void g_ptr_array_set_length (GPtrArray* self, gint value) {
 488 	gint _tmp0_;
 489 	g_return_if_fail (self != NULL);
 490 	_tmp0_ = value;
 491 	g_ptr_array_set_size (self, _tmp0_);
 492 }
 493 
 494 
 495 static gchar* tracker_query_get_tags_filter (TrackerQuery* self) {
 496 	gchar* result = NULL;
 497 	gchar* _tmp0_;
 498 	gchar* filter;
 499 	gboolean _tmp1_ = FALSE;
 500 	GPtrArray* _tmp2_;
 501 	gboolean _tmp6_;
 502 	g_return_val_if_fail (self != NULL, NULL);
 503 	_tmp0_ = g_strdup ("");
 504 	filter = _tmp0_;
 505 	_tmp2_ = self->priv->_tags;
 506 	if (_tmp2_ != NULL) {
 507 		GPtrArray* _tmp3_;
 508 		gint _tmp4_;
 509 		gint _tmp5_;
 510 		_tmp3_ = self->priv->_tags;
 511 		_tmp4_ = g_ptr_array_get_length (_tmp3_);
 512 		_tmp5_ = _tmp4_;
 513 		_tmp1_ = _tmp5_ > 0;
 514 	} else {
 515 		_tmp1_ = FALSE;
 516 	}
 517 	_tmp6_ = _tmp1_;
 518 	if (_tmp6_) {
 519 		{
 520 			gint i;
 521 			i = 0;
 522 			{
 523 				gboolean _tmp7_;
 524 				_tmp7_ = TRUE;
 525 				while (TRUE) {
 526 					gboolean _tmp8_;
 527 					gint _tmp10_;
 528 					GPtrArray* _tmp11_;
 529 					gint _tmp12_;
 530 					gint _tmp13_;
 531 					GPtrArray* _tmp14_;
 532 					gint _tmp15_;
 533 					gconstpointer _tmp16_ = NULL;
 534 					gchar* _tmp17_ = NULL;
 535 					gchar* escaped;
 536 					const gchar* _tmp18_;
 537 					gint _tmp19_;
 538 					gint _tmp20_;
 539 					const gchar* _tmp23_;
 540 					const gchar* _tmp24_;
 541 					gchar* _tmp25_ = NULL;
 542 					gchar* _tmp26_;
 543 					gchar* _tmp27_;
 544 					_tmp8_ = _tmp7_;
 545 					if (!_tmp8_) {
 546 						gint _tmp9_;
 547 						_tmp9_ = i;
 548 						i = _tmp9_ + 1;
 549 					}
 550 					_tmp7_ = FALSE;
 551 					_tmp10_ = i;
 552 					_tmp11_ = self->priv->_tags;
 553 					_tmp12_ = g_ptr_array_get_length (_tmp11_);
 554 					_tmp13_ = _tmp12_;
 555 					if (!(_tmp10_ < _tmp13_)) {
 556 						break;
 557 					}
 558 					_tmp14_ = self->priv->_tags;
 559 					_tmp15_ = i;
 560 					_tmp16_ = g_ptr_array_index (_tmp14_, (guint) _tmp15_);
 561 					_tmp17_ = tracker_sparql_escape_string ((const gchar*) _tmp16_);
 562 					escaped = _tmp17_;
 563 					_tmp18_ = filter;
 564 					_tmp19_ = strlen (_tmp18_);
 565 					_tmp20_ = _tmp19_;
 566 					if (_tmp20_ > 1) {
 567 						const gchar* _tmp21_;
 568 						gchar* _tmp22_;
 569 						_tmp21_ = filter;
 570 						_tmp22_ = g_strconcat (_tmp21_, ", ", NULL);
 571 						_g_free0 (filter);
 572 						filter = _tmp22_;
 573 					}
 574 					_tmp23_ = filter;
 575 					_tmp24_ = escaped;
 576 					_tmp25_ = g_strdup_printf ("\"%s\"", _tmp24_);
 577 					_tmp26_ = _tmp25_;
 578 					_tmp27_ = g_strconcat (_tmp23_, _tmp26_, NULL);
 579 					_g_free0 (filter);
 580 					filter = _tmp27_;
 581 					_g_free0 (_tmp26_);
 582 					_g_free0 (escaped);
 583 				}
 584 			}
 585 		}
 586 	}
 587 	result = filter;
 588 	return result;
 589 }
 590 
 591 
 592 static gboolean tracker_query_check_query_and_match_type (TrackerQuery* self, TrackerQueryType query_type, TrackerQueryMatch match_type) {
 593 	gboolean result = FALSE;
 594 	gboolean _tmp0_ = FALSE;
 595 	TrackerQueryType _tmp1_;
 596 	gboolean _tmp3_;
 597 	gboolean _tmp5_ = FALSE;
 598 	TrackerQueryType _tmp6_;
 599 	gboolean _tmp11_;
 600 	gboolean _tmp12_ = FALSE;
 601 	gboolean _tmp13_ = FALSE;
 602 	TrackerQueryType _tmp14_;
 603 	gboolean _tmp16_;
 604 	gboolean _tmp24_;
 605 	g_return_val_if_fail (self != NULL, FALSE);
 606 	_tmp1_ = query_type;
 607 	if (_tmp1_ != TRACKER_QUERY_TYPE_IMAGES) {
 608 		TrackerQueryMatch _tmp2_;
 609 		_tmp2_ = match_type;
 610 		_tmp0_ = _tmp2_ == TRACKER_QUERY_MATCH_NONE;
 611 	} else {
 612 		_tmp0_ = FALSE;
 613 	}
 614 	_tmp3_ = _tmp0_;
 615 	if (_tmp3_) {
 616 		TrackerQueryType _tmp4_;
 617 		_tmp4_ = query_type;
 618 		g_critical ("tracker-query.vala:253: You can not use a non-IMAGES query (%d) with N" \
 619 "ONE matching", (gint) _tmp4_);
 620 		result = FALSE;
 621 		return result;
 622 	}
 623 	_tmp6_ = query_type;
 624 	if (_tmp6_ == TRACKER_QUERY_TYPE_MUSIC) {
 625 		gboolean _tmp7_ = FALSE;
 626 		TrackerQueryMatch _tmp8_;
 627 		gboolean _tmp10_;
 628 		_tmp8_ = match_type;
 629 		if (_tmp8_ == TRACKER_QUERY_MATCH_FTS_INDIRECT) {
 630 			_tmp7_ = TRUE;
 631 		} else {
 632 			TrackerQueryMatch _tmp9_;
 633 			_tmp9_ = match_type;
 634 			_tmp7_ = _tmp9_ == TRACKER_QUERY_MATCH_TITLES_INDIRECT;
 635 		}
 636 		_tmp10_ = _tmp7_;
 637 		_tmp5_ = !_tmp10_;
 638 	} else {
 639 		_tmp5_ = FALSE;
 640 	}
 641 	_tmp11_ = _tmp5_;
 642 	if (_tmp11_) {
 643 		g_critical ("tracker-query.vala:259: You can not use a MUSIC query with match TITLE" \
 644 "S or FTS, INDIRECT required");
 645 		result = FALSE;
 646 		return result;
 647 	}
 648 	_tmp14_ = query_type;
 649 	if (_tmp14_ != TRACKER_QUERY_TYPE_MUSIC) {
 650 		TrackerQueryType _tmp15_;
 651 		_tmp15_ = query_type;
 652 		_tmp13_ = _tmp15_ != TRACKER_QUERY_TYPE_DOCUMENTS;
 653 	} else {
 654 		_tmp13_ = FALSE;
 655 	}
 656 	_tmp16_ = _tmp13_;
 657 	if (_tmp16_) {
 658 		gboolean _tmp17_ = FALSE;
 659 		gboolean _tmp18_ = FALSE;
 660 		TrackerQueryMatch _tmp19_;
 661 		gboolean _tmp21_;
 662 		gboolean _tmp23_;
 663 		_tmp19_ = match_type;
 664 		if (_tmp19_ == TRACKER_QUERY_MATCH_NONE) {
 665 			_tmp18_ = TRUE;
 666 		} else {
 667 			TrackerQueryMatch _tmp20_;
 668 			_tmp20_ = match_type;
 669 			_tmp18_ = _tmp20_ == TRACKER_QUERY_MATCH_FTS;
 670 		}
 671 		_tmp21_ = _tmp18_;
 672 		if (_tmp21_) {
 673 			_tmp17_ = TRUE;
 674 		} else {
 675 			TrackerQueryMatch _tmp22_;
 676 			_tmp22_ = match_type;
 677 			_tmp17_ = _tmp22_ == TRACKER_QUERY_MATCH_TITLES;
 678 		}
 679 		_tmp23_ = _tmp17_;
 680 		_tmp12_ = !_tmp23_;
 681 	} else {
 682 		_tmp12_ = FALSE;
 683 	}
 684 	_tmp24_ = _tmp12_;
 685 	if (_tmp24_) {
 686 		TrackerQueryType _tmp25_;
 687 		TrackerQueryMatch _tmp26_;
 688 		_tmp25_ = query_type;
 689 		_tmp26_ = match_type;
 690 		g_critical ("tracker-query.vala:267: You can not use a non-MUSIC or non-DOCUMENTS q" \
 691 "uery (%d) with INDIRECT matching (%d)", (gint) _tmp25_, (gint) _tmp26_);
 692 		result = FALSE;
 693 		return result;
 694 	}
 695 	result = TRUE;
 696 	return result;
 697 }
 698 
 699 
 700 static void tracker_query_get_count_async_data_free (gpointer _data) {
 701 	TrackerQueryGetCountAsyncData* _data_;
 702 	_data_ = _data;
 703 	_g_object_unref0 (_data_->cancellable);
 704 	_tracker_query_unref0 (_data_->self);
 705 	g_slice_free (TrackerQueryGetCountAsyncData, _data_);
 706 }
 707 
 708 
 709 static gpointer _tracker_query_ref0 (gpointer self) {
 710 	return self ? tracker_query_ref (self) : NULL;
 711 }
 712 
 713 
 714 static gpointer _g_object_ref0 (gpointer self) {
 715 	return self ? g_object_ref (self) : NULL;
 716 }
 717 
 718 
 719 void tracker_query_get_count_async (TrackerQuery* self, TrackerQueryType query_type, TrackerQueryMatch match_type, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
 720 	TrackerQueryGetCountAsyncData* _data_;
 721 	TrackerQuery* _tmp0_;
 722 	TrackerQueryType _tmp1_;
 723 	TrackerQueryMatch _tmp2_;
 724 	GCancellable* _tmp3_;
 725 	GCancellable* _tmp4_;
 726 	_data_ = g_slice_new0 (TrackerQueryGetCountAsyncData);
 727 	_data_->_async_result = g_simple_async_result_new (g_object_newv (G_TYPE_OBJECT, 0, NULL), _callback_, _user_data_, tracker_query_get_count_async);
 728 	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, tracker_query_get_count_async_data_free);
 729 	_tmp0_ = _tracker_query_ref0 (self);
 730 	_data_->self = _tmp0_;
 731 	_tmp1_ = query_type;
 732 	_data_->query_type = _tmp1_;
 733 	_tmp2_ = match_type;
 734 	_data_->match_type = _tmp2_;
 735 	_tmp3_ = cancellable;
 736 	_tmp4_ = _g_object_ref0 (_tmp3_);
 737 	_g_object_unref0 (_data_->cancellable);
 738 	_data_->cancellable = _tmp4_;
 739 	tracker_query_get_count_async_co (_data_);
 740 }
 741 
 742 
 743 guint tracker_query_get_count_finish (TrackerQuery* self, GAsyncResult* _res_, GError** error) {
 744 	guint result;
 745 	TrackerQueryGetCountAsyncData* _data_;
 746 	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
 747 		return 0U;
 748 	}
 749 	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
 750 	result = _data_->result;
 751 	return result;
 752 }
 753 
 754 
 755 static void tracker_query_get_count_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
 756 	TrackerQueryGetCountAsyncData* _data_;
 757 	_data_ = _user_data_;
 758 	_data_->_source_object_ = source_object;
 759 	_data_->_res_ = _res_;
 760 	tracker_query_get_count_async_co (_data_);
 761 }
 762 
 763 
 764 static gboolean tracker_query_get_count_async_co (TrackerQueryGetCountAsyncData* _data_) {
 765 	switch (_data_->_state_) {
 766 		case 0:
 767 		goto _state_0;
 768 		case 1:
 769 		goto _state_1;
 770 		case 2:
 771 		goto _state_2;
 772 		default:
 773 		g_assert_not_reached ();
 774 	}
 775 	_state_0:
 776 	_data_->_tmp0_ = tracker_query_connection;
 777 	g_return_val_if_fail (_data_->_tmp0_ != NULL, FALSE);
 778 	_data_->cursor = NULL;
 779 	_data_->_tmp1_ = _data_->query_type;
 780 	_data_->_tmp2_ = _data_->match_type;
 781 	_data_->_tmp3_ = FALSE;
 782 	_data_->_tmp3_ = tracker_query_check_query_and_match_type (_data_->self, _data_->_tmp1_, _data_->_tmp2_);
 783 	if (!_data_->_tmp3_) {
 784 		_data_->result = (guint) 0;
 785 		_g_object_unref0 (_data_->cursor);
 786 		if (_data_->_state_ == 0) {
 787 			g_simple_async_result_complete_in_idle (_data_->_async_result);
 788 		} else {
 789 			g_simple_async_result_complete (_data_->_async_result);
 790 		}
 791 		g_object_unref (_data_->_async_result);
 792 		return FALSE;
 793 	}
 794 	_data_->_tmp5_ = _data_->self->priv->_tags;
 795 	if (_data_->_tmp5_ != NULL) {
 796 		_data_->_tmp6_ = _data_->self->priv->_tags;
 797 		_data_->_tmp7_ = g_ptr_array_get_length (_data_->_tmp6_);
 798 		_data_->_tmp8_ = _data_->_tmp7_;
 799 		_data_->_tmp4_ = _data_->_tmp8_ > 0;
 800 	} else {
 801 		_data_->_tmp4_ = FALSE;
 802 	}
 803 	_data_->_tmp9_ = _data_->_tmp4_;
 804 	if (_data_->_tmp9_) {
 805 		_data_->_tmp11_ = _data_->match_type;
 806 		if (_data_->_tmp11_ == TRACKER_QUERY_MATCH_FTS_INDIRECT) {
 807 			_data_->_tmp10_ = TRUE;
 808 		} else {
 809 			_data_->_tmp12_ = _data_->match_type;
 810 			_data_->_tmp10_ = _data_->_tmp12_ == TRACKER_QUERY_MATCH_TITLES_INDIRECT;
 811 		}
 812 		_data_->_tmp13_ = _data_->_tmp10_;
 813 		if (_data_->_tmp13_) {
 814 			_data_->match_type = TRACKER_QUERY_MATCH_TAGS_ONLY_INDIRECT;
 815 		} else {
 816 			_data_->match_type = TRACKER_QUERY_MATCH_TAGS_ONLY;
 817 		}
 818 	}
 819 	_data_->_tmp14_ = _data_->match_type;
 820 	g_debug ("tracker-query.vala:291: match_type:%d", (gint) _data_->_tmp14_);
 821 	_data_->_tmp18_ = _data_->match_type;
 822 	if (_data_->_tmp18_ != TRACKER_QUERY_MATCH_NONE) {
 823 		_data_->_tmp19_ = _data_->match_type;
 824 		_data_->_tmp17_ = _data_->_tmp19_ != TRACKER_QUERY_MATCH_TAGS_ONLY;
 825 	} else {
 826 		_data_->_tmp17_ = FALSE;
 827 	}
 828 	_data_->_tmp20_ = _data_->_tmp17_;
 829 	if (_data_->_tmp20_) {
 830 		_data_->_tmp21_ = _data_->match_type;
 831 		_data_->_tmp16_ = _data_->_tmp21_ != TRACKER_QUERY_MATCH_TAGS_ONLY_INDIRECT;
 832 	} else {
 833 		_data_->_tmp16_ = FALSE;
 834 	}
 835 	_data_->_tmp22_ = _data_->_tmp16_;
 836 	if (_data_->_tmp22_) {
 837 		_data_->_tmp24_ = _data_->self->priv->_criteria;
 838 		if (_data_->_tmp24_ == NULL) {
 839 			_data_->_tmp23_ = TRUE;
 840 		} else {
 841 			_data_->_tmp25_ = _data_->self->priv->_criteria;
 842 			_data_->_tmp26_ = strlen (_data_->_tmp25_);
 843 			_data_->_tmp27_ = _data_->_tmp26_;
 844 			_data_->_tmp23_ = _data_->_tmp27_ < 1;
 845 		}
 846 		_data_->_tmp28_ = _data_->_tmp23_;
 847 		_data_->_tmp15_ = _data_->_tmp28_;
 848 	} else {
 849 		_data_->_tmp15_ = FALSE;
 850 	}
 851 	_data_->_tmp29_ = _data_->_tmp15_;
 852 	if (_data_->_tmp29_) {
 853 		g_warning ("tracker-query.vala:296: Criteria was NULL or an empty string no query " \
 854 "performed");
 855 		_data_->result = (guint) 0;
 856 		_g_object_unref0 (_data_->cursor);
 857 		if (_data_->_state_ == 0) {
 858 			g_simple_async_result_complete_in_idle (_data_->_async_result);
 859 		} else {
 860 			g_simple_async_result_complete (_data_->_async_result);
 861 		}
 862 		g_object_unref (_data_->_async_result);
 863 		return FALSE;
 864 	}
 865 	_data_->_tmp31_ = _data_->match_type;
 866 	if (_data_->_tmp31_ == TRACKER_QUERY_MATCH_TAGS_ONLY) {
 867 		_data_->_tmp30_ = TRUE;
 868 	} else {
 869 		_data_->_tmp32_ = _data_->match_type;
 870 		_data_->_tmp30_ = _data_->_tmp32_ == TRACKER_QUERY_MATCH_TAGS_ONLY_INDIRECT;
 871 	}
 872 	_data_->_tmp33_ = _data_->_tmp30_;
 873 	if (_data_->_tmp33_) {
 874 		_data_->_tmp34_ = _data_->self->priv->match_clauses;
 875 		_data_->_tmp34__length1 = _data_->self->priv->match_clauses_length1;
 876 		_data_->_tmp35_ = _data_->match_type;
 877 		_data_->_tmp36_ = _data_->_tmp34_[_data_->_tmp35_];
 878 		_data_->_tmp37_ = NULL;
 879 		_data_->_tmp37_ = tracker_query_get_tags_filter (_data_->self);
 880 		_data_->_tmp38_ = _data_->_tmp37_;
 881 		_data_->_tmp39_ = NULL;
 882 		_data_->_tmp39_ = g_strdup_printf (_data_->_tmp36_, _data_->_tmp38_);
 883 		_g_free0 (_data_->match);
 884 		_data_->match = _data_->_tmp39_;
 885 		_g_free0 (_data_->_tmp38_);
 886 	} else {
 887 		_data_->_tmp40_ = _data_->self->priv->_criteria;
 888 		_data_->_tmp41_ = NULL;
 889 		_data_->_tmp41_ = tracker_sparql_escape_string (_data_->_tmp40_);
 890 		_data_->criteria_escaped = _data_->_tmp41_;
 891 		_data_->_tmp43_ = _data_->match_type;
 892 		if (_data_->_tmp43_ == TRACKER_QUERY_MATCH_FTS) {
 893 			_data_->_tmp42_ = TRUE;
 894 		} else {
 895 			_data_->_tmp44_ = _data_->match_type;
 896 			_data_->_tmp42_ = _data_->_tmp44_ == TRACKER_QUERY_MATCH_FTS_INDIRECT;
 897 		}
 898 		_data_->_tmp45_ = _data_->_tmp42_;
 899 		if (_data_->_tmp45_) {
 900 			_data_->_tmp46_ = _data_->self->priv->match_clauses;
 901 			_data_->_tmp46__length1 = _data_->self->priv->match_clauses_length1;
 902 			_data_->_tmp47_ = _data_->match_type;
 903 			_data_->_tmp48_ = _data_->_tmp46_[_data_->_tmp47_];
 904 			_data_->_tmp49_ = _data_->criteria_escaped;
 905 			_data_->_tmp50_ = _data_->criteria_escaped;
 906 			_data_->_tmp51_ = NULL;
 907 			_data_->_tmp51_ = g_strdup_printf (_data_->_tmp48_, _data_->_tmp49_, _data_->_tmp50_);
 908 			_g_free0 (_data_->match);
 909 			_data_->match = _data_->_tmp51_;
 910 		} else {
 911 			_data_->_tmp52_ = _data_->self->priv->match_clauses;
 912 			_data_->_tmp52__length1 = _data_->self->priv->match_clauses_length1;
 913 			_data_->_tmp53_ = _data_->match_type;
 914 			_data_->_tmp54_ = _data_->_tmp52_[_data_->_tmp53_];
 915 			_data_->_tmp55_ = _data_->criteria_escaped;
 916 			_data_->_tmp56_ = NULL;
 917 			_data_->_tmp56_ = g_strdup_printf (_data_->_tmp54_, _data_->_tmp55_);
 918 			_g_free0 (_data_->match);
 919 			_data_->match = _data_->_tmp56_;
 920 		}
 921 		_g_free0 (_data_->criteria_escaped);
 922 	}
 923 	tracker_query_set_query (_data_->self, "SELECT count(?urn)");
 924 	_data_->_tmp57_ = _data_->self->priv->where_clauses;
 925 	_data_->_tmp57__length1 = _data_->self->priv->where_clauses_length1;
 926 	_data_->_tmp58_ = _data_->query_type;
 927 	_data_->_tmp59_ = _data_->_tmp57_[_data_->_tmp58_];
 928 	_data_->_tmp60_ = strlen (_data_->_tmp59_);
 929 	_data_->_tmp61_ = _data_->_tmp60_;
 930 	if (_data_->_tmp61_ > 0) {
 931 		_data_->_tmp62_ = _data_->self->priv->_query;
 932 		_data_->_tmp63_ = _data_->self->priv->where_clauses;
 933 		_data_->_tmp63__length1 = _data_->self->priv->where_clauses_length1;
 934 		_data_->_tmp64_ = _data_->query_type;
 935 		_data_->_tmp65_ = _data_->_tmp63_[_data_->_tmp64_];
 936 		_data_->_tmp66_ = _data_->match;
 937 		_data_->_tmp67_ = NULL;
 938 		_data_->_tmp67_ = g_strdup_printf (_data_->_tmp65_, _data_->_tmp66_);
 939 		_data_->_tmp68_ = _data_->_tmp67_;
 940 		_data_->_tmp69_ = g_strconcat (" ", _data_->_tmp68_, NULL);
 941 		_data_->_tmp70_ = _data_->_tmp69_;
 942 		_data_->_tmp71_ = g_strconcat (_data_->_tmp62_, _data_->_tmp70_, NULL);
 943 		_data_->_tmp72_ = _data_->_tmp71_;
 944 		tracker_query_set_query (_data_->self, _data_->_tmp72_);
 945 		_g_free0 (_data_->_tmp72_);
 946 		_g_free0 (_data_->_tmp70_);
 947 		_g_free0 (_data_->_tmp68_);
 948 	}
 949 	_data_->_tmp73_ = _data_->self->priv->sort_clauses;
 950 	_data_->_tmp73__length1 = _data_->self->priv->sort_clauses_length1;
 951 	_data_->_tmp74_ = _data_->query_type;
 952 	_data_->_tmp75_ = _data_->_tmp73_[_data_->_tmp74_];
 953 	_data_->_tmp76_ = strlen (_data_->_tmp75_);
 954 	_data_->_tmp77_ = _data_->_tmp76_;
 955 	if (_data_->_tmp77_ > 0) {
 956 		_data_->_tmp78_ = _data_->self->priv->_query;
 957 		_data_->_tmp79_ = _data_->self->priv->sort_clauses;
 958 		_data_->_tmp79__length1 = _data_->self->priv->sort_clauses_length1;
 959 		_data_->_tmp80_ = _data_->query_type;
 960 		_data_->_tmp81_ = _data_->_tmp79_[_data_->_tmp80_];
 961 		_data_->_tmp82_ = g_strconcat (" ORDER BY ", _data_->_tmp81_, NULL);
 962 		_data_->_tmp83_ = _data_->_tmp82_;
 963 		_data_->_tmp84_ = g_strconcat (_data_->_tmp78_, _data_->_tmp83_, NULL);
 964 		_data_->_tmp85_ = _data_->_tmp84_;
 965 		tracker_query_set_query (_data_->self, _data_->_tmp85_);
 966 		_g_free0 (_data_->_tmp85_);
 967 		_g_free0 (_data_->_tmp83_);
 968 	}
 969 	{
 970 		_data_->_tmp86_ = tracker_query_connection;
 971 		_data_->_tmp87_ = _data_->self->priv->_query;
 972 		_data_->_state_ = 1;
 973 		tracker_sparql_connection_query_async (_data_->_tmp86_, _data_->_tmp87_, NULL, tracker_query_get_count_async_ready, _data_);
 974 		return FALSE;
 975 		_state_1:
 976 		_data_->_tmp88_ = NULL;
 977 		_data_->_tmp88_ = tracker_sparql_connection_query_finish (_data_->_tmp86_, _data_->_res_, &_data_->_inner_error_);
 978 		_data_->_tmp89_ = _data_->_tmp88_;
 979 		if (_data_->_inner_error_ != NULL) {
 980 			goto __catch4_g_error;
 981 		}
 982 		_g_object_unref0 (_data_->cursor);
 983 		_data_->cursor = _data_->_tmp89_;
 984 		_data_->_tmp90_ = _data_->cursor;
 985 		_data_->_state_ = 2;
 986 		tracker_sparql_cursor_next_async (_data_->_tmp90_, NULL, tracker_query_get_count_async_ready, _data_);
 987 		return FALSE;
 988 		_state_2:
 989 		tracker_sparql_cursor_next_finish (_data_->_tmp90_, _data_->_res_, &_data_->_inner_error_);
 990 		if (_data_->_inner_error_ != NULL) {
 991 			goto __catch4_g_error;
 992 		}
 993 	}
 994 	goto __finally4;
 995 	__catch4_g_error:
 996 	{
 997 		_data_->e = _data_->_inner_error_;
 998 		_data_->_inner_error_ = NULL;
 999 		_data_->_tmp91_ = _data_->e;
1000 		_data_->_tmp92_ = _data_->_tmp91_->message;
1001 		g_warning ("tracker-query.vala:331: Could not run Sparql count query: %s", _data_->_tmp92_);
1002 		_g_error_free0 (_data_->e);
1003 	}
1004 	__finally4:
1005 	if (_data_->_inner_error_ != NULL) {
1006 		if (_data_->_inner_error_->domain == G_IO_ERROR) {
1007 			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
1008 			g_error_free (_data_->_inner_error_);
1009 			_g_free0 (_data_->match);
1010 			_g_object_unref0 (_data_->cursor);
1011 			if (_data_->_state_ == 0) {
1012 				g_simple_async_result_complete_in_idle (_data_->_async_result);
1013 			} else {
1014 				g_simple_async_result_complete (_data_->_async_result);
1015 			}
1016 			g_object_unref (_data_->_async_result);
1017 			return FALSE;
1018 		} else {
1019 			_g_free0 (_data_->match);
1020 			_g_object_unref0 (_data_->cursor);
1021 			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);
1022 			g_clear_error (&_data_->_inner_error_);
1023 			return FALSE;
1024 		}
1025 	}
1026 	_data_->_tmp93_ = _data_->cursor;
1027 	_data_->_tmp94_ = 0LL;
1028 	_data_->_tmp94_ = tracker_sparql_cursor_get_integer (_data_->_tmp93_, 0);
1029 	_data_->result = (guint) _data_->_tmp94_;
1030 	_g_free0 (_data_->match);
1031 	_g_object_unref0 (_data_->cursor);
1032 	if (_data_->_state_ == 0) {
1033 		g_simple_async_result_complete_in_idle (_data_->_async_result);
1034 	} else {
1035 		g_simple_async_result_complete (_data_->_async_result);
1036 	}
1037 	g_object_unref (_data_->_async_result);
1038 	return FALSE;
1039 	_g_free0 (_data_->match);
1040 	_g_object_unref0 (_data_->cursor);
1041 	if (_data_->_state_ == 0) {
1042 		g_simple_async_result_complete_in_idle (_data_->_async_result);
1043 	} else {
1044 		g_simple_async_result_complete (_data_->_async_result);
1045 	}
1046 	g_object_unref (_data_->_async_result);
1047 	return FALSE;
1048 }
1049 
1050 
1051 static void tracker_query_perform_async_data_free (gpointer _data) {
1052 	TrackerQueryPerformAsyncData* _data_;
1053 	_data_ = _data;
1054 	_g_object_unref0 (_data_->cancellable);
1055 	_g_object_unref0 (_data_->result);
1056 	_tracker_query_unref0 (_data_->self);
1057 	g_slice_free (TrackerQueryPerformAsyncData, _data_);
1058 }
1059 
1060 
1061 void tracker_query_perform_async (TrackerQuery* self, TrackerQueryType query_type, TrackerQueryMatch match_type, gchar** args, int args_length1, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
1062 	TrackerQueryPerformAsyncData* _data_;
1063 	TrackerQuery* _tmp0_;
1064 	TrackerQueryType _tmp1_;
1065 	TrackerQueryMatch _tmp2_;
1066 	gchar** _tmp3_;
1067 	gint _tmp3__length1;
1068 	GCancellable* _tmp4_;
1069 	GCancellable* _tmp5_;
1070 	_data_ = g_slice_new0 (TrackerQueryPerformAsyncData);
1071 	_data_->_async_result = g_simple_async_result_new (g_object_newv (G_TYPE_OBJECT, 0, NULL), _callback_, _user_data_, tracker_query_perform_async);
1072 	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, tracker_query_perform_async_data_free);
1073 	_tmp0_ = _tracker_query_ref0 (self);
1074 	_data_->self = _tmp0_;
1075 	_tmp1_ = query_type;
1076 	_data_->query_type = _tmp1_;
1077 	_tmp2_ = match_type;
1078 	_data_->match_type = _tmp2_;
1079 	_tmp3_ = args;
1080 	_tmp3__length1 = args_length1;
1081 	_data_->args = _tmp3_;
1082 	_data_->args_length1 = _tmp3__length1;
1083 	_tmp4_ = cancellable;
1084 	_tmp5_ = _g_object_ref0 (_tmp4_);
1085 	_g_object_unref0 (_data_->cancellable);
1086 	_data_->cancellable = _tmp5_;
1087 	tracker_query_perform_async_co (_data_);
1088 }
1089 
1090 
1091 TrackerSparqlCursor* tracker_query_perform_finish (TrackerQuery* self, GAsyncResult* _res_, GError** error) {
1092 	TrackerSparqlCursor* result;
1093 	TrackerQueryPerformAsyncData* _data_;
1094 	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
1095 		return NULL;
1096 	}
1097 	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
1098 	result = _data_->result;
1099 	_data_->result = NULL;
1100 	return result;
1101 }
1102 
1103 
1104 static void tracker_query_perform_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
1105 	TrackerQueryPerformAsyncData* _data_;
1106 	_data_ = _user_data_;
1107 	_data_->_source_object_ = source_object;
1108 	_data_->_res_ = _res_;
1109 	tracker_query_perform_async_co (_data_);
1110 }
1111 
1112 
1113 static gboolean tracker_query_perform_async_co (TrackerQueryPerformAsyncData* _data_) {
1114 	switch (_data_->_state_) {
1115 		case 0:
1116 		goto _state_0;
1117 		case 1:
1118 		goto _state_1;
1119 		default:
1120 		g_assert_not_reached ();
1121 	}
1122 	_state_0:
1123 	_data_->_tmp0_ = tracker_query_connection;
1124 	g_return_val_if_fail (_data_->_tmp0_ != NULL, FALSE);
1125 	_data_->cursor = NULL;
1126 	_data_->_tmp1_ = _data_->query_type;
1127 	_data_->_tmp2_ = _data_->match_type;
1128 	_data_->_tmp3_ = FALSE;
1129 	_data_->_tmp3_ = tracker_query_check_query_and_match_type (_data_->self, _data_->_tmp1_, _data_->_tmp2_);
1130 	if (!_data_->_tmp3_) {
1131 		_data_->result = NULL;
1132 		_g_object_unref0 (_data_->cursor);
1133 		if (_data_->_state_ == 0) {
1134 			g_simple_async_result_complete_in_idle (_data_->_async_result);
1135 		} else {
1136 			g_simple_async_result_complete (_data_->_async_result);
1137 		}
1138 		g_object_unref (_data_->_async_result);
1139 		return FALSE;
1140 	}
1141 	_data_->_tmp5_ = _data_->self->priv->_tags;
1142 	if (_data_->_tmp5_ != NULL) {
1143 		_data_->_tmp6_ = _data_->self->priv->_tags;
1144 		_data_->_tmp7_ = g_ptr_array_get_length (_data_->_tmp6_);
1145 		_data_->_tmp8_ = _data_->_tmp7_;
1146 		_data_->_tmp4_ = _data_->_tmp8_ > 0;
1147 	} else {
1148 		_data_->_tmp4_ = FALSE;
1149 	}
1150 	_data_->_tmp9_ = _data_->_tmp4_;
1151 	if (_data_->_tmp9_) {
1152 		_data_->_tmp11_ = _data_->match_type;
1153 		if (_data_->_tmp11_ == TRACKER_QUERY_MATCH_FTS_INDIRECT) {
1154 			_data_->_tmp10_ = TRUE;
1155 		} else {
1156 			_data_->_tmp12_ = _data_->match_type;
1157 			_data_->_tmp10_ = _data_->_tmp12_ == TRACKER_QUERY_MATCH_TITLES_INDIRECT;
1158 		}
1159 		_data_->_tmp13_ = _data_->_tmp10_;
1160 		if (_data_->_tmp13_) {
1161 			_data_->match_type = TRACKER_QUERY_MATCH_TAGS_ONLY_INDIRECT;
1162 		} else {
1163 			_data_->match_type = TRACKER_QUERY_MATCH_TAGS_ONLY;
1164 		}
1165 	}
1166 	_data_->_tmp17_ = _data_->match_type;
1167 	if (_data_->_tmp17_ != TRACKER_QUERY_MATCH_NONE) {
1168 		_data_->_tmp18_ = _data_->match_type;
1169 		_data_->_tmp16_ = _data_->_tmp18_ != TRACKER_QUERY_MATCH_TAGS_ONLY;
1170 	} else {
1171 		_data_->_tmp16_ = FALSE;
1172 	}
1173 	_data_->_tmp19_ = _data_->_tmp16_;
1174 	if (_data_->_tmp19_) {
1175 		_data_->_tmp20_ = _data_->match_type;
1176 		_data_->_tmp15_ = _data_->_tmp20_ != TRACKER_QUERY_MATCH_TAGS_ONLY_INDIRECT;
1177 	} else {
1178 		_data_->_tmp15_ = FALSE;
1179 	}
1180 	_data_->_tmp21_ = _data_->_tmp15_;
1181 	if (_data_->_tmp21_) {
1182 		_data_->_tmp23_ = _data_->self->priv->_criteria;
1183 		if (_data_->_tmp23_ == NULL) {
1184 			_data_->_tmp22_ = TRUE;
1185 		} else {
1186 			_data_->_tmp24_ = _data_->self->priv->_criteria;
1187 			_data_->_tmp25_ = strlen (_data_->_tmp24_);
1188 			_data_->_tmp26_ = _data_->_tmp25_;
1189 			_data_->_tmp22_ = _data_->_tmp26_ < 1;
1190 		}
1191 		_data_->_tmp27_ = _data_->_tmp22_;
1192 		_data_->_tmp14_ = _data_->_tmp27_;
1193 	} else {
1194 		_data_->_tmp14_ = FALSE;
1195 	}
1196 	_data_->_tmp28_ = _data_->_tmp14_;
1197 	if (_data_->_tmp28_) {
1198 		g_warning ("tracker-query.vala:359: Criteria was NULL or an empty string no query " \
1199 "performed");
1200 		_data_->result = NULL;
1201 		_g_object_unref0 (_data_->cursor);
1202 		if (_data_->_state_ == 0) {
1203 			g_simple_async_result_complete_in_idle (_data_->_async_result);
1204 		} else {
1205 			g_simple_async_result_complete (_data_->_async_result);
1206 		}
1207 		g_object_unref (_data_->_async_result);
1208 		return FALSE;
1209 	}
1210 	_data_->_tmp29_ = _data_->self->priv->_limit;
1211 	if (_data_->_tmp29_ < ((guint) 1)) {
1212 		g_warning ("tracker-query.vala:364: Limit was < 1, no query performed");
1213 		_data_->result = NULL;
1214 		_g_object_unref0 (_data_->cursor);
1215 		if (_data_->_state_ == 0) {
1216 			g_simple_async_result_complete_in_idle (_data_->_async_result);
1217 		} else {
1218 			g_simple_async_result_complete (_data_->_async_result);
1219 		}
1220 		g_object_unref (_data_->_async_result);
1221 		return FALSE;
1222 	}
1223 	_data_->_tmp31_ = _data_->match_type;
1224 	if (_data_->_tmp31_ == TRACKER_QUERY_MATCH_TAGS_ONLY) {
1225 		_data_->_tmp30_ = TRUE;
1226 	} else {
1227 		_data_->_tmp32_ = _data_->match_type;
1228 		_data_->_tmp30_ = _data_->_tmp32_ == TRACKER_QUERY_MATCH_TAGS_ONLY_INDIRECT;
1229 	}
1230 	_data_->_tmp33_ = _data_->_tmp30_;
1231 	if (_data_->_tmp33_) {
1232 		_data_->_tmp34_ = _data_->self->priv->match_clauses;
1233 		_data_->_tmp34__length1 = _data_->self->priv->match_clauses_length1;
1234 		_data_->_tmp35_ = _data_->match_type;
1235 		_data_->_tmp36_ = _data_->_tmp34_[_data_->_tmp35_];
1236 		_data_->_tmp37_ = NULL;
1237 		_data_->_tmp37_ = tracker_query_get_tags_filter (_data_->self);
1238 		_data_->_tmp38_ = _data_->_tmp37_;
1239 		_data_->_tmp39_ = NULL;
1240 		_data_->_tmp39_ = g_strdup_printf (_data_->_tmp36_, _data_->_tmp38_);
1241 		_g_free0 (_data_->match);
1242 		_data_->match = _data_->_tmp39_;
1243 		_g_free0 (_data_->_tmp38_);
1244 	} else {
1245 		_data_->_tmp40_ = _data_->self->priv->_criteria;
1246 		_data_->_tmp41_ = NULL;
1247 		_data_->_tmp41_ = tracker_sparql_escape_string (_data_->_tmp40_);
1248 		_data_->criteria_escaped = _data_->_tmp41_;
1249 		_data_->_tmp43_ = _data_->match_type;
1250 		if (_data_->_tmp43_ == TRACKER_QUERY_MATCH_FTS) {
1251 			_data_->_tmp42_ = TRUE;
1252 		} else {
1253 			_data_->_tmp44_ = _data_->match_type;
1254 			_data_->_tmp42_ = _data_->_tmp44_ == TRACKER_QUERY_MATCH_FTS_INDIRECT;
1255 		}
1256 		_data_->_tmp45_ = _data_->_tmp42_;
1257 		if (_data_->_tmp45_) {
1258 			_data_->_tmp46_ = _data_->self->priv->match_clauses;
1259 			_data_->_tmp46__length1 = _data_->self->priv->match_clauses_length1;
1260 			_data_->_tmp47_ = _data_->match_type;
1261 			_data_->_tmp48_ = _data_->_tmp46_[_data_->_tmp47_];
1262 			_data_->_tmp49_ = _data_->criteria_escaped;
1263 			_data_->_tmp50_ = _data_->criteria_escaped;
1264 			_data_->_tmp51_ = NULL;
1265 			_data_->_tmp51_ = g_strdup_printf (_data_->_tmp48_, _data_->_tmp49_, _data_->_tmp50_);
1266 			_g_free0 (_data_->match);
1267 			_data_->match = _data_->_tmp51_;
1268 		} else {
1269 			_data_->_tmp52_ = _data_->self->priv->match_clauses;
1270 			_data_->_tmp52__length1 = _data_->self->priv->match_clauses_length1;
1271 			_data_->_tmp53_ = _data_->match_type;
1272 			_data_->_tmp54_ = _data_->_tmp52_[_data_->_tmp53_];
1273 			_data_->_tmp55_ = _data_->criteria_escaped;
1274 			_data_->_tmp56_ = NULL;
1275 			_data_->_tmp56_ = g_strdup_printf (_data_->_tmp54_, _data_->_tmp55_);
1276 			_g_free0 (_data_->match);
1277 			_data_->match = _data_->_tmp56_;
1278 		}
1279 		_g_free0 (_data_->criteria_escaped);
1280 	}
1281 	_data_->_tmp57_ = _data_->args;
1282 	_data_->_tmp57__length1 = _data_->args_length1;
1283 	_data_->_tmp58_ = NULL;
1284 	_data_->_tmp58_ = g_strjoinv (" ", _data_->_tmp57_);
1285 	_data_->_tmp59_ = _data_->_tmp58_;
1286 	_data_->_tmp60_ = g_strconcat ("SELECT ", _data_->_tmp59_, NULL);
1287 	_data_->_tmp61_ = _data_->_tmp60_;
1288 	tracker_query_set_query (_data_->self, _data_->_tmp61_);
1289 	_g_free0 (_data_->_tmp61_);
1290 	_g_free0 (_data_->_tmp59_);
1291 	_data_->_tmp62_ = _data_->self->priv->where_clauses;
1292 	_data_->_tmp62__length1 = _data_->self->priv->where_clauses_length1;
1293 	_data_->_tmp63_ = _data_->query_type;
1294 	_data_->_tmp64_ = _data_->_tmp62_[_data_->_tmp63_];
1295 	_data_->_tmp65_ = strlen (_data_->_tmp64_);
1296 	_data_->_tmp66_ = _data_->_tmp65_;
1297 	if (_data_->_tmp66_ > 0) {
1298 		_data_->_tmp67_ = _data_->self->priv->_query;
1299 		_data_->_tmp68_ = _data_->self->priv->where_clauses;
1300 		_data_->_tmp68__length1 = _data_->self->priv->where_clauses_length1;
1301 		_data_->_tmp69_ = _data_->query_type;
1302 		_data_->_tmp70_ = _data_->_tmp68_[_data_->_tmp69_];
1303 		_data_->_tmp71_ = _data_->match;
1304 		_data_->_tmp72_ = NULL;
1305 		_data_->_tmp72_ = g_strdup_printf (_data_->_tmp70_, _data_->_tmp71_);
1306 		_data_->_tmp73_ = _data_->_tmp72_;
1307 		_data_->_tmp74_ = g_strconcat (" ", _data_->_tmp73_, NULL);
1308 		_data_->_tmp75_ = _data_->_tmp74_;
1309 		_data_->_tmp76_ = g_strconcat (_data_->_tmp67_, _data_->_tmp75_, NULL);
1310 		_data_->_tmp77_ = _data_->_tmp76_;
1311 		tracker_query_set_query (_data_->self, _data_->_tmp77_);
1312 		_g_free0 (_data_->_tmp77_);
1313 		_g_free0 (_data_->_tmp75_);
1314 		_g_free0 (_data_->_tmp73_);
1315 	}
1316 	_data_->_tmp78_ = _data_->self->priv->sort_clauses;
1317 	_data_->_tmp78__length1 = _data_->self->priv->sort_clauses_length1;
1318 	_data_->_tmp79_ = _data_->query_type;
1319 	_data_->_tmp80_ = _data_->_tmp78_[_data_->_tmp79_];
1320 	_data_->_tmp81_ = strlen (_data_->_tmp80_);
1321 	_data_->_tmp82_ = _data_->_tmp81_;
1322 	if (_data_->_tmp82_ > 0) {
1323 		_data_->_tmp83_ = _data_->self->priv->_query;
1324 		_data_->_tmp84_ = _data_->self->priv->sort_clauses;
1325 		_data_->_tmp84__length1 = _data_->self->priv->sort_clauses_length1;
1326 		_data_->_tmp85_ = _data_->query_type;
1327 		_data_->_tmp86_ = _data_->_tmp84_[_data_->_tmp85_];
1328 		_data_->_tmp87_ = g_strconcat (" ORDER BY ", _data_->_tmp86_, NULL);
1329 		_data_->_tmp88_ = _data_->_tmp87_;
1330 		_data_->_tmp89_ = g_strconcat (_data_->_tmp83_, _data_->_tmp88_, NULL);
1331 		_data_->_tmp90_ = _data_->_tmp89_;
1332 		tracker_query_set_query (_data_->self, _data_->_tmp90_);
1333 		_g_free0 (_data_->_tmp90_);
1334 		_g_free0 (_data_->_tmp88_);
1335 	}
1336 	_data_->_tmp91_ = _data_->self->priv->_query;
1337 	_data_->_tmp92_ = _data_->self->priv->_offset;
1338 	_data_->_tmp93_ = _data_->self->priv->_limit;
1339 	_data_->_tmp94_ = NULL;
1340 	_data_->_tmp94_ = g_strdup_printf (" OFFSET %u LIMIT %u", _data_->_tmp92_, _data_->_tmp93_);
1341 	_data_->_tmp95_ = _data_->_tmp94_;
1342 	_data_->_tmp96_ = g_strconcat (_data_->_tmp91_, _data_->_tmp95_, NULL);
1343 	_data_->_tmp97_ = _data_->_tmp96_;
1344 	tracker_query_set_query (_data_->self, _data_->_tmp97_);
1345 	_g_free0 (_data_->_tmp97_);
1346 	_g_free0 (_data_->_tmp95_);
1347 	_data_->_tmp98_ = _data_->self->priv->_query;
1348 	g_debug ("tracker-query.vala:396: Running query: '%s'", _data_->_tmp98_);
1349 	{
1350 		_data_->_tmp99_ = tracker_query_connection;
1351 		_data_->_tmp100_ = _data_->self->priv->_query;
1352 		_data_->_state_ = 1;
1353 		tracker_sparql_connection_query_async (_data_->_tmp99_, _data_->_tmp100_, NULL, tracker_query_perform_async_ready, _data_);
1354 		return FALSE;
1355 		_state_1:
1356 		_data_->_tmp101_ = NULL;
1357 		_data_->_tmp101_ = tracker_sparql_connection_query_finish (_data_->_tmp99_, _data_->_res_, &_data_->_inner_error_);
1358 		_data_->_tmp102_ = _data_->_tmp101_;
1359 		if (_data_->_inner_error_ != NULL) {
1360 			goto __catch5_g_error;
1361 		}
1362 		_g_object_unref0 (_data_->cursor);
1363 		_data_->cursor = _data_->_tmp102_;
1364 	}
1365 	goto __finally5;
1366 	__catch5_g_error:
1367 	{
1368 		_data_->e = _data_->_inner_error_;
1369 		_data_->_inner_error_ = NULL;
1370 		_data_->_tmp103_ = _data_->e;
1371 		_data_->_tmp104_ = _data_->_tmp103_->message;
1372 		g_warning ("tracker-query.vala:401: Could not run Sparql query: %s", _data_->_tmp104_);
1373 		_g_error_free0 (_data_->e);
1374 	}
1375 	__finally5:
1376 	if (_data_->_inner_error_ != NULL) {
1377 		if (_data_->_inner_error_->domain == G_IO_ERROR) {
1378 			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
1379 			g_error_free (_data_->_inner_error_);
1380 			_g_free0 (_data_->match);
1381 			_g_object_unref0 (_data_->cursor);
1382 			if (_data_->_state_ == 0) {
1383 				g_simple_async_result_complete_in_idle (_data_->_async_result);
1384 			} else {
1385 				g_simple_async_result_complete (_data_->_async_result);
1386 			}
1387 			g_object_unref (_data_->_async_result);
1388 			return FALSE;
1389 		} else {
1390 			_g_free0 (_data_->match);
1391 			_g_object_unref0 (_data_->cursor);
1392 			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);
1393 			g_clear_error (&_data_->_inner_error_);
1394 			return FALSE;
1395 		}
1396 	}
1397 	g_debug ("tracker-query.vala:404: Done");
1398 	_data_->result = _data_->cursor;
1399 	_g_free0 (_data_->match);
1400 	if (_data_->_state_ == 0) {
1401 		g_simple_async_result_complete_in_idle (_data_->_async_result);
1402 	} else {
1403 		g_simple_async_result_complete (_data_->_async_result);
1404 	}
1405 	g_object_unref (_data_->_async_result);
1406 	return FALSE;
1407 	_g_free0 (_data_->match);
1408 	_g_object_unref0 (_data_->cursor);
1409 	if (_data_->_state_ == 0) {
1410 		g_simple_async_result_complete_in_idle (_data_->_async_result);
1411 	} else {
1412 		g_simple_async_result_complete (_data_->_async_result);
1413 	}
1414 	g_object_unref (_data_->_async_result);
1415 	return FALSE;
1416 }
1417 
1418 
1419 const gchar* tracker_query_get_criteria (TrackerQuery* self) {
1420 	const gchar* result;
1421 	const gchar* _tmp0_;
1422 	g_return_val_if_fail (self != NULL, NULL);
1423 	_tmp0_ = self->priv->_criteria;
1424 	result = _tmp0_;
1425 	return result;
1426 }
1427 
1428 
1429 void tracker_query_set_criteria (TrackerQuery* self, const gchar* value) {
1430 	const gchar* _tmp0_;
1431 	gchar* _tmp1_;
1432 	g_return_if_fail (self != NULL);
1433 	_tmp0_ = value;
1434 	_tmp1_ = g_strdup (_tmp0_);
1435 	_g_free0 (self->priv->_criteria);
1436 	self->priv->_criteria = _tmp1_;
1437 }
1438 
1439 
1440 guint tracker_query_get_offset (TrackerQuery* self) {
1441 	guint result;
1442 	guint _tmp0_;
1443 	g_return_val_if_fail (self != NULL, 0U);
1444 	_tmp0_ = self->priv->_offset;
1445 	result = _tmp0_;
1446 	return result;
1447 }
1448 
1449 
1450 void tracker_query_set_offset (TrackerQuery* self, guint value) {
1451 	guint _tmp0_;
1452 	g_return_if_fail (self != NULL);
1453 	_tmp0_ = value;
1454 	self->priv->_offset = _tmp0_;
1455 }
1456 
1457 
1458 guint tracker_query_get_limit (TrackerQuery* self) {
1459 	guint result;
1460 	guint _tmp0_;
1461 	g_return_val_if_fail (self != NULL, 0U);
1462 	_tmp0_ = self->priv->_limit;
1463 	result = _tmp0_;
1464 	return result;
1465 }
1466 
1467 
1468 void tracker_query_set_limit (TrackerQuery* self, guint value) {
1469 	guint _tmp0_;
1470 	g_return_if_fail (self != NULL);
1471 	_tmp0_ = value;
1472 	self->priv->_limit = _tmp0_;
1473 }
1474 
1475 
1476 const gchar* tracker_query_get_query (TrackerQuery* self) {
1477 	const gchar* result;
1478 	const gchar* _tmp0_;
1479 	g_return_val_if_fail (self != NULL, NULL);
1480 	_tmp0_ = self->priv->_query;
1481 	result = _tmp0_;
1482 	return result;
1483 }
1484 
1485 
1486 static void tracker_query_set_query (TrackerQuery* self, const gchar* value) {
1487 	const gchar* _tmp0_;
1488 	gchar* _tmp1_;
1489 	g_return_if_fail (self != NULL);
1490 	_tmp0_ = value;
1491 	_tmp1_ = g_strdup (_tmp0_);
1492 	_g_free0 (self->priv->_query);
1493 	self->priv->_query = _tmp1_;
1494 }
1495 
1496 
1497 GPtrArray* tracker_query_get_tags (TrackerQuery* self) {
1498 	GPtrArray* result;
1499 	GPtrArray* _tmp0_;
1500 	g_return_val_if_fail (self != NULL, NULL);
1501 	_tmp0_ = self->priv->_tags;
1502 	result = _tmp0_;
1503 	return result;
1504 }
1505 
1506 
1507 static gpointer _g_ptr_array_ref0 (gpointer self) {
1508 	return self ? g_ptr_array_ref (self) : NULL;
1509 }
1510 
1511 
1512 void tracker_query_set_tags (TrackerQuery* self, GPtrArray* value) {
1513 	GPtrArray* _tmp0_;
1514 	GPtrArray* _tmp1_;
1515 	g_return_if_fail (self != NULL);
1516 	_tmp0_ = value;
1517 	_tmp1_ = _g_ptr_array_ref0 (_tmp0_);
1518 	_g_ptr_array_unref0 (self->priv->_tags);
1519 	self->priv->_tags = _tmp1_;
1520 }
1521 
1522 
1523 static void tracker_value_query_init (GValue* value) {
1524 	value->data[0].v_pointer = NULL;
1525 }
1526 
1527 
1528 static void tracker_value_query_free_value (GValue* value) {
1529 	if (value->data[0].v_pointer) {
1530 		tracker_query_unref (value->data[0].v_pointer);
1531 	}
1532 }
1533 
1534 
1535 static void tracker_value_query_copy_value (const GValue* src_value, GValue* dest_value) {
1536 	if (src_value->data[0].v_pointer) {
1537 		dest_value->data[0].v_pointer = tracker_query_ref (src_value->data[0].v_pointer);
1538 	} else {
1539 		dest_value->data[0].v_pointer = NULL;
1540 	}
1541 }
1542 
1543 
1544 static gpointer tracker_value_query_peek_pointer (const GValue* value) {
1545 	return value->data[0].v_pointer;
1546 }
1547 
1548 
1549 static gchar* tracker_value_query_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
1550 	if (collect_values[0].v_pointer) {
1551 		TrackerQuery* object;
1552 		object = collect_values[0].v_pointer;
1553 		if (object->parent_instance.g_class == NULL) {
1554 			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
1555 		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
1556 			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
1557 		}
1558 		value->data[0].v_pointer = tracker_query_ref (object);
1559 	} else {
1560 		value->data[0].v_pointer = NULL;
1561 	}
1562 	return NULL;
1563 }
1564 
1565 
1566 static gchar* tracker_value_query_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
1567 	TrackerQuery** object_p;
1568 	object_p = collect_values[0].v_pointer;
1569 	if (!object_p) {
1570 		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
1571 	}
1572 	if (!value->data[0].v_pointer) {
1573 		*object_p = NULL;
1574 	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
1575 		*object_p = value->data[0].v_pointer;
1576 	} else {
1577 		*object_p = tracker_query_ref (value->data[0].v_pointer);
1578 	}
1579 	return NULL;
1580 }
1581 
1582 
1583 GParamSpec* tracker_param_spec_query (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
1584 	TrackerParamSpecQuery* spec;
1585 	g_return_val_if_fail (g_type_is_a (object_type, TRACKER_TYPE_QUERY), NULL);
1586 	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
1587 	G_PARAM_SPEC (spec)->value_type = object_type;
1588 	return G_PARAM_SPEC (spec);
1589 }
1590 
1591 
1592 gpointer tracker_value_get_query (const GValue* value) {
1593 	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TRACKER_TYPE_QUERY), NULL);
1594 	return value->data[0].v_pointer;
1595 }
1596 
1597 
1598 void tracker_value_set_query (GValue* value, gpointer v_object) {
1599 	TrackerQuery* old;
1600 	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TRACKER_TYPE_QUERY));
1601 	old = value->data[0].v_pointer;
1602 	if (v_object) {
1603 		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TRACKER_TYPE_QUERY));
1604 		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
1605 		value->data[0].v_pointer = v_object;
1606 		tracker_query_ref (value->data[0].v_pointer);
1607 	} else {
1608 		value->data[0].v_pointer = NULL;
1609 	}
1610 	if (old) {
1611 		tracker_query_unref (old);
1612 	}
1613 }
1614 
1615 
1616 void tracker_value_take_query (GValue* value, gpointer v_object) {
1617 	TrackerQuery* old;
1618 	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TRACKER_TYPE_QUERY));
1619 	old = value->data[0].v_pointer;
1620 	if (v_object) {
1621 		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TRACKER_TYPE_QUERY));
1622 		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
1623 		value->data[0].v_pointer = v_object;
1624 	} else {
1625 		value->data[0].v_pointer = NULL;
1626 	}
1627 	if (old) {
1628 		tracker_query_unref (old);
1629 	}
1630 }
1631 
1632 
1633 static void tracker_query_class_init (TrackerQueryClass * klass) {
1634 	tracker_query_parent_class = g_type_class_peek_parent (klass);
1635 	TRACKER_QUERY_CLASS (klass)->finalize = tracker_query_finalize;
1636 	g_type_class_add_private (klass, sizeof (TrackerQueryPrivate));
1637 }
1638 
1639 
1640 static void tracker_query_instance_init (TrackerQuery * self) {
1641 	gchar* _tmp0_;
1642 	gchar* _tmp1_;
1643 	gchar* _tmp2_;
1644 	gchar* _tmp3_;
1645 	gchar* _tmp4_;
1646 	gchar* _tmp5_;
1647 	gchar* _tmp6_;
1648 	gchar** _tmp7_ = NULL;
1649 	gchar* _tmp8_;
1650 	gchar* _tmp9_;
1651 	gchar* _tmp10_;
1652 	gchar* _tmp11_;
1653 	gchar* _tmp12_;
1654 	gchar* _tmp13_;
1655 	gchar* _tmp14_;
1656 	gchar* _tmp15_;
1657 	gchar* _tmp16_;
1658 	gchar* _tmp17_;
1659 	gchar* _tmp18_;
1660 	gchar** _tmp19_ = NULL;
1661 	gchar* _tmp20_;
1662 	gchar* _tmp21_;
1663 	gchar* _tmp22_;
1664 	gchar* _tmp23_;
1665 	gchar* _tmp24_;
1666 	gchar* _tmp25_;
1667 	gchar* _tmp26_;
1668 	gchar* _tmp27_;
1669 	gchar* _tmp28_;
1670 	gchar* _tmp29_;
1671 	gchar* _tmp30_;
1672 	gchar** _tmp31_ = NULL;
1673 	self->priv = TRACKER_QUERY_GET_PRIVATE (self);
1674 	_tmp0_ = g_strdup ("");
1675 	_tmp1_ = g_strdup ("{\n" \
1676 "		   ?urn fts:match \"%s\"\n" \
1677 "		 } UNION {\n" \
1678 "		   ?urn nao:hasTag ?tag .\n" \
1679 "                   FILTER (fn:contains (fn:lower-case (nao:prefLabel(?" \
1680 "tag)), \"%s\"))\n" \
1681 "		 }");
1682 	_tmp2_ = g_strdup ("{\n" \
1683 "		   ?match fts:match \"%s\"\n" \
1684 "		 } UNION {\n" \
1685 "		   ?match nao:hasTag ?tag .\n" \
1686 "                   FILTER (fn:contains (fn:lower-case (nao:prefLabel(?" \
1687 "tag)), \"%s\"))\n" \
1688 "		 }");
1689 	_tmp3_ = g_strdup ("FILTER (fn:contains (fn:lower-case (nfo:fileName(?urn)), \"%s\"))");
1690 	_tmp4_ = g_strdup ("FILTER (fn:contains (fn:lower-case (nie:title(?match)), \"%s\"))");
1691 	_tmp5_ = g_strdup ("?urn nao:hasTag ?tag .\n		 FILTER (nao:prefLabel(?tag) IN (%s))");
1692 	_tmp6_ = g_strdup ("?match nao:hasTag ?tag .\n		 FILTER (nao:prefLabel(?tag) IN (%s))");
1693 	_tmp7_ = g_new0 (gchar*, 7 + 1);
1694 	_tmp7_[0] = _tmp0_;
1695 	_tmp7_[1] = _tmp1_;
1696 	_tmp7_[2] = _tmp2_;
1697 	_tmp7_[3] = _tmp3_;
1698 	_tmp7_[4] = _tmp4_;
1699 	_tmp7_[5] = _tmp5_;
1700 	_tmp7_[6] = _tmp6_;
1701 	self->priv->match_clauses = _tmp7_;
1702 	self->priv->match_clauses_length1 = 7;
1703 	self->priv->_match_clauses_size_ = self->priv->match_clauses_length1;
1704 	_tmp8_ = g_strdup ("WHERE {\n" \
1705 "		  %s .\n" \
1706 "		  ?urn nfo:belongsToContainer ?parent ;\n" \
1707 "		  tracker:available true .\n" \
1708 "		}");
1709 	_tmp9_ = g_strdup ("");
1710 	_tmp10_ = g_strdup ("WHERE {\n		  ?urn a nfo:Software .\n		  %s\n		}");
1711 	_tmp11_ = g_strdup ("WHERE {\n" \
1712 "		  {\n" \
1713 "		    ?urn nmm:musicAlbum ?match\n" \
1714 "		  } UNION {\n" \
1715 "		    ?urn nmm:performer ?match\n" \
1716 "		  } UNION {\n" \
1717 "		    ?urn a nfo:Audio .\n" \
1718 "		    ?match a nfo:Audio\n" \
1719 "		    FILTER (?urn = ?match)\n" \
1720 "		  }\n" \
1721 "		  %s .\n" \
1722 "		  ?urn nmm:performer [ nmm:artistName ?performer ] ;\n" \
1723 "		       nmm:musicAlbum [ nie:title ?album ] ;\n" \
1724 "		       nie:url ?tooltip .\n" \
1725 "		}");
1726 	_tmp12_ = g_strdup ("WHERE {\n" \
1727 "		  ?urn a nfo:Image ;\n" \
1728 "		         nie:url ?tooltip .\n" \
1729 "		  %s\n" \
1730 "		}");
1731 	_tmp13_ = g_strdup ("WHERE {\n" \
1732 "		  ?urn a nfo:Video ;\n" \
1733 "		         nie:url ?tooltip .\n" \
1734 "		  %s\n" \
1735 "		}");
1736 	_tmp14_ = g_strdup ("WHERE {\n" \
1737 "		  {\n" \
1738 "		    ?urn nco:creator ?match\n" \
1739 "		  } UNION {\n" \
1740 "		    ?urn nco:publisher ?match\n" \
1741 "		  } UNION {\n" \
1742 "		    ?urn a nfo:Document .\n" \
1743 "		    ?match a nfo:Document\n" \
1744 "		    FILTER (?urn = ?match)\n" \
1745 "		  }\n" \
1746 "		  %s .\n" \
1747 "		  ?urn nie:url ?tooltip .\n" \
1748 "		  OPTIONAL {\n" \
1749 "		    ?urn nco:creator ?creator .\n" \
1750 "		  }\n" \
1751 "		  OPTIONAL {\n" \
1752 "		    ?urn nco:publisher ?publisher .\n" \
1753 "		  }\n" \
1754 "		}");
1755 	_tmp15_ = g_strdup ("WHERE {\n" \
1756 "		  ?urn a nmo:Email ;\n" \
1757 "		         nmo:from ?sender ;\n" \
1758 "		         nmo:to ?to .\n" \
1759 "		  %s\n" \
1760 "		}");
1761 	_tmp16_ = g_strdup ("");
1762 	_tmp17_ = g_strdup ("WHERE {\n" \
1763 "		  ?urn a nfo:Folder ;\n" \
1764 "		         nie:url ?tooltip .\n" \
1765 "		  %s\n" \
1766 "		  OPTIONAL {\n" \
1767 "		    ?urn nfo:belongsToContainer ?parent .\n" \
1768 "		  }\n" \
1769 "		}");
1770 	_tmp18_ = g_strdup ("WHERE {\n" \
1771 "		  ?urn a nfo:Bookmark ;\n" \
1772 "                         nfo:bookmarks ?bookmark .\n" \
1773 "		  %s\n" \
1774 "		}");
1775 	_tmp19_ = g_new0 (gchar*, 11 + 1);
1776 	_tmp19_[0] = _tmp8_;
1777 	_tmp19_[1] = _tmp9_;
1778 	_tmp19_[2] = _tmp10_;
1779 	_tmp19_[3] = _tmp11_;
1780 	_tmp19_[4] = _tmp12_;
1781 	_tmp19_[5] = _tmp13_;
1782 	_tmp19_[6] = _tmp14_;
1783 	_tmp19_[7] = _tmp15_;
1784 	_tmp19_[8] = _tmp16_;
1785 	_tmp19_[9] = _tmp17_;
1786 	_tmp19_[10] = _tmp18_;
1787 	self->priv->where_clauses = _tmp19_;
1788 	self->priv->where_clauses_length1 = 11;
1789 	self->priv->_where_clauses_size_ = self->priv->where_clauses_length1;
1790 	_tmp20_ = g_strdup ("DESC(nfo:fileLastModified(?urn)) DESC(nie:contentCreated(?urn)) ASC(ni" \
1791 "e:title(?urn))");
1792 	_tmp21_ = g_strdup ("ASC(nco:fullname(?urn))");
1793 	_tmp22_ = g_strdup ("ASC(nie:title(?urn)) ASC(nie:comment(?urn))");
1794 	_tmp23_ = g_strdup ("DESC(nfo:fileLastModified(?urn)) ASC(nie:title(?urn))");
1795 	_tmp24_ = g_strdup ("DESC(nfo:fileLastModified(?urn)) ASC(nie:title(?urn))");
1796 	_tmp25_ = g_strdup ("DESC(nfo:fileLastModified(?urn)) ASC(nie:title(?urn))");
1797 	_tmp26_ = g_strdup ("DESC(nfo:fileLastModified(?urn)) ASC(nie:title(?urn))");
1798 	_tmp27_ = g_strdup ("DESC(nmo:receivedDate(?urn)) ASC(nmo:messageSubject(?urn))");
1799 	_tmp28_ = g_strdup ("DESC(nie:contentCreated(?urn))");
1800 	_tmp29_ = g_strdup ("DESC(nfo:fileLastModified(?urn)) ASC(nie:title(?urn))");
1801 	_tmp30_ = g_strdup ("DESC(nie:contentLastModified(?urn)) ASC(nie:title(?urn))");
1802 	_tmp31_ = g_new0 (gchar*, 11 + 1);
1803 	_tmp31_[0] = _tmp20_;
1804 	_tmp31_[1] = _tmp21_;
1805 	_tmp31_[2] = _tmp22_;
1806 	_tmp31_[3] = _tmp23_;
1807 	_tmp31_[4] = _tmp24_;
1808 	_tmp31_[5] = _tmp25_;
1809 	_tmp31_[6] = _tmp26_;
1810 	_tmp31_[7] = _tmp27_;
1811 	_tmp31_[8] = _tmp28_;
1812 	_tmp31_[9] = _tmp29_;
1813 	_tmp31_[10] = _tmp30_;
1814 	self->priv->sort_clauses = _tmp31_;
1815 	self->priv->sort_clauses_length1 = 11;
1816 	self->priv->_sort_clauses_size_ = self->priv->sort_clauses_length1;
1817 	self->ref_count = 1;
1818 }
1819 
1820 
1821 static void tracker_query_finalize (TrackerQuery* obj) {
1822 	TrackerQuery * self;
1823 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TRACKER_TYPE_QUERY, TrackerQuery);
1824 	self->priv->match_clauses = (_vala_array_free (self->priv->match_clauses, self->priv->match_clauses_length1, (GDestroyNotify) g_free), NULL);
1825 	self->priv->where_clauses = (_vala_array_free (self->priv->where_clauses, self->priv->where_clauses_length1, (GDestroyNotify) g_free), NULL);
1826 	self->priv->sort_clauses = (_vala_array_free (self->priv->sort_clauses, self->priv->sort_clauses_length1, (GDestroyNotify) g_free), NULL);
1827 	_g_free0 (self->priv->_criteria);
1828 	_g_free0 (self->priv->_query);
1829 	_g_ptr_array_unref0 (self->priv->_tags);
1830 }
1831 
1832 
1833 GType tracker_query_get_type (void) {
1834 	static volatile gsize tracker_query_type_id__volatile = 0;
1835 	if (g_once_init_enter (&tracker_query_type_id__volatile)) {
1836 		static const GTypeValueTable g_define_type_value_table = { tracker_value_query_init, tracker_value_query_free_value, tracker_value_query_copy_value, tracker_value_query_peek_pointer, "p", tracker_value_query_collect_value, "p", tracker_value_query_lcopy_value };
1837 		static const GTypeInfo g_define_type_info = { sizeof (TrackerQueryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_query_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerQuery), 0, (GInstanceInitFunc) tracker_query_instance_init, &g_define_type_value_table };
1838 		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) };
1839 		GType tracker_query_type_id;
1840 		tracker_query_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TrackerQuery", &g_define_type_info, &g_define_type_fundamental_info, 0);
1841 		g_once_init_leave (&tracker_query_type_id__volatile, tracker_query_type_id);
1842 	}
1843 	return tracker_query_type_id__volatile;
1844 }
1845 
1846 
1847 gpointer tracker_query_ref (gpointer instance) {
1848 	TrackerQuery* self;
1849 	self = instance;
1850 	g_atomic_int_inc (&self->ref_count);
1851 	return instance;
1852 }
1853 
1854 
1855 void tracker_query_unref (gpointer instance) {
1856 	TrackerQuery* self;
1857 	self = instance;
1858 	if (g_atomic_int_dec_and_test (&self->ref_count)) {
1859 		TRACKER_QUERY_GET_CLASS (self)->finalize (self);
1860 		g_type_free_instance ((GTypeInstance *) self);
1861 	}
1862 }
1863 
1864 
1865 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
1866 	if ((array != NULL) && (destroy_func != NULL)) {
1867 		int i;
1868 		for (i = 0; i < array_length; i = i + 1) {
1869 			if (((gpointer*) array)[i] != NULL) {
1870 				destroy_func (((gpointer*) array)[i]);
1871 			}
1872 		}
1873 	}
1874 }
1875 
1876 
1877 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
1878 	_vala_array_destroy (array, array_length, destroy_func);
1879 	g_free (array);
1880 }