/* backend-store.c generated by valac 0.36.1.697-2b74, the Vala compiler
 * generated from backend-store.vala, do not modify */

/*
 * Copyright (C) 2008 Nokia Corporation.
 * Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
 * Copyright (C) 2010 Collabora Ltd.
 *
 * This library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *          Travis Reitter <travis.reitter@collabora.co.uk>
 *
 * This file was originally part of Rygel.
 */

#include <glib.h>
#include <glib-object.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <folks/small-set.h>
#include <gio/gio.h>
#include <gmodule.h>
#include <folks-internal.h>
#include <config.h>
#include <glib/gi18n-lib.h>


#define FOLKS_TYPE_BACKEND_STORE (folks_backend_store_get_type ())
#define FOLKS_BACKEND_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_TYPE_BACKEND_STORE, FolksBackendStore))
#define FOLKS_BACKEND_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_TYPE_BACKEND_STORE, FolksBackendStoreClass))
#define FOLKS_IS_BACKEND_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_TYPE_BACKEND_STORE))
#define FOLKS_IS_BACKEND_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_TYPE_BACKEND_STORE))
#define FOLKS_BACKEND_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_TYPE_BACKEND_STORE, FolksBackendStoreClass))

typedef struct _FolksBackendStore FolksBackendStore;
typedef struct _FolksBackendStoreClass FolksBackendStoreClass;
typedef struct _FolksBackendStorePrivate FolksBackendStorePrivate;

#define FOLKS_TYPE_BACKEND (folks_backend_get_type ())
#define FOLKS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_TYPE_BACKEND, FolksBackend))
#define FOLKS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_TYPE_BACKEND, FolksBackendClass))
#define FOLKS_IS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_TYPE_BACKEND))
#define FOLKS_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_TYPE_BACKEND))
#define FOLKS_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_TYPE_BACKEND, FolksBackendClass))

typedef struct _FolksBackend FolksBackend;
typedef struct _FolksBackendClass FolksBackendClass;

#define FOLKS_TYPE_DEBUG (folks_debug_get_type ())
#define FOLKS_DEBUG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_TYPE_DEBUG, FolksDebug))
#define FOLKS_DEBUG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_TYPE_DEBUG, FolksDebugClass))
#define FOLKS_IS_DEBUG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_TYPE_DEBUG))
#define FOLKS_IS_DEBUG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_TYPE_DEBUG))
#define FOLKS_DEBUG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_TYPE_DEBUG, FolksDebugClass))

typedef struct _FolksDebug FolksDebug;
typedef struct _FolksDebugClass FolksDebugClass;
enum  {
	FOLKS_BACKEND_STORE_DUMMY_PROPERTY,
	FOLKS_BACKEND_STORE_ENABLED_BACKENDS,
	FOLKS_BACKEND_STORE_IS_PREPARED,
	FOLKS_BACKEND_STORE_LAST_PROPERTY
};
static GParamSpec* folks_backend_store_properties[FOLKS_BACKEND_STORE_LAST_PROPERTY];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_key_file_unref0(var) ((var == NULL) ? NULL : (var = (g_key_file_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define FOLKS_TYPE_PERSONA_STORE (folks_persona_store_get_type ())
#define FOLKS_PERSONA_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_TYPE_PERSONA_STORE, FolksPersonaStore))
#define FOLKS_PERSONA_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_TYPE_PERSONA_STORE, FolksPersonaStoreClass))
#define FOLKS_IS_PERSONA_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_TYPE_PERSONA_STORE))
#define FOLKS_IS_PERSONA_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_TYPE_PERSONA_STORE))
#define FOLKS_PERSONA_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_TYPE_PERSONA_STORE, FolksPersonaStoreClass))

typedef struct _FolksPersonaStore FolksPersonaStore;
typedef struct _FolksPersonaStoreClass FolksPersonaStoreClass;

#define FOLKS_TYPE_PERSONA_STORE_TRUST (folks_persona_store_trust_get_type ())

#define FOLKS_TYPE_PERSONA (folks_persona_get_type ())
#define FOLKS_PERSONA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOLKS_TYPE_PERSONA, FolksPersona))
#define FOLKS_PERSONA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOLKS_TYPE_PERSONA, FolksPersonaClass))
#define FOLKS_IS_PERSONA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOLKS_TYPE_PERSONA))
#define FOLKS_IS_PERSONA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOLKS_TYPE_PERSONA))
#define FOLKS_PERSONA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOLKS_TYPE_PERSONA, FolksPersonaClass))

typedef struct _FolksPersona FolksPersona;
typedef struct _FolksPersonaClass FolksPersonaClass;
typedef struct _FolksBackendStorePrepareData FolksBackendStorePrepareData;
typedef struct _Block1Data Block1Data;
typedef struct _FolksBackendStoreLoadBackendsData FolksBackendStoreLoadBackendsData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _FolksBackendStoreBackendLoadIfNeededData FolksBackendStoreBackendLoadIfNeededData;
typedef struct _FolksBackendStoreBackendUnloadIfNeededData FolksBackendStoreBackendUnloadIfNeededData;
typedef struct _FolksBackendStoreEnableBackendData FolksBackendStoreEnableBackendData;
typedef struct _FolksBackendStoreDisableBackendData FolksBackendStoreDisableBackendData;
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
typedef struct _FolksBackendStoreGetModulesFromDirData FolksBackendStoreGetModulesFromDirData;
#define _g_module_close0(var) ((var == NULL) ? NULL : (var = (g_module_close (var), NULL)))
typedef struct _FolksBackendStoreGetFileInfoData FolksBackendStoreGetFileInfoData;
typedef struct _FolksBackendStoreLoadDisabledBackendNamesData FolksBackendStoreLoadDisabledBackendNamesData;
typedef struct _FolksBackendStoreSaveKeyFileData FolksBackendStoreSaveKeyFileData;
enum  {
	FOLKS_BACKEND_STORE_BACKEND_AVAILABLE_SIGNAL,
	FOLKS_BACKEND_STORE_LAST_SIGNAL
};
static guint folks_backend_store_signals[FOLKS_BACKEND_STORE_LAST_SIGNAL] = {0};
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _FolksBackendStore {
	GObject parent_instance;
	FolksBackendStorePrivate * priv;
};

struct _FolksBackendStoreClass {
	GObjectClass parent_class;
};

struct _FolksBackendStorePrivate {
	GeeHashMap* _backend_hash;
	FolksSmallSet* _backends_allowed;
	FolksSmallSet* _backends_disabled;
	GeeHashMap* _prepared_backends;
	GeeMap* _prepared_backends_ro;
	GFile* _config_file;
	GKeyFile* _backends_key_file;
	GeeHashMap* _modules;
	gboolean _is_prepared;
	FolksDebug* _debug;
};

typedef void (*FolksBackendStoreModuleFinalizeFunc) (FolksBackendStore* store);
typedef enum  {
	FOLKS_PERSONA_STORE_TRUST_NONE,
	FOLKS_PERSONA_STORE_TRUST_PARTIAL,
	FOLKS_PERSONA_STORE_TRUST_FULL
} FolksPersonaStoreTrust;

struct _FolksBackendStorePrepareData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	FolksBackendStore* self;
	gboolean _tmp0_;
};

struct _Block1Data {
	int _ref_count_;
	FolksBackendStore* self;
	gint backends_remaining;
	gpointer _async_data_;
};

struct _FolksBackendStoreLoadBackendsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	FolksBackendStore* self;
	Block1Data* _data1_;
	gboolean _tmp0_;
	GeeIterator* _backend_existing_it;
	GeeHashMap* _tmp1_;
	GeeCollection* _tmp2_;
	GeeCollection* _tmp3_;
	GeeCollection* _tmp4_;
	GeeIterator* _tmp5_;
	GeeIterator* _tmp6_;
	GeeIterator* _tmp7_;
	gboolean _tmp8_;
	FolksBackend* backend_existing;
	GeeIterator* _tmp9_;
	gpointer _tmp10_;
	FolksBackend* _tmp11_;
	gchar* _path;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* path;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	const gchar* _tmp19_;
	GeeHashMap* modules;
	GeeHashMap* _tmp20_;
	gchar** path_split;
	const gchar* _tmp21_;
	gchar** _tmp22_;
	gchar** _tmp23_;
	gint path_split_length1;
	gint _path_split_size_;
	gchar** _tmp24_;
	gint _tmp24__length1;
	gchar** subpath_collection;
	gint subpath_collection_length1;
	gint _subpath_collection_size_;
	gint subpath_it;
	const gchar* subpath;
	GFile* file;
	const gchar* _tmp25_;
	GFile* _tmp26_;
	gboolean is_file;
	gboolean is_dir;
	GFile* _tmp27_;
	gboolean _tmp28_;
	gboolean _tmp29_;
	gboolean _tmp30_;
	GeeHashMap* _tmp31_;
	const gchar* _tmp32_;
	GFile* _tmp33_;
	gboolean _tmp34_;
	GeeHashMap* cur_modules;
	GFile* _tmp35_;
	GeeHashMap* _tmp36_;
	GeeHashMap* _tmp37_;
	GeeIterator* _entry_it;
	GeeHashMap* _tmp38_;
	GeeSet* _tmp39_;
	GeeSet* _tmp40_;
	GeeSet* _tmp41_;
	GeeIterator* _tmp42_;
	GeeIterator* _tmp43_;
	GeeIterator* _tmp44_;
	gboolean _tmp45_;
	GeeMapEntry* entry;
	GeeIterator* _tmp46_;
	gpointer _tmp47_;
	GeeHashMap* _tmp48_;
	GeeMapEntry* _tmp49_;
	gconstpointer _tmp50_;
	const gchar* _tmp51_;
	GeeMapEntry* _tmp52_;
	gconstpointer _tmp53_;
	GFile* _tmp54_;
	const gchar* _tmp55_;
	GeeIterator* _module_it;
	GeeHashMap* _tmp56_;
	GeeCollection* _tmp57_;
	GeeCollection* _tmp58_;
	GeeCollection* _tmp59_;
	GeeIterator* _tmp60_;
	GeeIterator* _tmp61_;
	GeeIterator* _tmp62_;
	gboolean _tmp63_;
	GFile* module;
	GeeIterator* _tmp64_;
	gpointer _tmp65_;
	GFile* _tmp66_;
	GeeIterator* _backend_it;
	GeeHashMap* _tmp67_;
	GeeCollection* _tmp68_;
	GeeCollection* _tmp69_;
	GeeCollection* _tmp70_;
	GeeIterator* _tmp71_;
	GeeIterator* _tmp72_;
	GeeIterator* _tmp73_;
	gboolean _tmp74_;
	FolksBackend* backend;
	GeeIterator* _tmp75_;
	gpointer _tmp76_;
	gint _tmp77_;
	FolksBackend* _tmp78_;
	gint _tmp79_;
	gint _tmp80_;
};

struct _FolksBackendStoreBackendLoadIfNeededData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	FolksBackendStore* self;
	FolksBackend* backend;
	FolksBackend* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp3_;
	GeeHashMap* _tmp4_;
	FolksBackend* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gboolean _tmp8_;
	FolksBackend* _tmp9_;
	FolksBackend* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	GeeHashMap* _tmp13_;
	FolksBackend* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	FolksBackend* _tmp17_;
	FolksBackend* _tmp18_;
	GError* e;
	GError* _tmp19_;
	FolksBackend* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	GError* _tmp23_;
	const gchar* _tmp24_;
	FolksBackend* _tmp25_;
	const gchar* _tmp26_;
	const gchar* _tmp27_;
	GError* _tmp28_;
	const gchar* _tmp29_;
	GError * _inner_error_;
};

struct _FolksBackendStoreBackendUnloadIfNeededData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	FolksBackendStore* self;
	FolksBackend* backend;
	gboolean result;
	gboolean unloaded;
	FolksBackend* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gboolean _tmp3_;
	FolksBackend* backend_existing;
	GeeHashMap* _tmp4_;
	FolksBackend* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gpointer _tmp8_;
	FolksBackend* _tmp9_;
	FolksBackend* _tmp10_;
	GError* e;
	FolksBackend* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	GError* _tmp14_;
	const gchar* _tmp15_;
	GeeHashMap* _tmp16_;
	FolksBackend* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	GError * _inner_error_;
};

struct _FolksBackendStoreEnableBackendData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	FolksBackendStore* self;
	gchar* name;
	GKeyFile* _tmp0_;
	const gchar* _tmp1_;
};

struct _FolksBackendStoreDisableBackendData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	FolksBackendStore* self;
	gchar* name;
	GKeyFile* _tmp0_;
	const gchar* _tmp1_;
};

struct _FolksBackendStoreGetModulesFromDirData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	FolksBackendStore* self;
	GFile* dir;
	GeeHashMap* result;
	GFile* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* attributes;
	gchar* _tmp3_;
	GList* infos;
	GFileEnumerator* enumerator;
	GFile* _tmp4_;
	const gchar* _tmp5_;
	GFileEnumerator* _tmp6_;
	GList* _tmp7_;
	GFileEnumerator* _tmp8_;
	GList* _tmp9_;
	GList* _tmp10_;
	GError* _error_;
	GFile* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GError* _tmp14_;
	const gchar* _tmp15_;
	GeeHashMap* modules_final;
	GeeHashMap* _tmp16_;
	gchar* _path;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	GList* _tmp19_;
	GList* info_collection;
	GList* info_it;
	GFileInfo* _tmp20_;
	GFileInfo* info;
	GFile* file;
	GFile* _tmp21_;
	GFileInfo* _tmp22_;
	const gchar* _tmp23_;
	GFile* _tmp24_;
	GFileInfo* _tmp25_;
	gboolean _tmp26_;
	GFile* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	GFileInfo* _tmp30_;
	const gchar* _tmp31_;
	GFile* old_file;
	GFile* _tmp32_;
	GFile* _tmp33_;
	GFile* _tmp34_;
	GFileInfo* _tmp35_;
	const gchar* _tmp36_;
	GFile* _tmp37_;
	GFileInfo* _tmp38_;
	GFile* _tmp39_;
	const gchar* _tmp40_;
	GFileInfo* _tmp41_;
	GFileInfo* _tmp42_;
	GError* _vala1__error_;
	GFile* _tmp43_;
	gchar* _tmp44_;
	gchar* _tmp45_;
	GFile* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	GError* _tmp49_;
	const gchar* _tmp50_;
	GFileType file_type;
	GFileInfo* _tmp51_;
	GFileType _tmp52_;
	const gchar* content_type;
	GFileInfo* _tmp53_;
	const gchar* _tmp54_;
	gchar* mime;
	const gchar* _tmp55_;
	gchar* _tmp56_;
	GFileType _tmp57_;
	GeeHashMap* modules;
	GFile* _tmp58_;
	GeeHashMap* _tmp59_;
	GeeHashMap* _tmp60_;
	GeeIterator* _entry_it;
	GeeHashMap* _tmp61_;
	GeeSet* _tmp62_;
	GeeSet* _tmp63_;
	GeeSet* _tmp64_;
	GeeIterator* _tmp65_;
	GeeIterator* _tmp66_;
	GeeIterator* _tmp67_;
	gboolean _tmp68_;
	GeeMapEntry* entry;
	GeeIterator* _tmp69_;
	gpointer _tmp70_;
	GeeHashMap* _tmp71_;
	GeeMapEntry* _tmp72_;
	gconstpointer _tmp73_;
	const gchar* _tmp74_;
	GeeMapEntry* _tmp75_;
	gconstpointer _tmp76_;
	GFile* _tmp77_;
	const gchar* _tmp78_;
	gchar* path;
	GFile* _tmp79_;
	gchar* _tmp80_;
	const gchar* _tmp81_;
	GeeHashMap* _tmp82_;
	const gchar* _tmp83_;
	GFile* _tmp84_;
	const gchar* _tmp85_;
	GFile* _tmp86_;
	gchar* _tmp87_;
	gchar* _tmp88_;
	gboolean _tmp89_;
	gboolean _tmp90_;
	gboolean _tmp91_;
	const gchar* _tmp92_;
	const gchar* _tmp93_;
	const gchar* _tmp94_;
	const gchar* _tmp95_;
	GFile* _tmp96_;
	gchar* _tmp97_;
	gchar* _tmp98_;
	const gchar* _tmp99_;
	GFile* _tmp100_;
	gchar* _tmp101_;
	gchar* _tmp102_;
	GError * _inner_error_;
};

typedef void (*FolksBackendStoreModuleInitFunc) (FolksBackendStore* store);
struct _FolksBackendStoreGetFileInfoData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	GFile* file;
	gboolean is_file;
	gboolean is_dir;
	GFileInfo* file_info;
	GFileInfo* _tmp0_;
	GFile* _tmp1_;
	GFileInfo* _tmp2_;
	GFileInfo* _tmp3_;
	GError* _error_;
	GError* _tmp4_;
	GFile* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GFile* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GFileInfo* _tmp11_;
	GFileType _tmp12_;
	GFileInfo* _tmp13_;
	GFileType _tmp14_;
	GError * _inner_error_;
};

