/* search-provider.c generated by valac 0.26.0.27-f1f8, the Vala compiler
 * generated from search-provider.vala, do not modify */

/*
 * Copyright (C) 2014  Paolo Borelli <pborelli@gnome.org>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <libgweather/gweather.h>
#include <gdk-pixbuf/gdk-pixbuf.h>


#define CLOCKS_TYPE_SEARCH_PROVIDER (clocks_search_provider_get_type ())
#define CLOCKS_SEARCH_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_SEARCH_PROVIDER, ClocksSearchProvider))
#define CLOCKS_SEARCH_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_TYPE_SEARCH_PROVIDER, ClocksSearchProviderClass))
#define CLOCKS_IS_SEARCH_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_SEARCH_PROVIDER))
#define CLOCKS_IS_SEARCH_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_TYPE_SEARCH_PROVIDER))
#define CLOCKS_SEARCH_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_TYPE_SEARCH_PROVIDER, ClocksSearchProviderClass))

typedef struct _ClocksSearchProvider ClocksSearchProvider;
typedef struct _ClocksSearchProviderClass ClocksSearchProviderClass;
typedef struct _ClocksSearchProviderPrivate ClocksSearchProviderPrivate;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
#define _gweather_location_unref0(var) ((var == NULL) ? NULL : (var = (gweather_location_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ClocksSearchProviderSearchLocationsData ClocksSearchProviderSearchLocationsData;
typedef struct _Block7Data Block7Data;
typedef struct _ClocksSearchProviderGetInitialResultSetData ClocksSearchProviderGetInitialResultSetData;
typedef struct _Block8Data Block8Data;
typedef struct _ClocksSearchProviderGetSubsearchResultSetData ClocksSearchProviderGetSubsearchResultSetData;

#define CLOCKS_WORLD_TYPE_ITEM (clocks_world_item_get_type ())
#define CLOCKS_WORLD_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_WORLD_TYPE_ITEM, ClocksWorldItem))
#define CLOCKS_WORLD_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLOCKS_WORLD_TYPE_ITEM, ClocksWorldItemClass))
#define CLOCKS_WORLD_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_WORLD_TYPE_ITEM))
#define CLOCKS_WORLD_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLOCKS_WORLD_TYPE_ITEM))
#define CLOCKS_WORLD_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLOCKS_WORLD_TYPE_ITEM, ClocksWorldItemClass))

typedef struct _ClocksWorldItem ClocksWorldItem;
typedef struct _ClocksWorldItemClass ClocksWorldItemClass;

#define CLOCKS_TYPE_CONTENT_ITEM (clocks_content_item_get_type ())
#define CLOCKS_CONTENT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLOCKS_TYPE_CONTENT_ITEM, ClocksContentItem))
#define CLOCKS_IS_CONTENT_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLOCKS_TYPE_CONTENT_ITEM))
#define CLOCKS_CONTENT_ITEM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLOCKS_TYPE_CONTENT_ITEM, ClocksContentItemIface))

typedef struct _ClocksContentItem ClocksContentItem;
typedef struct _ClocksContentItemIface ClocksContentItemIface;

struct _ClocksSearchProvider {
	GObject parent_instance;
	ClocksSearchProviderPrivate * priv;
};

struct _ClocksSearchProviderClass {
	GObjectClass parent_class;
};

struct _ClocksSearchProviderPrivate {
	GHashTable* matches;
	gint count;
};

struct _ClocksSearchProviderSearchLocationsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ClocksSearchProvider* self;
	GWeatherLocation* location;
	gchar** normalized_terms;
	gint normalized_terms_length1;
	GWeatherLocation** locations;
	GWeatherLocation* _tmp0_;
	GWeatherLocation** _tmp1_;
	GWeatherLocation** _tmp2_;
	GWeatherLocation** _tmp3_;
	gint _tmp3__length1;
	gint locations_length1;
	gint _locations_size_;
	GWeatherLocation** _tmp4_;
	gint _tmp4__length1;
	gint i;
	gboolean _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	GWeatherLocation** _tmp8_;
	gint _tmp8__length1;
	GWeatherLocation** _tmp9_;
	gint _tmp9__length1;
	gint _tmp10_;
	GWeatherLocation* _tmp11_;
	GWeatherLocationLevel _tmp12_;
	GWeatherLocation** _tmp13_;
	gint _tmp13__length1;
	gint _tmp14_;
	GWeatherLocation* _tmp15_;
	gchar** _tmp16_;
	gint _tmp16__length1;
	gboolean _tmp17_;
	GHashTable* _tmp18_;
	gint _tmp19_;
	gchar* _tmp20_;
	GWeatherLocation** _tmp21_;
	gint _tmp21__length1;
	gint _tmp22_;
	GWeatherLocation* _tmp23_;
	GWeatherLocation* _tmp24_;
	gint _tmp25_;
	GWeatherLocation** _tmp26_;
	gint _tmp26__length1;
	gint _tmp27_;
	GWeatherLocation* _tmp28_;
	gchar** _tmp29_;
	gint _tmp29__length1;
};

struct _Block7Data {
	int _ref_count_;
	ClocksSearchProvider* self;
	GPtrArray* _result_;
	gpointer _async_data_;
};

struct _ClocksSearchProviderGetInitialResultSetData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ClocksSearchProvider* self;
	gchar** terms;
	gint terms_length1;
	gchar** result;
	gint result_length1;
	Block7Data* _data7_;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	GWeatherLocation* _tmp3_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gint _tmp5_;
	gchar** _tmp6_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	GPtrArray* _tmp8_;
	GHashTable* _tmp9_;
	gpointer* _tmp10_;
	gint _tmp10__length1;
	gchar** _tmp11_;
	gint _tmp11__length1;
	gchar** _tmp12_;
	gint _tmp12__length1;
};

struct _Block8Data {
	int _ref_count_;
	ClocksSearchProvider* self;
	GPtrArray* _result_;
	gpointer _async_data_;
};

struct _ClocksSearchProviderGetSubsearchResultSetData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	ClocksSearchProvider* self;
	gchar** previous_results;
	gint previous_results_length1;
	gchar** terms;
	gint terms_length1;
	gchar** result;
	gint result_length1;
	Block8Data* _data8_;
	GPtrArray* _tmp0_;
	GHashTable* _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gint _tmp3_;
	gchar** _tmp4_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	GHashTable* _tmp6_;
	gchar** normalized_terms;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gint _tmp8_;
	gchar** _tmp9_;
	gint normalized_terms_length1;
	gint _normalized_terms_size_;
	gchar** _tmp10_;
	gint _tmp10__length1;
	gchar** id_collection;
	gint id_collection_length1;
	gint _id_collection_size_;
	gint id_it;
	gchar* _tmp11_;
	gchar* id;
	GWeatherLocation* location;
	GHashTable* _tmp12_;
	const gchar* _tmp13_;
	gconstpointer _tmp14_;
	GWeatherLocation* _tmp15_;
	gboolean _tmp16_;
	GWeatherLocation* _tmp17_;
	GWeatherLocation* _tmp18_;
	gchar** _tmp19_;
	gint _tmp19__length1;
	gboolean _tmp20_;
	GPtrArray* _tmp21_;
	const gchar* _tmp22_;
	gchar* _tmp23_;
	GPtrArray* _tmp24_;
	gpointer* _tmp25_;
	gint _tmp25__length1;
	gchar** _tmp26_;
	gint _tmp26__length1;
	gchar** _tmp27_;
	gint _tmp27__length1;
};

struct _ClocksContentItemIface {
	GTypeInterface parent_iface;
	void (*get_thumb_properties) (ClocksContentItem* self, gchar** text, gchar** subtext, GdkPixbuf** pixbuf, gchar** css_class);
	const gchar* (*get_name) (ClocksContentItem* self);
	void (*set_name) (ClocksContentItem* self, const gchar* value);
	const gchar* (*get_title_icon) (ClocksContentItem* self);
	void (*set_title_icon) (ClocksContentItem* self, const gchar* value);
	gboolean (*get_selectable) (ClocksContentItem* self);
	void (*set_selectable) (ClocksContentItem* self, gboolean value);
};


static gpointer clocks_search_provider_parent_class = NULL;

GType clocks_search_provider_get_type (void) G_GNUC_CONST;
guint clocks_search_provider_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
#define CLOCKS_SEARCH_PROVIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CLOCKS_TYPE_SEARCH_PROVIDER, ClocksSearchProviderPrivate))
enum  {
	CLOCKS_SEARCH_PROVIDER_DUMMY_PROPERTY
};
static gchar** clocks_search_provider_normalize_terms (ClocksSearchProvider* self, gchar** terms, int terms_length1, int* result_length1);
static void _g_free0_ (gpointer var);
static gchar** _vala_array_dup2 (gchar** self, int length);
static gboolean clocks_search_provider_location_matches (ClocksSearchProvider* self, GWeatherLocation* location, gchar** normalized_terms, int normalized_terms_length1);
static void clocks_search_provider_search_locations_data_free (gpointer _data);
static void clocks_search_provider_search_locations (ClocksSearchProvider* self, GWeatherLocation* location, gchar** normalized_terms, int normalized_terms_length1, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void clocks_search_provider_search_locations_finish (ClocksSearchProvider* self, GAsyncResult* _res_);
static gboolean clocks_search_provider_search_locations_co (ClocksSearchProviderSearchLocationsData* _data_);
static GWeatherLocation** _vala_array_dup3 (GWeatherLocation** self, int length);
static void clocks_search_provider_search_locations_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void clocks_search_provider_get_initial_result_set_data_free (gpointer _data);
void clocks_search_provider_get_initial_result_set (ClocksSearchProvider* self, gchar** terms, int terms_length1, GAsyncReadyCallback _callback_, gpointer _user_data_);
gchar** clocks_search_provider_get_initial_result_set_finish (ClocksSearchProvider* self, GAsyncResult* _res_, int* result_length1);
static gboolean clocks_search_provider_get_initial_result_set_co (ClocksSearchProviderGetInitialResultSetData* _data_);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static void _gweather_location_unref0_ (gpointer var);
static void clocks_search_provider_get_initial_result_set_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void __lambda4_ (Block7Data* _data7_, const gchar* id, GWeatherLocation* location);
static void ___lambda4__gh_func (gconstpointer key, gconstpointer value, gpointer self);
static gchar** _vala_array_dup4 (gchar** self, int length);
static void clocks_search_provider_get_subsearch_result_set_data_free (gpointer _data);
void clocks_search_provider_get_subsearch_result_set (ClocksSearchProvider* self, gchar** previous_results, int previous_results_length1, gchar** terms, int terms_length1, GAsyncReadyCallback _callback_, gpointer _user_data_);
gchar** clocks_search_provider_get_subsearch_result_set_finish (ClocksSearchProvider* self, GAsyncResult* _res_, int* result_length1);
static gboolean clocks_search_provider_get_subsearch_result_set_co (ClocksSearchProviderGetSubsearchResultSetData* _data_);
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
static void clocks_search_provider_get_subsearch_result_set_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void ___lambda5_ (Block8Data* _data8_, const gchar* id, GWeatherLocation* location);
static void ____lambda5__gh_func (gconstpointer key, gconstpointer value, gpointer self);
static gchar** _vala_array_dup5 (gchar** self, int length);
GHashTable** clocks_search_provider_get_result_metas (ClocksSearchProvider* self, gchar** results, int results_length1, int* result_length1);
static void _g_hash_table_unref0_ (gpointer var);
static void _g_variant_unref0_ (gpointer var);
GType clocks_world_item_get_type (void) G_GNUC_CONST;
ClocksWorldItem* clocks_world_item_new (GWeatherLocation* location);
ClocksWorldItem* clocks_world_item_construct (GType object_type, GWeatherLocation* location);
gchar* clocks_world_item_get_time_label (ClocksWorldItem* self);
const gchar* clocks_world_item_get_day_label (ClocksWorldItem* self);
static GVariant* _variant_new1 (const gchar* value);
static GVariant* _variant_new2 (const gchar* value);
GType clocks_content_item_get_type (void) G_GNUC_CONST;
const gchar* clocks_content_item_get_name (ClocksContentItem* self);
static GVariant* _variant_new3 (const gchar* value);
static GHashTable** _vala_array_dup6 (GHashTable** self, int length);
void clocks_search_provider_activate_result (ClocksSearchProvider* self, const gchar* _result_, gchar** terms, int terms_length1, guint32 timestamp);
void clocks_search_provider_launch_search (ClocksSearchProvider* self, gchar** terms, int terms_length1, guint32 timestamp);
ClocksSearchProvider* clocks_search_provider_new (void);
ClocksSearchProvider* clocks_search_provider_construct (GType object_type);
static void clocks_search_provider_finalize (GObject* obj);
static void _dbus_clocks_search_provider_get_initial_result_set (ClocksSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void _dbus_clocks_search_provider_get_initial_result_set_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
static void _dbus_clocks_search_provider_get_subsearch_result_set (ClocksSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void _dbus_clocks_search_provider_get_subsearch_result_set_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
static void _dbus_clocks_search_provider_get_result_metas (ClocksSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void _dbus_clocks_search_provider_activate_result (ClocksSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void _dbus_clocks_search_provider_launch_search (ClocksSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void clocks_search_provider_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
static GVariant* clocks_search_provider_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
static gboolean clocks_search_provider_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
static void _clocks_search_provider_unregister_object (gpointer user_data);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);

static const GDBusArgInfo _clocks_search_provider_dbus_arg_info_get_initial_result_set_terms = {-1, "terms", "as"};
static const GDBusArgInfo _clocks_search_provider_dbus_arg_info_get_initial_result_set_result = {-1, "result", "as"};
static const GDBusArgInfo * const _clocks_search_provider_dbus_arg_info_get_initial_result_set_in[] = {&_clocks_search_provider_dbus_arg_info_get_initial_result_set_terms, NULL};
static const GDBusArgInfo * const _clocks_search_provider_dbus_arg_info_get_initial_result_set_out[] = {&_clocks_search_provider_dbus_arg_info_get_initial_result_set_result, NULL};
static const GDBusMethodInfo _clocks_search_provider_dbus_method_info_get_initial_result_set = {-1, "GetInitialResultSet", (GDBusArgInfo **) (&_clocks_search_provider_dbus_arg_info_get_initial_result_set_in), (GDBusArgInfo **) (&_clocks_search_provider_dbus_arg_info_get_initial_result_set_out)};
static const GDBusArgInfo _clocks_search_provider_dbus_arg_info_get_subsearch_result_set_previous_results = {-1, "previous_results", "as"};
static const GDBusArgInfo _clocks_search_provider_dbus_arg_info_get_subsearch_result_set_terms = {-1, "terms", "as"};
static const GDBusArgInfo _clocks_search_provider_dbus_arg_info_get_subsearch_result_set_result = {-1, "result", "as"};
static const GDBusArgInfo * const _clocks_search_provider_dbus_arg_info_get_subsearch_result_set_in[] = {&_clocks_search_provider_dbus_arg_info_get_subsearch_result_set_previous_results, &_clocks_search_provider_dbus_arg_info_get_subsearch_result_set_terms, NULL};
static const GDBusArgInfo * const _clocks_search_provider_dbus_arg_info_get_subsearch_result_set_out[] = {&_clocks_search_provider_dbus_arg_info_get_subsearch_result_set_result, NULL};
static const GDBusMethodInfo _clocks_search_provider_dbus_method_info_get_subsearch_result_set = {-1, "GetSubsearchResultSet", (GDBusArgInfo **) (&_clocks_search_provider_dbus_arg_info_get_subsearch_result_set_in), (GDBusArgInfo **) (&_clocks_search_provider_dbus_arg_info_get_subsearch_result_set_out)};
static const GDBusArgInfo _clocks_search_provider_dbus_arg_info_get_result_metas_results = {-1, "results", "as"};
static const GDBusArgInfo _clocks_search_provider_dbus_arg_info_get_result_metas_result = {-1, "result", "aa{sv}"};
static const GDBusArgInfo * const _clocks_search_provider_dbus_arg_info_get_result_metas_in[] = {&_clocks_search_provider_dbus_arg_info_get_result_metas_results, NULL};
static const GDBusArgInfo * const _clocks_search_provider_dbus_arg_info_get_result_metas_out[] = {&_clocks_search_provider_dbus_arg_info_get_result_metas_result, NULL};
static const GDBusMethodInfo _clocks_search_provider_dbus_method_info_get_result_metas = {-1, "GetResultMetas", (GDBusArgInfo **) (&_clocks_search_provider_dbus_arg_info_get_result_metas_in), (GDBusArgInfo **) (&_clocks_search_provider_dbus_arg_info_get_result_metas_out)};
static const GDBusArgInfo _clocks_search_provider_dbus_arg_info_activate_result_result = {-1, "result", "s"};
static const GDBusArgInfo _clocks_search_provider_dbus_arg_info_activate_result_terms = {-1, "terms", "as"};
static const GDBusArgInfo _clocks_search_provider_dbus_arg_info_activate_result_timestamp = {-1, "timestamp", "u"};
static const GDBusArgInfo * const _clocks_search_provider_dbus_arg_info_activate_result_in[] = {&_clocks_search_provider_dbus_arg_info_activate_result_result, &_clocks_search_provider_dbus_arg_info_activate_result_terms, &_clocks_search_provider_dbus_arg_info_activate_result_timestamp, NULL};
static const GDBusArgInfo * const _clocks_search_provider_dbus_arg_info_activate_result_out[] = {NULL};
static const GDBusMethodInfo _clocks_search_provider_dbus_method_info_activate_result = {-1, "ActivateResult", (GDBusArgInfo **) (&_clocks_search_provider_dbus_arg_info_activate_result_in), (GDBusArgInfo **) (&_clocks_search_provider_dbus_arg_info_activate_result_out)};
static const GDBusArgInfo _clocks_search_provider_dbus_arg_info_launch_search_terms = {-1, "terms", "as"};
static const GDBusArgInfo _clocks_search_provider_dbus_arg_info_launch_search_timestamp = {-1, "timestamp", "u"};
static const GDBusArgInfo * const _clocks_search_provider_dbus_arg_info_launch_search_in[] = {&_clocks_search_provider_dbus_arg_info_launch_search_terms, &_clocks_search_provider_dbus_arg_info_launch_search_timestamp, NULL};
static const GDBusArgInfo * const _clocks_search_provider_dbus_arg_info_launch_search_out[] = {NULL};
static const GDBusMethodInfo _clocks_search_provider_dbus_method_info_launch_search = {-1, "LaunchSearch", (GDBusArgInfo **) (&_clocks_search_provider_dbus_arg_info_launch_search_in), (GDBusArgInfo **) (&_clocks_search_provider_dbus_arg_info_launch_search_out)};
static const GDBusMethodInfo * const _clocks_search_provider_dbus_method_info[] = {&_clocks_search_provider_dbus_method_info_get_initial_result_set, &_clocks_search_provider_dbus_method_info_get_subsearch_result_set, &_clocks_search_provider_dbus_method_info_get_result_metas, &_clocks_search_provider_dbus_method_info_activate_result, &_clocks_search_provider_dbus_method_info_launch_search, NULL};
static const GDBusSignalInfo * const _clocks_search_provider_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo * const _clocks_search_provider_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _clocks_search_provider_dbus_interface_info = {-1, "org.gnome.Shell.SearchProvider2", (GDBusMethodInfo **) (&_clocks_search_provider_dbus_method_info), (GDBusSignalInfo **) (&_clocks_search_provider_dbus_signal_info), (GDBusPropertyInfo **) (&_clocks_search_provider_dbus_property_info)};
static const GDBusInterfaceVTable _clocks_search_provider_dbus_interface_vtable = {clocks_search_provider_dbus_interface_method_call, clocks_search_provider_dbus_interface_get_property, clocks_search_provider_dbus_interface_set_property};

static void _g_free0_ (gpointer var) {
	var = (g_free (var), NULL);
}


static gchar** _vala_array_dup2 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_ = NULL;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static gchar** clocks_search_provider_normalize_terms (ClocksSearchProvider* self, gchar** terms, int terms_length1, int* result_length1) {
	gchar** result = NULL;
	GPtrArray* normalized_terms = NULL;
	GPtrArray* _tmp0_ = NULL;
	gchar** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	GPtrArray* _tmp8_ = NULL;
	gpointer* _tmp9_ = NULL;
	gint _tmp9__length1 = 0;
	gchar** _tmp10_ = NULL;
	gint _tmp10__length1 = 0;
	gchar** _tmp11_ = NULL;
	gint _tmp11__length1 = 0;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_ptr_array_new_full ((guint) 0, _g_free0_);
	normalized_terms = _tmp0_;
	_tmp1_ = terms;
	_tmp1__length1 = terms_length1;
	{
		gchar** t_collection = NULL;
		gint t_collection_length1 = 0;
		gint _t_collection_size_ = 0;
		gint t_it = 0;
		t_collection = _tmp1_;
		t_collection_length1 = _tmp1__length1;
		for (t_it = 0; t_it < _tmp1__length1; t_it = t_it + 1) {
			gchar* _tmp2_ = NULL;
			gchar* t = NULL;
			_tmp2_ = g_strdup (t_collection[t_it]);
			t = _tmp2_;
			{
				GPtrArray* _tmp3_ = NULL;
				const gchar* _tmp4_ = NULL;
				gchar* _tmp5_ = NULL;
				gchar* _tmp6_ = NULL;
				gchar* _tmp7_ = NULL;
				_tmp3_ = normalized_terms;
				_tmp4_ = t;
				_tmp5_ = g_utf8_normalize (_tmp4_, (gssize) (-1), G_NORMALIZE_DEFAULT);
				_tmp6_ = _tmp5_;
				_tmp7_ = g_utf8_casefold (_tmp6_, (gssize) (-1));
				g_ptr_array_add (_tmp3_, _tmp7_);
				_g_free0 (_tmp6_);
				_g_free0 (t);
			}
		}
	}
	_tmp8_ = normalized_terms;
	_tmp9_ = _tmp8_->pdata;
	_tmp9__length1 = (gint) _tmp8_->len;
	_tmp10_ = (_tmp9_ != NULL) ? _vala_array_dup2 (_tmp9_, _tmp9__length1) : ((gpointer) _tmp9_);
	_tmp10__length1 = _tmp9__length1;
	_tmp11_ = _tmp10_;
	_tmp11__length1 = _tmp10__length1;
	if (result_length1) {
		*result_length1 = _tmp11__length1;
	}
	result = _tmp11_;
	_g_ptr_array_unref0 (normalized_terms);
	return result;
}


static gboolean string_contains (const gchar* self, const gchar* needle) {
	gboolean result = FALSE;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = needle;
	_tmp1_ = strstr ((gchar*) self, (gchar*) _tmp0_);
	result = _tmp1_ != NULL;
	return result;
}


static gboolean clocks_search_provider_location_matches (ClocksSearchProvider* self, GWeatherLocation* location, gchar** normalized_terms, int normalized_terms_length1) {
	gboolean result = FALSE;
	gchar* city = NULL;
	GWeatherLocation* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar* country = NULL;
	GWeatherLocation* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gboolean _tmp4_ = FALSE;
	const gchar* _tmp5_ = NULL;
	gchar** _tmp7_ = NULL;
	gint _tmp7__length1 = 0;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (location != NULL, FALSE);
	_tmp0_ = location;
	_tmp1_ = gweather_location_get_city_name (_tmp0_);
	city = _tmp1_;
	_tmp2_ = location;
	_tmp3_ = gweather_location_get_country_name (_tmp2_);
	country = _tmp3_;
	_tmp5_ = city;
	if (_tmp5_ == NULL) {
		_tmp4_ = TRUE;
	} else {
		const gchar* _tmp6_ = NULL;
		_tmp6_ = country;
		_tmp4_ = _tmp6_ == NULL;
	}
	if (_tmp4_) {
		result = FALSE;
		_g_free0 (country);
		_g_free0 (city);
		return result;
	}
	_tmp7_ = normalized_terms;
	_tmp7__length1 = normalized_terms_length1;
	{
		gchar** t_collection = NULL;
		gint t_collection_length1 = 0;
		gint _t_collection_size_ = 0;
		gint t_it = 0;
		t_collection = _tmp7_;
		t_collection_length1 = _tmp7__length1;
		for (t_it = 0; t_it < _tmp7__length1; t_it = t_it + 1) {
			gchar* _tmp8_ = NULL;
			gchar* t = NULL;
			_tmp8_ = g_strdup (t_collection[t_it]);
			t = _tmp8_;
			{
				gboolean _tmp9_ = FALSE;
				const gchar* _tmp10_ = NULL;
				gchar* _tmp11_ = NULL;
				gchar* _tmp12_ = NULL;
				gchar* _tmp13_ = NULL;
				gchar* _tmp14_ = NULL;
				const gchar* _tmp15_ = NULL;
				gboolean _tmp16_ = FALSE;
				gboolean _tmp17_ = FALSE;
				_tmp10_ = city;
				_tmp11_ = g_utf8_normalize (_tmp10_, (gssize) (-1), G_NORMALIZE_DEFAULT);
				_tmp12_ = _tmp11_;
				_tmp13_ = g_utf8_casefold (_tmp12_, (gssize) (-1));
				_tmp14_ = _tmp13_;
				_tmp15_ = t;
				_tmp16_ = string_contains (_tmp14_, _tmp15_);
				_tmp17_ = !_tmp16_;
				_g_free0 (_tmp14_);
				_g_free0 (_tmp12_);
				if (_tmp17_) {
					const gchar* _tmp18_ = NULL;
					gchar* _tmp19_ = NULL;
					gchar* _tmp20_ = NULL;
					gchar* _tmp21_ = NULL;
					gchar* _tmp22_ = NULL;
					const gchar* _tmp23_ = NULL;
					gboolean _tmp24_ = FALSE;
					_tmp18_ = country;
					_tmp19_ = g_utf8_normalize (_tmp18_, (gssize) (-1), G_NORMALIZE_DEFAULT);
					_tmp20_ = _tmp19_;
					_tmp21_ = g_utf8_casefold (_tmp20_, (gssize) (-1));
					_tmp22_ = _tmp21_;
					_tmp23_ = t;
					_tmp24_ = string_contains (_tmp22_, _tmp23_);
					_tmp9_ = !_tmp24_;
					_g_free0 (_tmp22_);
					_g_free0 (_tmp20_);
				} else {
					_tmp9_ = FALSE;
				}
				if (_tmp9_) {
					result = FALSE;
					_g_free0 (t);
					_g_free0 (country);
					_g_free0 (city);
					return result;
				}
				_g_free0 (t);
			}
		}
	}
	result = TRUE;
	_g_free0 (country);
	_g_free0 (city);
	return result;
}


static void clocks_search_provider_search_locations_data_free (gpointer _data) {
	ClocksSearchProviderSearchLocationsData* _data_;
	_data_ = _data;
	_gweather_location_unref0 (_data_->location);
	_g_object_unref0 (_data_->self);
	g_slice_free (ClocksSearchProviderSearchLocationsData, _data_);
}


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


static gpointer _gweather_location_ref0 (gpointer self) {
	return self ? gweather_location_ref (self) : NULL;
}


static void clocks_search_provider_search_locations (ClocksSearchProvider* self, GWeatherLocation* location, gchar** normalized_terms, int normalized_terms_length1, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ClocksSearchProviderSearchLocationsData* _data_;
	ClocksSearchProvider* _tmp0_ = NULL;
	GWeatherLocation* _tmp1_ = NULL;
	GWeatherLocation* _tmp2_ = NULL;
	gchar** _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	_data_ = g_slice_new0 (ClocksSearchProviderSearchLocationsData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, clocks_search_provider_search_locations);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, clocks_search_provider_search_locations_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = location;
	_tmp2_ = _gweather_location_ref0 (_tmp1_);
	_gweather_location_unref0 (_data_->location);
	_data_->location = _tmp2_;
	_tmp3_ = normalized_terms;
	_tmp3__length1 = normalized_terms_length1;
	_data_->normalized_terms = _tmp3_;
	_data_->normalized_terms_length1 = _tmp3__length1;
	clocks_search_provider_search_locations_co (_data_);
}


static void clocks_search_provider_search_locations_finish (ClocksSearchProvider* self, GAsyncResult* _res_) {
	ClocksSearchProviderSearchLocationsData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static GWeatherLocation** _vala_array_dup3 (GWeatherLocation** self, int length) {
	GWeatherLocation** result;
	int i;
	result = g_new0 (GWeatherLocation*, length + 1);
	for (i = 0; i < length; i++) {
		GWeatherLocation* _tmp0_ = NULL;
		_tmp0_ = _gweather_location_ref0 (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static void clocks_search_provider_search_locations_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ClocksSearchProviderSearchLocationsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	clocks_search_provider_search_locations_co (_data_);
}


static gboolean clocks_search_provider_search_locations_co (ClocksSearchProviderSearchLocationsData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->location;
	_data_->_tmp1_ = NULL;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->_tmp1_ = gweather_location_get_children (_data_->_tmp0_);
	_data_->_tmp3_ = NULL;
	_data_->_tmp3__length1 = 0;
	_data_->_tmp3_ = (_data_->_tmp2_ != NULL) ? _vala_array_dup3 (_data_->_tmp2_, _vala_array_length (_data_->_tmp1_)) : ((gpointer) _data_->_tmp2_);
	_data_->_tmp3__length1 = _vala_array_length (_data_->_tmp1_);
	_data_->locations_length1 = 0;
	_data_->_locations_size_ = 0;
	_data_->locations = _data_->_tmp3_;
	_data_->locations_length1 = _data_->_tmp3__length1;
	_data_->_locations_size_ = _data_->locations_length1;
	_data_->_tmp4_ = NULL;
	_data_->_tmp4__length1 = 0;
	_data_->_tmp4_ = _data_->locations;
	_data_->_tmp4__length1 = _data_->locations_length1;
	if (_data_->_tmp4_ != NULL) {
		{
			_data_->i = 0;
			{
				_data_->_tmp5_ = TRUE;
				while (TRUE) {
					if (!_data_->_tmp5_) {
						_data_->_tmp6_ = 0;
						_data_->_tmp6_ = _data_->i;
						_data_->i = _data_->_tmp6_ + 1;
					}
					_data_->_tmp5_ = FALSE;
					_data_->_tmp7_ = 0;
					_data_->_tmp7_ = _data_->i;
					_data_->_tmp8_ = NULL;
					_data_->_tmp8__length1 = 0;
					_data_->_tmp8_ = _data_->locations;
					_data_->_tmp8__length1 = _data_->locations_length1;
					if (!(_data_->_tmp7_ < _data_->_tmp8__length1)) {
						break;
					}
					_data_->_tmp9_ = NULL;
					_data_->_tmp9__length1 = 0;
					_data_->_tmp9_ = _data_->locations;
					_data_->_tmp9__length1 = _data_->locations_length1;
					_data_->_tmp10_ = 0;
					_data_->_tmp10_ = _data_->i;
					_data_->_tmp11_ = NULL;
					_data_->_tmp11_ = _data_->_tmp9_[_data_->_tmp10_];
					_data_->_tmp12_ = 0;
					_data_->_tmp12_ = gweather_location_get_level (_data_->_tmp11_);
					if (_data_->_tmp12_ == GWEATHER_LOCATION_CITY) {
						_data_->_tmp13_ = NULL;
						_data_->_tmp13__length1 = 0;
						_data_->_tmp13_ = _data_->locations;
						_data_->_tmp13__length1 = _data_->locations_length1;
						_data_->_tmp14_ = 0;
						_data_->_tmp14_ = _data_->i;
						_data_->_tmp15_ = NULL;
						_data_->_tmp15_ = _data_->_tmp13_[_data_->_tmp14_];
						_data_->_tmp16_ = NULL;
						_data_->_tmp16__length1 = 0;
						_data_->_tmp16_ = _data_->normalized_terms;
						_data_->_tmp16__length1 = _data_->normalized_terms_length1;
						_data_->_tmp17_ = FALSE;
						_data_->_tmp17_ = clocks_search_provider_location_matches (_data_->self, _data_->_tmp15_, _data_->_tmp16_, _data_->_tmp16__length1);
						if (_data_->_tmp17_) {
							_data_->_tmp18_ = NULL;
							_data_->_tmp18_ = _data_->self->priv->matches;
							_data_->_tmp19_ = 0;
							_data_->_tmp19_ = _data_->self->priv->count;
							_data_->_tmp20_ = NULL;
							_data_->_tmp20_ = g_strdup_printf ("%i", _data_->_tmp19_);
							_data_->_tmp21_ = NULL;
							_data_->_tmp21__length1 = 0;
							_data_->_tmp21_ = _data_->locations;
							_data_->_tmp21__length1 = _data_->locations_length1;
							_data_->_tmp22_ = 0;
							_data_->_tmp22_ = _data_->i;
							_data_->_tmp23_ = NULL;
							_data_->_tmp23_ = _data_->_tmp21_[_data_->_tmp22_];
							_data_->_tmp24_ = NULL;
							_data_->_tmp24_ = _gweather_location_ref0 (_data_->_tmp23_);
							g_hash_table_insert (_data_->_tmp18_, _data_->_tmp20_, _data_->_tmp24_);
							_data_->_tmp25_ = 0;
							_data_->_tmp25_ = _data_->self->priv->count;
							_data_->self->priv->count = _data_->_tmp25_ + 1;
						}
					}
					_data_->_tmp26_ = NULL;
					_data_->_tmp26__length1 = 0;
					_data_->_tmp26_ = _data_->locations;
					_data_->_tmp26__length1 = _data_->locations_length1;
					_data_->_tmp27_ = 0;
					_data_->_tmp27_ = _data_->i;
					_data_->_tmp28_ = NULL;
					_data_->_tmp28_ = _data_->_tmp26_[_data_->_tmp27_];
					_data_->_tmp29_ = NULL;
					_data_->_tmp29__length1 = 0;
					_data_->_tmp29_ = _data_->normalized_terms;
					_data_->_tmp29__length1 = _data_->normalized_terms_length1;
					_data_->_state_ = 1;
					clocks_search_provider_search_locations (_data_->self, _data_->_tmp28_, _data_->_tmp29_, _data_->_tmp29__length1, clocks_search_provider_search_locations_ready, _data_);
					return FALSE;
					_state_1:
					clocks_search_provider_search_locations_finish (_data_->self, _data_->_res_);
				}
			}
		}
	}
	_data_->locations = (_vala_array_free (_data_->locations, _data_->locations_length1, (GDestroyNotify) gweather_location_unref), NULL);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void clocks_search_provider_get_initial_result_set_data_free (gpointer _data) {
	ClocksSearchProviderGetInitialResultSetData* _data_;
	_data_ = _data;
	_data_->result = (_vala_array_free (_data_->result, _data_->result_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_data_->self);
	g_slice_free (ClocksSearchProviderGetInitialResultSetData, _data_);
}


void clocks_search_provider_get_initial_result_set (ClocksSearchProvider* self, gchar** terms, int terms_length1, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ClocksSearchProviderGetInitialResultSetData* _data_;
	ClocksSearchProvider* _tmp0_ = NULL;
	gchar** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	_data_ = g_slice_new0 (ClocksSearchProviderGetInitialResultSetData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, clocks_search_provider_get_initial_result_set);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, clocks_search_provider_get_initial_result_set_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = terms;
	_tmp1__length1 = terms_length1;
	_data_->terms = _tmp1_;
	_data_->terms_length1 = _tmp1__length1;
	clocks_search_provider_get_initial_result_set_co (_data_);
}


gchar** clocks_search_provider_get_initial_result_set_finish (ClocksSearchProvider* self, GAsyncResult* _res_, int* result_length1) {
	gchar** result;
	ClocksSearchProviderGetInitialResultSetData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}


static Block7Data* block7_data_ref (Block7Data* _data7_) {
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}


static void block7_data_unref (void * _userdata_) {
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		ClocksSearchProvider* self;
		self = _data7_->self;
		_g_ptr_array_unref0 (_data7_->_result_);
		_g_object_unref0 (self);
		g_slice_free (Block7Data, _data7_);
	}
}


static void _gweather_location_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (gweather_location_unref (var), NULL));
}


static void clocks_search_provider_get_initial_result_set_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ClocksSearchProviderGetInitialResultSetData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	clocks_search_provider_get_initial_result_set_co (_data_);
}


static void __lambda4_ (Block7Data* _data7_, const gchar* id, GWeatherLocation* location) {
	ClocksSearchProvider* self;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	self = _data7_->self;
	g_return_if_fail (id != NULL);
	g_return_if_fail (location != NULL);
	_tmp0_ = id;
	_tmp1_ = g_strdup (_tmp0_);
	g_ptr_array_add (_data7_->_result_, _tmp1_);
}


static void ___lambda4__gh_func (gconstpointer key, gconstpointer value, gpointer self) {
	__lambda4_ (self, (const gchar*) key, (GWeatherLocation*) value);
}


static gchar** _vala_array_dup4 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_ = NULL;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static gboolean clocks_search_provider_get_initial_result_set_co (ClocksSearchProviderGetInitialResultSetData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data7_ = g_slice_new0 (Block7Data);
	_data_->_data7_->_ref_count_ = 1;
	_data_->_data7_->self = g_object_ref (_data_->self);
	_data_->_data7_->_async_data_ = _data_;
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = g_str_hash;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = g_str_equal;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = g_hash_table_new_full (_data_->_tmp0_, _data_->_tmp1_, _g_free0_, _gweather_location_unref0_);
	_g_hash_table_unref0 (_data_->self->priv->matches);
	_data_->self->priv->matches = _data_->_tmp2_;
	_data_->self->priv->count = 0;
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = gweather_location_get_world ();
	_data_->_tmp4_ = NULL;
	_data_->_tmp4__length1 = 0;
	_data_->_tmp4_ = _data_->terms;
	_data_->_tmp4__length1 = _data_->terms_length1;
	_data_->_tmp5_ = 0;
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = clocks_search_provider_normalize_terms (_data_->self, _data_->_tmp4_, _data_->_tmp4__length1, &_data_->_tmp5_);
	_data_->_tmp7_ = NULL;
	_data_->_tmp7__length1 = 0;
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp7__length1 = _data_->_tmp5_;
	_data_->_state_ = 1;
	clocks_search_provider_search_locations (_data_->self, _data_->_tmp3_, _data_->_tmp7_, _data_->_tmp5_, clocks_search_provider_get_initial_result_set_ready, _data_);
	return FALSE;
	_state_1:
	clocks_search_provider_search_locations_finish (_data_->self, _data_->_res_);
	_data_->_tmp7_ = (_vala_array_free (_data_->_tmp7_, _data_->_tmp7__length1, (GDestroyNotify) g_free), NULL);
	_data_->_tmp8_ = NULL;
	_data_->_tmp8_ = g_ptr_array_new_full ((guint) 0, _g_free0_);
	_data_->_data7_->_result_ = _data_->_tmp8_;
	_data_->_tmp9_ = NULL;
	_data_->_tmp9_ = _data_->self->priv->matches;
	g_hash_table_foreach (_data_->_tmp9_, ___lambda4__gh_func, _data_->_data7_);
	_data_->_tmp10_ = NULL;
	_data_->_tmp10__length1 = 0;
	_data_->_tmp10_ = _data_->_data7_->_result_->pdata;
	_data_->_tmp10__length1 = (gint) _data_->_data7_->_result_->len;
	_data_->_tmp11_ = NULL;
	_data_->_tmp11__length1 = 0;
	_data_->_tmp11_ = (_data_->_tmp10_ != NULL) ? _vala_array_dup4 (_data_->_tmp10_, _data_->_tmp10__length1) : ((gpointer) _data_->_tmp10_);
	_data_->_tmp11__length1 = _data_->_tmp10__length1;
	_data_->_tmp12_ = NULL;
	_data_->_tmp12__length1 = 0;
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp12__length1 = _data_->_tmp11__length1;
	_data_->result_length1 = _data_->_tmp12__length1;
	_data_->result = _data_->_tmp12_;
	block7_data_unref (_data_->_data7_);
	_data_->_data7_ = NULL;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	block7_data_unref (_data_->_data7_);
	_data_->_data7_ = NULL;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void clocks_search_provider_get_subsearch_result_set_data_free (gpointer _data) {
	ClocksSearchProviderGetSubsearchResultSetData* _data_;
	_data_ = _data;
	_data_->result = (_vala_array_free (_data_->result, _data_->result_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_data_->self);
	g_slice_free (ClocksSearchProviderGetSubsearchResultSetData, _data_);
}


void clocks_search_provider_get_subsearch_result_set (ClocksSearchProvider* self, gchar** previous_results, int previous_results_length1, gchar** terms, int terms_length1, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ClocksSearchProviderGetSubsearchResultSetData* _data_;
	ClocksSearchProvider* _tmp0_ = NULL;
	gchar** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	gchar** _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	_data_ = g_slice_new0 (ClocksSearchProviderGetSubsearchResultSetData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, clocks_search_provider_get_subsearch_result_set);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, clocks_search_provider_get_subsearch_result_set_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = previous_results;
	_tmp1__length1 = previous_results_length1;
	_data_->previous_results = _tmp1_;
	_data_->previous_results_length1 = _tmp1__length1;
	_tmp2_ = terms;
	_tmp2__length1 = terms_length1;
	_data_->terms = _tmp2_;
	_data_->terms_length1 = _tmp2__length1;
	clocks_search_provider_get_subsearch_result_set_co (_data_);
}


gchar** clocks_search_provider_get_subsearch_result_set_finish (ClocksSearchProvider* self, GAsyncResult* _res_, int* result_length1) {
	gchar** result;
	ClocksSearchProviderGetSubsearchResultSetData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}


static Block8Data* block8_data_ref (Block8Data* _data8_) {
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}


static void block8_data_unref (void * _userdata_) {
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		ClocksSearchProvider* self;
		self = _data8_->self;
		_g_ptr_array_unref0 (_data8_->_result_);
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}


static void clocks_search_provider_get_subsearch_result_set_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	ClocksSearchProviderGetSubsearchResultSetData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	clocks_search_provider_get_subsearch_result_set_co (_data_);
}


static void ___lambda5_ (Block8Data* _data8_, const gchar* id, GWeatherLocation* location) {
	ClocksSearchProvider* self;
	GPtrArray* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	self = _data8_->self;
	g_return_if_fail (id != NULL);
	g_return_if_fail (location != NULL);
	_tmp0_ = _data8_->_result_;
	_tmp1_ = id;
	_tmp2_ = g_strdup (_tmp1_);
	g_ptr_array_add (_tmp0_, _tmp2_);
}


static void ____lambda5__gh_func (gconstpointer key, gconstpointer value, gpointer self) {
	___lambda5_ (self, (const gchar*) key, (GWeatherLocation*) value);
}


static gchar** _vala_array_dup5 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_ = NULL;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static gboolean clocks_search_provider_get_subsearch_result_set_co (ClocksSearchProviderGetSubsearchResultSetData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data8_ = g_slice_new0 (Block8Data);
	_data_->_data8_->_ref_count_ = 1;
	_data_->_data8_->self = g_object_ref (_data_->self);
	_data_->_data8_->_async_data_ = _data_;
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = g_ptr_array_new_full ((guint) 0, _g_free0_);
	_data_->_data8_->_result_ = _data_->_tmp0_;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _data_->self->priv->matches;
	if (_data_->_tmp1_ == NULL) {
		_data_->_tmp2_ = NULL;
		_data_->_tmp2__length1 = 0;
		_data_->_tmp2_ = _data_->terms;
		_data_->_tmp2__length1 = _data_->terms_length1;
		_data_->_tmp3_ = 0;
		_data_->_state_ = 1;
		clocks_search_provider_get_initial_result_set (_data_->self, _data_->_tmp2_, _data_->_tmp2__length1, clocks_search_provider_get_subsearch_result_set_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = clocks_search_provider_get_initial_result_set_finish (_data_->self, _data_->_res_, &_data_->_tmp3_);
		_data_->_tmp5_ = NULL;
		_data_->_tmp5__length1 = 0;
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp5__length1 = _data_->_tmp3_;
		_data_->_tmp5_ = (_vala_array_free (_data_->_tmp5_, _data_->_tmp5__length1, (GDestroyNotify) g_free), NULL);
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = _data_->self->priv->matches;
		g_hash_table_foreach (_data_->_tmp6_, ____lambda5__gh_func, _data_->_data8_);
	} else {
		_data_->_tmp7_ = NULL;
		_data_->_tmp7__length1 = 0;
		_data_->_tmp7_ = _data_->terms;
		_data_->_tmp7__length1 = _data_->terms_length1;
		_data_->_tmp8_ = 0;
		_data_->_tmp9_ = NULL;
		_data_->_tmp9_ = clocks_search_provider_normalize_terms (_data_->self, _data_->_tmp7_, _data_->_tmp7__length1, &_data_->_tmp8_);
		_data_->normalized_terms_length1 = 0;
		_data_->_normalized_terms_size_ = 0;
		_data_->normalized_terms = _data_->_tmp9_;
		_data_->normalized_terms_length1 = _data_->_tmp8_;
		_data_->_normalized_terms_size_ = _data_->normalized_terms_length1;
		_data_->_tmp10_ = NULL;
		_data_->_tmp10__length1 = 0;
		_data_->_tmp10_ = _data_->previous_results;
		_data_->_tmp10__length1 = _data_->previous_results_length1;
		{
			_data_->id_collection_length1 = 0;
			_data_->_id_collection_size_ = 0;
			_data_->id_collection = _data_->_tmp10_;
			_data_->id_collection_length1 = _data_->_tmp10__length1;
			for (_data_->id_it = 0; _data_->id_it < _data_->_tmp10__length1; _data_->id_it = _data_->id_it + 1) {
				_data_->_tmp11_ = NULL;
				_data_->_tmp11_ = g_strdup (_data_->id_collection[_data_->id_it]);
				_data_->id = _data_->_tmp11_;
				{
					_data_->_tmp12_ = NULL;
					_data_->_tmp12_ = _data_->self->priv->matches;
					_data_->_tmp13_ = NULL;
					_data_->_tmp13_ = _data_->id;
					_data_->_tmp14_ = NULL;
					_data_->_tmp14_ = g_hash_table_lookup (_data_->_tmp12_, _data_->_tmp13_);
					_data_->_tmp15_ = NULL;
					_data_->_tmp15_ = _gweather_location_ref0 ((GWeatherLocation*) _data_->_tmp14_);
					_data_->location = _data_->_tmp15_;
					_data_->_tmp17_ = NULL;
					_data_->_tmp17_ = _data_->location;
					if (_data_->_tmp17_ != NULL) {
						_data_->_tmp18_ = NULL;
						_data_->_tmp18_ = _data_->location;
						_data_->_tmp19_ = NULL;
						_data_->_tmp19__length1 = 0;
						_data_->_tmp19_ = _data_->normalized_terms;
						_data_->_tmp19__length1 = _data_->normalized_terms_length1;
						_data_->_tmp20_ = FALSE;
						_data_->_tmp20_ = clocks_search_provider_location_matches (_data_->self, _data_->_tmp18_, _data_->_tmp19_, _data_->_tmp19__length1);
						_data_->_tmp16_ = _data_->_tmp20_;
					} else {
						_data_->_tmp16_ = FALSE;
					}
					if (_data_->_tmp16_) {
						_data_->_tmp21_ = NULL;
						_data_->_tmp21_ = _data_->_data8_->_result_;
						_data_->_tmp22_ = NULL;
						_data_->_tmp22_ = _data_->id;
						_data_->_tmp23_ = NULL;
						_data_->_tmp23_ = g_strdup (_data_->_tmp22_);
						g_ptr_array_add (_data_->_tmp21_, _data_->_tmp23_);
					}
					_gweather_location_unref0 (_data_->location);
					_g_free0 (_data_->id);
				}
			}
		}
		_data_->normalized_terms = (_vala_array_free (_data_->normalized_terms, _data_->normalized_terms_length1, (GDestroyNotify) g_free), NULL);
	}
	_data_->_tmp24_ = NULL;
	_data_->_tmp24_ = _data_->_data8_->_result_;
	_data_->_tmp25_ = NULL;
	_data_->_tmp25__length1 = 0;
	_data_->_tmp25_ = _data_->_tmp24_->pdata;
	_data_->_tmp25__length1 = (gint) _data_->_tmp24_->len;
	_data_->_tmp26_ = NULL;
	_data_->_tmp26__length1 = 0;
	_data_->_tmp26_ = (_data_->_tmp25_ != NULL) ? _vala_array_dup5 (_data_->_tmp25_, _data_->_tmp25__length1) : ((gpointer) _data_->_tmp25_);
	_data_->_tmp26__length1 = _data_->_tmp25__length1;
	_data_->_tmp27_ = NULL;
	_data_->_tmp27__length1 = 0;
	_data_->_tmp27_ = _data_->_tmp26_;
	_data_->_tmp27__length1 = _data_->_tmp26__length1;
	_data_->result_length1 = _data_->_tmp27__length1;
	_data_->result = _data_->_tmp27_;
	block8_data_unref (_data_->_data8_);
	_data_->_data8_ = NULL;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	block8_data_unref (_data_->_data8_);
	_data_->_data8_ = NULL;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void _g_hash_table_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL));
}


static void _g_variant_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_variant_unref (var), NULL));
}


static GVariant* _variant_new1 (const gchar* value) {
	return g_variant_ref_sink (g_variant_new_string (value));
}


static GVariant* _variant_new2 (const gchar* value) {
	return g_variant_ref_sink (g_variant_new_string (value));
}


static GVariant* _variant_new3 (const gchar* value) {
	return g_variant_ref_sink (g_variant_new_string (value));
}


static gpointer _g_hash_table_ref0 (gpointer self) {
	return self ? g_hash_table_ref (self) : NULL;
}


static GHashTable** _vala_array_dup6 (GHashTable** self, int length) {
	GHashTable** result;
	int i;
	result = g_new0 (GHashTable*, length + 1);
	for (i = 0; i < length; i++) {
		GHashTable* _tmp0_ = NULL;
		_tmp0_ = _g_hash_table_ref0 (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


GHashTable** clocks_search_provider_get_result_metas (ClocksSearchProvider* self, gchar** results, int results_length1, int* result_length1) {
	GHashTable** result = NULL;
	GPtrArray* _result_ = NULL;
	GPtrArray* _tmp0_ = NULL;
	gchar** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	GPtrArray* _tmp43_ = NULL;
	gpointer* _tmp44_ = NULL;
	gint _tmp44__length1 = 0;
	GHashTable** _tmp45_ = NULL;
	gint _tmp45__length1 = 0;
	GHashTable** _tmp46_ = NULL;
	gint _tmp46__length1 = 0;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_ptr_array_new_full ((guint) 0, _g_hash_table_unref0_);
	_result_ = _tmp0_;
	_tmp1_ = results;
	_tmp1__length1 = results_length1;
	{
		gchar** id_collection = NULL;
		gint id_collection_length1 = 0;
		gint _id_collection_size_ = 0;
		gint id_it = 0;
		id_collection = _tmp1_;
		id_collection_length1 = _tmp1__length1;
		for (id_it = 0; id_it < _tmp1__length1; id_it = id_it + 1) {
			gchar* _tmp2_ = NULL;
			gchar* id = NULL;
			_tmp2_ = g_strdup (id_collection[id_it]);
			id = _tmp2_;
			{
				GHashTable* meta = NULL;
				GHashFunc _tmp3_ = NULL;
				GEqualFunc _tmp4_ = NULL;
				GHashTable* _tmp5_ = NULL;
				GWeatherLocation* location = NULL;
				GHashTable* _tmp6_ = NULL;
				const gchar* _tmp7_ = NULL;
				gconstpointer _tmp8_ = NULL;
				GWeatherLocation* _tmp9_ = NULL;
				GWeatherLocation* _tmp10_ = NULL;
				GPtrArray* _tmp40_ = NULL;
				GHashTable* _tmp41_ = NULL;
				GHashTable* _tmp42_ = NULL;
				_tmp3_ = g_str_hash;
				_tmp4_ = g_str_equal;
				_tmp5_ = g_hash_table_new_full (_tmp3_, _tmp4_, _g_free0_, _g_variant_unref0_);
				meta = _tmp5_;
				_tmp6_ = self->priv->matches;
				_tmp7_ = id;
				_tmp8_ = g_hash_table_lookup (_tmp6_, _tmp7_);
				_tmp9_ = _gweather_location_ref0 ((GWeatherLocation*) _tmp8_);
				location = _tmp9_;
				_tmp10_ = location;
				if (_tmp10_ != NULL) {
					ClocksWorldItem* item = NULL;
					GWeatherLocation* _tmp11_ = NULL;
					ClocksWorldItem* _tmp12_ = NULL;
					gchar* time_label = NULL;
					ClocksWorldItem* _tmp13_ = NULL;
					gchar* _tmp14_ = NULL;
					gchar* _tmp15_ = NULL;
					gchar* day = NULL;
					ClocksWorldItem* _tmp16_ = NULL;
					const gchar* _tmp17_ = NULL;
					const gchar* _tmp18_ = NULL;
					gchar* _tmp19_ = NULL;
					const gchar* _tmp20_ = NULL;
					GHashTable* _tmp26_ = NULL;
					gchar* _tmp27_ = NULL;
					const gchar* _tmp28_ = NULL;
					GVariant* _tmp29_ = NULL;
					GHashTable* _tmp30_ = NULL;
					gchar* _tmp31_ = NULL;
					const gchar* _tmp32_ = NULL;
					GVariant* _tmp33_ = NULL;
					GHashTable* _tmp34_ = NULL;
					gchar* _tmp35_ = NULL;
					ClocksWorldItem* _tmp36_ = NULL;
					const gchar* _tmp37_ = NULL;
					const gchar* _tmp38_ = NULL;
					GVariant* _tmp39_ = NULL;
					_tmp11_ = location;
					_tmp12_ = clocks_world_item_new (_tmp11_);
					item = _tmp12_;
					_tmp13_ = item;
					_tmp14_ = clocks_world_item_get_time_label (_tmp13_);
					_tmp15_ = _tmp14_;
					time_label = _tmp15_;
					_tmp16_ = item;
					_tmp17_ = clocks_world_item_get_day_label (_tmp16_);
					_tmp18_ = _tmp17_;
					_tmp19_ = g_strdup (_tmp18_);
					day = _tmp19_;
					_tmp20_ = day;
					if (_tmp20_ != NULL) {
						const gchar* _tmp21_ = NULL;
						const gchar* _tmp22_ = NULL;
						gchar* _tmp23_ = NULL;
						gchar* _tmp24_ = NULL;
						gchar* _tmp25_ = NULL;
						_tmp21_ = time_label;
						_tmp22_ = day;
						_tmp23_ = g_strconcat (" ", _tmp22_, NULL);
						_tmp24_ = _tmp23_;
						_tmp25_ = g_strconcat (_tmp21_, _tmp24_, NULL);
						_g_free0 (time_label);
						time_label = _tmp25_;
						_g_free0 (_tmp24_);
					}
					_tmp26_ = meta;
					_tmp27_ = g_strdup ("id");
					_tmp28_ = id;
					_tmp29_ = _variant_new1 (_tmp28_);
					g_hash_table_insert (_tmp26_, _tmp27_, _tmp29_);
					_tmp30_ = meta;
					_tmp31_ = g_strdup ("name");
					_tmp32_ = time_label;
					_tmp33_ = _variant_new2 (_tmp32_);
					g_hash_table_insert (_tmp30_, _tmp31_, _tmp33_);
					_tmp34_ = meta;
					_tmp35_ = g_strdup ("description");
					_tmp36_ = item;
					_tmp37_ = clocks_content_item_get_name ((ClocksContentItem*) _tmp36_);
					_tmp38_ = _tmp37_;
					_tmp39_ = _variant_new3 (_tmp38_);
					g_hash_table_insert (_tmp34_, _tmp35_, _tmp39_);
					_g_free0 (day);
					_g_free0 (time_label);
					_g_object_unref0 (item);
				}
				_tmp40_ = _result_;
				_tmp41_ = meta;
				_tmp42_ = _g_hash_table_ref0 (_tmp41_);
				g_ptr_array_add (_tmp40_, _tmp42_);
				_gweather_location_unref0 (location);
				_g_hash_table_unref0 (meta);
				_g_free0 (id);
			}
		}
	}
	_tmp43_ = _result_;
	_tmp44_ = _tmp43_->pdata;
	_tmp44__length1 = (gint) _tmp43_->len;
	_tmp45_ = (_tmp44_ != NULL) ? _vala_array_dup6 (_tmp44_, _tmp44__length1) : ((gpointer) _tmp44_);
	_tmp45__length1 = _tmp44__length1;
	_tmp46_ = _tmp45_;
	_tmp46__length1 = _tmp45__length1;
	if (result_length1) {
		*result_length1 = _tmp46__length1;
	}
	result = _tmp46_;
	_g_ptr_array_unref0 (_result_);
	return result;
}


void clocks_search_provider_activate_result (ClocksSearchProvider* self, const gchar* _result_, gchar** terms, int terms_length1, guint32 timestamp) {
	guint32 _tmp0_ = 0U;
	g_return_if_fail (self != NULL);
	g_return_if_fail (_result_ != NULL);
	_tmp0_ = timestamp;
	g_signal_emit_by_name (self, "activate", _tmp0_);
}


void clocks_search_provider_launch_search (ClocksSearchProvider* self, gchar** terms, int terms_length1, guint32 timestamp) {
	g_return_if_fail (self != NULL);
}


ClocksSearchProvider* clocks_search_provider_construct (GType object_type) {
	ClocksSearchProvider * self = NULL;
	self = (ClocksSearchProvider*) g_object_new (object_type, NULL);
	return self;
}


ClocksSearchProvider* clocks_search_provider_new (void) {
	return clocks_search_provider_construct (CLOCKS_TYPE_SEARCH_PROVIDER);
}


static void clocks_search_provider_class_init (ClocksSearchProviderClass * klass) {
	clocks_search_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ClocksSearchProviderPrivate));
	G_OBJECT_CLASS (klass)->finalize = clocks_search_provider_finalize;
	g_signal_new ("activate", CLOCKS_TYPE_SEARCH_PROVIDER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT);
}


static void clocks_search_provider_instance_init (ClocksSearchProvider * self) {
	self->priv = CLOCKS_SEARCH_PROVIDER_GET_PRIVATE (self);
}


static void clocks_search_provider_finalize (GObject* obj) {
	ClocksSearchProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CLOCKS_TYPE_SEARCH_PROVIDER, ClocksSearchProvider);
	_g_hash_table_unref0 (self->priv->matches);
	G_OBJECT_CLASS (clocks_search_provider_parent_class)->finalize (obj);
}


GType clocks_search_provider_get_type (void) {
	static volatile gsize clocks_search_provider_type_id__volatile = 0;
	if (g_once_init_enter (&clocks_search_provider_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ClocksSearchProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) clocks_search_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ClocksSearchProvider), 0, (GInstanceInitFunc) clocks_search_provider_instance_init, NULL };
		GType clocks_search_provider_type_id;
		clocks_search_provider_type_id = g_type_register_static (G_TYPE_OBJECT, "ClocksSearchProvider", &g_define_type_info, 0);
		g_type_set_qdata (clocks_search_provider_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) clocks_search_provider_register_object);
		g_once_init_leave (&clocks_search_provider_type_id__volatile, clocks_search_provider_type_id);
	}
	return clocks_search_provider_type_id__volatile;
}


static void _dbus_clocks_search_provider_get_initial_result_set (ClocksSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GVariantIter _arguments_iter;
	gchar** terms = NULL;
	int terms_length1 = 0;
	GVariant* _tmp3_;
	gchar** _tmp4_;
	int _tmp4__length;
	int _tmp4__size;
	int _tmp4__length1;
	GVariantIter _tmp5_;
	GVariant* _tmp6_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp3_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp4_ = g_new (gchar*, 5);
	_tmp4__length = 0;
	_tmp4__size = 4;
	_tmp4__length1 = 0;
	g_variant_iter_init (&_tmp5_, _tmp3_);
	for (; (_tmp6_ = g_variant_iter_next_value (&_tmp5_)) != NULL; _tmp4__length1++) {
		if (_tmp4__size == _tmp4__length) {
			_tmp4__size = 2 * _tmp4__size;
			_tmp4_ = g_renew (gchar*, _tmp4_, _tmp4__size + 1);
		}
		_tmp4_[_tmp4__length++] = g_variant_dup_string (_tmp6_, NULL);
		g_variant_unref (_tmp6_);
	}
	terms_length1 = _tmp4__length1;
	_tmp4_[_tmp4__length] = NULL;
	terms = _tmp4_;
	g_variant_unref (_tmp3_);
	clocks_search_provider_get_initial_result_set (self, terms, terms_length1, (GAsyncReadyCallback) _dbus_clocks_search_provider_get_initial_result_set_ready, invocation);
	terms = (_vala_array_free (terms, terms_length1, (GDestroyNotify) g_free), NULL);
}


static void _dbus_clocks_search_provider_get_initial_result_set_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
	GDBusMethodInvocation * invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gchar** result;
	int result_length1 = 0;
	gchar** _tmp7_;
	GVariantBuilder _tmp8_;
	int _tmp9_;
	invocation = _user_data_;
	result = clocks_search_provider_get_initial_result_set_finish ((ClocksSearchProvider*) source_object, _res_, &result_length1);
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_tmp7_ = result;
	g_variant_builder_init (&_tmp8_, G_VARIANT_TYPE ("as"));
	for (_tmp9_ = 0; _tmp9_ < result_length1; _tmp9_++) {
		g_variant_builder_add_value (&_tmp8_, g_variant_new_string (*_tmp7_));
		_tmp7_++;
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp8_));
	result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}


static void _dbus_clocks_search_provider_get_subsearch_result_set (ClocksSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GVariantIter _arguments_iter;
	gchar** previous_results = NULL;
	int previous_results_length1 = 0;
	GVariant* _tmp10_;
	gchar** _tmp11_;
	int _tmp11__length;
	int _tmp11__size;
	int _tmp11__length1;
	GVariantIter _tmp12_;
	GVariant* _tmp13_;
	gchar** terms = NULL;
	int terms_length1 = 0;
	GVariant* _tmp14_;
	gchar** _tmp15_;
	int _tmp15__length;
	int _tmp15__size;
	int _tmp15__length1;
	GVariantIter _tmp16_;
	GVariant* _tmp17_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp10_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp11_ = g_new (gchar*, 5);
	_tmp11__length = 0;
	_tmp11__size = 4;
	_tmp11__length1 = 0;
	g_variant_iter_init (&_tmp12_, _tmp10_);
	for (; (_tmp13_ = g_variant_iter_next_value (&_tmp12_)) != NULL; _tmp11__length1++) {
		if (_tmp11__size == _tmp11__length) {
			_tmp11__size = 2 * _tmp11__size;
			_tmp11_ = g_renew (gchar*, _tmp11_, _tmp11__size + 1);
		}
		_tmp11_[_tmp11__length++] = g_variant_dup_string (_tmp13_, NULL);
		g_variant_unref (_tmp13_);
	}
	previous_results_length1 = _tmp11__length1;
	_tmp11_[_tmp11__length] = NULL;
	previous_results = _tmp11_;
	g_variant_unref (_tmp10_);
	_tmp14_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp15_ = g_new (gchar*, 5);
	_tmp15__length = 0;
	_tmp15__size = 4;
	_tmp15__length1 = 0;
	g_variant_iter_init (&_tmp16_, _tmp14_);
	for (; (_tmp17_ = g_variant_iter_next_value (&_tmp16_)) != NULL; _tmp15__length1++) {
		if (_tmp15__size == _tmp15__length) {
			_tmp15__size = 2 * _tmp15__size;
			_tmp15_ = g_renew (gchar*, _tmp15_, _tmp15__size + 1);
		}
		_tmp15_[_tmp15__length++] = g_variant_dup_string (_tmp17_, NULL);
		g_variant_unref (_tmp17_);
	}
	terms_length1 = _tmp15__length1;
	_tmp15_[_tmp15__length] = NULL;
	terms = _tmp15_;
	g_variant_unref (_tmp14_);
	clocks_search_provider_get_subsearch_result_set (self, previous_results, previous_results_length1, terms, terms_length1, (GAsyncReadyCallback) _dbus_clocks_search_provider_get_subsearch_result_set_ready, invocation);
	previous_results = (_vala_array_free (previous_results, previous_results_length1, (GDestroyNotify) g_free), NULL);
	terms = (_vala_array_free (terms, terms_length1, (GDestroyNotify) g_free), NULL);
}


static void _dbus_clocks_search_provider_get_subsearch_result_set_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
	GDBusMethodInvocation * invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gchar** result;
	int result_length1 = 0;
	gchar** _tmp18_;
	GVariantBuilder _tmp19_;
	int _tmp20_;
	invocation = _user_data_;
	result = clocks_search_provider_get_subsearch_result_set_finish ((ClocksSearchProvider*) source_object, _res_, &result_length1);
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_tmp18_ = result;
	g_variant_builder_init (&_tmp19_, G_VARIANT_TYPE ("as"));
	for (_tmp20_ = 0; _tmp20_ < result_length1; _tmp20_++) {
		g_variant_builder_add_value (&_tmp19_, g_variant_new_string (*_tmp18_));
		_tmp18_++;
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp19_));
	result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}


static void _dbus_clocks_search_provider_get_result_metas (ClocksSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gchar** results = NULL;
	int results_length1 = 0;
	GVariant* _tmp21_;
	gchar** _tmp22_;
	int _tmp22__length;
	int _tmp22__size;
	int _tmp22__length1;
	GVariantIter _tmp23_;
	GVariant* _tmp24_;
	GDBusMessage* _reply_message;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	GHashTable** result;
	int result_length1 = 0;
	GHashTable** _tmp25_;
	GVariantBuilder _tmp26_;
	int _tmp27_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp21_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp22_ = g_new (gchar*, 5);
	_tmp22__length = 0;
	_tmp22__size = 4;
	_tmp22__length1 = 0;
	g_variant_iter_init (&_tmp23_, _tmp21_);
	for (; (_tmp24_ = g_variant_iter_next_value (&_tmp23_)) != NULL; _tmp22__length1++) {
		if (_tmp22__size == _tmp22__length) {
			_tmp22__size = 2 * _tmp22__size;
			_tmp22_ = g_renew (gchar*, _tmp22_, _tmp22__size + 1);
		}
		_tmp22_[_tmp22__length++] = g_variant_dup_string (_tmp24_, NULL);
		g_variant_unref (_tmp24_);
	}
	results_length1 = _tmp22__length1;
	_tmp22_[_tmp22__length] = NULL;
	results = _tmp22_;
	g_variant_unref (_tmp21_);
	result = clocks_search_provider_get_result_metas (self, results, results_length1, &result_length1);
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_tmp25_ = result;
	g_variant_builder_init (&_tmp26_, G_VARIANT_TYPE ("aa{sv}"));
	for (_tmp27_ = 0; _tmp27_ < result_length1; _tmp27_++) {
		GVariantBuilder _tmp28_;
		GHashTableIter _tmp29_;
		gpointer _tmp30_;
		gpointer _tmp31_;
		g_hash_table_iter_init (&_tmp29_, *_tmp25_);
		g_variant_builder_init (&_tmp28_, G_VARIANT_TYPE ("a{sv}"));
		while (g_hash_table_iter_next (&_tmp29_, &_tmp30_, &_tmp31_)) {
			gchar* _key;
			GVariant* _value;
			_key = (gchar*) _tmp30_;
			_value = (GVariant*) _tmp31_;
			g_variant_builder_add (&_tmp28_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
		}
		g_variant_builder_add_value (&_tmp26_, g_variant_builder_end (&_tmp28_));
		_tmp25_++;
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp26_));
	result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_hash_table_unref), NULL);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	results = (_vala_array_free (results, results_length1, (GDestroyNotify) g_free), NULL);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}


static void _dbus_clocks_search_provider_activate_result (ClocksSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gchar* _result_ = NULL;
	GVariant* _tmp32_;
	gchar** terms = NULL;
	int terms_length1 = 0;
	GVariant* _tmp33_;
	gchar** _tmp34_;
	int _tmp34__length;
	int _tmp34__size;
	int _tmp34__length1;
	GVariantIter _tmp35_;
	GVariant* _tmp36_;
	guint32 timestamp = 0U;
	GVariant* _tmp37_;
	GDBusMessage* _reply_message;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp32_ = g_variant_iter_next_value (&_arguments_iter);
	_result_ = g_variant_dup_string (_tmp32_, NULL);
	g_variant_unref (_tmp32_);
	_tmp33_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp34_ = g_new (gchar*, 5);
	_tmp34__length = 0;
	_tmp34__size = 4;
	_tmp34__length1 = 0;
	g_variant_iter_init (&_tmp35_, _tmp33_);
	for (; (_tmp36_ = g_variant_iter_next_value (&_tmp35_)) != NULL; _tmp34__length1++) {
		if (_tmp34__size == _tmp34__length) {
			_tmp34__size = 2 * _tmp34__size;
			_tmp34_ = g_renew (gchar*, _tmp34_, _tmp34__size + 1);
		}
		_tmp34_[_tmp34__length++] = g_variant_dup_string (_tmp36_, NULL);
		g_variant_unref (_tmp36_);
	}
	terms_length1 = _tmp34__length1;
	_tmp34_[_tmp34__length] = NULL;
	terms = _tmp34_;
	g_variant_unref (_tmp33_);
	_tmp37_ = g_variant_iter_next_value (&_arguments_iter);
	timestamp = g_variant_get_uint32 (_tmp37_);
	g_variant_unref (_tmp37_);
	clocks_search_provider_activate_result (self, _result_, terms, terms_length1, timestamp);
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	_g_free0 (_result_);
	terms = (_vala_array_free (terms, terms_length1, (GDestroyNotify) g_free), NULL);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}


static void _dbus_clocks_search_provider_launch_search (ClocksSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gchar** terms = NULL;
	int terms_length1 = 0;
	GVariant* _tmp38_;
	gchar** _tmp39_;
	int _tmp39__length;
	int _tmp39__size;
	int _tmp39__length1;
	GVariantIter _tmp40_;
	GVariant* _tmp41_;
	guint32 timestamp = 0U;
	GVariant* _tmp42_;
	GDBusMessage* _reply_message;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp38_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp39_ = g_new (gchar*, 5);
	_tmp39__length = 0;
	_tmp39__size = 4;
	_tmp39__length1 = 0;
	g_variant_iter_init (&_tmp40_, _tmp38_);
	for (; (_tmp41_ = g_variant_iter_next_value (&_tmp40_)) != NULL; _tmp39__length1++) {
		if (_tmp39__size == _tmp39__length) {
			_tmp39__size = 2 * _tmp39__size;
			_tmp39_ = g_renew (gchar*, _tmp39_, _tmp39__size + 1);
		}
		_tmp39_[_tmp39__length++] = g_variant_dup_string (_tmp41_, NULL);
		g_variant_unref (_tmp41_);
	}
	terms_length1 = _tmp39__length1;
	_tmp39_[_tmp39__length] = NULL;
	terms = _tmp39_;
	g_variant_unref (_tmp38_);
	_tmp42_ = g_variant_iter_next_value (&_arguments_iter);
	timestamp = g_variant_get_uint32 (_tmp42_);
	g_variant_unref (_tmp42_);
	clocks_search_provider_launch_search (self, terms, terms_length1, timestamp);
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	terms = (_vala_array_free (terms, terms_length1, (GDestroyNotify) g_free), NULL);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}


static void clocks_search_provider_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (method_name, "GetInitialResultSet") == 0) {
		_dbus_clocks_search_provider_get_initial_result_set (object, parameters, invocation);
	} else if (strcmp (method_name, "GetSubsearchResultSet") == 0) {
		_dbus_clocks_search_provider_get_subsearch_result_set (object, parameters, invocation);
	} else if (strcmp (method_name, "GetResultMetas") == 0) {
		_dbus_clocks_search_provider_get_result_metas (object, parameters, invocation);
	} else if (strcmp (method_name, "ActivateResult") == 0) {
		_dbus_clocks_search_provider_activate_result (object, parameters, invocation);
	} else if (strcmp (method_name, "LaunchSearch") == 0) {
		_dbus_clocks_search_provider_launch_search (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}


static GVariant* clocks_search_provider_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return NULL;
}


static gboolean clocks_search_provider_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return FALSE;
}


guint clocks_search_provider_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_clocks_search_provider_dbus_interface_info), &_clocks_search_provider_dbus_interface_vtable, data, _clocks_search_provider_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}


static void _clocks_search_provider_unregister_object (gpointer user_data) {
	gpointer* data;
	data = user_data;
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}


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


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


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



