/* rygel-tracker-selection-query.c generated by valac 0.16.1, the Vala compiler
 * generated from rygel-tracker-selection-query.vala, do not modify */

/*
 * Copyright (C) 2010-2012 Nokia Corporation.
 *
 * Author: Zeeshan Ali <zeenix@gmail.com>
 *         Jens Georg <jensg@openismus.com>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Rygel 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser 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 <gio/gio.h>
#include <libtracker-sparql/tracker-sparql.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <rygel-core.h>


#define RYGEL_TRACKER_TYPE_QUERY (rygel_tracker_query_get_type ())
#define RYGEL_TRACKER_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_QUERY, RygelTrackerQuery))
#define RYGEL_TRACKER_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TRACKER_TYPE_QUERY, RygelTrackerQueryClass))
#define RYGEL_TRACKER_IS_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_QUERY))
#define RYGEL_TRACKER_IS_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TRACKER_TYPE_QUERY))
#define RYGEL_TRACKER_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TRACKER_TYPE_QUERY, RygelTrackerQueryClass))

typedef struct _RygelTrackerQuery RygelTrackerQuery;
typedef struct _RygelTrackerQueryClass RygelTrackerQueryClass;
typedef struct _RygelTrackerQueryPrivate RygelTrackerQueryPrivate;

#define RYGEL_TRACKER_TYPE_QUERY_TRIPLETS (rygel_tracker_query_triplets_get_type ())
#define RYGEL_TRACKER_QUERY_TRIPLETS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_QUERY_TRIPLETS, RygelTrackerQueryTriplets))
#define RYGEL_TRACKER_QUERY_TRIPLETS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TRACKER_TYPE_QUERY_TRIPLETS, RygelTrackerQueryTripletsClass))
#define RYGEL_TRACKER_IS_QUERY_TRIPLETS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_QUERY_TRIPLETS))
#define RYGEL_TRACKER_IS_QUERY_TRIPLETS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TRACKER_TYPE_QUERY_TRIPLETS))
#define RYGEL_TRACKER_QUERY_TRIPLETS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TRACKER_TYPE_QUERY_TRIPLETS, RygelTrackerQueryTripletsClass))

typedef struct _RygelTrackerQueryTriplets RygelTrackerQueryTriplets;
typedef struct _RygelTrackerQueryTripletsClass RygelTrackerQueryTripletsClass;

#define RYGEL_TRACKER_TYPE_SELECTION_QUERY (rygel_tracker_selection_query_get_type ())
#define RYGEL_TRACKER_SELECTION_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TRACKER_TYPE_SELECTION_QUERY, RygelTrackerSelectionQuery))
#define RYGEL_TRACKER_SELECTION_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TRACKER_TYPE_SELECTION_QUERY, RygelTrackerSelectionQueryClass))
#define RYGEL_TRACKER_IS_SELECTION_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TRACKER_TYPE_SELECTION_QUERY))
#define RYGEL_TRACKER_IS_SELECTION_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TRACKER_TYPE_SELECTION_QUERY))
#define RYGEL_TRACKER_SELECTION_QUERY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TRACKER_TYPE_SELECTION_QUERY, RygelTrackerSelectionQueryClass))

typedef struct _RygelTrackerSelectionQuery RygelTrackerSelectionQuery;
typedef struct _RygelTrackerSelectionQueryClass RygelTrackerSelectionQueryClass;
typedef struct _RygelTrackerSelectionQueryPrivate RygelTrackerSelectionQueryPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _rygel_tracker_query_unref0(var) ((var == NULL) ? NULL : (var = (rygel_tracker_query_unref (var), NULL)))
typedef struct _RygelTrackerSelectionQueryExecuteData RygelTrackerSelectionQueryExecuteData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _RygelTrackerQuery {
	GTypeInstance parent_instance;
	volatile int ref_count;
	RygelTrackerQueryPrivate * priv;
	RygelTrackerQueryTriplets* triplets;
};

struct _RygelTrackerQueryClass {
	GTypeClass parent_class;
	void (*finalize) (RygelTrackerQuery *self);
	void (*execute) (RygelTrackerQuery* self, TrackerSparqlConnection* resources, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*execute_finish) (RygelTrackerQuery* self, GAsyncResult* _res_, GError** error);
	gchar* (*to_string) (RygelTrackerQuery* self);
};

struct _RygelTrackerSelectionQuery {
	RygelTrackerQuery parent_instance;
	RygelTrackerSelectionQueryPrivate * priv;
	GeeArrayList* variables;
	GeeArrayList* filters;
	gchar* order_by;
	gint offset;
	gint max_count;
	TrackerSparqlCursor* result;
};

struct _RygelTrackerSelectionQueryClass {
	RygelTrackerQueryClass parent_class;
};

struct _RygelTrackerSelectionQueryExecuteData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelTrackerSelectionQuery* self;
	TrackerSparqlConnection* resources;
	gchar* _tmp0_;
	gchar* str;
	TrackerSparqlConnection* _tmp1_;
	TrackerSparqlCursor* _tmp2_;
	TrackerSparqlCursor* _tmp3_;
	GError * _inner_error_;
};


static gpointer rygel_tracker_selection_query_parent_class = NULL;

gpointer rygel_tracker_query_ref (gpointer instance);
void rygel_tracker_query_unref (gpointer instance);
GParamSpec* rygel_tracker_param_spec_query (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void rygel_tracker_value_set_query (GValue* value, gpointer v_object);
void rygel_tracker_value_take_query (GValue* value, gpointer v_object);
gpointer rygel_tracker_value_get_query (const GValue* value);
GType rygel_tracker_query_get_type (void) G_GNUC_CONST;
GType rygel_tracker_query_triplets_get_type (void) G_GNUC_CONST;
GType rygel_tracker_selection_query_get_type (void) G_GNUC_CONST;
enum  {
	RYGEL_TRACKER_SELECTION_QUERY_DUMMY_PROPERTY
};
#define RYGEL_TRACKER_SELECTION_QUERY_ITEM_VARIABLE "?item"
#define RYGEL_TRACKER_SELECTION_QUERY_SHARED_FILTER "(!BOUND(nmm:uPnPShared(" RYGEL_TRACKER_SELECTION_QUERY_ITEM_VARIABLE ")) ||" " nmm:uPnPShared(" RYGEL_TRACKER_SELECTION_QUERY_ITEM_VARIABLE ") = true) && " "(BOUND(nie:url(" RYGEL_TRACKER_SELECTION_QUERY_ITEM_VARIABLE ")))"
#define RYGEL_TRACKER_SELECTION_QUERY_STRICT_SHARED_FILTER "(BOUND(nmm:dlnaProfile(" RYGEL_TRACKER_SELECTION_QUERY_ITEM_VARIABLE ")))"
#define RYGEL_TRACKER_SELECTION_QUERY_AVAILABLE_FILTER "(tracker:available(" RYGEL_TRACKER_SELECTION_QUERY_ITEM_VARIABLE ") = true)"
RygelTrackerSelectionQuery* rygel_tracker_selection_query_new (GeeArrayList* variables, RygelTrackerQueryTriplets* triplets, GeeArrayList* filters, const gchar* order_by, gint offset, gint max_count);
RygelTrackerSelectionQuery* rygel_tracker_selection_query_construct (GType object_type, GeeArrayList* variables, RygelTrackerQueryTriplets* triplets, GeeArrayList* filters, const gchar* order_by, gint offset, gint max_count);
RygelTrackerQuery* rygel_tracker_query_construct (GType object_type, RygelTrackerQueryTriplets* triplets);
RygelTrackerSelectionQuery* rygel_tracker_selection_query_new_clone (RygelTrackerSelectionQuery* query);
RygelTrackerSelectionQuery* rygel_tracker_selection_query_construct_clone (GType object_type, RygelTrackerSelectionQuery* query);
static GeeArrayList* rygel_tracker_selection_query_copy_str_list (GeeList* str_list);
RygelTrackerQueryTriplets* rygel_tracker_query_triplets_new_clone (RygelTrackerQueryTriplets* triplets);
RygelTrackerQueryTriplets* rygel_tracker_query_triplets_construct_clone (GType object_type, RygelTrackerQueryTriplets* triplets);
static void rygel_tracker_selection_query_real_execute_data_free (gpointer _data);
static void rygel_tracker_selection_query_real_execute (RygelTrackerQuery* base, TrackerSparqlConnection* resources, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean rygel_tracker_selection_query_real_execute_co (RygelTrackerSelectionQueryExecuteData* _data_);
gchar* rygel_tracker_query_to_string (RygelTrackerQuery* self);
static void rygel_tracker_selection_query_execute_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static gchar* rygel_tracker_selection_query_real_to_string (RygelTrackerQuery* base);
static void rygel_tracker_selection_query_finalize (RygelTrackerQuery* obj);


static gpointer _g_object_ref0 (gpointer self) {
#line 62 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	return self ? g_object_ref (self) : NULL;
#line 159 "rygel-tracker-selection-query.c"
}


RygelTrackerSelectionQuery* rygel_tracker_selection_query_construct (GType object_type, GeeArrayList* variables, RygelTrackerQueryTriplets* triplets, GeeArrayList* filters, const gchar* order_by, gint offset, gint max_count) {
	RygelTrackerSelectionQuery* self = NULL;
	RygelTrackerQueryTriplets* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp5_;
	GeeArrayList* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
#line 53 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	g_return_val_if_fail (variables != NULL, NULL);
#line 53 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	g_return_val_if_fail (triplets != NULL, NULL);
#line 59 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp0_ = triplets;
#line 59 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	self = (RygelTrackerSelectionQuery*) rygel_tracker_query_construct (object_type, _tmp0_);
#line 61 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp1_ = filters;
#line 61 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	if (_tmp1_ != NULL) {
#line 185 "rygel-tracker-selection-query.c"
		GeeArrayList* _tmp2_;
		GeeArrayList* _tmp3_;
#line 62 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp2_ = filters;
#line 62 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp3_ = _g_object_ref0 (_tmp2_);
#line 62 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_object_unref0 (self->filters);
#line 62 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		self->filters = _tmp3_;
#line 196 "rygel-tracker-selection-query.c"
	} else {
		GeeArrayList* _tmp4_;
#line 64 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp4_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
#line 64 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_object_unref0 (self->filters);
#line 64 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		self->filters = _tmp4_;
#line 205 "rygel-tracker-selection-query.c"
	}
#line 67 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp5_ = variables;
#line 67 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp6_ = _g_object_ref0 (_tmp5_);
#line 67 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_object_unref0 (self->variables);
#line 67 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	self->variables = _tmp6_;
#line 68 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp7_ = order_by;
#line 68 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp8_ = g_strdup (_tmp7_);
#line 68 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_free0 (self->order_by);
#line 68 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	self->order_by = _tmp8_;
#line 69 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp9_ = offset;
#line 69 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	self->offset = _tmp9_;
#line 70 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp10_ = max_count;
#line 70 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	self->max_count = _tmp10_;
#line 53 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	return self;
#line 233 "rygel-tracker-selection-query.c"
}


RygelTrackerSelectionQuery* rygel_tracker_selection_query_new (GeeArrayList* variables, RygelTrackerQueryTriplets* triplets, GeeArrayList* filters, const gchar* order_by, gint offset, gint max_count) {
#line 53 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	return rygel_tracker_selection_query_construct (RYGEL_TRACKER_TYPE_SELECTION_QUERY, variables, triplets, filters, order_by, offset, max_count);
#line 240 "rygel-tracker-selection-query.c"
}


RygelTrackerSelectionQuery* rygel_tracker_selection_query_construct_clone (GType object_type, RygelTrackerSelectionQuery* query) {
	RygelTrackerSelectionQuery* self = NULL;
	RygelTrackerSelectionQuery* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp2_ = NULL;
	GeeArrayList* _tmp3_;
	RygelTrackerSelectionQuery* _tmp4_;
	RygelTrackerQueryTriplets* _tmp5_;
	RygelTrackerQueryTriplets* _tmp6_;
	RygelTrackerQueryTriplets* _tmp7_;
	RygelTrackerSelectionQuery* _tmp8_;
	GeeArrayList* _tmp9_;
	GeeArrayList* _tmp10_ = NULL;
	GeeArrayList* _tmp11_;
	RygelTrackerSelectionQuery* _tmp12_;
	const gchar* _tmp13_;
	RygelTrackerSelectionQuery* _tmp14_;
	gint _tmp15_;
	RygelTrackerSelectionQuery* _tmp16_;
	gint _tmp17_;
#line 73 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	g_return_val_if_fail (query != NULL, NULL);
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp0_ = query;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp1_ = _tmp0_->variables;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp2_ = rygel_tracker_selection_query_copy_str_list ((GeeList*) _tmp1_);
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp3_ = _tmp2_;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp4_ = query;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp5_ = ((RygelTrackerQuery*) _tmp4_)->triplets;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp6_ = rygel_tracker_query_triplets_new_clone (_tmp5_);
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp7_ = _tmp6_;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp8_ = query;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp9_ = _tmp8_->filters;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp10_ = rygel_tracker_selection_query_copy_str_list ((GeeList*) _tmp9_);
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp11_ = _tmp10_;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp12_ = query;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp13_ = _tmp12_->order_by;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp14_ = query;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp15_ = _tmp14_->offset;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp16_ = query;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp17_ = _tmp16_->max_count;
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	self = (RygelTrackerSelectionQuery*) rygel_tracker_selection_query_construct (object_type, _tmp3_, _tmp7_, _tmp11_, _tmp13_, _tmp15_, _tmp17_);
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_object_unref0 (_tmp11_);
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_object_unref0 (_tmp7_);
#line 74 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_object_unref0 (_tmp3_);
#line 73 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	return self;
#line 312 "rygel-tracker-selection-query.c"
}


RygelTrackerSelectionQuery* rygel_tracker_selection_query_new_clone (RygelTrackerSelectionQuery* query) {
#line 73 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	return rygel_tracker_selection_query_construct_clone (RYGEL_TRACKER_TYPE_SELECTION_QUERY, query);
#line 319 "rygel-tracker-selection-query.c"
}


static void rygel_tracker_selection_query_real_execute_data_free (gpointer _data) {
	RygelTrackerSelectionQueryExecuteData* _data_;
	_data_ = _data;
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_object_unref0 (_data_->resources);
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_rygel_tracker_query_unref0 (_data_->self);
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	g_slice_free (RygelTrackerSelectionQueryExecuteData, _data_);
#line 332 "rygel-tracker-selection-query.c"
}


static gpointer _rygel_tracker_query_ref0 (gpointer self) {
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	return self ? rygel_tracker_query_ref (self) : NULL;
#line 339 "rygel-tracker-selection-query.c"
}


static void rygel_tracker_selection_query_real_execute (RygelTrackerQuery* base, TrackerSparqlConnection* resources, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelTrackerSelectionQuery * self;
	RygelTrackerSelectionQueryExecuteData* _data_;
	RygelTrackerSelectionQuery* _tmp0_;
	TrackerSparqlConnection* _tmp1_;
	TrackerSparqlConnection* _tmp2_;
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	self = (RygelTrackerSelectionQuery*) base;
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_ = g_slice_new0 (RygelTrackerSelectionQueryExecuteData);
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->_async_result = g_simple_async_result_new (NULL, _callback_, _user_data_, rygel_tracker_selection_query_real_execute);
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_tracker_selection_query_real_execute_data_free);
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp0_ = _rygel_tracker_query_ref0 (self);
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->self = _tmp0_;
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp1_ = resources;
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp2_ = _g_object_ref0 (_tmp1_);
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->resources = _tmp2_;
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	rygel_tracker_selection_query_real_execute_co (_data_);
#line 369 "rygel-tracker-selection-query.c"
}


static void rygel_tracker_selection_query_real_execute_finish (RygelTrackerQuery* base, GAsyncResult* _res_, GError** error) {
	RygelTrackerSelectionQueryExecuteData* _data_;
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		return;
#line 379 "rygel-tracker-selection-query.c"
	}
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
#line 383 "rygel-tracker-selection-query.c"
}


static void rygel_tracker_selection_query_execute_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RygelTrackerSelectionQueryExecuteData* _data_;
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_ = _user_data_;
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->_source_object_ = source_object;
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->_res_ = _res_;
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	rygel_tracker_selection_query_real_execute_co (_data_);
#line 397 "rygel-tracker-selection-query.c"
}


static gboolean rygel_tracker_selection_query_real_execute_co (RygelTrackerSelectionQueryExecuteData* _data_) {
#line 82 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	switch (_data_->_state_) {
#line 82 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		case 0:
#line 406 "rygel-tracker-selection-query.c"
		goto _state_0;
#line 82 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		case 1:
#line 410 "rygel-tracker-selection-query.c"
		goto _state_1;
		default:
#line 82 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		g_assert_not_reached ();
#line 415 "rygel-tracker-selection-query.c"
	}
	_state_0:
#line 86 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->_tmp0_ = NULL;
#line 86 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->_tmp0_ = rygel_tracker_query_to_string ((RygelTrackerQuery*) _data_->self);
#line 86 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->str = _data_->_tmp0_;
#line 88 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	g_debug ("rygel-tracker-selection-query.vala:88: Executing SPARQL query: %s", _data_->str);
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->_tmp1_ = _data_->resources;
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->_state_ = 1;
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	tracker_sparql_connection_query_async (_data_->_tmp1_, _data_->str, NULL, rygel_tracker_selection_query_execute_ready, _data_);
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	return FALSE;
#line 434 "rygel-tracker-selection-query.c"
	_state_1:
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->_tmp2_ = NULL;
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->_tmp2_ = tracker_sparql_connection_query_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error_);
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->_tmp3_ = _data_->_tmp2_;
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	if (_data_->_inner_error_ != NULL) {
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		if (((_data_->_inner_error_->domain == G_IO_ERROR) || (_data_->_inner_error_->domain == TRACKER_SPARQL_ERROR)) || (_data_->_inner_error_->domain == G_DBUS_ERROR)) {
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			g_error_free (_data_->_inner_error_);
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_g_free0 (_data_->str);
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			if (_data_->_state_ == 0) {
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
				g_simple_async_result_complete_in_idle (_data_->_async_result);
#line 456 "rygel-tracker-selection-query.c"
			} else {
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
				g_simple_async_result_complete (_data_->_async_result);
#line 460 "rygel-tracker-selection-query.c"
			}
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			g_object_unref (_data_->_async_result);
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			return FALSE;
#line 466 "rygel-tracker-selection-query.c"
		} else {
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_g_free0 (_data_->str);
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.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 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			g_clear_error (&_data_->_inner_error_);
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			return FALSE;
#line 476 "rygel-tracker-selection-query.c"
		}
	}
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_object_unref0 (_data_->self->result);
#line 90 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_data_->self->result = _data_->_tmp3_;
#line 82 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_free0 (_data_->str);
#line 82 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	if (_data_->_state_ == 0) {
#line 82 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		g_simple_async_result_complete_in_idle (_data_->_async_result);
#line 489 "rygel-tracker-selection-query.c"
	} else {
#line 82 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		g_simple_async_result_complete (_data_->_async_result);
#line 493 "rygel-tracker-selection-query.c"
	}
#line 82 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	g_object_unref (_data_->_async_result);
#line 82 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	return FALSE;
#line 499 "rygel-tracker-selection-query.c"
}


static gchar* rygel_tracker_selection_query_real_to_string (RygelTrackerQuery* base) {
	RygelTrackerSelectionQuery * self;
	gchar* result = NULL;
	gchar* _tmp0_;
	gchar* query;
	const gchar* _tmp17_;
	gchar* _tmp18_ = NULL;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	GeeArrayList* _tmp23_;
	GeeArrayList* filters;
	GeeArrayList* _tmp24_;
	gint _tmp28_;
	gint _tmp29_;
	const gchar* _tmp50_;
	gchar* _tmp51_;
	const gchar* _tmp52_;
	gint _tmp58_;
	gint _tmp66_;
	GError * _inner_error_ = NULL;
#line 93 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	self = (RygelTrackerSelectionQuery*) base;
#line 94 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp0_ = g_strdup ("SELECT ");
#line 94 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	query = _tmp0_;
#line 531 "rygel-tracker-selection-query.c"
	{
		GeeArrayList* _tmp1_;
		GeeArrayList* _tmp2_;
		GeeArrayList* _variable_list;
		GeeArrayList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _variable_size;
		gint _variable_index;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp1_ = self->variables;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp2_ = _g_object_ref0 (_tmp1_);
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_variable_list = _tmp2_;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp3_ = _variable_list;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp4_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp3_);
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp5_ = _tmp4_;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_variable_size = _tmp5_;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_variable_index = -1;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		while (TRUE) {
#line 559 "rygel-tracker-selection-query.c"
			gint _tmp6_;
			gint _tmp7_;
			gint _tmp8_;
			GeeArrayList* _tmp9_;
			gint _tmp10_;
			gpointer _tmp11_ = NULL;
			gchar* variable;
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			gchar* _tmp14_;
			gchar* _tmp15_;
			gchar* _tmp16_;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_tmp6_ = _variable_index;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_variable_index = _tmp6_ + 1;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_tmp7_ = _variable_index;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_tmp8_ = _variable_size;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			if (!(_tmp7_ < _tmp8_)) {
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
				break;
#line 584 "rygel-tracker-selection-query.c"
			}
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_tmp9_ = _variable_list;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_tmp10_ = _variable_index;
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _tmp10_);
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			variable = (gchar*) _tmp11_;
#line 97 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_tmp12_ = query;
#line 97 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_tmp13_ = variable;
#line 97 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_tmp14_ = g_strconcat (" ", _tmp13_, NULL);
#line 97 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_tmp15_ = _tmp14_;
#line 97 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_tmp16_ = g_strconcat (_tmp12_, _tmp15_, NULL);
#line 97 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_g_free0 (query);
#line 97 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			query = _tmp16_;
#line 97 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_g_free0 (_tmp15_);
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_g_free0 (variable);
#line 612 "rygel-tracker-selection-query.c"
		}
#line 96 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_object_unref0 (_variable_list);
#line 616 "rygel-tracker-selection-query.c"
	}
#line 100 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp17_ = query;
#line 100 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp18_ = RYGEL_TRACKER_QUERY_CLASS (rygel_tracker_selection_query_parent_class)->to_string (RYGEL_TRACKER_QUERY (self));
#line 100 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp19_ = _tmp18_;
#line 100 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp20_ = g_strconcat (" WHERE { ", _tmp19_, NULL);
#line 100 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp21_ = _tmp20_;
#line 100 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp22_ = g_strconcat (_tmp17_, _tmp21_, NULL);
#line 100 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_free0 (query);
#line 100 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	query = _tmp22_;
#line 100 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_free0 (_tmp21_);
#line 100 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_free0 (_tmp19_);
#line 102 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp23_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
#line 102 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	filters = _tmp23_;
#line 103 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp24_ = self->filters;
#line 103 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	gee_abstract_collection_add_all ((GeeAbstractCollection*) filters, (GeeCollection*) _tmp24_);
#line 105 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	gee_abstract_collection_add ((GeeAbstractCollection*) filters, RYGEL_TRACKER_SELECTION_QUERY_SHARED_FILTER);
#line 109 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	gee_abstract_collection_add ((GeeAbstractCollection*) filters, RYGEL_TRACKER_SELECTION_QUERY_AVAILABLE_FILTER);
#line 650 "rygel-tracker-selection-query.c"
	{
		RygelMetaConfig* _tmp25_ = NULL;
		RygelMetaConfig* config;
		gboolean _tmp26_ = FALSE;
		gboolean _tmp27_;
#line 114 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp25_ = rygel_meta_config_get_default ();
#line 114 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		config = _tmp25_;
#line 115 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp26_ = rygel_configuration_get_bool ((RygelConfiguration*) config, "Tracker", "strict-sharing", &_inner_error_);
#line 115 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp27_ = _tmp26_;
#line 115 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		if (_inner_error_ != NULL) {
#line 115 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			_g_object_unref0 (config);
#line 668 "rygel-tracker-selection-query.c"
			goto __catch9_g_error;
		}
#line 115 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		if (_tmp27_) {
#line 116 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			gee_abstract_collection_add ((GeeAbstractCollection*) filters, RYGEL_TRACKER_SELECTION_QUERY_STRICT_SHARED_FILTER);
#line 675 "rygel-tracker-selection-query.c"
		}
#line 113 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_object_unref0 (config);
#line 679 "rygel-tracker-selection-query.c"
	}
	goto __finally9;
	__catch9_g_error:
	{
		GError* _error_ = NULL;
#line 113 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_error_ = _inner_error_;
#line 113 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_inner_error_ = NULL;
#line 113 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_error_free0 (_error_);
#line 691 "rygel-tracker-selection-query.c"
	}
	__finally9:
#line 113 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	if (_inner_error_ != NULL) {
#line 113 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_object_unref0 (filters);
#line 113 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_free0 (query);
#line 113 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.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 113 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		g_clear_error (&_inner_error_);
#line 113 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		return NULL;
#line 706 "rygel-tracker-selection-query.c"
	}
#line 120 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp28_ = gee_abstract_collection_get_size ((GeeCollection*) filters);
#line 120 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp29_ = _tmp28_;
#line 120 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	if (_tmp29_ > 0) {
#line 714 "rygel-tracker-selection-query.c"
		const gchar* _tmp30_;
		gchar* _tmp31_;
		const gchar* _tmp48_;
		gchar* _tmp49_;
#line 121 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp30_ = query;
#line 121 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp31_ = g_strconcat (_tmp30_, " FILTER (", NULL);
#line 121 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_free0 (query);
#line 121 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		query = _tmp31_;
#line 727 "rygel-tracker-selection-query.c"
		{
			gint i;
#line 122 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
			i = 0;
#line 732 "rygel-tracker-selection-query.c"
			{
				gboolean _tmp32_;
#line 122 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
				_tmp32_ = TRUE;
#line 122 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
				while (TRUE) {
#line 739 "rygel-tracker-selection-query.c"
					gboolean _tmp33_;
					gint _tmp35_;
					gint _tmp36_;
					gint _tmp37_;
					const gchar* _tmp38_;
					gint _tmp39_;
					gpointer _tmp40_ = NULL;
					gchar* _tmp41_;
					gchar* _tmp42_;
					gint _tmp43_;
					gint _tmp44_;
					gint _tmp45_;
#line 122 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_tmp33_ = _tmp32_;
#line 122 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					if (!_tmp33_) {
#line 756 "rygel-tracker-selection-query.c"
						gint _tmp34_;
#line 122 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
						_tmp34_ = i;
#line 122 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
						i = _tmp34_ + 1;
#line 762 "rygel-tracker-selection-query.c"
					}
#line 122 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_tmp32_ = FALSE;
#line 122 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_tmp35_ = i;
#line 122 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_tmp36_ = gee_abstract_collection_get_size ((GeeCollection*) filters);
#line 122 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_tmp37_ = _tmp36_;
#line 122 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					if (!(_tmp35_ < _tmp37_)) {
#line 122 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
						break;
#line 776 "rygel-tracker-selection-query.c"
					}
#line 123 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_tmp38_ = query;
#line 123 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_tmp39_ = i;
#line 123 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_tmp40_ = gee_abstract_list_get ((GeeAbstractList*) filters, _tmp39_);
#line 123 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_tmp41_ = (gchar*) _tmp40_;
#line 123 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_tmp42_ = g_strconcat (_tmp38_, _tmp41_, NULL);
#line 123 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_g_free0 (query);
#line 123 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					query = _tmp42_;
#line 123 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_g_free0 (_tmp41_);
#line 125 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_tmp43_ = i;
#line 125 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_tmp44_ = gee_abstract_collection_get_size ((GeeCollection*) filters);
#line 125 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					_tmp45_ = _tmp44_;
#line 125 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
					if (_tmp43_ < (_tmp45_ - 1)) {
#line 802 "rygel-tracker-selection-query.c"
						const gchar* _tmp46_;
						gchar* _tmp47_;
#line 126 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
						_tmp46_ = query;
#line 126 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
						_tmp47_ = g_strconcat (_tmp46_, " && ", NULL);
#line 126 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
						_g_free0 (query);
#line 126 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
						query = _tmp47_;
#line 813 "rygel-tracker-selection-query.c"
					}
				}
			}
		}
#line 129 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp48_ = query;
#line 129 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp49_ = g_strconcat (_tmp48_, ")", NULL);
#line 129 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_free0 (query);
#line 129 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		query = _tmp49_;
#line 826 "rygel-tracker-selection-query.c"
	}
#line 132 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp50_ = query;
#line 132 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp51_ = g_strconcat (_tmp50_, " }", NULL);
#line 132 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_free0 (query);
#line 132 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	query = _tmp51_;
#line 134 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp52_ = self->order_by;
#line 134 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	if (_tmp52_ != NULL) {
#line 840 "rygel-tracker-selection-query.c"
		const gchar* _tmp53_;
		const gchar* _tmp54_;
		gchar* _tmp55_;
		gchar* _tmp56_;
		gchar* _tmp57_;
#line 135 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp53_ = query;
#line 135 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp54_ = self->order_by;
#line 135 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp55_ = g_strconcat (" ORDER BY ", _tmp54_, NULL);
#line 135 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp56_ = _tmp55_;
#line 135 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp57_ = g_strconcat (_tmp53_, _tmp56_, NULL);
#line 135 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_free0 (query);
#line 135 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		query = _tmp57_;
#line 135 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_free0 (_tmp56_);
#line 862 "rygel-tracker-selection-query.c"
	}
#line 138 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp58_ = self->offset;
#line 138 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	if (_tmp58_ > 0) {
#line 868 "rygel-tracker-selection-query.c"
		const gchar* _tmp59_;
		gint _tmp60_;
		gchar* _tmp61_ = NULL;
		gchar* _tmp62_;
		gchar* _tmp63_;
		gchar* _tmp64_;
		gchar* _tmp65_;
#line 139 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp59_ = query;
#line 139 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp60_ = self->offset;
#line 139 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp61_ = g_strdup_printf ("%i", _tmp60_);
#line 139 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp62_ = _tmp61_;
#line 139 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp63_ = g_strconcat (" OFFSET ", _tmp62_, NULL);
#line 139 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp64_ = _tmp63_;
#line 139 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp65_ = g_strconcat (_tmp59_, _tmp64_, NULL);
#line 139 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_free0 (query);
#line 139 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		query = _tmp65_;
#line 139 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_free0 (_tmp64_);
#line 139 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_free0 (_tmp62_);
#line 898 "rygel-tracker-selection-query.c"
	}
#line 142 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp66_ = self->max_count;
#line 142 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	if (_tmp66_ > 0) {
#line 904 "rygel-tracker-selection-query.c"
		const gchar* _tmp67_;
		gint _tmp68_;
		gchar* _tmp69_ = NULL;
		gchar* _tmp70_;
		gchar* _tmp71_;
		gchar* _tmp72_;
		gchar* _tmp73_;
#line 143 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp67_ = query;
#line 143 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp68_ = self->max_count;
#line 143 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp69_ = g_strdup_printf ("%i", _tmp68_);
#line 143 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp70_ = _tmp69_;
#line 143 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp71_ = g_strconcat (" LIMIT ", _tmp70_, NULL);
#line 143 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp72_ = _tmp71_;
#line 143 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_tmp73_ = g_strconcat (_tmp67_, _tmp72_, NULL);
#line 143 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_free0 (query);
#line 143 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		query = _tmp73_;
#line 143 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_free0 (_tmp72_);
#line 143 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
		_g_free0 (_tmp70_);
#line 934 "rygel-tracker-selection-query.c"
	}
#line 146 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	result = query;
#line 146 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_object_unref0 (filters);
#line 146 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	return result;
#line 942 "rygel-tracker-selection-query.c"
}


static GeeArrayList* rygel_tracker_selection_query_copy_str_list (GeeList* str_list) {
	GeeArrayList* result = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* copy;
	GeeList* _tmp1_;
#line 149 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	g_return_val_if_fail (str_list != NULL, NULL);
#line 150 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
#line 150 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	copy = _tmp0_;
#line 152 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_tmp1_ = str_list;
#line 152 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	gee_abstract_collection_add_all ((GeeAbstractCollection*) copy, (GeeCollection*) _tmp1_);
#line 154 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	result = copy;
#line 154 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	return result;
#line 965 "rygel-tracker-selection-query.c"
}


static void rygel_tracker_selection_query_class_init (RygelTrackerSelectionQueryClass * klass) {
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	rygel_tracker_selection_query_parent_class = g_type_class_peek_parent (klass);
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	RYGEL_TRACKER_QUERY_CLASS (klass)->finalize = rygel_tracker_selection_query_finalize;
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	RYGEL_TRACKER_QUERY_CLASS (klass)->execute = rygel_tracker_selection_query_real_execute;
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	RYGEL_TRACKER_QUERY_CLASS (klass)->execute_finish = rygel_tracker_selection_query_real_execute_finish;
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	RYGEL_TRACKER_QUERY_CLASS (klass)->to_string = rygel_tracker_selection_query_real_to_string;
#line 980 "rygel-tracker-selection-query.c"
}


static void rygel_tracker_selection_query_instance_init (RygelTrackerSelectionQuery * self) {
}


static void rygel_tracker_selection_query_finalize (RygelTrackerQuery* obj) {
	RygelTrackerSelectionQuery * self;
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	self = RYGEL_TRACKER_SELECTION_QUERY (obj);
#line 44 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_object_unref0 (self->variables);
#line 45 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_object_unref0 (self->filters);
#line 47 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_free0 (self->order_by);
#line 51 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	_g_object_unref0 (self->result);
#line 30 "/home/jens/Source/rygel/src/plugins/tracker/rygel-tracker-selection-query.vala"
	RYGEL_TRACKER_QUERY_CLASS (rygel_tracker_selection_query_parent_class)->finalize (obj);
#line 1002 "rygel-tracker-selection-query.c"
}


/**
 * Represents Tracker SPARQL Selection query
 */
GType rygel_tracker_selection_query_get_type (void) {
	static volatile gsize rygel_tracker_selection_query_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_tracker_selection_query_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelTrackerSelectionQueryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_tracker_selection_query_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelTrackerSelectionQuery), 0, (GInstanceInitFunc) rygel_tracker_selection_query_instance_init, NULL };
		GType rygel_tracker_selection_query_type_id;
		rygel_tracker_selection_query_type_id = g_type_register_static (RYGEL_TRACKER_TYPE_QUERY, "RygelTrackerSelectionQuery", &g_define_type_info, 0);
		g_once_init_leave (&rygel_tracker_selection_query_type_id__volatile, rygel_tracker_selection_query_type_id);
	}
	return rygel_tracker_selection_query_type_id__volatile;
}