struct _FolksBackendStoreLoadDisabledBackendNamesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	FolksBackendStore* self;
	gchar* envvar;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar** tokens;
	const gchar* _tmp3_;
	gchar** _tmp4_;
	gchar** _tmp5_;
	gint tokens_length1;
	gint _tokens_size_;
	FolksSmallSet* _tmp6_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gchar** s_collection;
	gint s_collection_length1;
	gint _s_collection_size_;
	gint s_it;
	const gchar* s;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	FolksSmallSet* _tmp10_;
	const gchar* _tmp11_;
	FolksSmallSet* _tmp12_;
	gchar** _tmp13_;
	gint _tmp13__length1;
	gchar** _vala1_s_collection;
	gint _vala1_s_collection_length1;
	gint __vala1_s_collection_size_;
	gint _vala1_s_it;
	const gchar* _vala1_s;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar** _vala1_tokens;
	const gchar* _tmp18_;
	gchar** _tmp19_;
	gchar** _tmp20_;
	gint _vala1_tokens_length1;
	gint __vala1_tokens_size_;
	FolksSmallSet* _tmp21_;
	gchar** _tmp22_;
	gint _tmp22__length1;
	gchar** _vala2_s_collection;
	gint _vala2_s_collection_length1;
	gint __vala2_s_collection_size_;
	gint _vala2_s_it;
	const gchar* _vala2_s;
	const gchar* _tmp23_;
	const gchar* _tmp24_;
	FolksSmallSet* _tmp25_;
	const gchar* _tmp26_;
	GFile* file;
	const gchar* path;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	GFile* _tmp30_;
	GFile* _tmp31_;
	GFile* _tmp32_;
	GFile* _tmp33_;
	GFile* _tmp34_;
	GFile* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	const gchar* _tmp38_;
	GFile* _tmp39_;
	const gchar* _tmp40_;
	GFile* _tmp41_;
	GFile* _tmp42_;
	GKeyFile* key_file;
	GKeyFile* _tmp43_;
	guint8* contents;
	gint contents_length1;
	gint _contents_size_;
	GFile* _tmp44_;
	guint8* _tmp45_;
	gsize _tmp46_;
	const gchar* contents_s;
	guint8* _tmp47_;
	gint _tmp47__length1;
	const gchar* _tmp48_;
	gint _tmp49_;
	gint _tmp50_;
	GKeyFile* _tmp51_;
	const gchar* _tmp52_;
	const gchar* _tmp53_;
	gint _tmp54_;
	gint _tmp55_;
	GError* e1;
	GError* _tmp56_;
	GFile* _tmp57_;
	gchar* _tmp58_;
	gchar* _tmp59_;
	GError* _tmp60_;
	const gchar* _tmp61_;
	GKeyFile* _tmp62_;
	GKeyFile* _tmp63_;
	GError * _inner_error_;
};

struct _FolksBackendStoreSaveKeyFileData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	FolksBackendStore* self;
	gchar* key_file_data;
	GKeyFile* _tmp0_;
	gchar* _tmp1_;
	GFile* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GFile* _tmp5_;
	guint8* _tmp6_;
	gint _tmp6__length1;
	guint8* _tmp7_;
	gint _tmp7__length1;
	GError* e;
	GFile* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GError* _tmp11_;
	const gchar* _tmp12_;
	GError * _inner_error_;
};


static gpointer folks_backend_store_parent_class = NULL;
static FolksBackendStore* folks_backend_store__instance;
static FolksBackendStore* folks_backend_store__instance = NULL;
extern gchar* folks_backend_store_KEY_FILE_GROUP_ALL_OTHERS;
gchar* folks_backend_store_KEY_FILE_GROUP_ALL_OTHERS = NULL;

