/* contacts-shell-search-provider.c generated by valac 0.38.8, the Vala compiler
 * generated from contacts-shell-search-provider.vala, do not modify */

/* -*- Mode: vala; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 8 -*- */

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <contacts-esd-setup.h>
#include <folks/folks.h>
#include <stdio.h>


#define CONTACTS_TYPE_SEARCH_PROVIDER (contacts_search_provider_get_type ())
#define CONTACTS_SEARCH_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_SEARCH_PROVIDER, ContactsSearchProvider))
#define CONTACTS_SEARCH_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_SEARCH_PROVIDER, ContactsSearchProviderClass))
#define CONTACTS_IS_SEARCH_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_SEARCH_PROVIDER))
#define CONTACTS_IS_SEARCH_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_SEARCH_PROVIDER))
#define CONTACTS_SEARCH_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_SEARCH_PROVIDER, ContactsSearchProviderClass))

typedef struct _ContactsSearchProvider ContactsSearchProvider;
typedef struct _ContactsSearchProviderClass ContactsSearchProviderClass;
typedef struct _ContactsSearchProviderPrivate ContactsSearchProviderPrivate;

#define CONTACTS_TYPE_SEARCH_PROVIDER_APP (contacts_search_provider_app_get_type ())
#define CONTACTS_SEARCH_PROVIDER_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_SEARCH_PROVIDER_APP, ContactsSearchProviderApp))
#define CONTACTS_SEARCH_PROVIDER_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_SEARCH_PROVIDER_APP, ContactsSearchProviderAppClass))
#define CONTACTS_IS_SEARCH_PROVIDER_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_SEARCH_PROVIDER_APP))
#define CONTACTS_IS_SEARCH_PROVIDER_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_SEARCH_PROVIDER_APP))
#define CONTACTS_SEARCH_PROVIDER_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_SEARCH_PROVIDER_APP, ContactsSearchProviderAppClass))

typedef struct _ContactsSearchProviderApp ContactsSearchProviderApp;
typedef struct _ContactsSearchProviderAppClass ContactsSearchProviderAppClass;

#define CONTACTS_TYPE_STORE (contacts_store_get_type ())
#define CONTACTS_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_STORE, ContactsStore))
#define CONTACTS_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_STORE, ContactsStoreClass))
#define CONTACTS_IS_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_STORE))
#define CONTACTS_IS_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_STORE))
#define CONTACTS_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_STORE, ContactsStoreClass))

typedef struct _ContactsStore ContactsStore;
typedef struct _ContactsStoreClass ContactsStoreClass;

#define CONTACTS_TYPE_CONTACT (contacts_contact_get_type ())
#define CONTACTS_CONTACT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACTS_TYPE_CONTACT, ContactsContact))
#define CONTACTS_CONTACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CONTACTS_TYPE_CONTACT, ContactsContactClass))
#define CONTACTS_IS_CONTACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CONTACTS_TYPE_CONTACT))
#define CONTACTS_IS_CONTACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CONTACTS_TYPE_CONTACT))
#define CONTACTS_CONTACT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CONTACTS_TYPE_CONTACT, ContactsContactClass))

typedef struct _ContactsContact ContactsContact;
typedef struct _ContactsContactClass ContactsContactClass;
enum  {
	CONTACTS_SEARCH_PROVIDER_0_PROPERTY,
	CONTACTS_SEARCH_PROVIDER_NUM_PROPERTIES
};
static GParamSpec* contacts_search_provider_properties[CONTACTS_SEARCH_PROVIDER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _ContactsContactPrivate ContactsContactPrivate;
typedef struct _ContactsSearchProviderDoSearchData ContactsSearchProviderDoSearchData;
typedef struct _contacts_search_provider_GetInitialResultSetData contacts_search_provider_GetInitialResultSetData;
typedef struct _contacts_search_provider_GetSubsearchResultSetData contacts_search_provider_GetSubsearchResultSetData;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _ContactsSearchProviderGetMetasData ContactsSearchProviderGetMetasData;
typedef struct _contacts_search_provider_GetResultMetasData contacts_search_provider_GetResultMetasData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ContactsSearchProviderAppPrivate ContactsSearchProviderAppPrivate;
enum  {
	CONTACTS_SEARCH_PROVIDER_APP_0_PROPERTY,
	CONTACTS_SEARCH_PROVIDER_APP_NUM_PROPERTIES
};
static GParamSpec* contacts_search_provider_app_properties[CONTACTS_SEARCH_PROVIDER_APP_NUM_PROPERTIES];

struct _ContactsSearchProvider {
	GObject parent_instance;
	ContactsSearchProviderPrivate * priv;
};

struct _ContactsSearchProviderClass {
	GObjectClass parent_class;
};

struct _ContactsSearchProviderPrivate {
	ContactsSearchProviderApp* app;
	ContactsStore* store;
	GeeHashMap* contacts_map;
	guint next_id;
};

struct _ContactsContact {
	GObject parent_instance;
	ContactsContactPrivate * priv;
	ContactsStore* store;
	gboolean is_main;
	FolksIndividual* individual;
	FolksPersona* fake_persona;
};

struct _ContactsContactClass {
	GObjectClass parent_class;
};

struct _ContactsSearchProviderDoSearchData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ContactsSearchProvider* self;
	gchar** terms;
	gint terms_length1;
	gchar** result;
	gint result_length1;
	ContactsSearchProviderApp* _tmp0_;
	gchar** normalized_terms;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar** _tmp6_;
	gchar** _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	gint normalized_terms_length1;
	gint _normalized_terms_size_;
	GeeArrayList* matches;
	GeeArrayList* _tmp9_;
	GeeIterator* _c_it;
	ContactsStore* _tmp10_;
	GeeCollection* _tmp11_;
	GeeCollection* _tmp12_;
	GeeIterator* _tmp13_;
	GeeIterator* _tmp14_;
	GeeIterator* _tmp15_;
	gboolean _tmp16_;
	ContactsContact* c;
	GeeIterator* _tmp17_;
	gpointer _tmp18_;
	ContactsContact* _tmp19_;
	gboolean _tmp20_;
	gboolean _tmp21_;
	ContactsContact* _tmp22_;
	gchar** _tmp23_;
	gint _tmp23__length1;
	gboolean _tmp24_;
	GeeArrayList* _tmp25_;
	ContactsContact* _tmp26_;
	GeeArrayList* _tmp27_;
	gchar** results;
	GeeArrayList* _tmp28_;
	gint _tmp29_;
	gint _tmp30_;
	gchar** _tmp31_;
	gint results_length1;
	gint _results_size_;
	gint i;
	gboolean _tmp32_;
	gint _tmp33_;
	gint _tmp34_;
	GeeArrayList* _tmp35_;
	gint _tmp36_;
	gint _tmp37_;
	gchar** _tmp38_;
	gint _tmp38__length1;
	gint _tmp39_;
	GeeArrayList* _tmp40_;
	gint _tmp41_;
	gpointer _tmp42_;
	ContactsContact* _tmp43_;
	gconstpointer _tmp44_;
	gchar* _tmp45_;
	gchar* _tmp46_;
	ContactsSearchProviderApp* _tmp47_;
	gchar** _tmp48_;
	gint _tmp48__length1;
};

struct _contacts_search_provider_GetInitialResultSetData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ContactsSearchProvider* self;
	gchar** terms;
	gint terms_length1;
	gchar** result;
	gint result_length1;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gint _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
};

struct _contacts_search_provider_GetSubsearchResultSetData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ContactsSearchProvider* self;
	gchar** previous_results;
	gint previous_results_length1;
	gchar** new_terms;
	gint new_terms_length1;
	gchar** result;
	gint result_length1;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gint _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
};

struct _ContactsSearchProviderGetMetasData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ContactsSearchProvider* self;
	gchar** ids;
	gint ids_length1;
	GHashTable** result;
	gint result_length1;
	ContactsSearchProviderApp* _tmp0_;
	GeeArrayList* results;
	GeeArrayList* _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar** id_collection;
	gint id_collection_length1;
	gint _id_collection_size_;
	gint id_it;
	gchar* _tmp3_;
	gchar* id;
	ContactsContact* contact;
	GeeHashMap* _tmp4_;
	const gchar* _tmp5_;
	gpointer _tmp6_;
	ContactsContact* _tmp7_;
	GHashTable* meta;
	GHashFunc _tmp8_;
	GEqualFunc _tmp9_;
	GHashTable* _tmp10_;
	GHashTable* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	GVariant* _tmp14_;
	GHashTable* _tmp15_;
	gchar* _tmp16_;
	ContactsContact* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	GVariant* _tmp20_;
	ContactsContact* _tmp21_;
	GVariant* _tmp22_;
	GVariant* _tmp23_;
	GHashTable* _tmp24_;
	gchar* _tmp25_;
	ContactsContact* _tmp26_;
	GVariant* _tmp27_;
	GVariant* _tmp28_;
	GVariant* _tmp29_;
	GHashTable* _tmp30_;
	gchar* _tmp31_;
	GThemedIcon* _tmp32_;
	GThemedIcon* _tmp33_;
	GVariant* _tmp34_;
	GeeArrayList* _tmp35_;
	GHashTable* _tmp36_;
	ContactsSearchProviderApp* _tmp37_;
	GeeArrayList* _tmp38_;
	gint _tmp39_;
	gpointer* _tmp40_;
	GHashTable** _tmp41_;
	gint _tmp41__length1;
};

struct _contacts_search_provider_GetResultMetasData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ContactsSearchProvider* self;
	gchar** ids;
	gint ids_length1;
	GHashTable** result;
	gint result_length1;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gint _tmp2_;
	GHashTable** _tmp3_;
	GHashTable** _tmp4_;
	gint _tmp4__length1;
};

struct _ContactsSearchProviderApp {
	GApplication parent_instance;
	ContactsSearchProviderAppPrivate * priv;
};

struct _ContactsSearchProviderAppClass {
	GApplicationClass parent_class;
};


static gpointer contacts_search_provider_parent_class = NULL;
static gpointer contacts_search_provider_app_parent_class = NULL;

