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

/*
 * Copyright (C) 2011 Alexander Larsson <alexl@redhat.com>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

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

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#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;
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_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _Block1Data Block1Data;
typedef struct _contacts_search_provider_GetInitialResultSetData contacts_search_provider_GetInitialResultSetData;
typedef struct _contacts_search_provider_GetSubsearchResultSetData contacts_search_provider_GetSubsearchResultSetData;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ContactsSearchProviderDoSearchData ContactsSearchProviderDoSearchData;
typedef struct _contacts_search_provider_GetResultMetasData contacts_search_provider_GetResultMetasData;
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
#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_GetInitialResultSetReadyData contacts_search_provider_GetInitialResultSetReadyData;
typedef struct _contacts_search_provider_GetSubsearchResultSetReadyData contacts_search_provider_GetSubsearchResultSetReadyData;
typedef struct _contacts_search_provider_GetResultMetasReadyData contacts_search_provider_GetResultMetasReadyData;
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;
	FolksIndividualAggregator* aggregator;
	FolksSimpleQuery* query;
	GVariant* serialized_fallback_icon;
};

struct _Block1Data {
	int _ref_count_;
	ContactsSearchProvider* self;
	gpointer _async_data_;
};

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;
	Block1Data* _data1_;
	FolksIndividualAggregator* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gulong id;
	FolksIndividualAggregator* _tmp3_;
	gulong _tmp4_;
	guint timeout;
	FolksIndividualAggregator* _tmp5_;
	gchar** results;
	gint _tmp6_;
	gchar** _tmp7_;
	gint results_length1;
	gint _results_size_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	gchar** _tmp9_;
	gint _tmp10_;
	gchar** _tmp11_;
	gint _tmp9__length1;
	gint __tmp9__size_;
	gchar** _tmp12_;
	gint _tmp12__length1;
	gchar** _tmp13_;
	gint _tmp13__length1;
	gchar** _tmp14_;
	gint _tmp14__length1;
	gchar** _tmp15_;
	gint _tmp16_;
	gchar** _tmp17_;
	gint _tmp15__length1;
	gint __tmp15__size_;
	gchar** _tmp18_;
	gint _tmp18__length1;
	gchar** _tmp19_;
	gint _tmp19__length1;
	GError* _inner_error0_;
};

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 _tmp1_;
	gchar** _tmp2_;
	gint _tmp0__length1;
	gint __tmp0__size_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gchar** _tmp4_;
	gint _tmp4__length1;
	GError* _inner_error0_;
};

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_;
	FolksSimpleQuery* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	FolksSearchView* search_view;
	FolksIndividualAggregator* _tmp4_;
	FolksSimpleQuery* _tmp5_;
	FolksSearchView* _tmp6_;
	GError* e;
	const gchar* _tmp7_;
	gchar** results;
	GeeSortedSet* _tmp8_;
	GeeSortedSet* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gchar** _tmp12_;
	gint results_length1;
	gint _results_size_;
	gint i;
	GeeIterator* _individual_it;
	GeeSortedSet* _tmp13_;
	GeeSortedSet* _tmp14_;
	GeeIterator* _tmp15_;
	GeeIterator* _tmp16_;
	FolksIndividual* individual;
	GeeIterator* _tmp17_;
	gpointer _tmp18_;
	gchar** _tmp19_;
	gint _tmp19__length1;
	FolksIndividual* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	gchar* _tmp23_;
	gint _tmp24_;
	ContactsSearchProviderApp* _tmp25_;
	gchar** _tmp26_;
	gint _tmp26__length1;
	GError* _inner_error0_;
};

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;
	GHashTable** _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gint _tmp2_;
	GHashTable** _tmp3_;
	gint _tmp0__length1;
	gint __tmp0__size_;
	GHashTable** _tmp4_;
	gint _tmp4__length1;
	GHashTable** _tmp5_;
	gint _tmp5__length1;
	GError* _inner_error0_;
};

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** id_collection;
	gint id_collection_length1;
	gint _id_collection_size_;
	gint id_it;
	const gchar* id;
	FolksIndividual* indiv;
	FolksIndividual* _tmp2_;
	FolksIndividualAggregator* _tmp3_;
	const gchar* _tmp4_;
	FolksIndividual* _tmp5_;
	FolksIndividual* _tmp6_;
	FolksIndividual* _tmp7_;
	GHashTable* meta;
	GHashFunc _tmp8_;
	GEqualFunc _tmp9_;
	GHashTable* _tmp10_;
	GHashTable* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	GVariant* _tmp14_;
	GHashTable* _tmp15_;
	gchar* _tmp16_;
	FolksIndividual* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	GVariant* _tmp20_;
	GVariant* _tmp21_;
	FolksIndividual* _tmp22_;
	GLoadableIcon* _tmp23_;
	GLoadableIcon* _tmp24_;
	FolksIndividual* _tmp25_;
	GLoadableIcon* _tmp26_;
	GLoadableIcon* _tmp27_;
	GVariant* _tmp28_;
	GVariant* _tmp29_;
	GVariant* _tmp30_;
	GHashTable* _tmp31_;
	gchar* _tmp32_;
	GVariant* _tmp33_;
	GString* description;
	GString* _tmp34_;
	FolksEmailFieldDetails* email;
	FolksIndividual* _tmp35_;
	GeeSet* _tmp36_;
	GeeSet* _tmp37_;
	gpointer _tmp38_;
	gboolean _tmp39_;
	gboolean _tmp40_;
	FolksEmailFieldDetails* _tmp41_;
	FolksEmailFieldDetails* _tmp42_;
	gconstpointer _tmp43_;
	gconstpointer _tmp44_;
	FolksEmailFieldDetails* _tmp45_;
	gconstpointer _tmp46_;
	gconstpointer _tmp47_;
	GString* _tmp48_;
	FolksEmailFieldDetails* _tmp49_;
	gconstpointer _tmp50_;
	gconstpointer _tmp51_;
	FolksPhoneFieldDetails* phone;
	FolksIndividual* _tmp52_;
	GeeSet* _tmp53_;
	GeeSet* _tmp54_;
	gpointer _tmp55_;
	gboolean _tmp56_;
	gboolean _tmp57_;
	FolksPhoneFieldDetails* _tmp58_;
	FolksPhoneFieldDetails* _tmp59_;
	gconstpointer _tmp60_;
	gconstpointer _tmp61_;
	FolksPhoneFieldDetails* _tmp62_;
	gconstpointer _tmp63_;
	gconstpointer _tmp64_;
	GString* _tmp65_;
	GString* _tmp66_;
	GString* _tmp67_;
	FolksPhoneFieldDetails* _tmp68_;
	gconstpointer _tmp69_;
	gconstpointer _tmp70_;
	GHashTable* _tmp71_;
	gchar* _tmp72_;
	GString* _tmp73_;
	const gchar* _tmp74_;
	GVariant* _tmp75_;
	GeeArrayList* _tmp76_;
	GHashTable* _tmp77_;
	ContactsSearchProviderApp* _tmp78_;
	GeeArrayList* _tmp79_;
	gint _tmp80_;
	gpointer* _tmp81_;
	GHashTable** _tmp82_;
	gint _tmp82__length1;
	GError* _inner_error0_;
};

struct _contacts_search_provider_GetInitialResultSetReadyData {
	GDBusMethodInvocation* _invocation_;
	gchar** terms;
	gint terms_length1;
};

struct _contacts_search_provider_GetSubsearchResultSetReadyData {
	GDBusMethodInvocation* _invocation_;
	gchar** previous_results;
	gint previous_results_length1;
	gchar** new_terms;
	gint new_terms_length1;
};

struct _contacts_search_provider_GetResultMetasReadyData {
	GDBusMethodInvocation* _invocation_;
	gchar** ids;
	gint ids_length1;
};

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

struct _ContactsSearchProviderAppClass {
	GApplicationClass parent_class;
};

static gint ContactsSearchProvider_private_offset;
static gpointer contacts_search_provider_parent_class = NULL;
static gpointer contacts_search_provider_app_parent_class = NULL;

VALA_EXTERN GType contacts_search_provider_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ContactsSearchProvider, g_object_unref)
VALA_EXTERN guint contacts_search_provider_register_object (void* object,
                                                GDBusConnection* connection,
                                                const gchar* path,
                                                GError** error);
VALA_EXTERN GType contacts_search_provider_app_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ContactsSearchProviderApp, g_object_unref)
VALA_EXTERN ContactsSearchProvider* contacts_search_provider_new (ContactsSearchProviderApp* app);
VALA_EXTERN ContactsSearchProvider* contacts_search_provider_construct (GType object_type,
                                                            ContactsSearchProviderApp* app);
static const gchar** _vala_array_dup1 (const gchar** self,
                                gssize length);
static void _vala_array_add1 (const gchar** * array,
                       gint* length,
                       gint* size,
                       const gchar* value);
static void contacts_search_provider_GetInitialResultSet_data_free (gpointer _data);
VALA_EXTERN void contacts_search_provider_GetInitialResultSet (ContactsSearchProvider* self,
                                                   gchar** terms,
                                                   gint terms_length1,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_);
VALA_EXTERN gchar** contacts_search_provider_GetInitialResultSet_finish (ContactsSearchProvider* self,
                                                             GAsyncResult* _res_,
                                                             gint* result_length1,
                                                             GError** error);
static gboolean contacts_search_provider_GetInitialResultSet_co (contacts_search_provider_GetInitialResultSetData* _data_);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void ___lambda4_ (Block1Data* _data1_);
static void ____lambda4__g_object_notify (GObject* _sender,
                                   GParamSpec* pspec,
                                   gpointer self);
static gboolean ___lambda5_ (Block1Data* _data1_);
static gboolean ____lambda5__gsource_func (gpointer self);
static void contacts_search_provider_do_search (ContactsSearchProvider* self,
                                         gchar** terms,
                                         gint terms_length1,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static gchar** contacts_search_provider_do_search_finish (ContactsSearchProvider* self,
                                                   GAsyncResult* _res_,
                                                   gint* result_length1,
                                                   GError** error);
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);
VALA_EXTERN void contacts_search_provider_GetSubsearchResultSet (ContactsSearchProvider* self,
                                                     gchar** previous_results,
                                                     gint previous_results_length1,
                                                     gchar** new_terms,
                                                     gint new_terms_length1,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_);
VALA_EXTERN gchar** contacts_search_provider_GetSubsearchResultSet_finish (ContactsSearchProvider* self,
                                                               GAsyncResult* _res_,
                                                               gint* result_length1,
                                                               GError** error);
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_do_search_data_free (gpointer _data);
static gboolean contacts_search_provider_do_search_co (ContactsSearchProviderDoSearchData* _data_);
static void contacts_search_provider_do_search_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void contacts_search_provider_GetResultMetas_data_free (gpointer _data);
VALA_EXTERN void contacts_search_provider_GetResultMetas (ContactsSearchProvider* self,
                                              gchar** ids,
                                              gint ids_length1,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
VALA_EXTERN GHashTable** contacts_search_provider_GetResultMetas_finish (ContactsSearchProvider* self,
                                                             GAsyncResult* _res_,
                                                             gint* result_length1,
                                                             GError** error);
static gboolean contacts_search_provider_GetResultMetas_co (contacts_search_provider_GetResultMetasData* _data_);
static void contacts_search_provider_get_metas (ContactsSearchProvider* self,
                                         gchar** ids,
                                         gint ids_length1,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static GHashTable** contacts_search_provider_get_metas_finish (ContactsSearchProvider* self,
                                                        GAsyncResult* _res_,
                                                        gint* result_length1,
                                                        GError** error);
static gchar** _vala_array_dup2 (gchar** self,
                          gssize length);
static void contacts_search_provider_GetResultMetas_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
static void contacts_search_provider_get_metas_data_free (gpointer _data);
static gboolean contacts_search_provider_get_metas_co (ContactsSearchProviderGetMetasData* _data_);
static void contacts_search_provider_get_metas_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void _g_free0_ (gpointer var);
static void _g_variant_unref0_ (gpointer var);
static GVariant* _variant_new1 (const gchar* value);
VALA_EXTERN void contacts_search_provider_ActivateResult (ContactsSearchProvider* self,
                                              const gchar* id,
                                              gchar** terms,
                                              gint terms_length1,
                                              guint32 timestamp,
                                              GError** error);
VALA_EXTERN void contacts_search_provider_LaunchSearch (ContactsSearchProvider* self,
                                            gchar** terms,
                                            gint terms_length1,
                                            guint32 timestamp,
                                            GError** error);
static void _vala_array_add2 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void contacts_search_provider_finalize (GObject * obj);
static GType contacts_search_provider_get_type_once (void);
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);
VALA_EXTERN ContactsSearchProviderApp* contacts_search_provider_app_new (void);
VALA_EXTERN 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);
static GType contacts_search_provider_app_get_type_once (void);
static gint _vala_main (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_GetInitialResultSet_terms = {-1, "terms", "as", NULL};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_GetInitialResultSet_result = {-1, "result", "as", NULL};
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), NULL};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_GetSubsearchResultSet_previous_results = {-1, "previous_results", "as", NULL};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_GetSubsearchResultSet_new_terms = {-1, "new_terms", "as", NULL};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_GetSubsearchResultSet_result = {-1, "result", "as", NULL};
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), NULL};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_GetResultMetas_ids = {-1, "ids", "as", NULL};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_GetResultMetas_result = {-1, "result", "aa{sv}", NULL};
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), NULL};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_ActivateResult_id = {-1, "id", "s", NULL};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_ActivateResult_terms = {-1, "terms", "as", NULL};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_ActivateResult_timestamp = {-1, "timestamp", "u", NULL};
static const GDBusArgInfo * const _contacts_search_provider_dbus_arg_info_ActivateResult_in[] = {&_contacts_search_provider_dbus_arg_info_ActivateResult_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), NULL};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_LaunchSearch_terms = {-1, "terms", "as", NULL};
static const GDBusArgInfo _contacts_search_provider_dbus_arg_info_LaunchSearch_timestamp = {-1, "timestamp", "u", NULL};
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), NULL};
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), NULL};
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 inline gpointer
contacts_search_provider_get_instance_private (ContactsSearchProvider* self)
{
	return G_STRUCT_MEMBER_P (self, ContactsSearchProvider_private_offset);
}

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

static const gchar**
_vala_array_dup1 (const gchar** self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (const gchar*));
	}
	return NULL;
}

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

ContactsSearchProvider*
contacts_search_provider_construct (GType object_type,
                                    ContactsSearchProviderApp* app)
{
	ContactsSearchProvider * self = NULL;
	FolksIndividualAggregator* _tmp0_;
	FolksIndividualAggregator* _tmp1_;
	ContactsSearchProviderApp* _tmp2_;
	gchar* _tmp3_;
	gchar** _tmp4_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	GThemedIcon* _tmp6_;
	GThemedIcon* _tmp7_;
	GVariant* _tmp8_;
	const gchar** matched_fields = NULL;
	const gchar** _tmp9_;
	gint _tmp9__length1;
	gint matched_fields_length1;
	gint _matched_fields_size_;
	const gchar** _tmp11_;
	gint _tmp11__length1;
	FolksSimpleQuery* _tmp12_;
	g_return_val_if_fail (app != NULL, NULL);
	self = (ContactsSearchProvider*) g_object_new (object_type, NULL);
	_tmp0_ = folks_individual_aggregator_dup ();
	_g_object_unref0 (self->priv->aggregator);
	self->priv->aggregator = _tmp0_;
	_tmp1_ = self->priv->aggregator;
	folks_individual_aggregator_prepare (_tmp1_, NULL, NULL);
	_tmp2_ = _g_object_ref0 (app);
	_g_object_unref0 (self->priv->app);
	self->priv->app = _tmp2_;
	_tmp3_ = g_strdup ("avatar-default-symbolic");
	_tmp4_ = g_new0 (gchar*, 1 + 1);
	_tmp4_[0] = _tmp3_;
	_tmp5_ = _tmp4_;
	_tmp5__length1 = 1;
	_tmp6_ = (GThemedIcon*) g_themed_icon_new_from_names (_tmp5_, 1);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_icon_serialize ((GIcon*) _tmp7_);
	_g_variant_unref0 (self->priv->serialized_fallback_icon);
	self->priv->serialized_fallback_icon = _tmp8_;
	_g_object_unref0 (_tmp7_);
	_tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL);
	_tmp9_ = _vala_array_dup1 (FOLKS_QUERY_MATCH_FIELDS_NAMES, G_N_ELEMENTS (FOLKS_QUERY_MATCH_FIELDS_NAMES));
	_tmp9__length1 = G_N_ELEMENTS (FOLKS_QUERY_MATCH_FIELDS_NAMES);
	matched_fields = _tmp9_;
	matched_fields_length1 = _tmp9__length1;
	_matched_fields_size_ = matched_fields_length1;
	{
		const gchar** field_collection = NULL;
		gint field_collection_length1 = 0;
		gint _field_collection_size_ = 0;
		gint field_it = 0;
		field_collection = FOLKS_QUERY_MATCH_FIELDS_ADDRESSES;
		field_collection_length1 = G_N_ELEMENTS (FOLKS_QUERY_MATCH_FIELDS_ADDRESSES);
		for (field_it = 0; field_it < field_collection_length1; field_it = field_it + 1) {
			const gchar* field = NULL;
			field = field_collection[field_it];
			{
				const gchar* _tmp10_;
				_tmp10_ = field;
				_vala_array_add1 (&matched_fields, &matched_fields_length1, &_matched_fields_size_, _tmp10_);
			}
		}
	}
	_tmp11_ = matched_fields;
	_tmp11__length1 = matched_fields_length1;
	_tmp12_ = folks_simple_query_new ("", _tmp11_, _tmp11__length1);
	_g_object_unref0 (self->priv->query);
	self->priv->query = _tmp12_;
	if (!contacts_ensure_eds_accounts (FALSE)) {
		ContactsSearchProviderApp* _tmp13_;
		_tmp13_ = self->priv->app;
		g_application_quit ((GApplication*) _tmp13_);
	}
	matched_fields = (g_free (matched_fields), NULL);
	return self;
}

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

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,
                                              gint terms_length1,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_)
{
	contacts_search_provider_GetInitialResultSetData* _data_;
	ContactsSearchProvider* _tmp0_;
	g_return_if_fail (self != NULL);
	_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_;
	_data_->terms = terms;
	_data_->terms_length1 = terms_length1;
	contacts_search_provider_GetInitialResultSet_co (_data_);
}

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

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		ContactsSearchProvider* self;
		self = _data1_->self;
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}

static void
___lambda4_ (Block1Data* _data1_)
{
	ContactsSearchProvider* self;
	self = _data1_->self;
	contacts_search_provider_GetInitialResultSet_co (_data1_->_async_data_);
}

static void
____lambda4__g_object_notify (GObject* _sender,
                              GParamSpec* pspec,
                              gpointer self)
{
	___lambda4_ (self);
}

static gboolean
___lambda5_ (Block1Data* _data1_)
{
	ContactsSearchProvider* self;
	gboolean result;
	self = _data1_->self;
	contacts_search_provider_GetInitialResultSet_co (_data1_->_async_data_);
	result = FALSE;
	return result;
}

static gboolean
____lambda5__gsource_func (gpointer self)
{
	gboolean result;
	result = ___lambda5_ (self);
	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;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data1_ = g_slice_new0 (Block1Data);
	_data_->_data1_->_ref_count_ = 1;
	_data_->_data1_->self = g_object_ref (_data_->self);
	_data_->_data1_->_async_data_ = _data_;
	_data_->_tmp0_ = _data_->self->priv->aggregator;
	_data_->_tmp1_ = folks_individual_aggregator_get_is_quiescent (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (!_data_->_tmp2_) {
		_data_->_tmp3_ = _data_->self->priv->aggregator;
		_data_->_tmp4_ = g_signal_connect_data ((GObject*) _data_->_tmp3_, "notify::is-quiescent", (GCallback) ____lambda4__g_object_notify, block1_data_ref (_data_->_data1_), (GClosureNotify) block1_data_unref, 0);
		_data_->id = _data_->_tmp4_;
		_data_->timeout = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 1500, ____lambda5__gsource_func, block1_data_ref (_data_->_data1_), block1_data_unref);
		_data_->_state_ = 1;
		return FALSE;
		_state_1:
		;
		g_source_remove (_data_->timeout);
		_data_->_tmp5_ = _data_->self->priv->aggregator;
		g_signal_handler_disconnect ((GObject*) _data_->_tmp5_, _data_->id);
		_data_->_tmp6_ = 0;
		_data_->_state_ = 2;
		contacts_search_provider_do_search (_data_->self, _data_->terms, (gint) _data_->terms_length1, contacts_search_provider_GetInitialResultSet_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp7_ = contacts_search_provider_do_search_finish (_data_->self, _data_->_res_, &_data_->_tmp6_, &_data_->_inner_error0_);
		_data_->results = _data_->_tmp7_;
		_data_->results_length1 = _data_->_tmp6_;
		_data_->_results_size_ = _data_->results_length1;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			block1_data_unref (_data_->_data1_);
			_data_->_data1_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp8_ = _data_->results;
		_data_->_tmp8__length1 = _data_->results_length1;
		if (_data_->_tmp8__length1 == 0) {
			_data_->_tmp10_ = 0;
			_data_->_state_ = 3;
			contacts_search_provider_GetInitialResultSet (_data_->self, _data_->terms, (gint) _data_->terms_length1, contacts_search_provider_GetInitialResultSet_ready, _data_);
			return FALSE;
			_state_3:
			_data_->_tmp11_ = contacts_search_provider_GetInitialResultSet_finish (_data_->self, _data_->_res_, &_data_->_tmp10_, &_data_->_inner_error0_);
			_data_->_tmp9_ = _data_->_tmp11_;
			_data_->_tmp9__length1 = _data_->_tmp10_;
			_data_->__tmp9__size_ = _data_->_tmp9__length1;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_data_->results = (_vala_array_free (_data_->results, _data_->results_length1, (GDestroyNotify) g_free), NULL);
				block1_data_unref (_data_->_data1_);
				_data_->_data1_ = NULL;
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp12_ = _data_->_tmp9_;
			_data_->_tmp12__length1 = _data_->_tmp9__length1;
			_data_->_tmp9_ = NULL;
			_data_->_tmp9__length1 = 0;
			_data_->_tmp13_ = _data_->_tmp12_;
			_data_->_tmp13__length1 = _data_->_tmp12__length1;
			_data_->result_length1 = _data_->_tmp13__length1;
			_data_->result = _data_->_tmp13_;
			_data_->_tmp9_ = (_vala_array_free (_data_->_tmp9_, _data_->_tmp9__length1, (GDestroyNotify) g_free), NULL);
			_data_->results = (_vala_array_free (_data_->results, _data_->results_length1, (GDestroyNotify) g_free), NULL);
			block1_data_unref (_data_->_data1_);
			_data_->_data1_ = NULL;
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_data_->_tmp14_ = _data_->results;
			_data_->_tmp14__length1 = _data_->results_length1;
			_data_->result_length1 = _data_->_tmp14__length1;
			_data_->result = _data_->_tmp14_;
			block1_data_unref (_data_->_data1_);
			_data_->_data1_ = NULL;
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->results = (_vala_array_free (_data_->results, _data_->results_length1, (GDestroyNotify) g_free), NULL);
	} else {
		_data_->_tmp16_ = 0;
		_data_->_state_ = 4;
		contacts_search_provider_do_search (_data_->self, _data_->terms, (gint) _data_->terms_length1, contacts_search_provider_GetInitialResultSet_ready, _data_);
		return FALSE;
		_state_4:
		_data_->_tmp17_ = contacts_search_provider_do_search_finish (_data_->self, _data_->_res_, &_data_->_tmp16_, &_data_->_inner_error0_);
		_data_->_tmp15_ = _data_->_tmp17_;
		_data_->_tmp15__length1 = _data_->_tmp16_;
		_data_->__tmp15__size_ = _data_->_tmp15__length1;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			block1_data_unref (_data_->_data1_);
			_data_->_data1_ = NULL;
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp18_ = _data_->_tmp15_;
		_data_->_tmp18__length1 = _data_->_tmp15__length1;
		_data_->_tmp15_ = NULL;
		_data_->_tmp15__length1 = 0;
		_data_->_tmp19_ = _data_->_tmp18_;
		_data_->_tmp19__length1 = _data_->_tmp18__length1;
		_data_->result_length1 = _data_->_tmp19__length1;
		_data_->result = _data_->_tmp19_;
		_data_->_tmp15_ = (_vala_array_free (_data_->_tmp15_, _data_->_tmp15__length1, (GDestroyNotify) g_free), NULL);
		block1_data_unref (_data_->_data1_);
		_data_->_data1_ = NULL;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				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,
                                                gint previous_results_length1,
                                                gchar** new_terms,
                                                gint new_terms_length1,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_)
{
	contacts_search_provider_GetSubsearchResultSetData* _data_;
	ContactsSearchProvider* _tmp0_;
	g_return_if_fail (self != NULL);
	_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_;
	_data_->previous_results = previous_results;
	_data_->previous_results_length1 = previous_results_length1;
	_data_->new_terms = new_terms;
	_data_->new_terms_length1 = new_terms_length1;
	contacts_search_provider_GetSubsearchResultSet_co (_data_);
}

gchar**
contacts_search_provider_GetSubsearchResultSet_finish (ContactsSearchProvider* self,
                                                       GAsyncResult* _res_,
                                                       gint* result_length1,
                                                       GError** error)
{
	gchar** result;
	contacts_search_provider_GetSubsearchResultSetData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return 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_->_tmp1_ = 0;
	_data_->_state_ = 1;
	contacts_search_provider_GetInitialResultSet (_data_->self, _data_->new_terms, (gint) _data_->new_terms_length1, contacts_search_provider_GetSubsearchResultSet_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp2_ = contacts_search_provider_GetInitialResultSet_finish (_data_->self, _data_->_res_, &_data_->_tmp1_, &_data_->_inner_error0_);
	_data_->_tmp0_ = _data_->_tmp2_;
	_data_->_tmp0__length1 = _data_->_tmp1_;
	_data_->__tmp0__size_ = _data_->_tmp0__length1;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = _data_->_tmp0_;
	_data_->_tmp3__length1 = _data_->_tmp0__length1;
	_data_->_tmp0_ = NULL;
	_data_->_tmp0__length1 = 0;
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp4__length1 = _data_->_tmp3__length1;
	_data_->result_length1 = _data_->_tmp4__length1;
	_data_->result = _data_->_tmp4_;
	_data_->_tmp0_ = (_vala_array_free (_data_->_tmp0_, _data_->_tmp0__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)) {
			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_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,
                                    gint terms_length1,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	ContactsSearchProviderDoSearchData* _data_;
	ContactsSearchProvider* _tmp0_;
	g_return_if_fail (self != NULL);
	_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_;
	_data_->terms = terms;
	_data_->terms_length1 = terms_length1;
	contacts_search_provider_do_search_co (_data_);
}

static gchar**
contacts_search_provider_do_search_finish (ContactsSearchProvider* self,
                                           GAsyncResult* _res_,
                                           gint* result_length1,
                                           GError** error)
{
	gchar** result;
	ContactsSearchProviderDoSearchData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return 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,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

static void
contacts_search_provider_do_search_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	ContactsSearchProviderDoSearchData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_search_provider_do_search_co (_data_);
}

static gboolean
contacts_search_provider_do_search_co (ContactsSearchProviderDoSearchData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->app;
	g_application_hold ((GApplication*) _data_->_tmp0_);
	_data_->_tmp1_ = _data_->self->priv->query;
	_data_->_tmp2_ = _vala_g_strjoinv (" ", _data_->terms, (gint) _data_->terms_length1);
	_data_->_tmp3_ = _data_->_tmp2_;
	folks_simple_query_set_query_string (_data_->_tmp1_, _data_->_tmp3_);
	_g_free0 (_data_->_tmp3_);
	_data_->_tmp4_ = _data_->self->priv->aggregator;
	_data_->_tmp5_ = _data_->self->priv->query;
	_data_->_tmp6_ = folks_search_view_new (_data_->_tmp4_, (FolksQuery*) _data_->_tmp5_);
	_data_->search_view = _data_->_tmp6_;
	{
		_data_->_state_ = 1;
		folks_search_view_prepare (_data_->search_view, contacts_search_provider_do_search_ready, _data_);
		return FALSE;
		_state_1:
		folks_search_view_prepare_finish (_data_->search_view, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = _data_->e->message;
		g_error ("contacts-shell-search-provider.vala:75: Couldn't load SearchView: %s", _data_->_tmp7_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->search_view);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp8_ = folks_search_view_get_individuals (_data_->search_view);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp9_);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = g_new0 (gchar*, _data_->_tmp11_ + 1);
	_data_->results = _data_->_tmp12_;
	_data_->results_length1 = _data_->_tmp11_;
	_data_->_results_size_ = _data_->results_length1;
	_data_->i = 0;
	{
		_data_->_tmp13_ = folks_search_view_get_individuals (_data_->search_view);
		_data_->_tmp14_ = _data_->_tmp13_;
		_data_->_tmp15_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp14_);
		_data_->_individual_it = _data_->_tmp15_;
		while (TRUE) {
			_data_->_tmp16_ = _data_->_individual_it;
			if (!gee_iterator_next (_data_->_tmp16_)) {
				break;
			}
			_data_->_tmp17_ = _data_->_individual_it;
			_data_->_tmp18_ = gee_iterator_get (_data_->_tmp17_);
			_data_->individual = (FolksIndividual*) _data_->_tmp18_;
			_data_->_tmp19_ = _data_->results;
			_data_->_tmp19__length1 = _data_->results_length1;
			_data_->_tmp20_ = _data_->individual;
			_data_->_tmp21_ = folks_individual_get_id (_data_->_tmp20_);
			_data_->_tmp22_ = _data_->_tmp21_;
			_data_->_tmp23_ = g_strdup (_data_->_tmp22_);
			_g_free0 (_data_->_tmp19_[_data_->i]);
			_data_->_tmp19_[_data_->i] = _data_->_tmp23_;
			_data_->_tmp24_ = _data_->i;
			_data_->i = _data_->_tmp24_ + 1;
			_g_object_unref0 (_data_->individual);
		}
		_g_object_unref0 (_data_->_individual_it);
	}
	_data_->_tmp25_ = _data_->self->priv->app;
	g_application_release ((GApplication*) _data_->_tmp25_);
	_data_->_tmp26_ = _data_->results;
	_data_->_tmp26__length1 = _data_->results_length1;
	_data_->result_length1 = _data_->_tmp26__length1;
	_data_->result = _data_->_tmp26_;
	_g_object_unref0 (_data_->search_view);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			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,
                                         gint ids_length1,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	contacts_search_provider_GetResultMetasData* _data_;
	ContactsSearchProvider* _tmp0_;
	g_return_if_fail (self != NULL);
	_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_;
	_data_->ids = ids;
	_data_->ids_length1 = ids_length1;
	contacts_search_provider_GetResultMetas_co (_data_);
}

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

static gchar**
_vala_array_dup2 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize 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;
	}
	return NULL;
}

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_->_tmp1_ = (_data_->ids != NULL) ? _vala_array_dup2 (_data_->ids, _data_->ids_length1) : _data_->ids;
	_data_->_tmp1__length1 = _data_->ids_length1;
	_data_->_tmp2_ = 0;
	_data_->_state_ = 1;
	contacts_search_provider_get_metas (_data_->self, _data_->_tmp1_, (gint) _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_->_inner_error0_);
	_data_->_tmp0_ = _data_->_tmp3_;
	_data_->_tmp0__length1 = _data_->_tmp2_;
	_data_->__tmp0__size_ = _data_->_tmp0__length1;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = _data_->_tmp0_;
	_data_->_tmp4__length1 = _data_->_tmp0__length1;
	_data_->_tmp0_ = NULL;
	_data_->_tmp0__length1 = 0;
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp5__length1 = _data_->_tmp4__length1;
	_data_->result_length1 = _data_->_tmp5__length1;
	_data_->result = _data_->_tmp5_;
	_data_->_tmp0_ = (_vala_array_free (_data_->_tmp0_, _data_->_tmp0__length1, (GDestroyNotify) g_hash_table_unref), NULL);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			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,
                                    gint ids_length1,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	ContactsSearchProviderGetMetasData* _data_;
	ContactsSearchProvider* _tmp0_;
	g_return_if_fail (self != NULL);
	_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_,
                                           gint* result_length1,
                                           GError** error)
{
	GHashTable** result;
	ContactsSearchProviderGetMetasData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}

static void
contacts_search_provider_get_metas_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	ContactsSearchProviderGetMetasData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	contacts_search_provider_get_metas_co (_data_);
}

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 GVariant*
_variant_new1 (const gchar* value)
{
	return g_variant_ref_sink (g_variant_new_string (value));
}

static gboolean
contacts_search_provider_get_metas_co (ContactsSearchProviderGetMetasData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		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_->id_collection_length1 = 0;
		_data_->_id_collection_size_ = 0;
		_data_->id_collection = _data_->ids;
		_data_->id_collection_length1 = _data_->ids_length1;
		for (_data_->id_it = 0; _data_->id_it < _data_->id_collection_length1; _data_->id_it = _data_->id_it + 1) {
			_data_->id = _data_->id_collection[_data_->id_it];
			{
				_data_->indiv = NULL;
				{
					_data_->_tmp3_ = _data_->self->priv->aggregator;
					_data_->_tmp4_ = _data_->id;
					_data_->_state_ = 1;
					folks_individual_aggregator_look_up_individual (_data_->_tmp3_, _data_->_tmp4_, contacts_search_provider_get_metas_ready, _data_);
					return FALSE;
					_state_1:
					_data_->_tmp5_ = folks_individual_aggregator_look_up_individual_finish (_data_->_tmp3_, _data_->_res_, &_data_->_inner_error0_);
					_data_->_tmp2_ = _data_->_tmp5_;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
					_data_->_tmp6_ = _data_->_tmp2_;
					_data_->_tmp2_ = NULL;
					_g_object_unref0 (_data_->indiv);
					_data_->indiv = _data_->_tmp6_;
					_g_object_unref0 (_data_->_tmp2_);
				}
				goto __finally0;
				__catch0_g_error:
				{
					g_clear_error (&_data_->_inner_error0_);
					_g_object_unref0 (_data_->indiv);
					continue;
				}
				__finally0:
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_object_unref0 (_data_->indiv);
					_g_object_unref0 (_data_->results);
					_data_->ids = (_vala_array_free (_data_->ids, _data_->ids_length1, (GDestroyNotify) g_free), NULL);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp7_ = _data_->indiv;
				if (_data_->_tmp7_ == NULL) {
					_g_object_unref0 (_data_->indiv);
					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_->indiv;
				_data_->_tmp18_ = folks_individual_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_->_tmp22_ = _data_->indiv;
				_data_->_tmp23_ = folks_avatar_details_get_avatar ((FolksAvatarDetails*) _data_->_tmp22_);
				_data_->_tmp24_ = _data_->_tmp23_;
				if (_data_->_tmp24_ != NULL) {
					_data_->_tmp25_ = _data_->indiv;
					_data_->_tmp26_ = folks_avatar_details_get_avatar ((FolksAvatarDetails*) _data_->_tmp25_);
					_data_->_tmp27_ = _data_->_tmp26_;
					_data_->_tmp28_ = g_icon_serialize ((GIcon*) _data_->_tmp27_);
					_g_variant_unref0 (_data_->_tmp21_);
					_data_->_tmp21_ = _data_->_tmp28_;
				} else {
					_data_->_tmp29_ = _data_->self->priv->serialized_fallback_icon;
					_data_->_tmp30_ = _g_variant_ref0 (_data_->_tmp29_);
					_g_variant_unref0 (_data_->_tmp21_);
					_data_->_tmp21_ = _data_->_tmp30_;
				}
				_data_->_tmp31_ = _data_->meta;
				_data_->_tmp32_ = g_strdup ("icon");
				_data_->_tmp33_ = _g_variant_ref0 (_data_->_tmp21_);
				g_hash_table_insert (_data_->_tmp31_, _data_->_tmp32_, _data_->_tmp33_);
				_data_->_tmp34_ = g_string_new ("");
				_data_->description = _data_->_tmp34_;
				_data_->_tmp35_ = _data_->indiv;
				_data_->_tmp36_ = folks_email_details_get_email_addresses ((FolksEmailDetails*) _data_->_tmp35_);
				_data_->_tmp37_ = _data_->_tmp36_;
				_data_->_tmp38_ = contacts_utils_get_first (FOLKS_TYPE_EMAIL_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, (GeeCollection*) _data_->_tmp37_);
				_data_->email = (FolksEmailFieldDetails*) _data_->_tmp38_;
				_data_->_tmp41_ = _data_->email;
				if (_data_->_tmp41_ != NULL) {
					_data_->_tmp42_ = _data_->email;
					_data_->_tmp43_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _data_->_tmp42_);
					_data_->_tmp44_ = _data_->_tmp43_;
					_data_->_tmp40_ = ((const gchar*) _data_->_tmp44_) != NULL;
				} else {
					_data_->_tmp40_ = FALSE;
				}
				if (_data_->_tmp40_) {
					_data_->_tmp45_ = _data_->email;
					_data_->_tmp46_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _data_->_tmp45_);
					_data_->_tmp47_ = _data_->_tmp46_;
					_data_->_tmp39_ = g_strcmp0 ((const gchar*) _data_->_tmp47_, "") != 0;
				} else {
					_data_->_tmp39_ = FALSE;
				}
				if (_data_->_tmp39_) {
					_data_->_tmp48_ = _data_->description;
					_data_->_tmp49_ = _data_->email;
					_data_->_tmp50_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _data_->_tmp49_);
					_data_->_tmp51_ = _data_->_tmp50_;
					g_string_append (_data_->_tmp48_, (const gchar*) _data_->_tmp51_);
				}
				_data_->_tmp52_ = _data_->indiv;
				_data_->_tmp53_ = folks_phone_details_get_phone_numbers ((FolksPhoneDetails*) _data_->_tmp52_);
				_data_->_tmp54_ = _data_->_tmp53_;
				_data_->_tmp55_ = contacts_utils_get_first (FOLKS_TYPE_PHONE_FIELD_DETAILS, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, (GeeCollection*) _data_->_tmp54_);
				_data_->phone = (FolksPhoneFieldDetails*) _data_->_tmp55_;
				_data_->_tmp58_ = _data_->phone;
				if (_data_->_tmp58_ != NULL) {
					_data_->_tmp59_ = _data_->phone;
					_data_->_tmp60_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _data_->_tmp59_);
					_data_->_tmp61_ = _data_->_tmp60_;
					_data_->_tmp57_ = ((const gchar*) _data_->_tmp61_) != NULL;
				} else {
					_data_->_tmp57_ = FALSE;
				}
				if (_data_->_tmp57_) {
					_data_->_tmp62_ = _data_->phone;
					_data_->_tmp63_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _data_->_tmp62_);
					_data_->_tmp64_ = _data_->_tmp63_;
					_data_->_tmp56_ = g_strcmp0 ((const gchar*) _data_->_tmp64_, "") != 0;
				} else {
					_data_->_tmp56_ = FALSE;
				}
				if (_data_->_tmp56_) {
					_data_->_tmp65_ = _data_->description;
					if (_data_->_tmp65_->len > ((gssize) 0)) {
						_data_->_tmp66_ = _data_->description;
						g_string_append (_data_->_tmp66_, " / ");
					}
					_data_->_tmp67_ = _data_->description;
					_data_->_tmp68_ = _data_->phone;
					_data_->_tmp69_ = folks_abstract_field_details_get_value ((FolksAbstractFieldDetails*) _data_->_tmp68_);
					_data_->_tmp70_ = _data_->_tmp69_;
					g_string_append (_data_->_tmp67_, (const gchar*) _data_->_tmp70_);
				}
				_data_->_tmp71_ = _data_->meta;
				_data_->_tmp72_ = g_strdup ("description");
				_data_->_tmp73_ = _data_->description;
				_data_->_tmp74_ = _data_->_tmp73_->str;
				_data_->_tmp75_ = _variant_new1 (_data_->_tmp74_);
				g_hash_table_insert (_data_->_tmp71_, _data_->_tmp72_, _data_->_tmp75_);
				_data_->_tmp76_ = _data_->results;
				_data_->_tmp77_ = _data_->meta;
				gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp76_, _data_->_tmp77_);
				_g_object_unref0 (_data_->phone);
				_g_object_unref0 (_data_->email);
				_g_string_free0 (_data_->description);
				_g_variant_unref0 (_data_->_tmp21_);
				_g_hash_table_unref0 (_data_->meta);
				_g_object_unref0 (_data_->indiv);
			}
		}
	}
	_data_->_tmp78_ = _data_->self->priv->app;
	g_application_release ((GApplication*) _data_->_tmp78_);
	_data_->_tmp79_ = _data_->results;
	_data_->_tmp80_ = 0;
	_data_->_tmp81_ = gee_collection_to_array ((GeeCollection*) _data_->_tmp79_, &_data_->_tmp80_);
	_data_->_tmp82_ = _data_->_tmp81_;
	_data_->_tmp82__length1 = _data_->_tmp80_;
	_data_->result_length1 = _data_->_tmp82__length1;
	_data_->result = _data_->_tmp82_;
	_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)) {
			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* id,
                                         gchar** terms,
                                         gint terms_length1,
                                         guint32 timestamp,
                                         GError** error)
{
	ContactsSearchProviderApp* _tmp0_;
	ContactsSearchProviderApp* _tmp6_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (id != NULL);
	_tmp0_ = self->priv->app;
	g_application_hold ((GApplication*) _tmp0_);
	{
		gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = g_strconcat ("gnome-contacts -i ", id, NULL);
		_tmp2_ = _tmp1_;
		g_spawn_command_line_async (_tmp2_, &_inner_error0_);
		_g_free0 (_tmp2_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_SPAWN_ERROR) {
				goto __catch0_g_spawn_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	goto __finally0;
	__catch0_g_spawn_error:
	{
		GError* e = NULL;
		FILE* _tmp3_;
		GError* _tmp4_;
		const gchar* _tmp5_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp3_ = stderr;
		_tmp4_ = e;
		_tmp5_ = _tmp4_->message;
		fprintf (_tmp3_, "Failed to launch contact with id '%s': %s\n.", id, _tmp5_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp6_ = self->priv->app;
	g_application_release ((GApplication*) _tmp6_);
}

static void
_vala_array_add2 (gchar** * array,
                  gint* length,
                  gint* 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,
                                       gint terms_length1,
                                       guint32 timestamp,
                                       GError** error)
{
	ContactsSearchProviderApp* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	ContactsSearchProviderApp* _tmp9_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->app;
	g_application_hold ((GApplication*) _tmp0_);
	_tmp1_ = _vala_g_strjoinv (", ", terms, (gint) terms_length1);
	_tmp2_ = _tmp1_;
	g_debug ("contacts-shell-search-provider.vala:147: LaunchSearch (%s)", _tmp2_);
	_g_free0 (_tmp2_);
	{
		gchar** args = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar** _tmp5_;
		gint args_length1;
		gint _args_size_;
		gchar* _tmp6_;
		gchar** _tmp7_;
		gint _tmp7__length1;
		_tmp3_ = g_strdup ("gnome-contacts");
		_tmp4_ = g_strdup ("--search");
		_tmp5_ = g_new0 (gchar*, 2 + 1);
		_tmp5_[0] = _tmp3_;
		_tmp5_[1] = _tmp4_;
		args = _tmp5_;
		args_length1 = 2;
		_args_size_ = args_length1;
		_tmp6_ = _vala_g_strjoinv (" ", terms, (gint) terms_length1);
		_vala_array_add2 (&args, &args_length1, &_args_size_, _tmp6_);
		_tmp7_ = args;
		_tmp7__length1 = args_length1;
		g_spawn_async (NULL, _tmp7_, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL);
			if (_inner_error0_->domain == G_SPAWN_ERROR) {
				goto __catch0_g_spawn_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		args = (_vala_array_free (args, args_length1, (GDestroyNotify) g_free), NULL);
	}
	goto __finally0;
	__catch0_g_spawn_error:
	{
		FILE* _tmp8_;
		g_clear_error (&_inner_error0_);
		_tmp8_ = stderr;
		fprintf (_tmp8_, "Failed to launch Contacts for search\n");
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp9_ = self->priv->app;
	g_application_release ((GApplication*) _tmp9_);
}

static void
contacts_search_provider_class_init (ContactsSearchProviderClass * klass,
                                     gpointer klass_data)
{
	contacts_search_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ContactsSearchProvider_private_offset);
	G_OBJECT_CLASS (klass)->finalize = contacts_search_provider_finalize;
}

static void
contacts_search_provider_instance_init (ContactsSearchProvider * self,
                                        gpointer klass)
{
	self->priv = contacts_search_provider_get_instance_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->aggregator);
	_g_object_unref0 (self->priv->query);
	_g_variant_unref0 (self->priv->serialized_fallback_icon);
	G_OBJECT_CLASS (contacts_search_provider_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
contacts_search_provider_get_type_once (void)
{
	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);
	ContactsSearchProvider_private_offset = g_type_add_instance_private (contacts_search_provider_type_id, sizeof (ContactsSearchProviderPrivate));
	return contacts_search_provider_type_id;
}

GType
contacts_search_provider_get_type (void)
{
	static volatile gsize contacts_search_provider_type_id__once = 0;
	if (g_once_init_enter (&contacts_search_provider_type_id__once)) {
		GType contacts_search_provider_type_id;
		contacts_search_provider_type_id = contacts_search_provider_get_type_once ();
		g_once_init_leave (&contacts_search_provider_type_id__once, contacts_search_provider_type_id);
	}
	return contacts_search_provider_type_id__once;
}

static void
_dbus_contacts_search_provider_GetInitialResultSet (ContactsSearchProvider* self,
                                                    GVariant* _parameters_,
                                                    GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	contacts_search_provider_GetInitialResultSetReadyData* _ready_data;
	GVariant* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length;
	gint _tmp1__size;
	gint _tmp1__length1;
	GVariantIter _tmp2_;
	GVariant* _tmp3_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (contacts_search_provider_GetInitialResultSetReadyData);
	_ready_data->_invocation_ = invocation;
	_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_);
	}
	_ready_data->terms_length1 = _tmp1__length1;
	_tmp1_[_tmp1__length] = NULL;
	_ready_data->terms = _tmp1_;
	g_variant_unref (_tmp0_);
	contacts_search_provider_GetInitialResultSet (self, _ready_data->terms, _ready_data->terms_length1, (GAsyncReadyCallback) _dbus_contacts_search_provider_GetInitialResultSet_ready, _ready_data);
	_error:
	;
}

static void
_dbus_contacts_search_provider_GetInitialResultSet_ready (GObject * source_object,
                                                          GAsyncResult * _res_,
                                                          gpointer _user_data_)
{
	contacts_search_provider_GetInitialResultSetReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gchar** result;
	gint result_length1 = 0;
	gchar** _tmp4_;
	GVariantBuilder _tmp5_;
	gint _tmp6_;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	result = contacts_search_provider_GetInitialResultSet_finish ((ContactsSearchProvider*) source_object, _res_, &result_length1, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_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);
	_error:
	_ready_data->terms = (_vala_array_free (_ready_data->terms, _ready_data->terms_length1, (GDestroyNotify) g_free), NULL);
	g_slice_free (contacts_search_provider_GetInitialResultSetReadyData, _ready_data);
}

static void
_dbus_contacts_search_provider_GetSubsearchResultSet (ContactsSearchProvider* self,
                                                      GVariant* _parameters_,
                                                      GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	contacts_search_provider_GetSubsearchResultSetReadyData* _ready_data;
	GVariant* _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length;
	gint _tmp8__size;
	gint _tmp8__length1;
	GVariantIter _tmp9_;
	GVariant* _tmp10_;
	GVariant* _tmp11_;
	gchar** _tmp12_;
	gint _tmp12__length;
	gint _tmp12__size;
	gint _tmp12__length1;
	GVariantIter _tmp13_;
	GVariant* _tmp14_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (contacts_search_provider_GetSubsearchResultSetReadyData);
	_ready_data->_invocation_ = invocation;
	_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_);
	}
	_ready_data->previous_results_length1 = _tmp8__length1;
	_tmp8_[_tmp8__length] = NULL;
	_ready_data->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_);
	}
	_ready_data->new_terms_length1 = _tmp12__length1;
	_tmp12_[_tmp12__length] = NULL;
	_ready_data->new_terms = _tmp12_;
	g_variant_unref (_tmp11_);
	contacts_search_provider_GetSubsearchResultSet (self, _ready_data->previous_results, _ready_data->previous_results_length1, _ready_data->new_terms, _ready_data->new_terms_length1, (GAsyncReadyCallback) _dbus_contacts_search_provider_GetSubsearchResultSet_ready, _ready_data);
	_error:
	;
}

static void
_dbus_contacts_search_provider_GetSubsearchResultSet_ready (GObject * source_object,
                                                            GAsyncResult * _res_,
                                                            gpointer _user_data_)
{
	contacts_search_provider_GetSubsearchResultSetReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	gchar** result;
	gint result_length1 = 0;
	gchar** _tmp15_;
	GVariantBuilder _tmp16_;
	gint _tmp17_;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	result = contacts_search_provider_GetSubsearchResultSet_finish ((ContactsSearchProvider*) source_object, _res_, &result_length1, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_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);
	_error:
	_ready_data->previous_results = (_vala_array_free (_ready_data->previous_results, _ready_data->previous_results_length1, (GDestroyNotify) g_free), NULL);
	_ready_data->new_terms = (_vala_array_free (_ready_data->new_terms, _ready_data->new_terms_length1, (GDestroyNotify) g_free), NULL);
	g_slice_free (contacts_search_provider_GetSubsearchResultSetReadyData, _ready_data);
}

static void
_dbus_contacts_search_provider_GetResultMetas (ContactsSearchProvider* self,
                                               GVariant* _parameters_,
                                               GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	contacts_search_provider_GetResultMetasReadyData* _ready_data;
	GVariant* _tmp18_;
	gchar** _tmp19_;
	gint _tmp19__length;
	gint _tmp19__size;
	gint _tmp19__length1;
	GVariantIter _tmp20_;
	GVariant* _tmp21_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (contacts_search_provider_GetResultMetasReadyData);
	_ready_data->_invocation_ = invocation;
	_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_);
	}
	_ready_data->ids_length1 = _tmp19__length1;
	_tmp19_[_tmp19__length] = NULL;
	_ready_data->ids = _tmp19_;
	g_variant_unref (_tmp18_);
	contacts_search_provider_GetResultMetas (self, _ready_data->ids, _ready_data->ids_length1, (GAsyncReadyCallback) _dbus_contacts_search_provider_GetResultMetas_ready, _ready_data);
	_error:
	;
}

static void
_dbus_contacts_search_provider_GetResultMetas_ready (GObject * source_object,
                                                     GAsyncResult * _res_,
                                                     gpointer _user_data_)
{
	contacts_search_provider_GetResultMetasReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	GHashTable** result;
	gint result_length1 = 0;
	GHashTable** _tmp22_;
	GVariantBuilder _tmp23_;
	gint _tmp24_;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	result = contacts_search_provider_GetResultMetas_finish ((ContactsSearchProvider*) source_object, _res_, &result_length1, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_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);
	_error:
	_ready_data->ids = (_vala_array_free (_ready_data->ids, _ready_data->ids_length1, (GDestroyNotify) g_free), NULL);
	g_slice_free (contacts_search_provider_GetResultMetasReadyData, _ready_data);
}

static void
_dbus_contacts_search_provider_ActivateResult (ContactsSearchProvider* self,
                                               GVariant* _parameters_,
                                               GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	gchar* id = NULL;
	GVariant* _tmp29_;
	gchar** terms = NULL;
	gint terms_length1 = 0;
	GVariant* _tmp30_;
	gchar** _tmp31_;
	gint _tmp31__length;
	gint _tmp31__size;
	gint _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);
	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, id, terms, terms_length1, timestamp, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_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);
	_error:
	_g_free0 (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;
	gint terms_length1 = 0;
	GVariant* _tmp35_;
	gchar** _tmp36_;
	gint _tmp36__length;
	gint _tmp36__size;
	gint _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, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_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);
	_error:
	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", APP_ID ".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;
	GError* _inner_error0_ = NULL;
	gboolean result;
	self = (ContactsSearchProviderApp*) base;
	g_return_val_if_fail (connection != NULL, FALSE);
	g_return_val_if_fail (object_path != NULL, FALSE);
	{
		ContactsSearchProvider* _tmp0_;
		ContactsSearchProvider* _tmp1_;
		_tmp0_ = contacts_search_provider_new (self);
		_tmp1_ = _tmp0_;
		contacts_search_provider_register_object (_tmp1_, connection, object_path, &_inner_error0_);
		_g_object_unref0 (_tmp1_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp2_ = FALSE;
			if (_inner_error0_->domain == G_IO_ERROR) {
				goto __catch0_g_io_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp2_;
		}
	}
	goto __finally0;
	__catch0_g_io_error:
	{
		GError* _error_ = NULL;
		FILE* _tmp3_;
		GError* _tmp4_;
		const gchar* _tmp5_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp3_ = stderr;
		_tmp4_ = _error_;
		_tmp5_ = _tmp4_->message;
		fprintf (_tmp3_, "Could not register service: %s", _tmp5_);
		g_application_quit ((GApplication*) self);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp6_ = FALSE;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp6_;
	}
	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,
                                         gpointer klass_data)
{
	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,
                                            gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
contacts_search_provider_app_get_type_once (void)
{
	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);
	return contacts_search_provider_app_type_id;
}

GType
contacts_search_provider_app_get_type (void)
{
	static volatile gsize contacts_search_provider_app_type_id__once = 0;
	if (g_once_init_enter (&contacts_search_provider_app_type_id__once)) {
		GType contacts_search_provider_app_type_id;
		contacts_search_provider_app_type_id = contacts_search_provider_app_get_type_once ();
		g_once_init_leave (&contacts_search_provider_app_type_id__once, contacts_search_provider_app_type_id);
	}
	return contacts_search_provider_app_type_id__once;
}

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

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

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize 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,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