GType folks_backend_store_get_type (void) G_GNUC_CONST;
GType folks_backend_get_type (void) G_GNUC_CONST;
GType folks_debug_get_type (void) G_GNUC_CONST;
#define FOLKS_BACKEND_STORE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FOLKS_TYPE_BACKEND_STORE, FolksBackendStorePrivate))
void folks_backend_unprepare (FolksBackend* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void folks_backend_unprepare_finish (FolksBackend* self, GAsyncResult* _res_, GError** error);
static void _folks_backend_store_debug_print_status (FolksBackendStore* self, FolksDebug* debug);
static void __folks_backend_store_debug_print_status_folks_debug_print_status (FolksDebug* _sender, gpointer self);
FolksBackendStore* folks_backend_store_dup (void);
static FolksBackendStore* folks_backend_store_new (void);
static FolksBackendStore* folks_backend_store_construct (GType object_type);
#define FOLKS_DEBUG_STATUS_LOG_DOMAIN "folks-status"
void folks_debug_print_heading (FolksDebug* self, const gchar* domain, GLogLevelFlags level, const gchar* format, ...) G_GNUC_PRINTF(4,5);
void folks_debug_print_line (FolksDebug* self, const gchar* domain, GLogLevelFlags level, const gchar* format, ...) G_GNUC_PRINTF(4,5);
void folks_debug_indent (FolksDebug* self);
gboolean folks_backend_get_is_prepared (FolksBackend* self);
gboolean folks_backend_get_is_quiescent (FolksBackend* self);
void folks_debug_print_key_value_pairs (FolksDebug* self, const gchar* domain, GLogLevelFlags level, ...);
const gchar* folks_backend_get_name (FolksBackend* self);
GType folks_persona_store_get_type (void) G_GNUC_CONST;
GeeMap* folks_backend_get_persona_stores (FolksBackend* self);
GType folks_persona_store_trust_get_type (void) G_GNUC_CONST;
FolksPersonaStoreTrust folks_persona_store_get_trust_level (FolksPersonaStore* self);
gchar** folks_persona_store_get_always_writeable_properties (FolksPersonaStore* self, int* result_length1);
gboolean folks_persona_store_get_is_prepared (FolksPersonaStore* self);
gboolean folks_persona_store_get_is_primary_store (FolksPersonaStore* self);
gboolean folks_persona_store_get_is_quiescent (FolksPersonaStore* self);
const gchar* folks_persona_store_get_id (FolksPersonaStore* self);
GType folks_persona_get_type (void) G_GNUC_CONST;
GeeMap* folks_persona_store_get_personas (FolksPersonaStore* self);
void folks_debug_unindent (FolksDebug* self);
static void folks_backend_store_prepare_data_free (gpointer _data);
static void folks_backend_store_prepare_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
void folks_backend_store_prepare (FolksBackendStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void folks_backend_store_prepare_finish (FolksBackendStore* self, GAsyncResult* _res_);
static gboolean folks_backend_store_prepare_co (FolksBackendStorePrepareData* _data_);
static void _folks_backend_store_load_disabled_backend_names (FolksBackendStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _folks_backend_store_load_disabled_backend_names_finish (FolksBackendStore* self, GAsyncResult* _res_);
static void folks_backend_store_prepare_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void folks_backend_store_load_backends_data_free (gpointer _data);
static void folks_backend_store_load_backends_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
void folks_backend_store_load_backends (FolksBackendStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void folks_backend_store_load_backends_finish (FolksBackendStore* self, GAsyncResult* _res_, GError** error);
static gboolean folks_backend_store_load_backends_co (FolksBackendStoreLoadBackendsData* _data_);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void folks_backend_store_load_backends_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _folks_backend_store_backend_unload_if_needed (FolksBackendStore* self, FolksBackend* backend, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean _folks_backend_store_backend_unload_if_needed_finish (FolksBackendStore* self, GAsyncResult* _res_);
static void _folks_backend_store_get_file_info (GFile* file, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _folks_backend_store_get_file_info_finish (GAsyncResult* _res_, gboolean* is_file, gboolean* is_dir);
static void _folks_backend_store_get_modules_from_dir (FolksBackendStore* self, GFile* dir, GAsyncReadyCallback _callback_, gpointer _user_data_);
static GeeHashMap* _folks_backend_store_get_modules_from_dir_finish (FolksBackendStore* self, GAsyncResult* _res_);
static void _folks_backend_store_load_module_from_file (FolksBackendStore* self, GFile* file);
static void _folks_backend_store_backend_load_if_needed (FolksBackendStore* self, FolksBackend* backend, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _folks_backend_store_backend_load_if_needed_finish (FolksBackendStore* self, GAsyncResult* _res_);
static void ____lambda66_ (Block1Data* _data1_, GObject* o, GAsyncResult* r);
static void _____lambda66__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
static void _folks_backend_store_backend_load_if_needed_data_free (gpointer _data);
static void _folks_backend_store_backend_load_if_needed_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static gboolean _folks_backend_store_backend_load_if_needed_co (FolksBackendStoreBackendLoadIfNeededData* _data_);
static gboolean _folks_backend_store_backend_is_enabled (FolksBackendStore* self, const gchar* name);
void folks_backend_prepare (FolksBackend* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void folks_backend_prepare_finish (FolksBackend* self, GAsyncResult* _res_, GError** error);
static void _folks_backend_store_backend_load_if_needed_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _folks_backend_store_backend_unload_if_needed_data_free (gpointer _data);
static void _folks_backend_store_backend_unload_if_needed_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static gboolean _folks_backend_store_backend_unload_if_needed_co (FolksBackendStoreBackendUnloadIfNeededData* _data_);
static void _folks_backend_store_backend_unload_if_needed_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void folks_backend_store_add_backend (FolksBackendStore* self, FolksBackend* backend);
void _folks_debug_register_domain (FolksDebug* self, const gchar* domain);
FolksBackend* folks_backend_store_dup_backend_by_name (FolksBackendStore* self, const gchar* name);
GeeCollection* folks_backend_store_list_backends (FolksBackendStore* self);
static void folks_backend_store_enable_backend_data_free (gpointer _data);
static void folks_backend_store_enable_backend_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
void folks_backend_store_enable_backend (FolksBackendStore* self, const gchar* name, GAsyncReadyCallback _callback_, gpointer _user_data_);
void folks_backend_store_enable_backend_finish (FolksBackendStore* self, GAsyncResult* _res_);
static gboolean folks_backend_store_enable_backend_co (FolksBackendStoreEnableBackendData* _data_);
static void _folks_backend_store_save_key_file (FolksBackendStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void _folks_backend_store_save_key_file_finish (FolksBackendStore* self, GAsyncResult* _res_);
static void folks_backend_store_enable_backend_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void folks_backend_store_disable_backend_data_free (gpointer _data);
static void folks_backend_store_disable_backend_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
void folks_backend_store_disable_backend (FolksBackendStore* self, const gchar* name, GAsyncReadyCallback _callback_, gpointer _user_data_);
void folks_backend_store_disable_backend_finish (FolksBackendStore* self, GAsyncResult* _res_);
static gboolean folks_backend_store_disable_backend_co (FolksBackendStoreDisableBackendData* _data_);
static void folks_backend_store_disable_backend_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _folks_backend_store_get_modules_from_dir_data_free (gpointer _data);
static void _folks_backend_store_get_modules_from_dir_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static gboolean _folks_backend_store_get_modules_from_dir_co (FolksBackendStoreGetModulesFromDirData* _data_);
static void _folks_backend_store_get_modules_from_dir_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void _folks_backend_store_get_file_info_data_free (gpointer _data);
static void _folks_backend_store_get_file_info_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static gboolean _folks_backend_store_get_file_info_co (FolksBackendStoreGetFileInfoData* _data_);
static void _folks_backend_store_get_file_info_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _folks_backend_store_load_disabled_backend_names_data_free (gpointer _data);
static void _folks_backend_store_load_disabled_backend_names_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static gboolean _folks_backend_store_load_disabled_backend_names_co (FolksBackendStoreLoadDisabledBackendNamesData* _data_);
static void _folks_backend_store_load_disabled_backend_names_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _folks_backend_store_save_key_file_data_free (gpointer _data);
static void _folks_backend_store_save_key_file_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data);
static gboolean _folks_backend_store_save_key_file_co (FolksBackendStoreSaveKeyFileData* _data_);
static void _folks_backend_store_save_key_file_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
GeeMap* folks_backend_store_get_enabled_backends (FolksBackendStore* self);
static void folks_backend_store_set_enabled_backends (FolksBackendStore* self, GeeMap* value);
gboolean folks_backend_store_get_is_prepared (FolksBackendStore* self);
static void folks_backend_store_set_is_prepared (FolksBackendStore* self, gboolean value);
static GObject * folks_backend_store_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
FolksDebug* folks_debug_dup_with_flags (const gchar* debug_flags, gboolean colour_enabled);
static void folks_backend_store_finalize (GObject * obj);
static void _vala_folks_backend_store_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_folks_backend_store_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


static void __folks_backend_store_debug_print_status_folks_debug_print_status (FolksDebug* _sender, gpointer self) {
	_folks_backend_store_debug_print_status ((FolksBackendStore*) self, _sender);
}


/**
   * Create a new BackendStore.
   */
static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


FolksBackendStore* folks_backend_store_dup (void) {
	FolksBackendStore* result = NULL;
	FolksBackendStore* _tmp0_;
	FolksBackendStore* _tmp3_;
	FolksBackendStore* _tmp4_;
	_tmp0_ = folks_backend_store__instance;
	if (_tmp0_ == NULL) {
		FolksBackendStore* new_instance = NULL;
		FolksBackendStore* _tmp1_;
		FolksBackendStore* _tmp2_;
		_tmp1_ = folks_backend_store_new ();
		new_instance = _tmp1_;
		_tmp2_ = new_instance;
		folks_backend_store__instance = _tmp2_;
		result = new_instance;
		return result;
	}
	_tmp3_ = folks_backend_store__instance;
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, FOLKS_TYPE_BACKEND_STORE, FolksBackendStore));
	result = _tmp4_;
	return result;
}


static FolksBackendStore* folks_backend_store_construct (GType object_type) {
	FolksBackendStore * self = NULL;
	self = (FolksBackendStore*) g_object_new (object_type, NULL);
	return self;
}


static FolksBackendStore* folks_backend_store_new (void) {
	return folks_backend_store_construct (FOLKS_TYPE_BACKEND_STORE);
}


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


static void _folks_backend_store_debug_print_status (FolksBackendStore* self, FolksDebug* debug) {
	static const char domain[] = FOLKS_DEBUG_STATUS_LOG_DOMAIN;
	static const GLogLevelFlags level = G_LOG_LEVEL_INFO;
	FolksDebug* _tmp0_;
	FolksDebug* _tmp1_;
	GeeHashMap* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	FolksDebug* _tmp5_;
	FolksDebug* _tmp93_;
	FolksDebug* _tmp94_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (debug != NULL);
	_tmp0_ = debug;
	folks_debug_print_heading (_tmp0_, domain, level, "BackendStore (%p)", self);
	_tmp1_ = debug;
	_tmp2_ = self->priv->_backend_hash;
	_tmp3_ = gee_abstract_map_get_size ((GeeAbstractMap*) _tmp2_);
	_tmp4_ = _tmp3_;
	folks_debug_print_line (_tmp1_, domain, level, "%u Backends:", (guint) _tmp4_);
	_tmp5_ = debug;
	folks_debug_indent (_tmp5_);
	{
		GeeIterator* _backend_it = NULL;
		GeeHashMap* _tmp6_;
		GeeCollection* _tmp7_;
		GeeCollection* _tmp8_;
		GeeCollection* _tmp9_;
		GeeIterator* _tmp10_;
		GeeIterator* _tmp11_;
		_tmp6_ = self->priv->_backend_hash;
		_tmp7_ = gee_abstract_map_get_values ((GeeAbstractMap*) _tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = _tmp8_;
		_tmp10_ = gee_iterable_iterator ((GeeIterable*) _tmp9_);
		_tmp11_ = _tmp10_;
		_g_object_unref0 (_tmp9_);
		_backend_it = _tmp11_;
		while (TRUE) {
			GeeIterator* _tmp12_;
			gboolean _tmp13_;
			FolksBackend* backend = NULL;
			GeeIterator* _tmp14_;
			gpointer _tmp15_;
			FolksDebug* _tmp16_;
			FolksBackend* _tmp17_;
			const gchar* _tmp18_ = NULL;
			FolksBackend* _tmp19_;
			gboolean _tmp20_;
			gboolean _tmp21_;
			const gchar* _tmp22_ = NULL;
			FolksBackend* _tmp23_;
			gboolean _tmp24_;
			gboolean _tmp25_;
			FolksDebug* _tmp26_;
			guint _tmp27_;
			gchar* _tmp28_;
			gchar* _tmp29_;
			FolksBackend* _tmp30_;
			const gchar* _tmp31_;
			const gchar* _tmp32_;
			FolksDebug* _tmp33_;
			FolksBackend* _tmp34_;
			GeeMap* _tmp35_;
			GeeMap* _tmp36_;
			gint _tmp37_;
			gint _tmp38_;
			FolksDebug* _tmp39_;
			FolksDebug* _tmp92_;
			_tmp12_ = _backend_it;
			_tmp13_ = gee_iterator_next (_tmp12_);
			if (!_tmp13_) {
				break;
			}
			_tmp14_ = _backend_it;
			_tmp15_ = gee_iterator_get (_tmp14_);
			backend = (FolksBackend*) _tmp15_;
			_tmp16_ = debug;
			_tmp17_ = backend;
			folks_debug_print_heading (_tmp16_, domain, level, "Backend (%p)", _tmp17_);
			_tmp19_ = backend;
			_tmp20_ = folks_backend_get_is_prepared (_tmp19_);
			_tmp21_ = _tmp20_;
			if (_tmp21_) {
				_tmp18_ = "yes";
			} else {
				_tmp18_ = "no";
			}
			_tmp23_ = backend;
			_tmp24_ = folks_backend_get_is_quiescent (_tmp23_);
			_tmp25_ = _tmp24_;
			if (_tmp25_) {
				_tmp22_ = "yes";
			} else {
				_tmp22_ = "no";
			}
			_tmp26_ = debug;
			_tmp27_ = ((GObject*) self)->ref_count;
			_tmp28_ = g_strdup_printf ("%u", _tmp27_);
			_tmp29_ = _tmp28_;
			_tmp30_ = backend;
			_tmp31_ = folks_backend_get_name (_tmp30_);
			_tmp32_ = _tmp31_;
			folks_debug_print_key_value_pairs (_tmp26_, domain, level, "Ref. count", _tmp29_, "Name", _tmp32_, "Prepared?", _tmp18_, "Quiescent?", _tmp22_, NULL);
			_g_free0 (_tmp29_);
			_tmp33_ = debug;
			_tmp34_ = backend;
			_tmp35_ = folks_backend_get_persona_stores (_tmp34_);
			_tmp36_ = _tmp35_;
			_tmp37_ = gee_map_get_size (_tmp36_);
			_tmp38_ = _tmp37_;
			folks_debug_print_line (_tmp33_, domain, level, "%u PersonaStores:", (guint) _tmp38_);
			_tmp39_ = debug;
			folks_debug_indent (_tmp39_);
			{
				GeeIterator* _persona_store_it = NULL;
				FolksBackend* _tmp40_;
				GeeMap* _tmp41_;
				GeeMap* _tmp42_;
				GeeCollection* _tmp43_;
				GeeCollection* _tmp44_;
				GeeCollection* _tmp45_;
				GeeIterator* _tmp46_;
				GeeIterator* _tmp47_;
				_tmp40_ = backend;
				_tmp41_ = folks_backend_get_persona_stores (_tmp40_);
				_tmp42_ = _tmp41_;
				_tmp43_ = gee_map_get_values (_tmp42_);
				_tmp44_ = _tmp43_;
				_tmp45_ = _tmp44_;
				_tmp46_ = gee_iterable_iterator ((GeeIterable*) _tmp45_);
				_tmp47_ = _tmp46_;
				_g_object_unref0 (_tmp45_);
				_persona_store_it = _tmp47_;
				while (TRUE) {
					GeeIterator* _tmp48_;
					gboolean _tmp49_;
					FolksPersonaStore* persona_store = NULL;
					GeeIterator* _tmp50_;
					gpointer _tmp51_;
					gchar* trust_level = NULL;
					FolksPersonaStore* _tmp52_;
					FolksPersonaStoreTrust _tmp53_;
					FolksPersonaStoreTrust _tmp54_;
					gchar* writeable_props = NULL;
					FolksPersonaStore* _tmp58_;
					gchar** _tmp59_;
					gint _tmp59__length1;
					gchar** _tmp60_;
					gint _tmp60__length1;
					gchar* _tmp61_;
					FolksDebug* _tmp62_;
					FolksPersonaStore* _tmp63_;
					const gchar* _tmp64_ = NULL;
					FolksPersonaStore* _tmp65_;
					gboolean _tmp66_;
					gboolean _tmp67_;
					const gchar* _tmp68_ = NULL;
					FolksPersonaStore* _tmp69_;
					gboolean _tmp70_;
					gboolean _tmp71_;
					const gchar* _tmp72_ = NULL;
					FolksPersonaStore* _tmp73_;
					gboolean _tmp74_;
					gboolean _tmp75_;
					FolksDebug* _tmp76_;
					guint _tmp77_;
					gchar* _tmp78_;
					gchar* _tmp79_;
					FolksPersonaStore* _tmp80_;
					const gchar* _tmp81_;
					const gchar* _tmp82_;
					const gchar* _tmp83_;
					const gchar* _tmp84_;
					FolksPersonaStore* _tmp85_;
					GeeMap* _tmp86_;
					GeeMap* _tmp87_;
					gint _tmp88_;
					gint _tmp89_;
					gchar* _tmp90_;
					gchar* _tmp91_;
					_tmp48_ = _persona_store_it;
					_tmp49_ = gee_iterator_next (_tmp48_);
					if (!_tmp49_) {
						break;
					}
					_tmp50_ = _persona_store_it;
					_tmp51_ = gee_iterator_get (_tmp50_);
					persona_store = (FolksPersonaStore*) _tmp51_;
					trust_level = NULL;
					_tmp52_ = persona_store;
					_tmp53_ = folks_persona_store_get_trust_level (_tmp52_);
					_tmp54_ = _tmp53_;
					switch (_tmp54_) {
						case FOLKS_PERSONA_STORE_TRUST_NONE:
						{
							gchar* _tmp55_;
							_tmp55_ = g_strdup ("none");
							_g_free0 (trust_level);
							trust_level = _tmp55_;
							break;
						}
						case FOLKS_PERSONA_STORE_TRUST_PARTIAL:
						{
							gchar* _tmp56_;
							_tmp56_ = g_strdup ("partial");
							_g_free0 (trust_level);
							trust_level = _tmp56_;
							break;
						}
						case FOLKS_PERSONA_STORE_TRUST_FULL:
						{
							gchar* _tmp57_;
							_tmp57_ = g_strdup ("full");
							_g_free0 (trust_level);
							trust_level = _tmp57_;
							break;
						}
						default:
						{
							g_assert_not_reached ();
						}
					}
					_tmp58_ = persona_store;
					_tmp59_ = folks_persona_store_get_always_writeable_properties (_tmp58_, &_tmp59__length1);
					_tmp60_ = _tmp59_;
					_tmp60__length1 = _tmp59__length1;
					_tmp61_ = _vala_g_strjoinv (",", _tmp60_, _tmp60__length1);
					writeable_props = _tmp61_;
					_tmp62_ = debug;
					_tmp63_ = persona_store;
					folks_debug_print_heading (_tmp62_, domain, level, "PersonaStore (%p)", _tmp63_);
					_tmp65_ = persona_store;
					_tmp66_ = folks_persona_store_get_is_prepared (_tmp65_);
					_tmp67_ = _tmp66_;
					if (_tmp67_) {
						_tmp64_ = "yes";
					} else {
						_tmp64_ = "no";
					}
					_tmp69_ = persona_store;
					_tmp70_ = folks_persona_store_get_is_primary_store (_tmp69_);
					_tmp71_ = _tmp70_;
					if (_tmp71_) {
						_tmp68_ = "yes";
					} else {
						_tmp68_ = "no";
					}
					_tmp73_ = persona_store;
					_tmp74_ = folks_persona_store_get_is_quiescent (_tmp73_);
					_tmp75_ = _tmp74_;
					if (_tmp75_) {
						_tmp72_ = "yes";
					} else {
						_tmp72_ = "no";
					}
					_tmp76_ = debug;
					_tmp77_ = ((GObject*) self)->ref_count;
					_tmp78_ = g_strdup_printf ("%u", _tmp77_);
					_tmp79_ = _tmp78_;
					_tmp80_ = persona_store;
					_tmp81_ = folks_persona_store_get_id (_tmp80_);
					_tmp82_ = _tmp81_;
					_tmp83_ = writeable_props;
					_tmp84_ = trust_level;
					_tmp85_ = persona_store;
					_tmp86_ = folks_persona_store_get_personas (_tmp85_);
					_tmp87_ = _tmp86_;
					_tmp88_ = gee_map_get_size (_tmp87_);
					_tmp89_ = _tmp88_;
					_tmp90_ = g_strdup_printf ("%i", _tmp89_);
					_tmp91_ = _tmp90_;
					folks_debug_print_key_value_pairs (_tmp76_, domain, level, "Ref. count", _tmp79_, "ID", _tmp82_, "Prepared?", _tmp64_, "Is primary store?", _tmp68_, "Always writeable properties", _tmp83_, "Quiescent?", _tmp72_, "Trust level", _tmp84_, "Persona count", _tmp91_, NULL);
					_g_free0 (_tmp91_);
					_g_free0 (_tmp79_);
					_g_free0 (writeable_props);
					_g_free0 (trust_level);
					_g_object_unref0 (persona_store);
				}
				_g_object_unref0 (_persona_store_it);
			}
			_tmp92_ = debug;
			folks_debug_unindent (_tmp92_);
			_g_object_unref0 (backend);
		}
		_g_object_unref0 (_backend_it);
	}
	_tmp93_ = debug;
	folks_debug_unindent (_tmp93_);
	_tmp94_ = debug;
	folks_debug_print_line (_tmp94_, domain, level, "");
}


static void folks_backend_store_prepare_data_free (gpointer _data) {
	FolksBackendStorePrepareData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendStorePrepareData, _data_);
}


static void folks_backend_store_prepare_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	FolksBackendStorePrepareData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


void folks_backend_store_prepare (FolksBackendStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendStorePrepareData* _data_;
	FolksBackendStore* _tmp0_;
	_data_ = g_slice_new0 (FolksBackendStorePrepareData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, folks_backend_store_prepare_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, folks_backend_store_prepare_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	folks_backend_store_prepare_co (_data_);
}


void folks_backend_store_prepare_finish (FolksBackendStore* self, GAsyncResult* _res_) {
	FolksBackendStorePrepareData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


/**
   * Prepare the BackendStore for use.
   *
   * This must only ever be called before {@link BackendStore.load_backends} is
   * called for the first time. If it isn't called explicitly,
   * {@link BackendStore.load_backends} will call it.
   *
   * This method is safe to call multiple times concurrently (e.g. an
   * asynchronous call may begin between a subsequent asynchronous call
   * beginning and finishing).
   *
   * @since 0.3.0
   */
static void folks_backend_store_prepare_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendStorePrepareData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	folks_backend_store_prepare_co (_data_);
}


static gboolean folks_backend_store_prepare_co (FolksBackendStorePrepareData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	folks_internal_profiling_start ("preparing BackendStore", NULL);
	_data_->_state_ = 1;
	_folks_backend_store_load_disabled_backend_names (_data_->self, folks_backend_store_prepare_ready, _data_);
	return FALSE;
	_state_1:
	_folks_backend_store_load_disabled_backend_names_finish (_data_->self, _data_->_res_);
	_data_->_tmp0_ = _data_->self->priv->_is_prepared;
	if (_data_->_tmp0_ == FALSE) {
		_data_->self->priv->_is_prepared = TRUE;
		g_object_notify ((GObject*) _data_->self, "is-prepared");
	}
	folks_internal_profiling_end ("preparing BackendStore", NULL);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void folks_backend_store_load_backends_data_free (gpointer _data) {
	FolksBackendStoreLoadBackendsData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendStoreLoadBackendsData, _data_);
}


static void folks_backend_store_load_backends_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	FolksBackendStoreLoadBackendsData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


void folks_backend_store_load_backends (FolksBackendStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendStoreLoadBackendsData* _data_;
	FolksBackendStore* _tmp0_;
	_data_ = g_slice_new0 (FolksBackendStoreLoadBackendsData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, folks_backend_store_load_backends_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, folks_backend_store_load_backends_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	folks_backend_store_load_backends_co (_data_);
}


void folks_backend_store_load_backends_finish (FolksBackendStore* self, GAsyncResult* _res_, GError** error) {
	FolksBackendStoreLoadBackendsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}


/**
   * Find, load, and prepare all backends which are not disabled.
   *
   * Backends will be searched for in the path given by the
   * ``FOLKS_BACKEND_PATH`` environment variable, if it's set. If it's not set,
   * backends will be searched for in a path set at compilation time.
   *
   * This method is not safe to call multiple times concurrently.
   *
   * @throws GLib.Error currently unused
   */
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_)) {
		FolksBackendStore* self;
		self = _data1_->self;
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}


static void folks_backend_store_load_backends_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendStoreLoadBackendsData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	folks_backend_store_load_backends_co (_data_);
}


static void ____lambda66_ (Block1Data* _data1_, GObject* o, GAsyncResult* r) {
	FolksBackendStore* self;
	GAsyncResult* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	self = _data1_->self;
	g_return_if_fail (r != NULL);
	_tmp0_ = r;
	_folks_backend_store_backend_load_if_needed_finish (self, _tmp0_);
	_tmp1_ = _data1_->backends_remaining;
	_data1_->backends_remaining = _tmp1_ - 1;
	_tmp2_ = _data1_->backends_remaining;
	if (_tmp2_ == 0) {
		folks_backend_store_load_backends_co (_data1_->_async_data_);
	}
}


static void _____lambda66__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	____lambda66_ (self, source_object, res);
	block1_data_unref (self);
}


static gboolean folks_backend_store_load_backends_co (FolksBackendStoreLoadBackendsData* _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;
		case 5:
		goto _state_5;
		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_ = g_module_supported ();
	_vala_assert (_data_->_tmp0_, "Module.supported()");
	folks_internal_profiling_start ("loading backends in BackendStore", NULL);
	_data_->_state_ = 1;
	folks_backend_store_prepare (_data_->self, folks_backend_store_load_backends_ready, _data_);
	return FALSE;
	_state_1:
	folks_backend_store_prepare_finish (_data_->self, _data_->_res_);
	{
		_data_->_tmp1_ = _data_->self->priv->_backend_hash;
		_data_->_tmp2_ = gee_abstract_map_get_values ((GeeAbstractMap*) _data_->_tmp1_);
		_data_->_tmp3_ = _data_->_tmp2_;
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp5_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp4_);
		_data_->_tmp6_ = _data_->_tmp5_;
		_g_object_unref0 (_data_->_tmp4_);
		_data_->_backend_existing_it = _data_->_tmp6_;
		while (TRUE) {
			_data_->_tmp7_ = _data_->_backend_existing_it;
			_data_->_tmp8_ = gee_iterator_next (_data_->_tmp7_);
			if (!_data_->_tmp8_) {
				break;
			}
			_data_->_tmp9_ = _data_->_backend_existing_it;
			_data_->_tmp10_ = gee_iterator_get (_data_->_tmp9_);
			_data_->backend_existing = (FolksBackend*) _data_->_tmp10_;
			_data_->_tmp11_ = _data_->backend_existing;
			_data_->_state_ = 2;
			_folks_backend_store_backend_unload_if_needed (_data_->self, _data_->_tmp11_, folks_backend_store_load_backends_ready, _data_);
			return FALSE;
			_state_2:
			_folks_backend_store_backend_unload_if_needed_finish (_data_->self, _data_->_res_);
			_g_object_unref0 (_data_->backend_existing);
		}
		_g_object_unref0 (_data_->_backend_existing_it);
	}
	folks_internal_profiling_point ("unloaded backends in BackendStore");
	_data_->_tmp12_ = g_getenv ("FOLKS_BACKEND_PATH");
	_data_->_tmp13_ = g_strdup (_data_->_tmp12_);
	_data_->_path = _data_->_tmp13_;
	_data_->_tmp14_ = _data_->_path;
	if (_data_->_tmp14_ == NULL) {
		_data_->_tmp15_ = g_strdup (BACKEND_DIR);
		_g_free0 (_data_->path);
		_data_->path = _data_->_tmp15_;
		_data_->_tmp16_ = _data_->path;
		g_debug ("Using built-in backend dir '%s' (override with " "environment variable FOLKS_BACKEND_PATH)", _data_->_tmp16_);
	} else {
		_data_->_tmp17_ = _data_->_path;
		_data_->_tmp18_ = g_strdup ((const gchar*) _data_->_tmp17_);
		_g_free0 (_data_->path);
		_data_->path = _data_->_tmp18_;
		_data_->_tmp19_ = _data_->path;
		g_debug ("Using environment variable FOLKS_BACKEND_PATH = " "'%s' to look for backends", _data_->_tmp19_);
	}
	_data_->_tmp20_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, g_file_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->modules = _data_->_tmp20_;
	_data_->_tmp21_ = _data_->path;
	_data_->_tmp23_ = _data_->_tmp22_ = g_strsplit (_data_->_tmp21_, ":", 0);
	_data_->path_split = _data_->_tmp23_;
	_data_->path_split_length1 = _vala_array_length (_data_->_tmp22_);
	_data_->_path_split_size_ = _data_->path_split_length1;
	_data_->_tmp24_ = _data_->path_split;
	_data_->_tmp24__length1 = _data_->path_split_length1;
	{
		_data_->subpath_collection_length1 = 0;
		_data_->_subpath_collection_size_ = 0;
		_data_->subpath_collection = _data_->_tmp24_;
		_data_->subpath_collection_length1 = _data_->_tmp24__length1;
		for (_data_->subpath_it = 0; _data_->subpath_it < _data_->_tmp24__length1; _data_->subpath_it = _data_->subpath_it + 1) {
			_data_->subpath = _data_->subpath_collection[_data_->subpath_it];
			{
				_data_->_tmp25_ = _data_->subpath;
				_data_->_tmp26_ = g_file_new_for_path (_data_->_tmp25_);
				_data_->file = _data_->_tmp26_;
				_data_->_tmp27_ = _data_->file;
				_data_->_tmp28_ = FALSE;
				_data_->_tmp29_ = FALSE;
				_data_->_state_ = 3;
				_folks_backend_store_get_file_info (_data_->_tmp27_, folks_backend_store_load_backends_ready, _data_);
				return FALSE;
				_state_3:
				_folks_backend_store_get_file_info_finish (_data_->_res_, &_data_->_tmp28_, &_data_->_tmp29_);
				_data_->is_file = _data_->_tmp28_;
				_data_->is_dir = _data_->_tmp29_;
				_data_->_tmp30_ = _data_->is_file;
				if (_data_->_tmp30_) {
					_data_->_tmp31_ = _data_->modules;
					_data_->_tmp32_ = _data_->subpath;
					_data_->_tmp33_ = _data_->file;
					gee_abstract_map_set ((GeeAbstractMap*) _data_->_tmp31_, _data_->_tmp32_, _data_->_tmp33_);
				} else {
					_data_->_tmp34_ = _data_->is_dir;
					if (_data_->_tmp34_) {
						_data_->_tmp35_ = _data_->file;
						_data_->_state_ = 4;
						_folks_backend_store_get_modules_from_dir (_data_->self, _data_->_tmp35_, folks_backend_store_load_backends_ready, _data_);
						return FALSE;
						_state_4:
						_data_->_tmp36_ = _folks_backend_store_get_modules_from_dir_finish (_data_->self, _data_->_res_);
						_data_->cur_modules = _data_->_tmp36_;
						_data_->_tmp37_ = _data_->cur_modules;
						if (_data_->_tmp37_ != NULL) {
							{
								_data_->_tmp38_ = _data_->cur_modules;
								_data_->_tmp39_ = gee_abstract_map_get_entries ((GeeAbstractMap*) G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp38_, GEE_TYPE_HASH_MAP, GeeHashMap));
								_data_->_tmp40_ = _data_->_tmp39_;
								_data_->_tmp41_ = _data_->_tmp40_;
								_data_->_tmp42_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp41_);
								_data_->_tmp43_ = _data_->_tmp42_;
								_g_object_unref0 (_data_->_tmp41_);
								_data_->_entry_it = _data_->_tmp43_;
								while (TRUE) {
									_data_->_tmp44_ = _data_->_entry_it;
									_data_->_tmp45_ = gee_iterator_next (_data_->_tmp44_);
									if (!_data_->_tmp45_) {
										break;
									}
									_data_->_tmp46_ = _data_->_entry_it;
									_data_->_tmp47_ = gee_iterator_get (_data_->_tmp46_);
									_data_->entry = (GeeMapEntry*) _data_->_tmp47_;
									_data_->_tmp48_ = _data_->modules;
									_data_->_tmp49_ = _data_->entry;
									_data_->_tmp50_ = gee_map_entry_get_key (_data_->_tmp49_);
									_data_->_tmp51_ = _data_->_tmp50_;
									_data_->_tmp52_ = _data_->entry;
									_data_->_tmp53_ = gee_map_entry_get_value (_data_->_tmp52_);
									_data_->_tmp54_ = _data_->_tmp53_;
									gee_abstract_map_set ((GeeAbstractMap*) _data_->_tmp48_, (const gchar*) _data_->_tmp51_, (GFile*) _data_->_tmp54_);
									_g_object_unref0 (_data_->entry);
								}
								_g_object_unref0 (_data_->_entry_it);
							}
						}
						_g_object_unref0 (_data_->cur_modules);
					} else {
						_data_->_tmp55_ = _data_->subpath;
						g_critical ("FOLKS_BACKEND_PATH component '%s' is not a regular " "file or directory; ignoring...", _data_->_tmp55_);
						g_assert_not_reached ();
					}
				}
				_g_object_unref0 (_data_->file);
			}
		}
	}
	folks_internal_profiling_point ("found modules in BackendStore");
	{
		_data_->_tmp56_ = _data_->modules;
		_data_->_tmp57_ = gee_abstract_map_get_values ((GeeAbstractMap*) _data_->_tmp56_);
		_data_->_tmp58_ = _data_->_tmp57_;
		_data_->_tmp59_ = _data_->_tmp58_;
		_data_->_tmp60_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp59_);
		_data_->_tmp61_ = _data_->_tmp60_;
		_g_object_unref0 (_data_->_tmp59_);
		_data_->_module_it = _data_->_tmp61_;
		while (TRUE) {
			_data_->_tmp62_ = _data_->_module_it;
			_data_->_tmp63_ = gee_iterator_next (_data_->_tmp62_);
			if (!_data_->_tmp63_) {
				break;
			}
			_data_->_tmp64_ = _data_->_module_it;
			_data_->_tmp65_ = gee_iterator_get (_data_->_tmp64_);
			_data_->module = (GFile*) _data_->_tmp65_;
			_data_->_tmp66_ = _data_->module;
			_folks_backend_store_load_module_from_file (_data_->self, _data_->_tmp66_);
			_g_object_unref0 (_data_->module);
		}
		_g_object_unref0 (_data_->_module_it);
	}
	folks_internal_profiling_point ("loaded modules in BackendStore");
	_data_->_data1_->backends_remaining = 1;
	{
		_data_->_tmp67_ = _data_->self->priv->_backend_hash;
		_data_->_tmp68_ = gee_abstract_map_get_values ((GeeAbstractMap*) _data_->_tmp67_);
		_data_->_tmp69_ = _data_->_tmp68_;
		_data_->_tmp70_ = _data_->_tmp69_;
		_data_->_tmp71_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp70_);
		_data_->_tmp72_ = _data_->_tmp71_;
		_g_object_unref0 (_data_->_tmp70_);
		_data_->_backend_it = _data_->_tmp72_;
		while (TRUE) {
			_data_->_tmp73_ = _data_->_backend_it;
			_data_->_tmp74_ = gee_iterator_next (_data_->_tmp73_);
			if (!_data_->_tmp74_) {
				break;
			}
			_data_->_tmp75_ = _data_->_backend_it;
			_data_->_tmp76_ = gee_iterator_get (_data_->_tmp75_);
			_data_->backend = (FolksBackend*) _data_->_tmp76_;
			_data_->_tmp77_ = _data_->_data1_->backends_remaining;
			_data_->_data1_->backends_remaining = _data_->_tmp77_ + 1;
			_data_->_tmp78_ = _data_->backend;
			_folks_backend_store_backend_load_if_needed (_data_->self, _data_->_tmp78_, _____lambda66__gasync_ready_callback, block1_data_ref (_data_->_data1_));
			_g_object_unref0 (_data_->backend);
		}
		_g_object_unref0 (_data_->_backend_it);
	}
	_data_->_tmp79_ = _data_->_data1_->backends_remaining;
	_data_->_data1_->backends_remaining = _data_->_tmp79_ - 1;
	_data_->_tmp80_ = _data_->_data1_->backends_remaining;
	if (_data_->_tmp80_ > 0) {
		_data_->_state_ = 5;
		return FALSE;
		_state_5:
		;
	}
	folks_internal_profiling_end ("loading backends in BackendStore", NULL);
	_data_->path_split = (_vala_array_free (_data_->path_split, _data_->path_split_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_data_->modules);
	_g_free0 (_data_->path);
	_g_free0 (_data_->_path);
	block1_data_unref (_data_->_data1_);
	_data_->_data1_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void _folks_backend_store_backend_load_if_needed_data_free (gpointer _data) {
	FolksBackendStoreBackendLoadIfNeededData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->backend);
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendStoreBackendLoadIfNeededData, _data_);
}