GType contacts_search_provider_get_type (void) G_GNUC_CONST;
guint contacts_search_provider_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
GType contacts_search_provider_app_get_type (void) G_GNUC_CONST;
GType contacts_store_get_type (void) G_GNUC_CONST;
GType contacts_contact_get_type (void) G_GNUC_CONST;
#define CONTACTS_SEARCH_PROVIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CONTACTS_TYPE_SEARCH_PROVIDER, ContactsSearchProviderPrivate))
ContactsSearchProvider* contacts_search_provider_new (ContactsSearchProviderApp* app);
ContactsSearchProvider* contacts_search_provider_construct (GType object_type, ContactsSearchProviderApp* app);
ContactsStore* contacts_store_new (void);
ContactsStore* contacts_store_construct (GType object_type);
static void __lambda21_ (ContactsSearchProvider* self, ContactsContact* c);
static void ___lambda21__contacts_store_changed (ContactsStore* _sender, ContactsContact* c, gpointer self);
static void __lambda22_ (ContactsSearchProvider* self, ContactsContact* c);
static void ___lambda22__contacts_store_added (ContactsStore* _sender, ContactsContact* c, gpointer self);
static void __lambda23_ (ContactsSearchProvider* self, ContactsContact* c);
static void ___lambda23__contacts_store_removed (ContactsStore* _sender, ContactsContact* c, gpointer self);
static gint contacts_search_provider_compare_contacts (ContactsContact* a, ContactsContact* b);
gboolean contacts_is_set (const gchar* str);
const gchar* contacts_contact_get_display_name (ContactsContact* self);
static void contacts_search_provider_do_search_data_free (gpointer _data);
static void contacts_search_provider_do_search (ContactsSearchProvider* self, gchar** terms, int terms_length1, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gchar** contacts_search_provider_do_search_finish (ContactsSearchProvider* self, GAsyncResult* _res_, int* result_length1);
static gboolean contacts_search_provider_do_search_co (ContactsSearchProviderDoSearchData* _data_);
gchar* contacts_utils_canonicalize_for_search (const gchar* str);
GeeCollection* contacts_store_get_contacts (ContactsStore* self);
gboolean contacts_contact_get_is_hidden (ContactsContact* self);
gboolean contacts_contact_contains_strings (ContactsContact* self, gchar** strings, int strings_length1);
static void contacts_search_provider_GetInitialResultSet_data_free (gpointer _data);
void contacts_search_provider_GetInitialResultSet (ContactsSearchProvider* self, gchar** terms, int terms_length1, GAsyncReadyCallback _callback_, gpointer _user_data_);
gchar** contacts_search_provider_GetInitialResultSet_finish (ContactsSearchProvider* self, GAsyncResult* _res_, int* result_length1);
static gboolean contacts_search_provider_GetInitialResultSet_co (contacts_search_provider_GetInitialResultSetData* _data_);
static void contacts_search_provider_GetInitialResultSet_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void contacts_search_provider_GetSubsearchResultSet_data_free (gpointer _data);
void contacts_search_provider_GetSubsearchResultSet (ContactsSearchProvider* self, gchar** previous_results, int previous_results_length1, gchar** new_terms, int new_terms_length1, GAsyncReadyCallback _callback_, gpointer _user_data_);
gchar** contacts_search_provider_GetSubsearchResultSet_finish (ContactsSearchProvider* self, GAsyncResult* _res_, int* result_length1);
static gboolean contacts_search_provider_GetSubsearchResultSet_co (contacts_search_provider_GetSubsearchResultSetData* _data_);
static void contacts_search_provider_GetSubsearchResultSet_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void contacts_search_provider_get_metas_data_free (gpointer _data);
static void contacts_search_provider_get_metas (ContactsSearchProvider* self, gchar** ids, int ids_length1, GAsyncReadyCallback _callback_, gpointer _user_data_);
static GHashTable** contacts_search_provider_get_metas_finish (ContactsSearchProvider* self, GAsyncResult* _res_, int* result_length1);
static gboolean contacts_search_provider_get_metas_co (ContactsSearchProviderGetMetasData* _data_);
static void _g_free0_ (gpointer var);
static void _g_variant_unref0_ (gpointer var);
GVariant* contacts_contact_get_avatar_icon_data (ContactsContact* self);
static void contacts_search_provider_GetResultMetas_data_free (gpointer _data);
void contacts_search_provider_GetResultMetas (ContactsSearchProvider* self, gchar** ids, int ids_length1, GAsyncReadyCallback _callback_, gpointer _user_data_);
GHashTable** contacts_search_provider_GetResultMetas_finish (ContactsSearchProvider* self, GAsyncResult* _res_, int* result_length1);
static gboolean contacts_search_provider_GetResultMetas_co (contacts_search_provider_GetResultMetasData* _data_);
static gchar** _vala_array_dup1 (gchar** self, int length);
static void contacts_search_provider_GetResultMetas_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void contacts_search_provider_ActivateResult (ContactsSearchProvider* self, const gchar* search_id, gchar** terms, int terms_length1, guint32 timestamp);
void contacts_search_provider_LaunchSearch (ContactsSearchProvider* self, gchar** terms, int terms_length1, guint32 timestamp);
static void _vala_array_add9 (gchar** * array, int* length, int* size, gchar* value);
static void _vala_array_add10 (gchar** * array, int* length, int* size, gchar* value);
static void _vala_array_add11 (gchar** * array, int* length, int* size, gchar* value);
static void contacts_search_provider_finalize (GObject * obj);
static void _dbus_contacts_search_provider_GetInitialResultSet (ContactsSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void _dbus_contacts_search_provider_GetInitialResultSet_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
static void _dbus_contacts_search_provider_GetSubsearchResultSet (ContactsSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void _dbus_contacts_search_provider_GetSubsearchResultSet_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
static void _dbus_contacts_search_provider_GetResultMetas (ContactsSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void _dbus_contacts_search_provider_GetResultMetas_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
static void _dbus_contacts_search_provider_ActivateResult (ContactsSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void _dbus_contacts_search_provider_LaunchSearch (ContactsSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation);
static void contacts_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* contacts_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 contacts_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 _contacts_search_provider_unregister_object (gpointer user_data);
ContactsSearchProviderApp* contacts_search_provider_app_new (void);
ContactsSearchProviderApp* contacts_search_provider_app_construct (GType object_type);
static gboolean contacts_search_provider_app_real_dbus_register (GApplication* base, GDBusConnection* connection, const gchar* object_path, GError** error);
static void contacts_search_provider_app_real_startup (GApplication* base);
gint _vala_main (void);
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 _contacts_search_provider_dbus_arg_info_GetInitialResultSet_terms = {-1, "terms", "as"};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_GetInitialResultSet_result = {-1, "result", "as"};
static const GDBusArgInfo * const _contacts_search_provider_dbus_arg_info_GetInitialResultSet_in[] = {&_contacts_search_provider_dbus_arg_info_GetInitialResultSet_terms, NULL};
static const GDBusArgInfo * const _contacts_search_provider_dbus_arg_info_GetInitialResultSet_out[] = {&_contacts_search_provider_dbus_arg_info_GetInitialResultSet_result, NULL};
static const GDBusMethodInfo _contacts_search_provider_dbus_method_info_GetInitialResultSet = {-1, "GetInitialResultSet", (GDBusArgInfo **) (&_contacts_search_provider_dbus_arg_info_GetInitialResultSet_in), (GDBusArgInfo **) (&_contacts_search_provider_dbus_arg_info_GetInitialResultSet_out)};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_GetSubsearchResultSet_previous_results = {-1, "previous_results", "as"};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_GetSubsearchResultSet_new_terms = {-1, "new_terms", "as"};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_GetSubsearchResultSet_result = {-1, "result", "as"};
static const GDBusArgInfo * const _contacts_search_provider_dbus_arg_info_GetSubsearchResultSet_in[] = {&_contacts_search_provider_dbus_arg_info_GetSubsearchResultSet_previous_results, &_contacts_search_provider_dbus_arg_info_GetSubsearchResultSet_new_terms, NULL};
static const GDBusArgInfo * const _contacts_search_provider_dbus_arg_info_GetSubsearchResultSet_out[] = {&_contacts_search_provider_dbus_arg_info_GetSubsearchResultSet_result, NULL};
static const GDBusMethodInfo _contacts_search_provider_dbus_method_info_GetSubsearchResultSet = {-1, "GetSubsearchResultSet", (GDBusArgInfo **) (&_contacts_search_provider_dbus_arg_info_GetSubsearchResultSet_in), (GDBusArgInfo **) (&_contacts_search_provider_dbus_arg_info_GetSubsearchResultSet_out)};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_GetResultMetas_ids = {-1, "ids", "as"};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_GetResultMetas_result = {-1, "result", "aa{sv}"};
static const GDBusArgInfo * const _contacts_search_provider_dbus_arg_info_GetResultMetas_in[] = {&_contacts_search_provider_dbus_arg_info_GetResultMetas_ids, NULL};
static const GDBusArgInfo * const _contacts_search_provider_dbus_arg_info_GetResultMetas_out[] = {&_contacts_search_provider_dbus_arg_info_GetResultMetas_result, NULL};
static const GDBusMethodInfo _contacts_search_provider_dbus_method_info_GetResultMetas = {-1, "GetResultMetas", (GDBusArgInfo **) (&_contacts_search_provider_dbus_arg_info_GetResultMetas_in), (GDBusArgInfo **) (&_contacts_search_provider_dbus_arg_info_GetResultMetas_out)};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_ActivateResult_search_id = {-1, "search_id", "s"};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_ActivateResult_terms = {-1, "terms", "as"};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_ActivateResult_timestamp = {-1, "timestamp", "u"};
static const GDBusArgInfo * const _contacts_search_provider_dbus_arg_info_ActivateResult_in[] = {&_contacts_search_provider_dbus_arg_info_ActivateResult_search_id, &_contacts_search_provider_dbus_arg_info_ActivateResult_terms, &_contacts_search_provider_dbus_arg_info_ActivateResult_timestamp, NULL};
static const GDBusArgInfo * const _contacts_search_provider_dbus_arg_info_ActivateResult_out[] = {NULL};
static const GDBusMethodInfo _contacts_search_provider_dbus_method_info_ActivateResult = {-1, "ActivateResult", (GDBusArgInfo **) (&_contacts_search_provider_dbus_arg_info_ActivateResult_in), (GDBusArgInfo **) (&_contacts_search_provider_dbus_arg_info_ActivateResult_out)};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_LaunchSearch_terms = {-1, "terms", "as"};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_LaunchSearch_timestamp = {-1, "timestamp", "u"};
static const GDBusArgInfo * const _contacts_search_provider_dbus_arg_info_LaunchSearch_in[] = {&_contacts_search_provider_dbus_arg_info_LaunchSearch_terms, &_contacts_search_provider_dbus_arg_info_LaunchSearch_timestamp, NULL};
static const GDBusArgInfo * const _contacts_search_provider_dbus_arg_info_LaunchSearch_out[] = {NULL};
static const GDBusMethodInfo _contacts_search_provider_dbus_method_info_LaunchSearch = {-1, "LaunchSearch", (GDBusArgInfo **) (&_contacts_search_provider_dbus_arg_info_LaunchSearch_in), (GDBusArgInfo **) (&_contacts_search_provider_dbus_arg_info_LaunchSearch_out)};
static const GDBusMethodInfo * const _contacts_search_provider_dbus_method_info[] = {&_contacts_search_provider_dbus_method_info_GetInitialResultSet, &_contacts_search_provider_dbus_method_info_GetSubsearchResultSet, &_contacts_search_provider_dbus_method_info_GetResultMetas, &_contacts_search_provider_dbus_method_info_ActivateResult, &_contacts_search_provider_dbus_method_info_LaunchSearch, NULL};
static const GDBusSignalInfo * const _contacts_search_provider_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo * const _contacts_search_provider_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _contacts_search_provider_dbus_interface_info = {-1, "org.gnome.Shell.SearchProvider2", (GDBusMethodInfo **) (&_contacts_search_provider_dbus_method_info), (GDBusSignalInfo **) (&_contacts_search_provider_dbus_signal_info), (GDBusPropertyInfo **) (&_contacts_search_provider_dbus_property_info)};
static const GDBusInterfaceVTable _contacts_search_provider_dbus_interface_vtable = {contacts_search_provider_dbus_interface_method_call, contacts_search_provider_dbus_interface_get_property, contacts_search_provider_dbus_interface_set_property};

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


static void __lambda21_ (ContactsSearchProvider* self, ContactsContact* c) {
	GeeHashMap* _tmp0_;
	ContactsContact* _tmp1_;
	gconstpointer _tmp2_;
	ContactsContact* _tmp3_;
	g_return_if_fail (c != NULL);
	_tmp0_ = self->priv->contacts_map;
	_tmp1_ = c;
	_tmp2_ = g_object_get_data ((GObject*) _tmp1_, "search-id");
	_tmp3_ = c;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp0_, (const gchar*) _tmp2_, _tmp3_);
}


static void ___lambda21__contacts_store_changed (ContactsStore* _sender, ContactsContact* c, gpointer self) {
	__lambda21_ ((ContactsSearchProvider*) self, c);
}


static void __lambda22_ (ContactsSearchProvider* self, ContactsContact* c) {
	gchar* id = NULL;
	guint _tmp0_;
	gchar* _tmp1_;
	ContactsContact* _tmp2_;
	gchar* _tmp3_;
	GeeHashMap* _tmp4_;
	ContactsContact* _tmp5_;
	g_return_if_fail (c != NULL);
	_tmp0_ = self->priv->next_id;
	self->priv->next_id = _tmp0_ + 1;
	_tmp1_ = g_strdup_printf ("%u", _tmp0_);
	id = _tmp1_;
	_tmp2_ = c;
	_tmp3_ = g_strdup (id);
	g_object_set_data_full ((GObject*) _tmp2_, "search-id", _tmp3_, g_free);
	_tmp4_ = self->priv->contacts_map;
	_tmp5_ = c;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp4_, id, _tmp5_);
	_g_free0 (id);
}


static void ___lambda22__contacts_store_added (ContactsStore* _sender, ContactsContact* c, gpointer self) {
	__lambda22_ ((ContactsSearchProvider*) self, c);
}


static void __lambda23_ (ContactsSearchProvider* self, ContactsContact* c) {
	GeeHashMap* _tmp0_;
	ContactsContact* _tmp1_;
	gconstpointer _tmp2_;
	g_return_if_fail (c != NULL);
	_tmp0_ = self->priv->contacts_map;
	_tmp1_ = c;
	_tmp2_ = g_object_get_data ((GObject*) _tmp1_, "search-id");
	gee_abstract_map_unset ((GeeAbstractMap*) _tmp0_, (const gchar*) _tmp2_, NULL);
}


static void ___lambda23__contacts_store_removed (ContactsStore* _sender, ContactsContact* c, gpointer self) {
	__lambda23_ ((ContactsSearchProvider*) self, c);
}


ContactsSearchProvider* contacts_search_provider_construct (GType object_type, ContactsSearchProviderApp* app) {
	ContactsSearchProvider * self = NULL;
	ContactsSearchProviderApp* _tmp0_;
	ContactsSearchProviderApp* _tmp1_;
	gboolean _tmp2_;
	ContactsStore* _tmp4_;
	GeeHashMap* _tmp5_;
	ContactsStore* _tmp6_;
	ContactsStore* _tmp7_;
	ContactsStore* _tmp8_;
	g_return_val_if_fail (app != NULL, NULL);
	self = (ContactsSearchProvider*) g_object_new (object_type, NULL);
	_tmp0_ = app;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->app);
	self->priv->app = _tmp1_;
	_tmp2_ = contacts_ensure_eds_accounts (FALSE);
	if (!_tmp2_) {
		ContactsSearchProviderApp* _tmp3_;
		_tmp3_ = app;
		g_application_quit ((GApplication*) _tmp3_);
	}
	_tmp4_ = contacts_store_new ();
	_g_object_unref0 (self->priv->store);
	self->priv->store = _tmp4_;
	_tmp5_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, CONTACTS_TYPE_CONTACT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->contacts_map);
	self->priv->contacts_map = _tmp5_;
	self->priv->next_id = (guint) 0;
	_tmp6_ = self->priv->store;
	g_signal_connect_object (_tmp6_, "changed", (GCallback) ___lambda21__contacts_store_changed, self, 0);
	_tmp7_ = self->priv->store;
	g_signal_connect_object (_tmp7_, "added", (GCallback) ___lambda22__contacts_store_added, self, 0);
	_tmp8_ = self->priv->store;
	g_signal_connect_object (_tmp8_, "removed", (GCallback) ___lambda23__contacts_store_removed, self, 0);
	return self;
}


ContactsSearchProvider* contacts_search_provider_new (ContactsSearchProviderApp* app) {
	return contacts_search_provider_construct (CONTACTS_TYPE_SEARCH_PROVIDER, app);
}


static gint contacts_search_provider_compare_contacts (ContactsContact* a, ContactsContact* b) {
	gint result = 0;
	gint _tmp0_ = 0;
	ContactsContact* _tmp1_;
	gboolean _tmp2_;
	gint a_prio = 0;
	gint _tmp3_ = 0;
	ContactsContact* _tmp4_;
	gboolean _tmp5_;
	gint b_prio = 0;
	gint _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	gboolean _tmp10_ = FALSE;
	ContactsContact* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gboolean _tmp14_;
	ContactsContact* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	gboolean _tmp29_;
	ContactsContact* _tmp30_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	gboolean _tmp33_;
	g_return_val_if_fail (a != NULL, 0);
	g_return_val_if_fail (b != NULL, 0);
	_tmp1_ = a;
	_tmp2_ = _tmp1_->is_main;
	if (_tmp2_) {
		_tmp0_ = 0;
	} else {
		_tmp0_ = -1;
	}
	a_prio = _tmp0_;
	_tmp4_ = b;
	_tmp5_ = _tmp4_->is_main;
	if (_tmp5_) {
		_tmp3_ = 0;
	} else {
		_tmp3_ = -1;
	}
	b_prio = _tmp3_;
	_tmp6_ = a_prio;
	_tmp7_ = b_prio;
	if (_tmp6_ > _tmp7_) {
		result = -1;
		return result;
	}
	_tmp8_ = a_prio;
	_tmp9_ = b_prio;
	if (_tmp8_ < _tmp9_) {
		result = 1;
		return result;
	}
	_tmp11_ = a;
	_tmp12_ = contacts_contact_get_display_name (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = contacts_is_set (_tmp13_);
	if (_tmp14_) {
		ContactsContact* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		gboolean _tmp18_;
		_tmp15_ = b;
		_tmp16_ = contacts_contact_get_display_name (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = contacts_is_set (_tmp17_);
		_tmp10_ = _tmp18_;
	} else {
		_tmp10_ = FALSE;
	}
	if (_tmp10_) {
		ContactsContact* _tmp19_;
		const gchar* _tmp20_;
		const gchar* _tmp21_;
		ContactsContact* _tmp22_;
		const gchar* _tmp23_;
		const gchar* _tmp24_;
		gint _tmp25_;
		_tmp19_ = a;
		_tmp20_ = contacts_contact_get_display_name (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = b;
		_tmp23_ = contacts_contact_get_display_name (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp25_ = g_utf8_collate (_tmp21_, _tmp24_);
		result = _tmp25_;
		return result;
	}
	_tmp26_ = a;
	_tmp27_ = contacts_contact_get_display_name (_tmp26_);
	_tmp28_ = _tmp27_;
	_tmp29_ = contacts_is_set (_tmp28_);
	if (_tmp29_) {
		result = -1;
		return result;
	}
	_tmp30_ = b;
	_tmp31_ = contacts_contact_get_display_name (_tmp30_);
	_tmp32_ = _tmp31_;
	_tmp33_ = contacts_is_set (_tmp32_);
	if (_tmp33_) {
		result = 1;
		return result;
	}
	result = 0;
	return result;
}


static void contacts_search_provider_do_search_data_free (gpointer _data) {
	ContactsSearchProviderDoSearchData* _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 (ContactsSearchProviderDoSearchData, _data_);
}


static void contacts_search_provider_do_search (ContactsSearchProvider* self, gchar** terms, int terms_length1, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsSearchProviderDoSearchData* _data_;
	ContactsSearchProvider* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	_data_ = g_slice_new0 (ContactsSearchProviderDoSearchData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, contacts_search_provider_do_search_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = terms;
	_tmp1__length1 = terms_length1;
	_data_->terms = _tmp1_;
	_data_->terms_length1 = _tmp1__length1;
	contacts_search_provider_do_search_co (_data_);
}


static gchar** contacts_search_provider_do_search_finish (ContactsSearchProvider* self, GAsyncResult* _res_, int* result_length1) {
	gchar** result;
	ContactsSearchProviderDoSearchData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}


static gchar* _vala_g_strjoinv (const gchar* separator, gchar** str_array, int str_array_length1) {
	gchar* result = NULL;
	const gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	gchar** _tmp2_;
	gint _tmp2__length1;
	_tmp0_ = separator;
	if (_tmp0_ == NULL) {
		separator = "";
	}
	_tmp2_ = str_array;
	_tmp2__length1 = str_array_length1;
	if (_tmp2_ != NULL) {
		gboolean _tmp3_ = FALSE;
		gchar** _tmp4_;
		gint _tmp4__length1;
		_tmp4_ = str_array;
		_tmp4__length1 = str_array_length1;
		if (_tmp4__length1 > 0) {
			_tmp3_ = TRUE;
		} else {
			gboolean _tmp5_ = FALSE;
			gchar** _tmp6_;
			gint _tmp6__length1;
			_tmp6_ = str_array;
			_tmp6__length1 = str_array_length1;
			if (_tmp6__length1 == -1) {
				gchar** _tmp7_;
				gint _tmp7__length1;
				const gchar* _tmp8_;
				_tmp7_ = str_array;
				_tmp7__length1 = str_array_length1;
				_tmp8_ = _tmp7_[0];
				_tmp5_ = _tmp8_ != NULL;
			} else {
				_tmp5_ = FALSE;
			}
			_tmp3_ = _tmp5_;
		}
		_tmp1_ = _tmp3_;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp31_;
		gint _tmp33_;
		gint _tmp34_;
		gsize _tmp35_;
		const gchar* _tmp36_;
		gint _tmp37_;
		gint _tmp38_;
		gint _tmp39_;
		const gchar* res = NULL;
		gsize _tmp40_;
		void* _tmp41_;
		void* ptr = NULL;
		const gchar* _tmp42_;
		gchar** _tmp43_;
		gint _tmp43__length1;
		const gchar* _tmp44_;
		void* _tmp45_;
		const gchar* _tmp62_;
		len = (gsize) 1;
		{
			gboolean _tmp9_ = FALSE;
			i = 0;
			_tmp9_ = TRUE;
			while (TRUE) {
				gboolean _tmp11_ = FALSE;
				gboolean _tmp12_ = FALSE;
				gchar** _tmp13_;
				gint _tmp13__length1;
				gint _tmp21_ = 0;
				gchar** _tmp22_;
				gint _tmp22__length1;
				gint _tmp23_;
				const gchar* _tmp24_;
				gsize _tmp30_;
				if (!_tmp9_) {
					gint _tmp10_;
					_tmp10_ = i;
					i = _tmp10_ + 1;
				}
				_tmp9_ = FALSE;
				_tmp13_ = str_array;
				_tmp13__length1 = str_array_length1;
				if (_tmp13__length1 != -1) {
					gint _tmp14_;
					gchar** _tmp15_;
					gint _tmp15__length1;
					_tmp14_ = i;
					_tmp15_ = str_array;
					_tmp15__length1 = str_array_length1;
					_tmp12_ = _tmp14_ < _tmp15__length1;
				} else {
					_tmp12_ = FALSE;
				}
				if (_tmp12_) {
					_tmp11_ = TRUE;
				} else {
					gboolean _tmp16_ = FALSE;
					gchar** _tmp17_;
					gint _tmp17__length1;
					_tmp17_ = str_array;
					_tmp17__length1 = str_array_length1;
					if (_tmp17__length1 == -1) {
						gchar** _tmp18_;
						gint _tmp18__length1;
						gint _tmp19_;
						const gchar* _tmp20_;
						_tmp18_ = str_array;
						_tmp18__length1 = str_array_length1;
						_tmp19_ = i;
						_tmp20_ = _tmp18_[_tmp19_];
						_tmp16_ = _tmp20_ != NULL;
					} else {
						_tmp16_ = FALSE;
					}
					_tmp11_ = _tmp16_;
				}
				if (!_tmp11_) {
					break;
				}
				_tmp22_ = str_array;
				_tmp22__length1 = str_array_length1;
				_tmp23_ = i;
				_tmp24_ = _tmp22_[_tmp23_];
				if (_tmp24_ != NULL) {
					gchar** _tmp25_;
					gint _tmp25__length1;
					gint _tmp26_;
					const gchar* _tmp27_;
					gint _tmp28_;
					gint _tmp29_;
					_tmp25_ = str_array;
					_tmp25__length1 = str_array_length1;
					_tmp26_ = i;
					_tmp27_ = _tmp25_[_tmp26_];
					_tmp28_ = strlen ((const gchar*) _tmp27_);
					_tmp29_ = _tmp28_;
					_tmp21_ = _tmp29_;
				} else {
					_tmp21_ = 0;
				}
				_tmp30_ = len;
				len = _tmp30_ + _tmp21_;
			}
		}
		_tmp31_ = i;
		if (_tmp31_ == 0) {
			gchar* _tmp32_;
			_tmp32_ = g_strdup ("");
			result = _tmp32_;
			return result;
		}
		_tmp33_ = i;
		str_array_length1 = _tmp33_;
		_tmp34_ = str_array_length1;
		_tmp35_ = len;
		_tmp36_ = separator;
		_tmp37_ = strlen ((const gchar*) _tmp36_);
		_tmp38_ = _tmp37_;
		_tmp39_ = i;
		len = _tmp35_ + (_tmp38_ * (_tmp39_ - 1));
		_tmp40_ = len;
		_tmp41_ = g_malloc (_tmp40_);
		res = _tmp41_;
		_tmp42_ = res;
		_tmp43_ = str_array;
		_tmp43__length1 = str_array_length1;
		_tmp44_ = _tmp43_[0];
		_tmp45_ = g_stpcpy ((void*) _tmp42_, (const gchar*) _tmp44_);
		ptr = _tmp45_;
		{
			gboolean _tmp46_ = FALSE;
			i = 1;
			_tmp46_ = TRUE;
			while (TRUE) {
				gint _tmp48_;
				gchar** _tmp49_;
				gint _tmp49__length1;
				void* _tmp50_;
				const gchar* _tmp51_;
				void* _tmp52_;
				const gchar* _tmp53_ = NULL;
				gchar** _tmp54_;
				gint _tmp54__length1;
				gint _tmp55_;
				const gchar* _tmp56_;
				void* _tmp60_;
				void* _tmp61_;
				if (!_tmp46_) {
					gint _tmp47_;
					_tmp47_ = i;
					i = _tmp47_ + 1;
				}
				_tmp46_ = FALSE;
				_tmp48_ = i;
				_tmp49_ = str_array;
				_tmp49__length1 = str_array_length1;
				if (!(_tmp48_ < _tmp49__length1)) {
					break;
				}
				_tmp50_ = ptr;
				_tmp51_ = separator;
				_tmp52_ = g_stpcpy (_tmp50_, (const gchar*) _tmp51_);
				ptr = _tmp52_;
				_tmp54_ = str_array;
				_tmp54__length1 = str_array_length1;
				_tmp55_ = i;
				_tmp56_ = _tmp54_[_tmp55_];
				if (_tmp56_ != NULL) {
					gchar** _tmp57_;
					gint _tmp57__length1;
					gint _tmp58_;
					const gchar* _tmp59_;
					_tmp57_ = str_array;
					_tmp57__length1 = str_array_length1;
					_tmp58_ = i;
					_tmp59_ = _tmp57_[_tmp58_];
					_tmp53_ = (const gchar*) _tmp59_;
				} else {
					_tmp53_ = "";
				}
				_tmp60_ = ptr;
				_tmp61_ = g_stpcpy (_tmp60_, _tmp53_);
				ptr = _tmp61_;
			}
		}
		_tmp62_ = res;
		res = NULL;
		result = (gchar*) _tmp62_;
		return result;
	} else {
		gchar* _tmp63_;
		_tmp63_ = g_strdup ("");
		result = _tmp63_;
		return result;
	}
}


static gboolean contacts_search_provider_do_search_co (ContactsSearchProviderDoSearchData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->app;
	g_application_hold ((GApplication*) _data_->_tmp0_);
	_data_->_tmp1_ = _data_->terms;
	_data_->_tmp1__length1 = _data_->terms_length1;
	_data_->_tmp2_ = _vala_g_strjoinv (" ", _data_->_tmp1_, _data_->_tmp1__length1);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = contacts_utils_canonicalize_for_search (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp7_ = _data_->_tmp6_ = g_strsplit (_data_->_tmp5_, " ", 0);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp8__length1 = _vala_array_length (_data_->_tmp6_);
	_g_free0 (_data_->_tmp5_);
	_g_free0 (_data_->_tmp3_);
	_data_->normalized_terms = _data_->_tmp8_;
	_data_->normalized_terms_length1 = _data_->_tmp8__length1;
	_data_->_normalized_terms_size_ = _data_->normalized_terms_length1;
	_data_->_tmp9_ = gee_array_list_new (CONTACTS_TYPE_CONTACT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_data_->matches = _data_->_tmp9_;
	{
		_data_->_tmp10_ = _data_->self->priv->store;
		_data_->_tmp11_ = contacts_store_get_contacts (_data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_tmp13_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp12_);
		_data_->_tmp14_ = _data_->_tmp13_;
		_g_object_unref0 (_data_->_tmp12_);
		_data_->_c_it = _data_->_tmp14_;
		while (TRUE) {
			_data_->_tmp15_ = _data_->_c_it;
			_data_->_tmp16_ = gee_iterator_next (_data_->_tmp15_);
			if (!_data_->_tmp16_) {
				break;
			}
			_data_->_tmp17_ = _data_->_c_it;
			_data_->_tmp18_ = gee_iterator_get (_data_->_tmp17_);
			_data_->c = (ContactsContact*) _data_->_tmp18_;
			_data_->_tmp19_ = _data_->c;
			_data_->_tmp20_ = contacts_contact_get_is_hidden (_data_->_tmp19_);
			_data_->_tmp21_ = _data_->_tmp20_;
			if (_data_->_tmp21_) {
				_g_object_unref0 (_data_->c);
				continue;
			}
			_data_->_tmp22_ = _data_->c;
			_data_->_tmp23_ = _data_->normalized_terms;
			_data_->_tmp23__length1 = _data_->normalized_terms_length1;
			_data_->_tmp24_ = contacts_contact_contains_strings (_data_->_tmp22_, _data_->_tmp23_, _data_->_tmp23__length1);
			if (_data_->_tmp24_) {
				_data_->_tmp25_ = _data_->matches;
				_data_->_tmp26_ = _data_->c;
				gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp25_, _data_->_tmp26_);
			}
			_g_object_unref0 (_data_->c);
		}
		_g_object_unref0 (_data_->_c_it);
	}
	_data_->_tmp27_ = _data_->matches;
	gee_list_sort ((GeeList*) _data_->_tmp27_, (GCompareDataFunc) contacts_search_provider_compare_contacts, NULL, NULL);
	_data_->_tmp28_ = _data_->matches;
	_data_->_tmp29_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp28_);
	_data_->_tmp30_ = _data_->_tmp29_;
	_data_->_tmp31_ = g_new0 (gchar*, _data_->_tmp30_ + 1);
	_data_->results = _data_->_tmp31_;
	_data_->results_length1 = _data_->_tmp30_;
	_data_->_results_size_ = _data_->results_length1;
	{
		_data_->i = 0;
		{
			_data_->_tmp32_ = TRUE;
			while (TRUE) {
				if (!_data_->_tmp32_) {
					_data_->_tmp33_ = _data_->i;
					_data_->i = _data_->_tmp33_ + 1;
				}
				_data_->_tmp32_ = FALSE;
				_data_->_tmp34_ = _data_->i;
				_data_->_tmp35_ = _data_->matches;
				_data_->_tmp36_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp35_);
				_data_->_tmp37_ = _data_->_tmp36_;
				if (!(_data_->_tmp34_ < _data_->_tmp37_)) {
					break;
				}
				_data_->_tmp38_ = _data_->results;
				_data_->_tmp38__length1 = _data_->results_length1;
				_data_->_tmp39_ = _data_->i;
				_data_->_tmp40_ = _data_->matches;
				_data_->_tmp41_ = _data_->i;
				_data_->_tmp42_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp40_, _data_->_tmp41_);
				_data_->_tmp43_ = (ContactsContact*) _data_->_tmp42_;
				_data_->_tmp44_ = g_object_get_data ((GObject*) _data_->_tmp43_, "search-id");
				_data_->_tmp45_ = g_strdup ((const gchar*) _data_->_tmp44_);
				_g_free0 (_data_->_tmp38_[_data_->_tmp39_]);
				_data_->_tmp38_[_data_->_tmp39_] = _data_->_tmp45_;
				_data_->_tmp46_ = _data_->_tmp38_[_data_->_tmp39_];
				_g_object_unref0 (_data_->_tmp43_);
			}
		}
	}
	_data_->_tmp47_ = _data_->self->priv->app;
	g_application_release ((GApplication*) _data_->_tmp47_);
	_data_->_tmp48_ = _data_->results;
	_data_->_tmp48__length1 = _data_->results_length1;
	_data_->result_length1 = _data_->_tmp48__length1;
	_data_->result = _data_->_tmp48_;
	_g_object_unref0 (_data_->matches);
	_data_->normalized_terms = (_vala_array_free (_data_->normalized_terms, _data_->normalized_terms_length1, (GDestroyNotify) g_free), NULL);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (g_task_get_completed (_data_->_async_result) != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void contacts_search_provider_GetInitialResultSet_data_free (gpointer _data) {
	contacts_search_provider_GetInitialResultSetData* _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 (contacts_search_provider_GetInitialResultSetData, _data_);
}


void contacts_search_provider_GetInitialResultSet (ContactsSearchProvider* self, gchar** terms, int terms_length1, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	contacts_search_provider_GetInitialResultSetData* _data_;
	ContactsSearchProvider* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	_data_ = g_slice_new0 (contacts_search_provider_GetInitialResultSetData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, contacts_search_provider_GetInitialResultSet_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = terms;
	_tmp1__length1 = terms_length1;
	_data_->terms = _tmp1_;
	_data_->terms_length1 = _tmp1__length1;
	contacts_search_provider_GetInitialResultSet_co (_data_);
}


gchar** contacts_search_provider_GetInitialResultSet_finish (ContactsSearchProvider* self, GAsyncResult* _res_, int* result_length1) {
	gchar** result;
	contacts_search_provider_GetInitialResultSetData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}


static void contacts_search_provider_GetInitialResultSet_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	contacts_search_provider_GetInitialResultSetData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_search_provider_GetInitialResultSet_co (_data_);
}


static gboolean contacts_search_provider_GetInitialResultSet_co (contacts_search_provider_GetInitialResultSetData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->terms;
	_data_->_tmp0__length1 = _data_->terms_length1;
	_data_->_state_ = 1;
	contacts_search_provider_do_search (_data_->self, _data_->_tmp0_, _data_->_tmp0__length1, contacts_search_provider_GetInitialResultSet_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp2_ = contacts_search_provider_do_search_finish (_data_->self, _data_->_res_, &_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp3__length1 = _data_->_tmp1_;
	_data_->result_length1 = _data_->_tmp3__length1;
	_data_->result = _data_->_tmp3_;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (g_task_get_completed (_data_->_async_result) != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void contacts_search_provider_GetSubsearchResultSet_data_free (gpointer _data) {
	contacts_search_provider_GetSubsearchResultSetData* _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 (contacts_search_provider_GetSubsearchResultSetData, _data_);
}


void contacts_search_provider_GetSubsearchResultSet (ContactsSearchProvider* self, gchar** previous_results, int previous_results_length1, gchar** new_terms, int new_terms_length1, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	contacts_search_provider_GetSubsearchResultSetData* _data_;
	ContactsSearchProvider* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar** _tmp2_;
	gint _tmp2__length1;
	_data_ = g_slice_new0 (contacts_search_provider_GetSubsearchResultSetData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, contacts_search_provider_GetSubsearchResultSet_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_ = new_terms;
	_tmp2__length1 = new_terms_length1;
	_data_->new_terms = _tmp2_;
	_data_->new_terms_length1 = _tmp2__length1;
	contacts_search_provider_GetSubsearchResultSet_co (_data_);
}


gchar** contacts_search_provider_GetSubsearchResultSet_finish (ContactsSearchProvider* self, GAsyncResult* _res_, int* result_length1) {
	gchar** result;
	contacts_search_provider_GetSubsearchResultSetData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}


static void contacts_search_provider_GetSubsearchResultSet_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	contacts_search_provider_GetSubsearchResultSetData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_search_provider_GetSubsearchResultSet_co (_data_);
}


static gboolean contacts_search_provider_GetSubsearchResultSet_co (contacts_search_provider_GetSubsearchResultSetData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->new_terms;
	_data_->_tmp0__length1 = _data_->new_terms_length1;
	_data_->_state_ = 1;
	contacts_search_provider_do_search (_data_->self, _data_->_tmp0_, _data_->_tmp0__length1, contacts_search_provider_GetSubsearchResultSet_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp2_ = contacts_search_provider_do_search_finish (_data_->self, _data_->_res_, &_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp3__length1 = _data_->_tmp1_;
	_data_->result_length1 = _data_->_tmp3__length1;
	_data_->result = _data_->_tmp3_;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (g_task_get_completed (_data_->_async_result) != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void contacts_search_provider_get_metas_data_free (gpointer _data) {
	ContactsSearchProviderGetMetasData* _data_;
	_data_ = _data;
	_data_->ids = (_vala_array_free (_data_->ids, _data_->ids_length1, (GDestroyNotify) g_free), NULL);
	_data_->result = (_vala_array_free (_data_->result, _data_->result_length1, (GDestroyNotify) g_hash_table_unref), NULL);
	_g_object_unref0 (_data_->self);
	g_slice_free (ContactsSearchProviderGetMetasData, _data_);
}


static void contacts_search_provider_get_metas (ContactsSearchProvider* self, gchar** ids, int ids_length1, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	ContactsSearchProviderGetMetasData* _data_;
	ContactsSearchProvider* _tmp0_;
	_data_ = g_slice_new0 (ContactsSearchProviderGetMetasData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, contacts_search_provider_get_metas_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->ids = (_vala_array_free (_data_->ids, _data_->ids_length1, (GDestroyNotify) g_free), NULL);
	_data_->ids = ids;
	_data_->ids_length1 = ids_length1;
	contacts_search_provider_get_metas_co (_data_);
}


static GHashTable** contacts_search_provider_get_metas_finish (ContactsSearchProvider* self, GAsyncResult* _res_, int* result_length1) {
	GHashTable** result;
	ContactsSearchProviderGetMetasData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}


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


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


static gpointer _g_variant_ref0 (gpointer self) {
	return self ? g_variant_ref (self) : NULL;
}


static gboolean contacts_search_provider_get_metas_co (ContactsSearchProviderGetMetasData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->app;
	g_application_hold ((GApplication*) _data_->_tmp0_);
	_data_->_tmp1_ = gee_array_list_new (G_TYPE_HASH_TABLE, (GBoxedCopyFunc) g_hash_table_ref, (GDestroyNotify) g_hash_table_unref, NULL, NULL, NULL);
	_data_->results = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->ids;
	_data_->_tmp2__length1 = _data_->ids_length1;
	{
		_data_->id_collection_length1 = 0;
		_data_->_id_collection_size_ = 0;
		_data_->id_collection = _data_->_tmp2_;
		_data_->id_collection_length1 = _data_->_tmp2__length1;
		for (_data_->id_it = 0; _data_->id_it < _data_->_tmp2__length1; _data_->id_it = _data_->id_it + 1) {
			_data_->_tmp3_ = g_strdup (_data_->id_collection[_data_->id_it]);
			_data_->id = _data_->_tmp3_;
			{
				_data_->_tmp4_ = _data_->self->priv->contacts_map;
				_data_->_tmp5_ = _data_->id;
				_data_->_tmp6_ = gee_abstract_map_get ((GeeAbstractMap*) _data_->_tmp4_, _data_->_tmp5_);
				_data_->contact = (ContactsContact*) _data_->_tmp6_;
				_data_->_tmp7_ = _data_->contact;
				if (_data_->_tmp7_ == NULL) {
					_g_object_unref0 (_data_->contact);
					_g_free0 (_data_->id);
					continue;
				}
				_data_->_tmp8_ = g_str_hash;
				_data_->_tmp9_ = g_str_equal;
				_data_->_tmp10_ = g_hash_table_new_full (_data_->_tmp8_, _data_->_tmp9_, _g_free0_, _g_variant_unref0_);
				_data_->meta = _data_->_tmp10_;
				_data_->_tmp11_ = _data_->meta;
				_data_->_tmp12_ = g_strdup ("id");
				_data_->_tmp13_ = _data_->id;
				_data_->_tmp14_ = g_variant_new_string (_data_->_tmp13_);
				g_variant_ref_sink (_data_->_tmp14_);
				g_hash_table_insert (_data_->_tmp11_, _data_->_tmp12_, _data_->_tmp14_);
				_data_->_tmp15_ = _data_->meta;
				_data_->_tmp16_ = g_strdup ("name");
				_data_->_tmp17_ = _data_->contact;
				_data_->_tmp18_ = contacts_contact_get_display_name (_data_->_tmp17_);
				_data_->_tmp19_ = _data_->_tmp18_;
				_data_->_tmp20_ = g_variant_new_string (_data_->_tmp19_);
				g_variant_ref_sink (_data_->_tmp20_);
				g_hash_table_insert (_data_->_tmp15_, _data_->_tmp16_, _data_->_tmp20_);
				_data_->_tmp21_ = _data_->contact;
				_data_->_tmp22_ = contacts_contact_get_avatar_icon_data (_data_->_tmp21_);
				_data_->_tmp23_ = _data_->_tmp22_;
				if (_data_->_tmp23_ != NULL) {
					_data_->_tmp24_ = _data_->meta;
					_data_->_tmp25_ = g_strdup ("icon");
					_data_->_tmp26_ = _data_->contact;
					_data_->_tmp27_ = contacts_contact_get_avatar_icon_data (_data_->_tmp26_);
					_data_->_tmp28_ = _data_->_tmp27_;
					_data_->_tmp29_ = _g_variant_ref0 (_data_->_tmp28_);
					g_hash_table_insert (_data_->_tmp24_, _data_->_tmp25_, _data_->_tmp29_);
				} else {
					_data_->_tmp30_ = _data_->meta;
					_data_->_tmp31_ = g_strdup ("icon");
					_data_->_tmp32_ = (GThemedIcon*) g_themed_icon_new ("avatar-default");
					_data_->_tmp33_ = _data_->_tmp32_;
					_data_->_tmp34_ = g_icon_serialize ((GIcon*) _data_->_tmp33_);
					g_hash_table_insert (_data_->_tmp30_, _data_->_tmp31_, _data_->_tmp34_);
					_g_object_unref0 (_data_->_tmp33_);
				}
				_data_->_tmp35_ = _data_->results;
				_data_->_tmp36_ = _data_->meta;
				gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp35_, _data_->_tmp36_);
				_g_hash_table_unref0 (_data_->meta);
				_g_object_unref0 (_data_->contact);
				_g_free0 (_data_->id);
			}
		}
	}
	_data_->_tmp37_ = _data_->self->priv->app;
	g_application_release ((GApplication*) _data_->_tmp37_);
	_data_->_tmp38_ = _data_->results;
	_data_->_tmp40_ = gee_collection_to_array ((GeeCollection*) _data_->_tmp38_, &_data_->_tmp39_);
	_data_->_tmp41_ = _data_->_tmp40_;
	_data_->_tmp41__length1 = _data_->_tmp39_;
	_data_->result_length1 = _data_->_tmp41__length1;
	_data_->result = _data_->_tmp41_;
	_g_object_unref0 (_data_->results);
	_data_->ids = (_vala_array_free (_data_->ids, _data_->ids_length1, (GDestroyNotify) g_free), NULL);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (g_task_get_completed (_data_->_async_result) != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void contacts_search_provider_GetResultMetas_data_free (gpointer _data) {
	contacts_search_provider_GetResultMetasData* _data_;
	_data_ = _data;
	_data_->result = (_vala_array_free (_data_->result, _data_->result_length1, (GDestroyNotify) g_hash_table_unref), NULL);
	_g_object_unref0 (_data_->self);
	g_slice_free (contacts_search_provider_GetResultMetasData, _data_);
}


void contacts_search_provider_GetResultMetas (ContactsSearchProvider* self, gchar** ids, int ids_length1, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	contacts_search_provider_GetResultMetasData* _data_;
	ContactsSearchProvider* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	_data_ = g_slice_new0 (contacts_search_provider_GetResultMetasData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, contacts_search_provider_GetResultMetas_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = ids;
	_tmp1__length1 = ids_length1;
	_data_->ids = _tmp1_;
	_data_->ids_length1 = _tmp1__length1;
	contacts_search_provider_GetResultMetas_co (_data_);
}


GHashTable** contacts_search_provider_GetResultMetas_finish (ContactsSearchProvider* self, GAsyncResult* _res_, int* result_length1) {
	GHashTable** result;
	contacts_search_provider_GetResultMetasData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}


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


static void contacts_search_provider_GetResultMetas_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	contacts_search_provider_GetResultMetasData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_search_provider_GetResultMetas_co (_data_);
}


static gboolean contacts_search_provider_GetResultMetas_co (contacts_search_provider_GetResultMetasData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->ids;
	_data_->_tmp0__length1 = _data_->ids_length1;
	_data_->_tmp1_ = (_data_->_tmp0_ != NULL) ? _vala_array_dup1 (_data_->_tmp0_, _data_->_tmp0__length1) : ((gpointer) _data_->_tmp0_);
	_data_->_tmp1__length1 = _data_->_tmp0__length1;
	_data_->_state_ = 1;
	contacts_search_provider_get_metas (_data_->self, _data_->_tmp1_, _data_->_tmp1__length1, contacts_search_provider_GetResultMetas_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = contacts_search_provider_get_metas_finish (_data_->self, _data_->_res_, &_data_->_tmp2_);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp4__length1 = _data_->_tmp2_;
	_data_->result_length1 = _data_->_tmp4__length1;
	_data_->result = _data_->_tmp4_;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (g_task_get_completed (_data_->_async_result) != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


void contacts_search_provider_ActivateResult (ContactsSearchProvider* self, const gchar* search_id, gchar** terms, int terms_length1, guint32 timestamp) {
	ContactsSearchProviderApp* _tmp0_;
	ContactsContact* contact = NULL;
	GeeHashMap* _tmp1_;
	const gchar* _tmp2_;
	gpointer _tmp3_;
	ContactsContact* _tmp4_;
	gchar* id = NULL;
	ContactsContact* _tmp6_;
	FolksIndividual* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	ContactsSearchProviderApp* _tmp21_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (search_id != NULL);
	_tmp0_ = self->priv->app;
	g_application_hold ((GApplication*) _tmp0_);
	_tmp1_ = self->priv->contacts_map;
	_tmp2_ = search_id;
	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, _tmp2_);
	contact = (ContactsContact*) _tmp3_;
	_tmp4_ = contact;
	if (_tmp4_ == NULL) {
		ContactsSearchProviderApp* _tmp5_;
		_tmp5_ = self->priv->app;
		g_application_release ((GApplication*) _tmp5_);
		_g_object_unref0 (contact);
		return;
	}
	_tmp6_ = contact;
	_tmp7_ = _tmp6_->individual;
	_tmp8_ = folks_individual_get_id (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = g_strdup (_tmp9_);
	id = _tmp10_;
	{
		gboolean _tmp11_ = FALSE;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		gboolean _tmp15_;
		gboolean _tmp16_;
		_tmp12_ = id;
		_tmp13_ = g_strconcat ("gnome-contacts -i ", _tmp12_, NULL);
		_tmp14_ = _tmp13_;
		_tmp15_ = g_spawn_command_line_async (_tmp14_, &_inner_error_);
		_tmp16_ = _tmp15_;
		_g_free0 (_tmp14_);
		_tmp11_ = _tmp16_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == G_SPAWN_ERROR) {
				goto __catch3_g_spawn_error;
			}
			_g_free0 (id);
			_g_object_unref0 (contact);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
		if (!_tmp11_) {
			FILE* _tmp17_;
			const gchar* _tmp18_;
			_tmp17_ = stderr;
			_tmp18_ = id;
			fprintf (_tmp17_, "Failed to launch contact with id '%s'\n", _tmp18_);
		}
	}
	goto __finally3;
	__catch3_g_spawn_error:
	{
		GError* e = NULL;
		FILE* _tmp19_;
		const gchar* _tmp20_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp19_ = stderr;
		_tmp20_ = id;
		fprintf (_tmp19_, "Failed to launch contact with id '%s'\n", _tmp20_);
		_g_error_free0 (e);
	}
	__finally3:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_free0 (id);
		_g_object_unref0 (contact);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp21_ = self->priv->app;
	g_application_release ((GApplication*) _tmp21_);
	_g_free0 (id);
	_g_object_unref0 (contact);
}


static void _vala_array_add9 (gchar** * array, int* length, int* size, gchar* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


static void _vala_array_add10 (gchar** * array, int* length, int* size, gchar* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


static void _vala_array_add11 (gchar** * array, int* length, int* size, gchar* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


void contacts_search_provider_LaunchSearch (ContactsSearchProvider* self, gchar** terms, int terms_length1, guint32 timestamp) {
	ContactsSearchProviderApp* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar* _tmp2_;
	gchar* _tmp3_;
	ContactsSearchProviderApp* _tmp17_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->app;
	g_application_hold ((GApplication*) _tmp0_);
	_tmp1_ = terms;
	_tmp1__length1 = terms_length1;
	_tmp2_ = _vala_g_strjoinv (", ", _tmp1_, _tmp1__length1);
	_tmp3_ = _tmp2_;
	g_debug ("contacts-shell-search-provider.vala:137: LaunchSearch (%s)", _tmp3_);
	_g_free0 (_tmp3_);
	{
		gchar** args = NULL;
		gchar** _tmp4_;
		gint args_length1;
		gint _args_size_;
		gchar** _tmp5_;
		gint _tmp5__length1;
		gchar* _tmp6_;
		gchar** _tmp7_;
		gint _tmp7__length1;
		gchar* _tmp8_;
		gchar** _tmp9_;
		gint _tmp9__length1;
		gchar** _tmp10_;
		gint _tmp10__length1;
		gchar* _tmp11_;
		gboolean _tmp12_ = FALSE;
		gchar** _tmp13_;
		gint _tmp13__length1;
		gboolean _tmp14_;
		_tmp4_ = g_new0 (gchar*, 0 + 1);
		args = _tmp4_;
		args_length1 = 0;
		_args_size_ = args_length1;
		_tmp5_ = args;
		_tmp5__length1 = args_length1;
		_tmp6_ = g_strdup ("gnome-contacts");
		_vala_array_add9 (&args, &args_length1, &_args_size_, _tmp6_);
		_tmp7_ = args;
		_tmp7__length1 = args_length1;
		_tmp8_ = g_strdup ("--search");
		_vala_array_add10 (&args, &args_length1, &_args_size_, _tmp8_);
		_tmp9_ = args;
		_tmp9__length1 = args_length1;
		_tmp10_ = terms;
		_tmp10__length1 = terms_length1;
		_tmp11_ = _vala_g_strjoinv (" ", _tmp10_, _tmp10__length1);
		_vala_array_add11 (&args, &args_length1, &_args_size_, _tmp11_);
		_tmp13_ = args;
		_tmp13__length1 = args_length1;
		_tmp14_ = g_spawn_async (NULL, _tmp13_, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &_inner_error_);
		_tmp12_ = _tmp14_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL);
			if (_inner_error_->domain == G_SPAWN_ERROR) {
				goto __catch4_g_spawn_error;
			}
			args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
		if (!_tmp12_) {
			FILE* _tmp15_;
			_tmp15_ = stderr;
			fprintf (_tmp15_, "Failed to launch Contacts for search\n");
		}
		args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL);
	}
	goto __finally4;
	__catch4_g_spawn_error:
	{
		GError* _error_ = NULL;
		FILE* _tmp16_;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		_tmp16_ = stderr;
		fprintf (_tmp16_, "Failed to launch Contacts for search\n");
		_g_error_free0 (_error_);
	}
	__finally4:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp17_ = self->priv->app;
	g_application_release ((GApplication*) _tmp17_);
}


static void contacts_search_provider_class_init (ContactsSearchProviderClass * klass) {
	contacts_search_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (ContactsSearchProviderPrivate));
	G_OBJECT_CLASS (klass)->finalize = contacts_search_provider_finalize;
}


static void contacts_search_provider_instance_init (ContactsSearchProvider * self) {
	self->priv = CONTACTS_SEARCH_PROVIDER_GET_PRIVATE (self);
}


static void contacts_search_provider_finalize (GObject * obj) {
	ContactsSearchProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, CONTACTS_TYPE_SEARCH_PROVIDER, ContactsSearchProvider);
	_g_object_unref0 (self->priv->app);
	_g_object_unref0 (self->priv->store);
	_g_object_unref0 (self->priv->contacts_map);
	G_OBJECT_CLASS (contacts_search_provider_parent_class)->finalize (obj);
}


GType contacts_search_provider_get_type (void) {
	static volatile gsize contacts_search_provider_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_search_provider_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsSearchProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_search_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsSearchProvider), 0, (GInstanceInitFunc) contacts_search_provider_instance_init, NULL };
		GType contacts_search_provider_type_id;
		contacts_search_provider_type_id = g_type_register_static (G_TYPE_OBJECT, "ContactsSearchProvider", &g_define_type_info, 0);
		g_type_set_qdata (contacts_search_provider_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) contacts_search_provider_register_object);
		g_once_init_leave (&contacts_search_provider_type_id__volatile, contacts_search_provider_type_id);
	}
	return contacts_search_provider_type_id__volatile;
}


static void _dbus_contacts_search_provider_GetInitialResultSet (ContactsSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GVariantIter _arguments_iter;
	gchar** terms = NULL;
	int terms_length1 = 0;
	GVariant* _tmp0_;
	gchar** _tmp1_;
	int _tmp1__length;
	int _tmp1__size;
	int _tmp1__length1;
	GVariantIter _tmp2_;
	GVariant* _tmp3_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp0_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp1_ = g_new (gchar*, 5);
	_tmp1__length = 0;
	_tmp1__size = 4;
	_tmp1__length1 = 0;
	g_variant_iter_init (&_tmp2_, _tmp0_);
	for (; (_tmp3_ = g_variant_iter_next_value (&_tmp2_)) != NULL; _tmp1__length1++) {
		if (_tmp1__size == _tmp1__length) {
			_tmp1__size = 2 * _tmp1__size;
			_tmp1_ = g_renew (gchar*, _tmp1_, _tmp1__size + 1);
		}
		_tmp1_[_tmp1__length++] = g_variant_dup_string (_tmp3_, NULL);
		g_variant_unref (_tmp3_);
	}
	terms_length1 = _tmp1__length1;
	_tmp1_[_tmp1__length] = NULL;
	terms = _tmp1_;
	g_variant_unref (_tmp0_);
	contacts_search_provider_GetInitialResultSet (self, terms, terms_length1, (GAsyncReadyCallback) _dbus_contacts_search_provider_GetInitialResultSet_ready, invocation);
	terms = (_vala_array_free (terms, terms_length1, (GDestroyNotify) g_free), NULL);
}


static void _dbus_contacts_search_provider_GetInitialResultSet_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
	GDBusMethodInvocation * invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gchar** result;
	int result_length1 = 0;
	gchar** _tmp4_;
	GVariantBuilder _tmp5_;
	int _tmp6_;
	invocation = _user_data_;
	result = contacts_search_provider_GetInitialResultSet_finish ((ContactsSearchProvider*) 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);
	_tmp4_ = result;
	g_variant_builder_init (&_tmp5_, G_VARIANT_TYPE ("as"));
	for (_tmp6_ = 0; _tmp6_ < result_length1; _tmp6_++) {
		g_variant_builder_add_value (&_tmp5_, g_variant_new_string (*_tmp4_));
		_tmp4_++;
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp5_));
	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_contacts_search_provider_GetSubsearchResultSet (ContactsSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GVariantIter _arguments_iter;
	gchar** previous_results = NULL;
	int previous_results_length1 = 0;
	GVariant* _tmp7_;
	gchar** _tmp8_;
	int _tmp8__length;
	int _tmp8__size;
	int _tmp8__length1;
	GVariantIter _tmp9_;
	GVariant* _tmp10_;
	gchar** new_terms = NULL;
	int new_terms_length1 = 0;
	GVariant* _tmp11_;
	gchar** _tmp12_;
	int _tmp12__length;
	int _tmp12__size;
	int _tmp12__length1;
	GVariantIter _tmp13_;
	GVariant* _tmp14_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp7_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp8_ = g_new (gchar*, 5);
	_tmp8__length = 0;
	_tmp8__size = 4;
	_tmp8__length1 = 0;
	g_variant_iter_init (&_tmp9_, _tmp7_);
	for (; (_tmp10_ = g_variant_iter_next_value (&_tmp9_)) != NULL; _tmp8__length1++) {
		if (_tmp8__size == _tmp8__length) {
			_tmp8__size = 2 * _tmp8__size;
			_tmp8_ = g_renew (gchar*, _tmp8_, _tmp8__size + 1);
		}
		_tmp8_[_tmp8__length++] = g_variant_dup_string (_tmp10_, NULL);
		g_variant_unref (_tmp10_);
	}
	previous_results_length1 = _tmp8__length1;
	_tmp8_[_tmp8__length] = NULL;
	previous_results = _tmp8_;
	g_variant_unref (_tmp7_);
	_tmp11_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp12_ = g_new (gchar*, 5);
	_tmp12__length = 0;
	_tmp12__size = 4;
	_tmp12__length1 = 0;
	g_variant_iter_init (&_tmp13_, _tmp11_);
	for (; (_tmp14_ = g_variant_iter_next_value (&_tmp13_)) != NULL; _tmp12__length1++) {
		if (_tmp12__size == _tmp12__length) {
			_tmp12__size = 2 * _tmp12__size;
			_tmp12_ = g_renew (gchar*, _tmp12_, _tmp12__size + 1);
		}
		_tmp12_[_tmp12__length++] = g_variant_dup_string (_tmp14_, NULL);
		g_variant_unref (_tmp14_);
	}
	new_terms_length1 = _tmp12__length1;
	_tmp12_[_tmp12__length] = NULL;
	new_terms = _tmp12_;
	g_variant_unref (_tmp11_);
	contacts_search_provider_GetSubsearchResultSet (self, previous_results, previous_results_length1, new_terms, new_terms_length1, (GAsyncReadyCallback) _dbus_contacts_search_provider_GetSubsearchResultSet_ready, invocation);
	previous_results = (_vala_array_free (previous_results, previous_results_length1, (GDestroyNotify) g_free), NULL);
	new_terms = (_vala_array_free (new_terms, new_terms_length1, (GDestroyNotify) g_free), NULL);
}


static void _dbus_contacts_search_provider_GetSubsearchResultSet_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
	GDBusMethodInvocation * invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gchar** result;
	int result_length1 = 0;
	gchar** _tmp15_;
	GVariantBuilder _tmp16_;
	int _tmp17_;
	invocation = _user_data_;
	result = contacts_search_provider_GetSubsearchResultSet_finish ((ContactsSearchProvider*) 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);
	_tmp15_ = result;
	g_variant_builder_init (&_tmp16_, G_VARIANT_TYPE ("as"));
	for (_tmp17_ = 0; _tmp17_ < result_length1; _tmp17_++) {
		g_variant_builder_add_value (&_tmp16_, g_variant_new_string (*_tmp15_));
		_tmp15_++;
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp16_));
	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_contacts_search_provider_GetResultMetas (ContactsSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GVariantIter _arguments_iter;
	gchar** ids = NULL;
	int ids_length1 = 0;
	GVariant* _tmp18_;
	gchar** _tmp19_;
	int _tmp19__length;
	int _tmp19__size;
	int _tmp19__length1;
	GVariantIter _tmp20_;
	GVariant* _tmp21_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp18_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp19_ = g_new (gchar*, 5);
	_tmp19__length = 0;
	_tmp19__size = 4;
	_tmp19__length1 = 0;
	g_variant_iter_init (&_tmp20_, _tmp18_);
	for (; (_tmp21_ = g_variant_iter_next_value (&_tmp20_)) != NULL; _tmp19__length1++) {
		if (_tmp19__size == _tmp19__length) {
			_tmp19__size = 2 * _tmp19__size;
			_tmp19_ = g_renew (gchar*, _tmp19_, _tmp19__size + 1);
		}
		_tmp19_[_tmp19__length++] = g_variant_dup_string (_tmp21_, NULL);
		g_variant_unref (_tmp21_);
	}
	ids_length1 = _tmp19__length1;
	_tmp19_[_tmp19__length] = NULL;
	ids = _tmp19_;
	g_variant_unref (_tmp18_);
	contacts_search_provider_GetResultMetas (self, ids, ids_length1, (GAsyncReadyCallback) _dbus_contacts_search_provider_GetResultMetas_ready, invocation);
	ids = (_vala_array_free (ids, ids_length1, (GDestroyNotify) g_free), NULL);
}


static void _dbus_contacts_search_provider_GetResultMetas_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
	GDBusMethodInvocation * invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	GHashTable** result;
	int result_length1 = 0;
	GHashTable** _tmp22_;
	GVariantBuilder _tmp23_;
	int _tmp24_;
	invocation = _user_data_;
	result = contacts_search_provider_GetResultMetas_finish ((ContactsSearchProvider*) 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);
	_tmp22_ = result;
	g_variant_builder_init (&_tmp23_, G_VARIANT_TYPE ("aa{sv}"));
	for (_tmp24_ = 0; _tmp24_ < result_length1; _tmp24_++) {
		GVariantBuilder _tmp25_;
		GHashTableIter _tmp26_;
		gpointer _tmp27_;
		gpointer _tmp28_;
		g_hash_table_iter_init (&_tmp26_, *_tmp22_);
		g_variant_builder_init (&_tmp25_, G_VARIANT_TYPE ("a{sv}"));
		while (g_hash_table_iter_next (&_tmp26_, &_tmp27_, &_tmp28_)) {
			gchar* _key;
			GVariant* _value;
			_key = (gchar*) _tmp27_;
			_value = (GVariant*) _tmp28_;
			g_variant_builder_add (&_tmp25_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
		}
		g_variant_builder_add_value (&_tmp23_, g_variant_builder_end (&_tmp25_));
		_tmp22_++;
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp23_));
	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);
	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_contacts_search_provider_ActivateResult (ContactsSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gchar* search_id = NULL;
	GVariant* _tmp29_;
	gchar** terms = NULL;
	int terms_length1 = 0;
	GVariant* _tmp30_;
	gchar** _tmp31_;
	int _tmp31__length;
	int _tmp31__size;
	int _tmp31__length1;
	GVariantIter _tmp32_;
	GVariant* _tmp33_;
	guint32 timestamp = 0U;
	GVariant* _tmp34_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp29_ = g_variant_iter_next_value (&_arguments_iter);
	search_id = g_variant_dup_string (_tmp29_, NULL);
	g_variant_unref (_tmp29_);
	_tmp30_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp31_ = g_new (gchar*, 5);
	_tmp31__length = 0;
	_tmp31__size = 4;
	_tmp31__length1 = 0;
	g_variant_iter_init (&_tmp32_, _tmp30_);
	for (; (_tmp33_ = g_variant_iter_next_value (&_tmp32_)) != NULL; _tmp31__length1++) {
		if (_tmp31__size == _tmp31__length) {
			_tmp31__size = 2 * _tmp31__size;
			_tmp31_ = g_renew (gchar*, _tmp31_, _tmp31__size + 1);
		}
		_tmp31_[_tmp31__length++] = g_variant_dup_string (_tmp33_, NULL);
		g_variant_unref (_tmp33_);
	}
	terms_length1 = _tmp31__length1;
	_tmp31_[_tmp31__length] = NULL;
	terms = _tmp31_;
	g_variant_unref (_tmp30_);
	_tmp34_ = g_variant_iter_next_value (&_arguments_iter);
	timestamp = g_variant_get_uint32 (_tmp34_);
	g_variant_unref (_tmp34_);
	contacts_search_provider_ActivateResult (self, search_id, 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_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);
	_g_free0 (search_id);
	terms = (_vala_array_free (terms, terms_length1, (GDestroyNotify) g_free), NULL);
}


static void _dbus_contacts_search_provider_LaunchSearch (ContactsSearchProvider* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) {
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gchar** terms = NULL;
	int terms_length1 = 0;
	GVariant* _tmp35_;
	gchar** _tmp36_;
	int _tmp36__length;
	int _tmp36__size;
	int _tmp36__length1;
	GVariantIter _tmp37_;
	GVariant* _tmp38_;
	guint32 timestamp = 0U;
	GVariant* _tmp39_;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_tmp35_ = g_variant_iter_next_value (&_arguments_iter);
	_tmp36_ = g_new (gchar*, 5);
	_tmp36__length = 0;
	_tmp36__size = 4;
	_tmp36__length1 = 0;
	g_variant_iter_init (&_tmp37_, _tmp35_);
	for (; (_tmp38_ = g_variant_iter_next_value (&_tmp37_)) != NULL; _tmp36__length1++) {
		if (_tmp36__size == _tmp36__length) {
			_tmp36__size = 2 * _tmp36__size;
			_tmp36_ = g_renew (gchar*, _tmp36_, _tmp36__size + 1);
		}
		_tmp36_[_tmp36__length++] = g_variant_dup_string (_tmp38_, NULL);
		g_variant_unref (_tmp38_);
	}
	terms_length1 = _tmp36__length1;
	_tmp36_[_tmp36__length] = NULL;
	terms = _tmp36_;
	g_variant_unref (_tmp35_);
	_tmp39_ = g_variant_iter_next_value (&_arguments_iter);
	timestamp = g_variant_get_uint32 (_tmp39_);
	g_variant_unref (_tmp39_);
	contacts_search_provider_LaunchSearch (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);
	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);
	terms = (_vala_array_free (terms, terms_length1, (GDestroyNotify) g_free), NULL);
}


static void contacts_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_contacts_search_provider_GetInitialResultSet (object, parameters, invocation);
	} else if (strcmp (method_name, "GetSubsearchResultSet") == 0) {
		_dbus_contacts_search_provider_GetSubsearchResultSet (object, parameters, invocation);
	} else if (strcmp (method_name, "GetResultMetas") == 0) {
		_dbus_contacts_search_provider_GetResultMetas (object, parameters, invocation);
	} else if (strcmp (method_name, "ActivateResult") == 0) {
		_dbus_contacts_search_provider_ActivateResult (object, parameters, invocation);
	} else if (strcmp (method_name, "LaunchSearch") == 0) {
		_dbus_contacts_search_provider_LaunchSearch (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}


static GVariant* contacts_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 contacts_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 contacts_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 *) (&_contacts_search_provider_dbus_interface_info), &_contacts_search_provider_dbus_interface_vtable, data, _contacts_search_provider_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}


static void _contacts_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);
}


ContactsSearchProviderApp* contacts_search_provider_app_construct (GType object_type) {
	ContactsSearchProviderApp * self = NULL;
	self = (ContactsSearchProviderApp*) g_object_new (object_type, "application-id", "org.gnome.Contacts.SearchProvider", "flags", G_APPLICATION_IS_SERVICE, "inactivity-timeout", 10000, NULL);
	return self;
}


ContactsSearchProviderApp* contacts_search_provider_app_new (void) {
	return contacts_search_provider_app_construct (CONTACTS_TYPE_SEARCH_PROVIDER_APP);
}


static gboolean contacts_search_provider_app_real_dbus_register (GApplication* base, GDBusConnection* connection, const gchar* object_path, GError** error) {
	ContactsSearchProviderApp * self;
	gboolean result = FALSE;
	GError * _inner_error_ = NULL;
	self = (ContactsSearchProviderApp*) base;
	g_return_val_if_fail (connection != NULL, FALSE);
	g_return_val_if_fail (object_path != NULL, FALSE);
	{
		GDBusConnection* _tmp0_;
		const gchar* _tmp1_;
		ContactsSearchProvider* _tmp2_;
		ContactsSearchProvider* _tmp3_;
		_tmp0_ = connection;
		_tmp1_ = object_path;
		_tmp2_ = contacts_search_provider_new (self);
		_tmp3_ = _tmp2_;
		contacts_search_provider_register_object (_tmp3_, _tmp0_, _tmp1_, &_inner_error_);
		_g_object_unref0 (_tmp3_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			gboolean _tmp4_ = FALSE;
			if (_inner_error_->domain == G_IO_ERROR) {
				goto __catch5_g_io_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return _tmp4_;
		}
	}
	goto __finally5;
	__catch5_g_io_error:
	{
		GError* _error_ = NULL;
		FILE* _tmp5_;
		GError* _tmp6_;
		const gchar* _tmp7_;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		_tmp5_ = stderr;
		_tmp6_ = _error_;
		_tmp7_ = _tmp6_->message;
		fprintf (_tmp5_, "Could not register service: %s", _tmp7_);
		g_application_quit ((GApplication*) self);
		_g_error_free0 (_error_);
	}
	__finally5:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		gboolean _tmp8_ = FALSE;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return _tmp8_;
	}
	result = TRUE;
	return result;
}


static void contacts_search_provider_app_real_startup (GApplication* base) {
	ContactsSearchProviderApp * self;
	const gchar* _tmp0_;
	self = (ContactsSearchProviderApp*) base;
	_tmp0_ = g_getenv ("CONTACTS_SEARCH_PROVIDER_PERSIST");
	if (_tmp0_ != NULL) {
		g_application_hold ((GApplication*) self);
	}
	G_APPLICATION_CLASS (contacts_search_provider_app_parent_class)->startup (G_TYPE_CHECK_INSTANCE_CAST (self, g_application_get_type (), GApplication));
}


static void contacts_search_provider_app_class_init (ContactsSearchProviderAppClass * klass) {
	contacts_search_provider_app_parent_class = g_type_class_peek_parent (klass);
	((GApplicationClass *) klass)->dbus_register = (gboolean (*) (GApplication *, GDBusConnection*, const gchar*, GError**)) contacts_search_provider_app_real_dbus_register;
	((GApplicationClass *) klass)->startup = (void (*) (GApplication *)) contacts_search_provider_app_real_startup;
}


static void contacts_search_provider_app_instance_init (ContactsSearchProviderApp * self) {
}


GType contacts_search_provider_app_get_type (void) {
	static volatile gsize contacts_search_provider_app_type_id__volatile = 0;
	if (g_once_init_enter (&contacts_search_provider_app_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (ContactsSearchProviderAppClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) contacts_search_provider_app_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ContactsSearchProviderApp), 0, (GInstanceInitFunc) contacts_search_provider_app_instance_init, NULL };
		GType contacts_search_provider_app_type_id;
		contacts_search_provider_app_type_id = g_type_register_static (g_application_get_type (), "ContactsSearchProviderApp", &g_define_type_info, 0);
		g_once_init_leave (&contacts_search_provider_app_type_id__volatile, contacts_search_provider_app_type_id);
	}
	return contacts_search_provider_app_type_id__volatile;
}


gint _vala_main (void) {
	gint result = 0;
	ContactsSearchProviderApp* _tmp0_;
	ContactsSearchProviderApp* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	_tmp0_ = contacts_search_provider_app_new ();
	_tmp1_ = _tmp0_;
	_tmp2_ = g_application_run ((GApplication*) _tmp1_, 0, NULL);
	_tmp3_ = _tmp2_;
	_g_object_unref0 (_tmp1_);
	result = _tmp3_;
	return result;
}


int main (int argc, char ** argv) {
	return _vala_main ();
}


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;
}