static void _folks_backend_store_backend_load_if_needed_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	FolksBackendStoreBackendLoadIfNeededData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


static void _folks_backend_store_backend_load_if_needed (FolksBackendStore* self, FolksBackend* backend, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendStoreBackendLoadIfNeededData* _data_;
	FolksBackendStore* _tmp0_;
	FolksBackend* _tmp1_;
	FolksBackend* _tmp2_;
	_data_ = g_slice_new0 (FolksBackendStoreBackendLoadIfNeededData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _folks_backend_store_backend_load_if_needed_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, _folks_backend_store_backend_load_if_needed_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = backend;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->backend);
	_data_->backend = _tmp2_;
	_folks_backend_store_backend_load_if_needed_co (_data_);
}


static void _folks_backend_store_backend_load_if_needed_finish (FolksBackendStore* self, GAsyncResult* _res_) {
	FolksBackendStoreBackendLoadIfNeededData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


static void _folks_backend_store_backend_load_if_needed_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendStoreBackendLoadIfNeededData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	_folks_backend_store_backend_load_if_needed_co (_data_);
}


static gboolean _folks_backend_store_backend_load_if_needed_co (FolksBackendStoreBackendLoadIfNeededData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->backend;
	_data_->_tmp1_ = folks_backend_get_name (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = _folks_backend_store_backend_is_enabled (_data_->self, _data_->_tmp2_);
	if (_data_->_tmp3_) {
		_data_->_tmp4_ = _data_->self->priv->_prepared_backends;
		_data_->_tmp5_ = _data_->backend;
		_data_->_tmp6_ = folks_backend_get_name (_data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp8_ = gee_abstract_map_has_key ((GeeAbstractMap*) _data_->_tmp4_, _data_->_tmp7_);
		if (!_data_->_tmp8_) {
			{
				_data_->_tmp9_ = _data_->backend;
				_data_->_state_ = 1;
				folks_backend_prepare (_data_->_tmp9_, _folks_backend_store_backend_load_if_needed_ready, _data_);
				return FALSE;
				_state_1:
				folks_backend_prepare_finish (_data_->_tmp9_, _data_->_res_, &_data_->_inner_error_);
				if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
					goto __catch0_g_error;
				}
				_data_->_tmp10_ = _data_->backend;
				_data_->_tmp11_ = folks_backend_get_name (_data_->_tmp10_);
				_data_->_tmp12_ = _data_->_tmp11_;
				g_debug ("backend-store.vala:417: New backend '%s' prepared", _data_->_tmp12_);
				_data_->_tmp13_ = _data_->self->priv->_prepared_backends;
				_data_->_tmp14_ = _data_->backend;
				_data_->_tmp15_ = folks_backend_get_name (_data_->_tmp14_);
				_data_->_tmp16_ = _data_->_tmp15_;
				_data_->_tmp17_ = _data_->backend;
				gee_abstract_map_set ((GeeAbstractMap*) _data_->_tmp13_, _data_->_tmp16_, _data_->_tmp17_);
				_data_->_tmp18_ = _data_->backend;
				g_signal_emit (_data_->self, folks_backend_store_signals[FOLKS_BACKEND_STORE_BACKEND_AVAILABLE_SIGNAL], 0, _data_->_tmp18_);
			}
			goto __finally0;
			__catch0_g_error:
			{
				_data_->e = _data_->_inner_error_;
				_data_->_inner_error_ = NULL;
				_data_->_tmp19_ = _data_->e;
				if (g_error_matches (_data_->_tmp19_, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN)) {
					_data_->_tmp20_ = _data_->backend;
					_data_->_tmp21_ = folks_backend_get_name (_data_->_tmp20_);
					_data_->_tmp22_ = _data_->_tmp21_;
					_data_->_tmp23_ = _data_->e;
					_data_->_tmp24_ = _data_->_tmp23_->message;
					g_debug ("backend-store.vala:429: Error preparing Backend '%s': %s", _data_->_tmp22_, _data_->_tmp24_);
				} else {
					_data_->_tmp25_ = _data_->backend;
					_data_->_tmp26_ = folks_backend_get_name (_data_->_tmp25_);
					_data_->_tmp27_ = _data_->_tmp26_;
					_data_->_tmp28_ = _data_->e;
					_data_->_tmp29_ = _data_->_tmp28_->message;
					g_warning ("backend-store.vala:434: Error preparing Backend '%s': %s", _data_->_tmp27_, _data_->_tmp29_);
				}
				_g_error_free0 (_data_->e);
			}
			__finally0:
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
				g_clear_error (&_data_->_inner_error_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void _folks_backend_store_backend_unload_if_needed_data_free (gpointer _data) {
	FolksBackendStoreBackendUnloadIfNeededData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->backend);
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendStoreBackendUnloadIfNeededData, _data_);
}


static void _folks_backend_store_backend_unload_if_needed_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	FolksBackendStoreBackendUnloadIfNeededData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


static void _folks_backend_store_backend_unload_if_needed (FolksBackendStore* self, FolksBackend* backend, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendStoreBackendUnloadIfNeededData* _data_;
	FolksBackendStore* _tmp0_;
	FolksBackend* _tmp1_;
	FolksBackend* _tmp2_;
	_data_ = g_slice_new0 (FolksBackendStoreBackendUnloadIfNeededData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _folks_backend_store_backend_unload_if_needed_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, _folks_backend_store_backend_unload_if_needed_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = backend;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->backend);
	_data_->backend = _tmp2_;
	_folks_backend_store_backend_unload_if_needed_co (_data_);
}


static gboolean _folks_backend_store_backend_unload_if_needed_finish (FolksBackendStore* self, GAsyncResult* _res_) {
	gboolean result;
	FolksBackendStoreBackendUnloadIfNeededData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}


static void _folks_backend_store_backend_unload_if_needed_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendStoreBackendUnloadIfNeededData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	_folks_backend_store_backend_unload_if_needed_co (_data_);
}


static gboolean _folks_backend_store_backend_unload_if_needed_co (FolksBackendStoreBackendUnloadIfNeededData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->unloaded = FALSE;
	_data_->_tmp0_ = _data_->backend;
	_data_->_tmp1_ = folks_backend_get_name (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = _folks_backend_store_backend_is_enabled (_data_->self, _data_->_tmp2_);
	if (!_data_->_tmp3_) {
		_data_->_tmp4_ = _data_->self->priv->_backend_hash;
		_data_->_tmp5_ = _data_->backend;
		_data_->_tmp6_ = folks_backend_get_name (_data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp8_ = gee_abstract_map_get ((GeeAbstractMap*) _data_->_tmp4_, _data_->_tmp7_);
		_data_->backend_existing = (FolksBackend*) _data_->_tmp8_;
		_data_->_tmp9_ = _data_->backend_existing;
		if (_data_->_tmp9_ != NULL) {
			{
				_data_->_tmp10_ = _data_->backend_existing;
				_data_->_state_ = 1;
				folks_backend_unprepare (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp10_, FOLKS_TYPE_BACKEND, FolksBackend), _folks_backend_store_backend_unload_if_needed_ready, _data_);
				return FALSE;
				_state_1:
				folks_backend_unprepare_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp10_, FOLKS_TYPE_BACKEND, FolksBackend), _data_->_res_, &_data_->_inner_error_);
				if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
					goto __catch1_g_error;
				}
			}
			goto __finally1;
			__catch1_g_error:
			{
				_data_->e = _data_->_inner_error_;
				_data_->_inner_error_ = NULL;
				_data_->_tmp11_ = _data_->backend;
				_data_->_tmp12_ = folks_backend_get_name (_data_->_tmp11_);
				_data_->_tmp13_ = _data_->_tmp12_;
				_data_->_tmp14_ = _data_->e;
				_data_->_tmp15_ = _data_->_tmp14_->message;
				g_warning ("backend-store.vala:459: Error unpreparing Backend '%s': %s", _data_->_tmp13_, _data_->_tmp15_);
				_g_error_free0 (_data_->e);
			}
			__finally1:
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				_g_object_unref0 (_data_->backend_existing);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
				g_clear_error (&_data_->_inner_error_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
			_data_->_tmp16_ = _data_->self->priv->_prepared_backends;
			_data_->_tmp17_ = _data_->backend_existing;
			_data_->_tmp18_ = folks_backend_get_name (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp17_, FOLKS_TYPE_BACKEND, FolksBackend));
			_data_->_tmp19_ = _data_->_tmp18_;
			gee_abstract_map_unset ((GeeAbstractMap*) _data_->_tmp16_, _data_->_tmp19_, NULL);
			_data_->unloaded = TRUE;
		}
		_g_object_unref0 (_data_->backend_existing);
	}
	_data_->result = _data_->unloaded;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


/**
   * Add a new {@link Backend} to the BackendStore.
   *
   * @param backend the {@link Backend} to add
   */
void folks_backend_store_add_backend (FolksBackendStore* self, FolksBackend* backend) {
	FolksBackend* backend_existing = NULL;
	GeeHashMap* _tmp0_;
	FolksBackend* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gpointer _tmp4_;
	gboolean _tmp5_ = FALSE;
	FolksBackend* _tmp6_;
	FolksDebug* _tmp14_;
	FolksBackend* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	GeeHashMap* _tmp18_;
	FolksBackend* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	FolksBackend* _tmp22_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (backend != NULL);
	_tmp0_ = self->priv->_backend_hash;
	_tmp1_ = backend;
	_tmp2_ = folks_backend_get_name (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, _tmp3_);
	backend_existing = (FolksBackend*) _tmp4_;
	_tmp6_ = backend_existing;
	if (_tmp6_ != NULL) {
		FolksBackend* _tmp7_;
		FolksBackend* _tmp8_;
		_tmp7_ = backend_existing;
		_tmp8_ = backend;
		_tmp5_ = _tmp7_ != _tmp8_;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		FolksBackend* _tmp9_;
		GeeHashMap* _tmp10_;
		FolksBackend* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		_tmp9_ = backend_existing;
		folks_backend_unprepare (G_TYPE_CHECK_INSTANCE_CAST (_tmp9_, FOLKS_TYPE_BACKEND, FolksBackend), NULL, NULL);
		_tmp10_ = self->priv->_prepared_backends;
		_tmp11_ = backend_existing;
		_tmp12_ = folks_backend_get_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, FOLKS_TYPE_BACKEND, FolksBackend));
		_tmp13_ = _tmp12_;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp10_, _tmp13_, NULL);
	}
	_tmp14_ = self->priv->_debug;
	_tmp15_ = backend;
	_tmp16_ = folks_backend_get_name (_tmp15_);
	_tmp17_ = _tmp16_;
	_folks_debug_register_domain (_tmp14_, _tmp17_);
	_tmp18_ = self->priv->_backend_hash;
	_tmp19_ = backend;
	_tmp20_ = folks_backend_get_name (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = backend;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp18_, _tmp21_, _tmp22_);
	_g_object_unref0 (backend_existing);
}


static gboolean _folks_backend_store_backend_is_enabled (FolksBackendStore* self, const gchar* name) {
	gboolean result = FALSE;
	gboolean all_others_enabled = FALSE;
	gboolean _tmp0_ = FALSE;
	FolksSmallSet* _tmp1_;
	gboolean _tmp5_ = FALSE;
	FolksSmallSet* _tmp6_;
	gboolean enabled = FALSE;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (name != NULL, FALSE);
	all_others_enabled = TRUE;
	_tmp1_ = self->priv->_backends_allowed;
	if (_tmp1_ != NULL) {
		FolksSmallSet* _tmp2_;
		const gchar* _tmp3_;
		gboolean _tmp4_;
		_tmp2_ = self->priv->_backends_allowed;
		_tmp3_ = name;
		_tmp4_ = gee_abstract_collection_contains ((GeeAbstractCollection*) G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, FOLKS_TYPE_SMALL_SET, FolksSmallSet), _tmp3_);
		_tmp0_ = !_tmp4_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	_tmp6_ = self->priv->_backends_disabled;
	if (_tmp6_ != NULL) {
		FolksSmallSet* _tmp7_;
		const gchar* _tmp8_;
		gboolean _tmp9_;
		_tmp7_ = self->priv->_backends_disabled;
		_tmp8_ = name;
		_tmp9_ = gee_abstract_collection_contains ((GeeAbstractCollection*) G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, FOLKS_TYPE_SMALL_SET, FolksSmallSet), _tmp8_);
		_tmp5_ = _tmp9_;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		result = FALSE;
		return result;
	}
	{
		gboolean _tmp10_ = FALSE;
		GKeyFile* _tmp11_;
		const gchar* _tmp12_;
		gboolean _tmp13_;
		_tmp11_ = self->priv->_backends_key_file;
		_tmp12_ = folks_backend_store_KEY_FILE_GROUP_ALL_OTHERS;
		_tmp13_ = g_key_file_get_boolean (_tmp11_, _tmp12_, "enabled", &_inner_error_);
		_tmp10_ = _tmp13_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			gboolean _tmp14_ = FALSE;
			if (_inner_error_->domain == G_KEY_FILE_ERROR) {
				goto __catch2_g_key_file_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return _tmp14_;
		}
		all_others_enabled = _tmp10_;
	}
	goto __finally2;
	__catch2_g_key_file_error:
	{
		GError* e = NULL;
		gboolean _tmp15_ = FALSE;
		GError* _tmp16_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp16_ = e;
		if (!g_error_matches (_tmp16_, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
			GError* _tmp17_;
			_tmp17_ = e;
			_tmp15_ = !g_error_matches (_tmp17_, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND);
		} else {
			_tmp15_ = FALSE;
		}
		if (_tmp15_) {
			const gchar* _tmp18_ = NULL;
			gboolean _tmp19_;
			_tmp19_ = all_others_enabled;
			if (_tmp19_) {
				_tmp18_ = "enabled";
			} else {
				_tmp18_ = "disabled";
			}
			g_warning ("Couldn't determine whether to enable or disable " "backends not listed in backend key file. Defaulting to %s.", _tmp18_);
		} else {
			const gchar* _tmp20_ = NULL;
			gboolean _tmp21_;
			_tmp21_ = all_others_enabled;
			if (_tmp21_) {
				_tmp20_ = "Enabling";
			} else {
				_tmp20_ = "Disabling";
			}
			g_debug ("No catch-all entry in the backend key file. %s " "unlisted backends.", _tmp20_);
		}
		_g_error_free0 (e);
	}
	__finally2:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		gboolean _tmp22_ = FALSE;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return _tmp22_;
	}
	enabled = TRUE;
	{
		gboolean _tmp23_ = FALSE;
		GKeyFile* _tmp24_;
		const gchar* _tmp25_;
		gboolean _tmp26_;
		_tmp24_ = self->priv->_backends_key_file;
		_tmp25_ = name;
		_tmp26_ = g_key_file_get_boolean (_tmp24_, _tmp25_, "enabled", &_inner_error_);
		_tmp23_ = _tmp26_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			gboolean _tmp27_ = FALSE;
			if (_inner_error_->domain == G_KEY_FILE_ERROR) {
				goto __catch3_g_key_file_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return _tmp27_;
		}
		enabled = _tmp23_;
	}
	goto __finally3;
	__catch3_g_key_file_error:
	{
		GError* e = NULL;
		gboolean _tmp28_ = FALSE;
		GError* _tmp29_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp29_ = e;
		if (g_error_matches (_tmp29_, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
			_tmp28_ = TRUE;
		} else {
			GError* _tmp30_;
			_tmp30_ = e;
			_tmp28_ = g_error_matches (_tmp30_, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND);
		}
		if (_tmp28_) {
			const gchar* _tmp31_ = NULL;
			gboolean _tmp32_;
			const gchar* _tmp33_;
			const gchar* _tmp34_;
			gboolean _tmp35_;
			_tmp32_ = all_others_enabled;
			if (_tmp32_) {
				_tmp31_ = "Enabling";
			} else {
				_tmp31_ = "Disabling";
			}
			_tmp33_ = name;
			_tmp34_ = folks_backend_store_KEY_FILE_GROUP_ALL_OTHERS;
			g_debug ("Found no entry for backend '%s'.enabled in backend " "keyfile. %s according to '%s' setting.", _tmp33_, _tmp31_, _tmp34_);
			_tmp35_ = all_others_enabled;
			enabled = _tmp35_;
		} else {
			gboolean _tmp36_ = FALSE;
			GError* _tmp37_;
			_tmp37_ = e;
			if (!g_error_matches (_tmp37_, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
				GError* _tmp38_;
				_tmp38_ = e;
				_tmp36_ = !g_error_matches (_tmp38_, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND);
			} else {
				_tmp36_ = FALSE;
			}
			if (_tmp36_) {
				const gchar* _tmp39_;
				GError* _tmp40_;
				const gchar* _tmp41_;
				_tmp39_ = name;
				_tmp40_ = e;
				_tmp41_ = _tmp40_->message;
				g_warning ("Couldn't check enabled state of backend '%s': %s\n" "Disabling backend.", _tmp39_, _tmp41_);
				enabled = FALSE;
			}
		}
		_g_error_free0 (e);
	}
	__finally3:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		gboolean _tmp42_ = FALSE;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return _tmp42_;
	}
	result = enabled;
	return result;
}


/**
   * Get a backend from the store by name. If a backend is returned, its
   * reference count is increased.
   *
   * @param name the backend name to retrieve
   * @return the backend, or ``null`` if none could be found
   *
   * @since 0.3.5
   */
FolksBackend* folks_backend_store_dup_backend_by_name (FolksBackendStore* self, const gchar* name) {
	FolksBackend* result = NULL;
	GeeHashMap* _tmp0_;
	const gchar* _tmp1_;
	gpointer _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = self->priv->_backend_hash;
	_tmp1_ = name;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, _tmp1_);
	result = (FolksBackend*) _tmp2_;
	return result;
}


/**
   * List the currently loaded backends.
   *
   * @return a list of the backends currently in the BackendStore
   */
GeeCollection* folks_backend_store_list_backends (FolksBackendStore* self) {
	GeeCollection* result = NULL;
	GeeHashMap* _tmp0_;
	GeeCollection* _tmp1_;
	GeeCollection* _tmp2_;
	GeeCollection* _tmp3_;
	GeeCollection* _tmp4_;
	GeeCollection* _tmp5_;
	GeeCollection* _tmp6_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_backend_hash;
	_tmp1_ = gee_abstract_map_get_values ((GeeAbstractMap*) _tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_collection_get_read_only_view (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	_g_object_unref0 (_tmp3_);
	result = _tmp6_;
	return result;
}


static void folks_backend_store_enable_backend_data_free (gpointer _data) {
	FolksBackendStoreEnableBackendData* _data_;
	_data_ = _data;
	_g_free0 (_data_->name);
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendStoreEnableBackendData, _data_);
}


static void folks_backend_store_enable_backend_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	FolksBackendStoreEnableBackendData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


void folks_backend_store_enable_backend (FolksBackendStore* self, const gchar* name, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendStoreEnableBackendData* _data_;
	FolksBackendStore* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	_data_ = g_slice_new0 (FolksBackendStoreEnableBackendData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, folks_backend_store_enable_backend_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, folks_backend_store_enable_backend_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = name;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (_data_->name);
	_data_->name = _tmp2_;
	folks_backend_store_enable_backend_co (_data_);
}


void folks_backend_store_enable_backend_finish (FolksBackendStore* self, GAsyncResult* _res_) {
	FolksBackendStoreEnableBackendData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


/**
   * Enable a backend.
   *
   * Mark a backend as enabled, such that the BackendStore will always attempt
   * to load it when {@link BackendStore.load_backends} is called. This will
   * not load the backend if it's not currently loaded.
   *
   * This method is safe to call multiple times concurrently (e.g. an
   * asynchronous call may begin after a previous asynchronous call for the same
   * backend name has begun and before it has finished).
   *
   * If the backend is disallowed by the FOLKS_BACKENDS_ALLOWED
   * and/or FOLKS_BACKENDS_DISABLED environment variables, this method
   * will store the fact that it should be enabled in future, but will
   * not enable it during this application run.
   *
   * @param name the name of the backend to enable
   * @since 0.3.2
   */
static void folks_backend_store_enable_backend_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendStoreEnableBackendData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	folks_backend_store_enable_backend_co (_data_);
}


static gboolean folks_backend_store_enable_backend_co (FolksBackendStoreEnableBackendData* _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->_backends_key_file;
	_data_->_tmp1_ = _data_->name;
	g_key_file_set_boolean (_data_->_tmp0_, _data_->_tmp1_, "enabled", TRUE);
	_data_->_state_ = 1;
	_folks_backend_store_save_key_file (_data_->self, folks_backend_store_enable_backend_ready, _data_);
	return FALSE;
	_state_1:
	_folks_backend_store_save_key_file_finish (_data_->self, _data_->_res_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void folks_backend_store_disable_backend_data_free (gpointer _data) {
	FolksBackendStoreDisableBackendData* _data_;
	_data_ = _data;
	_g_free0 (_data_->name);
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendStoreDisableBackendData, _data_);
}


static void folks_backend_store_disable_backend_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	FolksBackendStoreDisableBackendData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


void folks_backend_store_disable_backend (FolksBackendStore* self, const gchar* name, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendStoreDisableBackendData* _data_;
	FolksBackendStore* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	_data_ = g_slice_new0 (FolksBackendStoreDisableBackendData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, folks_backend_store_disable_backend_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, folks_backend_store_disable_backend_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = name;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (_data_->name);
	_data_->name = _tmp2_;
	folks_backend_store_disable_backend_co (_data_);
}


void folks_backend_store_disable_backend_finish (FolksBackendStore* self, GAsyncResult* _res_) {
	FolksBackendStoreDisableBackendData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


/**
   * Disable a backend.
   *
   * Mark a backend as disabled, such that it won't be loaded even when the
   * client application is restarted. This will not remove the backend if it's
   * already loaded.
   *
   * This method is safe to call multiple times concurrently (e.g. an
   * asynchronous call may begin after a previous asynchronous call for the same
   * backend name has begun and before it has finished).
   *
   * @param name the name of the backend to disable
   * @since 0.3.2
   */
static void folks_backend_store_disable_backend_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendStoreDisableBackendData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	folks_backend_store_disable_backend_co (_data_);
}


static gboolean folks_backend_store_disable_backend_co (FolksBackendStoreDisableBackendData* _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->_backends_key_file;
	_data_->_tmp1_ = _data_->name;
	g_key_file_set_boolean (_data_->_tmp0_, _data_->_tmp1_, "enabled", FALSE);
	_data_->_state_ = 1;
	_folks_backend_store_save_key_file (_data_->self, folks_backend_store_disable_backend_ready, _data_);
	return FALSE;
	_state_1:
	_folks_backend_store_save_key_file_finish (_data_->self, _data_->_res_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void _folks_backend_store_get_modules_from_dir_data_free (gpointer _data) {
	FolksBackendStoreGetModulesFromDirData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->dir);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendStoreGetModulesFromDirData, _data_);
}


static void _folks_backend_store_get_modules_from_dir_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	FolksBackendStoreGetModulesFromDirData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


static void _folks_backend_store_get_modules_from_dir (FolksBackendStore* self, GFile* dir, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendStoreGetModulesFromDirData* _data_;
	FolksBackendStore* _tmp0_;
	GFile* _tmp1_;
	GFile* _tmp2_;
	_data_ = g_slice_new0 (FolksBackendStoreGetModulesFromDirData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _folks_backend_store_get_modules_from_dir_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, _folks_backend_store_get_modules_from_dir_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = dir;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->dir);
	_data_->dir = _tmp2_;
	_folks_backend_store_get_modules_from_dir_co (_data_);
}


static GeeHashMap* _folks_backend_store_get_modules_from_dir_finish (FolksBackendStore* self, GAsyncResult* _res_) {
	GeeHashMap* result;
	FolksBackendStoreGetModulesFromDirData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _folks_backend_store_get_modules_from_dir_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendStoreGetModulesFromDirData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	_folks_backend_store_get_modules_from_dir_co (_data_);
}


static void _g_object_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}


static inline void _g_list_free__g_object_unref0_ (GList* self) {
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}


static gboolean _folks_backend_store_get_modules_from_dir_co (FolksBackendStoreGetModulesFromDirData* _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_->_tmp0_ = _data_->dir;
	_data_->_tmp1_ = g_file_get_path (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	g_debug ("backend-store.vala:631: Searching for modules in folder '%s' ..", _data_->_tmp2_);
	_g_free0 (_data_->_tmp2_);
	_data_->_tmp3_ = g_strdup (G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK "," G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET "," G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
	_data_->attributes = _data_->_tmp3_;
	{
		_data_->_tmp4_ = _data_->dir;
		_data_->_tmp5_ = _data_->attributes;
		_data_->_state_ = 1;
		g_file_enumerate_children_async (_data_->_tmp4_, _data_->_tmp5_, G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL, _folks_backend_store_get_modules_from_dir_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp6_ = g_file_enumerate_children_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error_);
		_data_->enumerator = _data_->_tmp6_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch4_g_error;
		}
		_data_->_tmp8_ = _data_->enumerator;
		_data_->_state_ = 2;
		g_file_enumerator_next_files_async (_data_->_tmp8_, G_MAXINT, G_PRIORITY_DEFAULT, NULL, _folks_backend_store_get_modules_from_dir_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp9_ = g_file_enumerator_next_files_finish (_data_->_tmp8_, _data_->_res_, &_data_->_inner_error_);
		_data_->_tmp7_ = _data_->_tmp9_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_object_unref0 (_data_->enumerator);
			goto __catch4_g_error;
		}
		_data_->_tmp10_ = _data_->_tmp7_;
		_data_->_tmp7_ = NULL;
		__g_list_free__g_object_unref0_0 (_data_->infos);
		_data_->infos = _data_->_tmp10_;
		__g_list_free__g_object_unref0_0 (_data_->_tmp7_);
		_g_object_unref0 (_data_->enumerator);
	}
	goto __finally4;
	__catch4_g_error:
	{
		_data_->_error_ = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp11_ = _data_->dir;
		_data_->_tmp12_ = g_file_get_path (_data_->_tmp11_);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_tmp14_ = _data_->_error_;
		_data_->_tmp15_ = _data_->_tmp14_->message;
		g_critical (_ ("Error listing contents of folder ‘%s’: %s"), _data_->_tmp13_, _data_->_tmp15_);
		_g_free0 (_data_->_tmp13_);
		_data_->result = NULL;
		_g_error_free0 (_data_->_error_);
		__g_list_free__g_object_unref0_0 (_data_->infos);
		_g_free0 (_data_->attributes);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (_data_->_task_complete_ != TRUE) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally4:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		__g_list_free__g_object_unref0_0 (_data_->infos);
		_g_free0 (_data_->attributes);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp16_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, g_file_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_data_->modules_final = _data_->_tmp16_;
	_data_->_tmp17_ = g_getenv ("FOLKS_BACKEND_PATH");
	_data_->_tmp18_ = g_strdup (_data_->_tmp17_);
	_data_->_path = _data_->_tmp18_;
	_data_->_tmp19_ = _data_->infos;
	{
		_data_->info_collection = _data_->_tmp19_;
		for (_data_->info_it = _data_->info_collection; _data_->info_it != NULL; _data_->info_it = _data_->info_it->next) {
			_data_->_tmp20_ = _g_object_ref0 ((GFileInfo*) _data_->info_it->data);
			_data_->info = _data_->_tmp20_;
			{
				_data_->_tmp21_ = _data_->dir;
				_data_->_tmp22_ = _data_->info;
				_data_->_tmp23_ = g_file_info_get_name (_data_->_tmp22_);
				_data_->_tmp24_ = g_file_get_child (_data_->_tmp21_, _data_->_tmp23_);
				_data_->file = _data_->_tmp24_;
				_data_->_tmp25_ = _data_->info;
				_data_->_tmp26_ = g_file_info_get_is_symlink (_data_->_tmp25_);
				if (_data_->_tmp26_) {
					_data_->_tmp27_ = _data_->file;
					_data_->_tmp28_ = g_file_get_path (_data_->_tmp27_);
					_data_->_tmp29_ = _data_->_tmp28_;
					_data_->_tmp30_ = _data_->info;
					_data_->_tmp31_ = g_file_info_get_symlink_target (_data_->_tmp30_);
					g_debug ("backend-store.vala:679: Handling symlink ‘%s’ to ‘%s’.", _data_->_tmp29_, _data_->_tmp31_);
					_g_free0 (_data_->_tmp29_);
					_data_->_tmp32_ = _data_->file;
					_data_->_tmp33_ = _g_object_ref0 (_data_->_tmp32_);
					_data_->old_file = _data_->_tmp33_;
					_data_->_tmp34_ = _data_->dir;
					_data_->_tmp35_ = _data_->info;
					_data_->_tmp36_ = g_file_info_get_symlink_target (_data_->_tmp35_);
					_data_->_tmp37_ = g_file_resolve_relative_path (_data_->_tmp34_, _data_->_tmp36_);
					_g_object_unref0 (_data_->file);
					_data_->file = _data_->_tmp37_;
					{
						_data_->_tmp39_ = _data_->file;
						_data_->_tmp40_ = _data_->attributes;
						_data_->_state_ = 3;
						g_file_query_info_async (_data_->_tmp39_, _data_->_tmp40_, G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL, _folks_backend_store_get_modules_from_dir_ready, _data_);
						return FALSE;
						_state_3:
						_data_->_tmp41_ = g_file_query_info_finish (_data_->_tmp39_, _data_->_res_, &_data_->_inner_error_);
						_data_->_tmp38_ = _data_->_tmp41_;
						if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
							goto __catch5_g_error;
						}
						_data_->_tmp42_ = _data_->_tmp38_;
						_data_->_tmp38_ = NULL;
						_g_object_unref0 (_data_->info);
						_data_->info = _data_->_tmp42_;
						_g_object_unref0 (_data_->_tmp38_);
					}
					goto __finally5;
					__catch5_g_error:
					{
						_data_->_vala1__error_ = _data_->_inner_error_;
						_data_->_inner_error_ = NULL;
						_data_->_tmp43_ = _data_->file;
						_data_->_tmp44_ = g_file_get_path (_data_->_tmp43_);
						_data_->_tmp45_ = _data_->_tmp44_;
						_data_->_tmp46_ = _data_->old_file;
						_data_->_tmp47_ = g_file_get_path (_data_->_tmp46_);
						_data_->_tmp48_ = _data_->_tmp47_;
						_data_->_tmp49_ = _data_->_vala1__error_;
						_data_->_tmp50_ = _data_->_tmp49_->message;
						g_warning (_ ("Error querying info for target ‘%s’ of symlink ‘%s’: %s"), _data_->_tmp45_, _data_->_tmp48_, _data_->_tmp50_);
						_g_free0 (_data_->_tmp48_);
						_g_free0 (_data_->_tmp45_);
						_g_error_free0 (_data_->_vala1__error_);
						_g_object_unref0 (_data_->old_file);
						_g_object_unref0 (_data_->file);
						_g_object_unref0 (_data_->info);
						continue;
					}
					__finally5:
					if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
						_g_object_unref0 (_data_->old_file);
						_g_object_unref0 (_data_->file);
						_g_object_unref0 (_data_->info);
						_g_free0 (_data_->_path);
						_g_object_unref0 (_data_->modules_final);
						__g_list_free__g_object_unref0_0 (_data_->infos);
						_g_free0 (_data_->attributes);
						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
						g_clear_error (&_data_->_inner_error_);
						g_object_unref (_data_->_async_result);
						return FALSE;
					}
					_g_object_unref0 (_data_->old_file);
				}
				_data_->_tmp51_ = _data_->info;
				_data_->_tmp52_ = g_file_info_get_file_type (_data_->_tmp51_);
				_data_->file_type = _data_->_tmp52_;
				_data_->_tmp53_ = _data_->info;
				_data_->_tmp54_ = g_file_info_get_content_type (_data_->_tmp53_);
				_data_->content_type = _data_->_tmp54_;
				_data_->_tmp55_ = _data_->content_type;
				_data_->_tmp56_ = g_content_type_get_mime_type (_data_->_tmp55_);
				_data_->mime = _data_->_tmp56_;
				_data_->_tmp57_ = _data_->file_type;
				if (_data_->_tmp57_ == G_FILE_TYPE_DIRECTORY) {
					_data_->_tmp58_ = _data_->file;
					_data_->_state_ = 4;
					_folks_backend_store_get_modules_from_dir (_data_->self, _data_->_tmp58_, _folks_backend_store_get_modules_from_dir_ready, _data_);
					return FALSE;
					_state_4:
					_data_->_tmp59_ = _folks_backend_store_get_modules_from_dir_finish (_data_->self, _data_->_res_);
					_data_->modules = _data_->_tmp59_;
					_data_->_tmp60_ = _data_->modules;
					if (_data_->_tmp60_ != NULL) {
						{
							_data_->_tmp61_ = _data_->modules;
							_data_->_tmp62_ = gee_abstract_map_get_entries ((GeeAbstractMap*) G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp61_, GEE_TYPE_HASH_MAP, GeeHashMap));
							_data_->_tmp63_ = _data_->_tmp62_;
							_data_->_tmp64_ = _data_->_tmp63_;
							_data_->_tmp65_ = gee_iterable_iterator ((GeeIterable*) _data_->_tmp64_);
							_data_->_tmp66_ = _data_->_tmp65_;
							_g_object_unref0 (_data_->_tmp64_);
							_data_->_entry_it = _data_->_tmp66_;
							while (TRUE) {
								_data_->_tmp67_ = _data_->_entry_it;
								_data_->_tmp68_ = gee_iterator_next (_data_->_tmp67_);
								if (!_data_->_tmp68_) {
									break;
								}
								_data_->_tmp69_ = _data_->_entry_it;
								_data_->_tmp70_ = gee_iterator_get (_data_->_tmp69_);
								_data_->entry = (GeeMapEntry*) _data_->_tmp70_;
								_data_->_tmp71_ = _data_->modules_final;
								_data_->_tmp72_ = _data_->entry;
								_data_->_tmp73_ = gee_map_entry_get_key (_data_->_tmp72_);
								_data_->_tmp74_ = _data_->_tmp73_;
								_data_->_tmp75_ = _data_->entry;
								_data_->_tmp76_ = gee_map_entry_get_value (_data_->_tmp75_);
								_data_->_tmp77_ = _data_->_tmp76_;
								gee_abstract_map_set ((GeeAbstractMap*) _data_->_tmp71_, (const gchar*) _data_->_tmp74_, (GFile*) _data_->_tmp77_);
								_g_object_unref0 (_data_->entry);
							}
							_g_object_unref0 (_data_->_entry_it);
						}
					}
					_g_object_unref0 (_data_->modules);
				} else {
					_data_->_tmp78_ = _data_->mime;
					if (g_strcmp0 (_data_->_tmp78_, "application/x-sharedlib") == 0) {
						_data_->_tmp79_ = _data_->file;
						_data_->_tmp80_ = g_file_get_path (_data_->_tmp79_);
						_data_->path = _data_->_tmp80_;
						_data_->_tmp81_ = _data_->path;
						if (_data_->_tmp81_ != NULL) {
							_data_->_tmp82_ = _data_->modules_final;
							_data_->_tmp83_ = _data_->path;
							_data_->_tmp84_ = _data_->file;
							gee_abstract_map_set ((GeeAbstractMap*) _data_->_tmp82_, (const gchar*) _data_->_tmp83_, _data_->_tmp84_);
						}
						_g_free0 (_data_->path);
					} else {
						_data_->_tmp85_ = _data_->mime;
						if (_data_->_tmp85_ == NULL) {
							_data_->_tmp86_ = _data_->file;
							_data_->_tmp87_ = g_file_get_path (_data_->_tmp86_);
							_data_->_tmp88_ = _data_->_tmp87_;
							g_warning ("backend-store.vala:729: The content type of '%s' could not be determin" \
"ed. Have you installed shared-mime-info?", _data_->_tmp88_);
							_g_free0 (_data_->_tmp88_);
						} else {
							_data_->_tmp92_ = _data_->_path;
							if (_data_->_tmp92_ == NULL) {
								_data_->_tmp93_ = _data_->mime;
								_data_->_tmp91_ = g_strcmp0 (_data_->_tmp93_, "application/x-sharedlib") != 0;
							} else {
								_data_->_tmp91_ = FALSE;
							}
							if (_data_->_tmp91_) {
								_data_->_tmp94_ = _data_->mime;
								_data_->_tmp90_ = g_strcmp0 (_data_->_tmp94_, "application/x-shared-library-la") != 0;
							} else {
								_data_->_tmp90_ = FALSE;
							}
							if (_data_->_tmp90_) {
								_data_->_tmp95_ = _data_->mime;
								_data_->_tmp89_ = g_strcmp0 (_data_->_tmp95_, "inode/directory") != 0;
							} else {
								_data_->_tmp89_ = FALSE;
							}
							if (_data_->_tmp89_) {
								_data_->_tmp96_ = _data_->file;
								_data_->_tmp97_ = g_file_get_path (_data_->_tmp96_);
								_data_->_tmp98_ = _data_->_tmp97_;
								_data_->_tmp99_ = _data_->mime;
								g_warning ("backend-store.vala:742: The content type of '%s' appears to be '%s' wh" \
"ich looks suspicious. Have you installed shared-mime-info?", _data_->_tmp98_, _data_->_tmp99_);
								_g_free0 (_data_->_tmp98_);
							}
						}
					}
				}
				_g_free0 (_data_->mime);
				_g_object_unref0 (_data_->file);
				_g_object_unref0 (_data_->info);
			}
		}
	}
	_data_->_tmp100_ = _data_->dir;
	_data_->_tmp101_ = g_file_get_path (_data_->_tmp100_);
	_data_->_tmp102_ = _data_->_tmp101_;
	g_debug ("backend-store.vala:746: Finished searching for modules in folder '%s'", _data_->_tmp102_);
	_g_free0 (_data_->_tmp102_);
	_data_->result = _data_->modules_final;
	_g_free0 (_data_->_path);
	__g_list_free__g_object_unref0_0 (_data_->infos);
	_g_free0 (_data_->attributes);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void _folks_backend_store_load_module_from_file (FolksBackendStore* self, GFile* file) {
	gchar* _file_path = NULL;
	GFile* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* file_path = NULL;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	GeeHashMap* _tmp5_;
	const gchar* _tmp6_;
	gboolean _tmp7_;
	GModule* _module = NULL;
	const gchar* _tmp8_;
	GModule* _tmp9_;
	GModule* _tmp10_;
	GModule* module = NULL;
	GModule* _tmp13_;
	void* function = NULL;
	GModule* _tmp14_;
	void* _tmp15_ = NULL;
	gboolean _tmp16_;
	FolksBackendStoreModuleInitFunc module_init = NULL;
	void* _tmp19_;
	FolksBackendStoreModuleInitFunc _tmp20_;
	GeeHashMap* _tmp21_;
	const gchar* _tmp22_;
	GModule* _tmp23_;
	GModule* _tmp24_;
	FolksBackendStoreModuleInitFunc _tmp25_;
	GModule* _tmp26_;
	const gchar* _tmp27_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file != NULL);
	_tmp0_ = file;
	_tmp1_ = g_file_get_path (_tmp0_);
	_file_path = _tmp1_;
	_tmp2_ = _file_path;
	if (_tmp2_ == NULL) {
		_g_free0 (_file_path);
		return;
	}
	_tmp3_ = _file_path;
	_tmp4_ = g_strdup ((const gchar*) _tmp3_);
	file_path = _tmp4_;
	_tmp5_ = self->priv->_modules;
	_tmp6_ = file_path;
	_tmp7_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp5_, _tmp6_);
	if (_tmp7_) {
		_g_free0 (file_path);
		_g_free0 (_file_path);
		return;
	}
	_tmp8_ = file_path;
	_tmp9_ = g_module_open (_tmp8_, G_MODULE_BIND_LOCAL);
	_module = _tmp9_;
	_tmp10_ = _module;
	if (_tmp10_ == NULL) {
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		_tmp11_ = file_path;
		_tmp12_ = g_module_error ();
		g_warning ("backend-store.vala:767: Failed to load module from path '%s': %s", _tmp11_, _tmp12_);
		_g_module_close0 (_module);
		_g_free0 (file_path);
		_g_free0 (_file_path);
		return;
	}
	_tmp13_ = _module;
	module = (GModule*) _tmp13_;
	_tmp14_ = module;
	_tmp16_ = g_module_symbol (_tmp14_, "module_init", &_tmp15_);
	function = _tmp15_;
	if (!_tmp16_) {
		const gchar* _tmp17_;
		const gchar* _tmp18_;
		_tmp17_ = file_path;
		_tmp18_ = g_module_error ();
		g_warning ("backend-store.vala:781: Failed to find entry point function '%s' in '%" \
"s': %s", "module_init", _tmp17_, _tmp18_);
		_g_module_close0 (_module);
		_g_free0 (file_path);
		_g_free0 (_file_path);
		return;
	}
	_tmp19_ = function;
	module_init = (FolksBackendStoreModuleInitFunc) _tmp19_;
	_tmp20_ = module_init;
	_vala_assert (_tmp20_ != NULL, "module_init != null");
	_tmp21_ = self->priv->_modules;
	_tmp22_ = file_path;
	_tmp23_ = module;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp21_, _tmp22_, _tmp23_);
	_tmp24_ = module;
	g_module_make_resident (_tmp24_);
	_tmp25_ = module_init;
	_tmp25_ (self);
	_tmp26_ = module;
	_tmp27_ = g_module_name (_tmp26_);
	g_debug ("backend-store.vala:799: Loaded module source: '%s'", _tmp27_);
	_g_module_close0 (_module);
	_g_free0 (file_path);
	_g_free0 (_file_path);
}


static void _folks_backend_store_get_file_info_data_free (gpointer _data) {
	FolksBackendStoreGetFileInfoData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file);
	g_slice_free (FolksBackendStoreGetFileInfoData, _data_);
}


static void _folks_backend_store_get_file_info_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	FolksBackendStoreGetFileInfoData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


static void _folks_backend_store_get_file_info (GFile* file, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendStoreGetFileInfoData* _data_;
	GFile* _tmp0_;
	GFile* _tmp1_;
	_data_ = g_slice_new0 (FolksBackendStoreGetFileInfoData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (NULL, NULL, _folks_backend_store_get_file_info_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, _folks_backend_store_get_file_info_data_free);
	_tmp0_ = file;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (_data_->file);
	_data_->file = _tmp1_;
	_folks_backend_store_get_file_info_co (_data_);
}


static void _folks_backend_store_get_file_info_finish (GAsyncResult* _res_, gboolean* is_file, gboolean* is_dir) {
	FolksBackendStoreGetFileInfoData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (is_file) {
		*is_file = _data_->is_file;
	}
	if (is_dir) {
		*is_dir = _data_->is_dir;
	}
}


static void _folks_backend_store_get_file_info_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendStoreGetFileInfoData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	_folks_backend_store_get_file_info_co (_data_);
}


static gboolean _folks_backend_store_get_file_info_co (FolksBackendStoreGetFileInfoData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->is_file = FALSE;
	_data_->is_dir = FALSE;
	{
		_data_->_tmp1_ = _data_->file;
		_data_->_state_ = 1;
		g_file_query_info_async (_data_->_tmp1_, G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL, _folks_backend_store_get_file_info_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp2_ = g_file_query_info_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error_);
		_data_->_tmp0_ = _data_->_tmp2_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch6_g_error;
		}
		_data_->_tmp3_ = _data_->_tmp0_;
		_data_->_tmp0_ = NULL;
		_g_object_unref0 (_data_->file_info);
		_data_->file_info = _data_->_tmp3_;
		_g_object_unref0 (_data_->_tmp0_);
	}
	goto __finally6;
	__catch6_g_error:
	{
		_data_->_error_ = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp4_ = _data_->_error_;
		if (g_error_matches (_data_->_tmp4_, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) {
			_data_->_tmp5_ = _data_->file;
			_data_->_tmp6_ = g_file_get_path (_data_->_tmp5_);
			_data_->_tmp7_ = _data_->_tmp6_;
			g_critical (_ ("File or directory ‘%s’ does not exist."), _data_->_tmp7_);
			_g_free0 (_data_->_tmp7_);
		} else {
			_data_->_tmp8_ = _data_->file;
			_data_->_tmp9_ = g_file_get_path (_data_->_tmp8_);
			_data_->_tmp10_ = _data_->_tmp9_;
			g_critical (_ ("Failed to get content type for ‘%s’."), _data_->_tmp10_);
			_g_free0 (_data_->_tmp10_);
		}
		_g_error_free0 (_data_->_error_);
		_g_object_unref0 (_data_->file_info);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (_data_->_task_complete_ != TRUE) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally6:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_object_unref0 (_data_->file_info);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp11_ = _data_->file_info;
	_data_->_tmp12_ = g_file_info_get_file_type (_data_->_tmp11_);
	_data_->is_file = _data_->_tmp12_ == G_FILE_TYPE_REGULAR;
	_data_->_tmp13_ = _data_->file_info;
	_data_->_tmp14_ = g_file_info_get_file_type (_data_->_tmp13_);
	_data_->is_dir = _data_->_tmp14_ == G_FILE_TYPE_DIRECTORY;
	_g_object_unref0 (_data_->file_info);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void _folks_backend_store_load_disabled_backend_names_data_free (gpointer _data) {
	FolksBackendStoreLoadDisabledBackendNamesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendStoreLoadDisabledBackendNamesData, _data_);
}


static void _folks_backend_store_load_disabled_backend_names_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	FolksBackendStoreLoadDisabledBackendNamesData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


static void _folks_backend_store_load_disabled_backend_names (FolksBackendStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendStoreLoadDisabledBackendNamesData* _data_;
	FolksBackendStore* _tmp0_;
	_data_ = g_slice_new0 (FolksBackendStoreLoadDisabledBackendNamesData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _folks_backend_store_load_disabled_backend_names_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, _folks_backend_store_load_disabled_backend_names_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_folks_backend_store_load_disabled_backend_names_co (_data_);
}


static void _folks_backend_store_load_disabled_backend_names_finish (FolksBackendStore* self, GAsyncResult* _res_) {
	FolksBackendStoreLoadDisabledBackendNamesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


static void _folks_backend_store_load_disabled_backend_names_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendStoreLoadDisabledBackendNamesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	_folks_backend_store_load_disabled_backend_names_co (_data_);
}


static gboolean _folks_backend_store_load_disabled_backend_names_co (FolksBackendStoreLoadDisabledBackendNamesData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_getenv ("FOLKS_BACKENDS_ALLOWED");
	_data_->_tmp1_ = g_strdup (_data_->_tmp0_);
	_data_->envvar = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->envvar;
	if (_data_->_tmp2_ != NULL) {
		_data_->_tmp3_ = _data_->envvar;
		_data_->_tmp5_ = _data_->_tmp4_ = g_strsplit_set (_data_->_tmp3_, " ,:", 0);
		_data_->tokens = _data_->_tmp5_;
		_data_->tokens_length1 = _vala_array_length (_data_->_tmp4_);
		_data_->_tokens_size_ = _data_->tokens_length1;
		_data_->_tmp6_ = folks_small_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (_data_->self->priv->_backends_allowed);
		_data_->self->priv->_backends_allowed = _data_->_tmp6_;
		_data_->_tmp7_ = _data_->tokens;
		_data_->_tmp7__length1 = _data_->tokens_length1;
		{
			_data_->s_collection_length1 = 0;
			_data_->_s_collection_size_ = 0;
			_data_->s_collection = _data_->_tmp7_;
			_data_->s_collection_length1 = _data_->_tmp7__length1;
			for (_data_->s_it = 0; _data_->s_it < _data_->_tmp7__length1; _data_->s_it = _data_->s_it + 1) {
				_data_->s = _data_->s_collection[_data_->s_it];
				{
					_data_->_tmp8_ = _data_->s;
					if (g_strcmp0 (_data_->_tmp8_, "all") == 0) {
						_g_object_unref0 (_data_->self->priv->_backends_allowed);
						_data_->self->priv->_backends_allowed = NULL;
						break;
					}
					_data_->_tmp9_ = _data_->s;
					if (g_strcmp0 (_data_->_tmp9_, "") != 0) {
						_data_->_tmp10_ = _data_->self->priv->_backends_allowed;
						_data_->_tmp11_ = _data_->s;
						gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp10_, _data_->_tmp11_);
					}
				}
			}
		}
		_data_->_tmp12_ = _data_->self->priv->_backends_allowed;
		if (_data_->_tmp12_ != NULL) {
			g_debug ("backend-store.vala:874: Backends limited by FOLKS_BACKENDS_ALLOWED:");
			_data_->_tmp13_ = _data_->tokens;
			_data_->_tmp13__length1 = _data_->tokens_length1;
			{
				_data_->_vala1_s_collection_length1 = 0;
				_data_->__vala1_s_collection_size_ = 0;
				_data_->_vala1_s_collection = _data_->_tmp13_;
				_data_->_vala1_s_collection_length1 = _data_->_tmp13__length1;
				for (_data_->_vala1_s_it = 0; _data_->_vala1_s_it < _data_->_tmp13__length1; _data_->_vala1_s_it = _data_->_vala1_s_it + 1) {
					_data_->_vala1_s = _data_->_vala1_s_collection[_data_->_vala1_s_it];
					{
						_data_->_tmp14_ = _data_->_vala1_s;
						g_debug ("backend-store.vala:877: Backend '%s' is allowed", _data_->_tmp14_);
					}
				}
			}
			g_debug ("backend-store.vala:879: All other backends disabled by FOLKS_BACKENDS_" \
"ALLOWED");
		}
		_data_->tokens = (_vala_array_free (_data_->tokens, _data_->tokens_length1, (GDestroyNotify) g_free), NULL);
	}
	_data_->_tmp15_ = g_getenv ("FOLKS_BACKENDS_DISABLED");
	_data_->_tmp16_ = g_strdup (_data_->_tmp15_);
	_g_free0 (_data_->envvar);
	_data_->envvar = _data_->_tmp16_;
	_data_->_tmp17_ = _data_->envvar;
	if (_data_->_tmp17_ != NULL) {
		_data_->_tmp18_ = _data_->envvar;
		_data_->_tmp20_ = _data_->_tmp19_ = g_strsplit_set (_data_->_tmp18_, " ,:", 0);
		_data_->_vala1_tokens = _data_->_tmp20_;
		_data_->_vala1_tokens_length1 = _vala_array_length (_data_->_tmp19_);
		_data_->__vala1_tokens_size_ = _data_->_vala1_tokens_length1;
		_data_->_tmp21_ = folks_small_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (_data_->self->priv->_backends_disabled);
		_data_->self->priv->_backends_disabled = _data_->_tmp21_;
		_data_->_tmp22_ = _data_->_vala1_tokens;
		_data_->_tmp22__length1 = _data_->_vala1_tokens_length1;
		{
			_data_->_vala2_s_collection_length1 = 0;
			_data_->__vala2_s_collection_size_ = 0;
			_data_->_vala2_s_collection = _data_->_tmp22_;
			_data_->_vala2_s_collection_length1 = _data_->_tmp22__length1;
			for (_data_->_vala2_s_it = 0; _data_->_vala2_s_it < _data_->_tmp22__length1; _data_->_vala2_s_it = _data_->_vala2_s_it + 1) {
				_data_->_vala2_s = _data_->_vala2_s_collection[_data_->_vala2_s_it];
				{
					_data_->_tmp23_ = _data_->_vala2_s;
					if (g_strcmp0 (_data_->_tmp23_, "") != 0) {
						_data_->_tmp24_ = _data_->_vala2_s;
						g_debug ("backend-store.vala:897: Backend '%s' disabled by FOLKS_BACKENDS_DISABL" \
"ED", _data_->_tmp24_);
						_data_->_tmp25_ = _data_->self->priv->_backends_disabled;
						_data_->_tmp26_ = _data_->_vala2_s;
						gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp25_, _data_->_tmp26_);
					}
				}
			}
		}
		_data_->_vala1_tokens = (_vala_array_free (_data_->_vala1_tokens, _data_->_vala1_tokens_length1, (GDestroyNotify) g_free), NULL);
	}
	_data_->_tmp27_ = g_getenv ("FOLKS_BACKEND_STORE_KEY_FILE_PATH");
	_data_->path = _data_->_tmp27_;
	_data_->_tmp28_ = _data_->path;
	if (_data_->_tmp28_ == NULL) {
		_data_->_tmp29_ = g_get_user_data_dir ();
		_data_->_tmp30_ = g_file_new_for_path (_data_->_tmp29_);
		_g_object_unref0 (_data_->file);
		_data_->file = _data_->_tmp30_;
		_data_->_tmp31_ = _data_->file;
		_data_->_tmp32_ = g_file_get_child (_data_->_tmp31_, "folks");
		_g_object_unref0 (_data_->file);
		_data_->file = _data_->_tmp32_;
		_data_->_tmp33_ = _data_->file;
		_data_->_tmp34_ = g_file_get_child (_data_->_tmp33_, "backends.ini");
		_g_object_unref0 (_data_->file);
		_data_->file = _data_->_tmp34_;
		_data_->_tmp35_ = _data_->file;
		_data_->_tmp36_ = g_file_get_path (_data_->_tmp35_);
		_data_->_tmp37_ = _data_->_tmp36_;
		g_debug ("Using built-in backends key file '%s' (override with " "environment variable FOLKS_BACKEND_STORE_KEY_FILE_PATH)", _data_->_tmp37_);
		_g_free0 (_data_->_tmp37_);
	} else {
		_data_->_tmp38_ = _data_->path;
		_data_->_tmp39_ = g_file_new_for_path ((const gchar*) _data_->_tmp38_);
		_g_object_unref0 (_data_->file);
		_data_->file = _data_->_tmp39_;
		_data_->_tmp40_ = _data_->path;
		g_debug ("Using environment variable " "FOLKS_BACKEND_STORE_KEY_FILE_PATH = '%s' to load the backends " "key file.", (const gchar*) _data_->_tmp40_);
	}
	_data_->_tmp41_ = _data_->file;
	_data_->_tmp42_ = _g_object_ref0 (_data_->_tmp41_);
	_g_object_unref0 (_data_->self->priv->_config_file);
	_data_->self->priv->_config_file = _data_->_tmp42_;
	_data_->_tmp43_ = g_key_file_new ();
	_data_->key_file = _data_->_tmp43_;
	{
		_data_->contents_length1 = 0;
		_data_->_contents_size_ = 0;
		_data_->_tmp44_ = _data_->file;
		_data_->_tmp45_ = NULL;
		_data_->_state_ = 1;
		g_file_load_contents_async (_data_->_tmp44_, NULL, _folks_backend_store_load_disabled_backend_names_ready, _data_);
		return FALSE;
		_state_1:
		g_file_load_contents_finish (_data_->_tmp44_, _data_->_res_, &_data_->_tmp45_, &_data_->_tmp46_, NULL, &_data_->_inner_error_);
		_data_->contents = (g_free (_data_->contents), NULL);
		_data_->contents = _data_->_tmp45_;
		_data_->contents_length1 = _data_->_tmp46_;
		_data_->_contents_size_ = _data_->contents_length1;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_data_->contents = (g_free (_data_->contents), NULL);
			goto __catch7_g_error;
		}
		_data_->_tmp47_ = _data_->contents;
		_data_->_tmp47__length1 = _data_->contents_length1;
		_data_->contents_s = (const gchar*) _data_->_tmp47_;
		_data_->_tmp48_ = _data_->contents_s;
		_data_->_tmp49_ = strlen (_data_->_tmp48_);
		_data_->_tmp50_ = _data_->_tmp49_;
		if (_data_->_tmp50_ > 0) {
			_data_->_tmp51_ = _data_->key_file;
			_data_->_tmp52_ = _data_->contents_s;
			_data_->_tmp53_ = _data_->contents_s;
			_data_->_tmp54_ = strlen (_data_->_tmp53_);
			_data_->_tmp55_ = _data_->_tmp54_;
			g_key_file_load_from_data (_data_->_tmp51_, _data_->_tmp52_, (gsize) _data_->_tmp55_, G_KEY_FILE_KEEP_COMMENTS, &_data_->_inner_error_);
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				_data_->contents = (g_free (_data_->contents), NULL);
				goto __catch7_g_error;
			}
		}
		_data_->contents = (g_free (_data_->contents), NULL);
	}
	goto __finally7;
	__catch7_g_error:
	{
		_data_->e1 = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp56_ = _data_->e1;
		if (!g_error_matches (_data_->_tmp56_, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) {
			_data_->_tmp57_ = _data_->file;
			_data_->_tmp58_ = g_file_get_path (_data_->_tmp57_);
			_data_->_tmp59_ = _data_->_tmp58_;
			_data_->_tmp60_ = _data_->e1;
			_data_->_tmp61_ = _data_->_tmp60_->message;
			g_warning ("backend-store.vala:945: The backends key file '%s' could not be loaded" \
": %s", _data_->_tmp59_, _data_->_tmp61_);
			_g_free0 (_data_->_tmp59_);
			_g_error_free0 (_data_->e1);
			{
				_data_->_tmp62_ = _data_->key_file;
				_data_->key_file = NULL;
				_g_key_file_unref0 (_data_->self->priv->_backends_key_file);
				_data_->self->priv->_backends_key_file = _data_->_tmp62_;
			}
			_g_key_file_unref0 (_data_->key_file);
			_g_object_unref0 (_data_->file);
			_g_free0 (_data_->envvar);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (_data_->_task_complete_ != TRUE) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_g_error_free0 (_data_->e1);
	}
	__finally7:
	{
		_data_->_tmp63_ = _data_->key_file;
		_data_->key_file = NULL;
		_g_key_file_unref0 (_data_->self->priv->_backends_key_file);
		_data_->self->priv->_backends_key_file = _data_->_tmp63_;
	}
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_key_file_unref0 (_data_->key_file);
		_g_object_unref0 (_data_->file);
		_g_free0 (_data_->envvar);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_key_file_unref0 (_data_->key_file);
	_g_object_unref0 (_data_->file);
	_g_free0 (_data_->envvar);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void _folks_backend_store_save_key_file_data_free (gpointer _data) {
	FolksBackendStoreSaveKeyFileData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (FolksBackendStoreSaveKeyFileData, _data_);
}


static void _folks_backend_store_save_key_file_async_ready_wrapper (GObject *source_object, GAsyncResult *res, void *user_data) {
	FolksBackendStoreSaveKeyFileData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


static void _folks_backend_store_save_key_file (FolksBackendStore* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	FolksBackendStoreSaveKeyFileData* _data_;
	FolksBackendStore* _tmp0_;
	_data_ = g_slice_new0 (FolksBackendStoreSaveKeyFileData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _folks_backend_store_save_key_file_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, _folks_backend_store_save_key_file_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_folks_backend_store_save_key_file_co (_data_);
}


static void _folks_backend_store_save_key_file_finish (FolksBackendStore* self, GAsyncResult* _res_) {
	FolksBackendStoreSaveKeyFileData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}


static guint8* string_get_data (const gchar* self, int* result_length1) {
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	guint8* _tmp3_;
	gint _tmp3__length1;
	guint8* _tmp4_;
	gint _tmp4__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res_length1;
	_tmp3_ = res;
	_tmp3__length1 = res_length1;
	_tmp4_ = _tmp3_;
	_tmp4__length1 = _tmp3__length1;
	if (result_length1) {
		*result_length1 = _tmp4__length1;
	}
	result = _tmp4_;
	return result;
}


static void _folks_backend_store_save_key_file_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	FolksBackendStoreSaveKeyFileData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	_folks_backend_store_save_key_file_co (_data_);
}


static gboolean _folks_backend_store_save_key_file_co (FolksBackendStoreSaveKeyFileData* _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->_backends_key_file;
	_data_->_tmp1_ = g_key_file_to_data (_data_->_tmp0_, NULL, NULL);
	_data_->key_file_data = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->self->priv->_config_file;
	_data_->_tmp3_ = g_file_get_path (_data_->_tmp2_);
	_data_->_tmp4_ = _data_->_tmp3_;
	g_debug ("backend-store.vala:963: Saving backend key file '%s'.", _data_->_tmp4_);
	_g_free0 (_data_->_tmp4_);
	{
		_data_->_tmp5_ = _data_->self->priv->_config_file;
		_data_->_tmp6_ = string_get_data (_data_->key_file_data, &_data_->_tmp6__length1);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp7__length1 = _data_->_tmp6__length1;
		_data_->_state_ = 1;
		g_file_replace_contents_async (_data_->_tmp5_, _data_->_tmp7_, (gsize) _data_->_tmp7__length1, NULL, FALSE, G_FILE_CREATE_PRIVATE, NULL, _folks_backend_store_save_key_file_ready, _data_);
		return FALSE;
		_state_1:
		g_file_replace_contents_finish (_data_->_tmp5_, _data_->_res_, NULL, &_data_->_inner_error_);
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch8_g_error;
		}
	}
	goto __finally8;
	__catch8_g_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp8_ = _data_->self->priv->_config_file;
		_data_->_tmp9_ = g_file_get_path (_data_->_tmp8_);
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp11_ = _data_->e;
		_data_->_tmp12_ = _data_->_tmp11_->message;
		g_warning ("backend-store.vala:980: Could not write updated backend key file '%s':" \
" %s", _data_->_tmp10_, _data_->_tmp12_);
		_g_free0 (_data_->_tmp10_);
		_g_error_free0 (_data_->e);
	}
	__finally8:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_free0 (_data_->key_file_data);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
		g_clear_error (&_data_->_inner_error_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_free0 (_data_->key_file_data);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


GeeMap* folks_backend_store_get_enabled_backends (FolksBackendStore* self) {
	GeeMap* result;
	GeeMap* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_prepared_backends_ro;
	result = _tmp0_;
	return result;
}


static void folks_backend_store_set_enabled_backends (FolksBackendStore* self, GeeMap* value) {
	g_return_if_fail (self != NULL);
	g_object_notify_by_pspec ((GObject *) self, folks_backend_store_properties[FOLKS_BACKEND_STORE_ENABLED_BACKENDS]);
}


gboolean folks_backend_store_get_is_prepared (FolksBackendStore* self) {
	gboolean result;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_is_prepared;
	result = _tmp0_;
	return result;
}


static void folks_backend_store_set_is_prepared (FolksBackendStore* self, gboolean value) {
	g_return_if_fail (self != NULL);
	g_object_notify_by_pspec ((GObject *) self, folks_backend_store_properties[FOLKS_BACKEND_STORE_IS_PREPARED]);
}


static GObject * folks_backend_store_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	FolksBackendStore * self;
	gchar* debug_no_colour = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* debug_no_color = NULL;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	const gchar* _tmp6_;
	const gchar* _tmp11_;
	FolksDebug* _tmp12_;
	FolksDebug* _tmp13_;
	FolksDebug* _tmp14_;
	GeeHashMap* _tmp15_;
	GeeHashMap* _tmp16_;
	GeeHashMap* _tmp17_;
	GeeHashMap* _tmp18_;
	GeeMap* _tmp19_;
	GeeMap* _tmp20_;
	parent_class = G_OBJECT_CLASS (folks_backend_store_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLKS_TYPE_BACKEND_STORE, FolksBackendStore);
	_tmp0_ = g_getenv ("FOLKS_DEBUG_NO_COLOUR");
	_tmp1_ = g_strdup (_tmp0_);
	debug_no_colour = _tmp1_;
	_tmp2_ = g_getenv ("FOLKS_DEBUG_NO_COLOR");
	_tmp3_ = g_strdup (_tmp2_);
	debug_no_color = _tmp3_;
	_tmp6_ = debug_no_colour;
	if (_tmp6_ == NULL) {
		_tmp5_ = TRUE;
	} else {
		const gchar* _tmp7_;
		_tmp7_ = debug_no_colour;
		_tmp5_ = g_strcmp0 (_tmp7_, "0") == 0;
	}
	if (_tmp5_) {
		gboolean _tmp8_ = FALSE;
		const gchar* _tmp9_;
		_tmp9_ = debug_no_color;
		if (_tmp9_ == NULL) {
			_tmp8_ = TRUE;
		} else {
			const gchar* _tmp10_;
			_tmp10_ = debug_no_color;
			_tmp8_ = g_strcmp0 (_tmp10_, "0") == 0;
		}
		_tmp4_ = _tmp8_;
	} else {
		_tmp4_ = FALSE;
	}
	_tmp11_ = g_getenv ("G_MESSAGES_DEBUG");
	_tmp12_ = folks_debug_dup_with_flags (_tmp11_, _tmp4_);
	_g_object_unref0 (self->priv->_debug);
	self->priv->_debug = _tmp12_;
	_tmp13_ = self->priv->_debug;
	_folks_debug_register_domain (_tmp13_, G_LOG_DOMAIN);
	_tmp14_ = self->priv->_debug;
	g_signal_connect_object (_tmp14_, "print-status", (GCallback) __folks_backend_store_debug_print_status_folks_debug_print_status, self, 0);
	_tmp15_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_POINTER, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->_modules);
	self->priv->_modules = _tmp15_;
	_tmp16_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, FOLKS_TYPE_BACKEND, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->_backend_hash);
	self->priv->_backend_hash = _tmp16_;
	_tmp17_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, FOLKS_TYPE_BACKEND, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->priv->_prepared_backends);
	self->priv->_prepared_backends = _tmp17_;
	_tmp18_ = self->priv->_prepared_backends;
	_tmp19_ = gee_abstract_map_get_read_only_view ((GeeAbstractMap*) _tmp18_);
	_tmp20_ = _tmp19_;
	_g_object_unref0 (self->priv->_prepared_backends_ro);
	self->priv->_prepared_backends_ro = _tmp20_;
	_g_free0 (debug_no_color);
	_g_free0 (debug_no_colour);
	return obj;
}


static void folks_backend_store_class_init (FolksBackendStoreClass * klass) {
	gchar* _tmp0_;
	folks_backend_store_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (FolksBackendStorePrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_folks_backend_store_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_folks_backend_store_set_property;
	G_OBJECT_CLASS (klass)->constructor = folks_backend_store_constructor;
	G_OBJECT_CLASS (klass)->finalize = folks_backend_store_finalize;
	/**
	   * The list of backends visible to this store which have not been explicitly
	   * disabled.
	   *
	   * This list will be empty before {@link BackendStore.load_backends} has been
	   * called.
	   *
	   * The backends in this list have been prepared and are ready to use.
	   *
	   * @since 0.5.1
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKEND_STORE_ENABLED_BACKENDS, folks_backend_store_properties[FOLKS_BACKEND_STORE_ENABLED_BACKENDS] = g_param_spec_object ("enabled-backends", "enabled-backends", "enabled-backends", GEE_TYPE_MAP, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	/**
	   * Whether {@link BackendStore.prepare} has successfully completed for this
	   * store.
	   *
	   * @since 0.3.0
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), FOLKS_BACKEND_STORE_IS_PREPARED, folks_backend_store_properties[FOLKS_BACKEND_STORE_IS_PREPARED] = g_param_spec_boolean ("is-prepared", "is-prepared", "is-prepared", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	/**
	   * Emitted when a backend has been added to the BackendStore.
	   *
	   * This will not be emitted until after {@link BackendStore.load_backends}
	   * has been called.
	   *
	   * {@link Backend}s referenced in this signal are also included in
	   * {@link BackendStore.enabled_backends}.
	   *
	   * @param backend the new {@link Backend}
	   */
	folks_backend_store_signals[FOLKS_BACKEND_STORE_BACKEND_AVAILABLE_SIGNAL] = g_signal_new ("backend-available", FOLKS_TYPE_BACKEND_STORE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, FOLKS_TYPE_BACKEND);
	_tmp0_ = g_strdup ("all-others");
	folks_backend_store_KEY_FILE_GROUP_ALL_OTHERS = _tmp0_;
}


static void folks_backend_store_instance_init (FolksBackendStore * self) {
	self->priv = FOLKS_BACKEND_STORE_GET_PRIVATE (self);
	self->priv->_is_prepared = FALSE;
}


static void folks_backend_store_finalize (GObject * obj) {
	FolksBackendStore * self;
	GeeMapIterator* iter = NULL;
	GeeHashMap* _tmp0_;
	GeeMapIterator* _tmp1_;
	GeeHashMap* _tmp7_;
	GeeHashMap* _tmp23_;
	FolksDebug* _tmp24_;
	guint _tmp25_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FOLKS_TYPE_BACKEND_STORE, FolksBackendStore);
	_tmp0_ = self->priv->_prepared_backends;
	_tmp1_ = gee_abstract_map_map_iterator ((GeeAbstractMap*) _tmp0_);
	iter = _tmp1_;
	while (TRUE) {
		GeeMapIterator* _tmp2_;
		gboolean _tmp3_;
		FolksBackend* backend = NULL;
		GeeMapIterator* _tmp4_;
		gpointer _tmp5_;
		FolksBackend* _tmp6_;
		_tmp2_ = iter;
		_tmp3_ = gee_map_iterator_next (_tmp2_);
		if (!(_tmp3_ == TRUE)) {
			break;
		}
		_tmp4_ = iter;
		_tmp5_ = gee_map_iterator_get_value (_tmp4_);
		backend = (FolksBackend*) _tmp5_;
		_tmp6_ = backend;
		folks_backend_unprepare (_tmp6_, NULL, NULL);
		_g_object_unref0 (backend);
	}
	_tmp7_ = self->priv->_prepared_backends;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp7_);
	{
		GeeIterator* _module_it = NULL;
		GeeHashMap* _tmp8_;
		GeeCollection* _tmp9_;
		GeeCollection* _tmp10_;
		GeeCollection* _tmp11_;
		GeeIterator* _tmp12_;
		GeeIterator* _tmp13_;
		_tmp8_ = self->priv->_modules;
		_tmp9_ = gee_abstract_map_get_values ((GeeAbstractMap*) _tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = _tmp10_;
		_tmp12_ = gee_iterable_iterator ((GeeIterable*) _tmp11_);
		_tmp13_ = _tmp12_;
		_g_object_unref0 (_tmp11_);
		_module_it = _tmp13_;
		while (TRUE) {
			GeeIterator* _tmp14_;
			gboolean _tmp15_;
			GModule* module = NULL;
			GeeIterator* _tmp16_;
			gpointer _tmp17_;
			void* func = NULL;
			GModule* _tmp18_;
			void* _tmp19_ = NULL;
			gboolean _tmp20_;
			_tmp14_ = _module_it;
			_tmp15_ = gee_iterator_next (_tmp14_);
			if (!_tmp15_) {
				break;
			}
			_tmp16_ = _module_it;
			_tmp17_ = gee_iterator_get (_tmp16_);
			module = (GModule*) _tmp17_;
			_tmp18_ = module;
			_tmp20_ = g_module_symbol (_tmp18_, "module_finalize", &_tmp19_);
			func = _tmp19_;
			if (_tmp20_) {
				FolksBackendStoreModuleFinalizeFunc module_finalize = NULL;
				void* _tmp21_;
				FolksBackendStoreModuleFinalizeFunc _tmp22_;
				_tmp21_ = func;
				module_finalize = (FolksBackendStoreModuleFinalizeFunc) _tmp21_;
				_tmp22_ = module_finalize;
				_tmp22_ (self);
			}
		}
		_g_object_unref0 (_module_it);
	}
	_tmp23_ = self->priv->_modules;
	gee_abstract_map_clear ((GeeAbstractMap*) _tmp23_);
	_tmp24_ = self->priv->_debug;
	g_signal_parse_name ("print-status", FOLKS_TYPE_DEBUG, &_tmp25_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_tmp24_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp25_, 0, NULL, (GCallback) __folks_backend_store_debug_print_status_folks_debug_print_status, self);
	folks_backend_store__instance = NULL;
	_g_object_unref0 (iter);
	_g_object_unref0 (self->priv->_backend_hash);
	_g_object_unref0 (self->priv->_backends_allowed);
	_g_object_unref0 (self->priv->_backends_disabled);
	_g_object_unref0 (self->priv->_prepared_backends);
	_g_object_unref0 (self->priv->_prepared_backends_ro);
	_g_object_unref0 (self->priv->_config_file);
	_g_key_file_unref0 (self->priv->_backends_key_file);
	_g_object_unref0 (self->priv->_modules);
	_g_object_unref0 (self->priv->_debug);
	G_OBJECT_CLASS (folks_backend_store_parent_class)->finalize (obj);
}


/**
 * Responsible for backend loading.
 *
 * The BackendStore manages the set of available Folks backends. The
 * {@link BackendStore.load_backends} function loads all compatible and enabled
 * backends and the {@link BackendStore.backend_available} signal notifies when
 * these backends are ready.
 */
GType folks_backend_store_get_type (void) {
	static volatile gsize folks_backend_store_type_id__volatile = 0;
	if (g_once_init_enter (&folks_backend_store_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FolksBackendStoreClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) folks_backend_store_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FolksBackendStore), 0, (GInstanceInitFunc) folks_backend_store_instance_init, NULL };
		GType folks_backend_store_type_id;
		folks_backend_store_type_id = g_type_register_static (G_TYPE_OBJECT, "FolksBackendStore", &g_define_type_info, 0);
		g_once_init_leave (&folks_backend_store_type_id__volatile, folks_backend_store_type_id);
	}
	return folks_backend_store_type_id__volatile;
}


static void _vala_folks_backend_store_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	FolksBackendStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FOLKS_TYPE_BACKEND_STORE, FolksBackendStore);
	switch (property_id) {
		case FOLKS_BACKEND_STORE_ENABLED_BACKENDS:
		g_value_set_object (value, folks_backend_store_get_enabled_backends (self));
		break;
		case FOLKS_BACKEND_STORE_IS_PREPARED:
		g_value_set_boolean (value, folks_backend_store_get_is_prepared (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_folks_backend_store_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	FolksBackendStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FOLKS_TYPE_BACKEND_STORE, FolksBackendStore);
	switch (property_id) {
		case FOLKS_BACKEND_STORE_ENABLED_BACKENDS:
		folks_backend_store_set_enabled_backends (self, g_value_get_object (value));
		break;
		case FOLKS_BACKEND_STORE_IS_PREPARED:
		folks_backend_store_set_is_prepared (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


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


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


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



