/* provider-set.c generated by valac 0.56.19, the Vala compiler
 * generated from provider-set.vala, do not modify */

/*
 * Copyright (c) 2024-2026 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * Authors: Kamil Prusko <kamilprusko@gmail.com>
 */

#include <glib.h>
#include "ft_core.h"
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <gobject/gvaluecollector.h>
#include <libpeas.h>

#define FT_AVAILABILITY_TIMEOUT (FT_INTERVAL_MILLISECOND * 200)
#define FT_AVAILABILITY_TIMEOUT_TOLERANCE (FT_INTERVAL_MILLISECOND * 20)
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

typedef enum  {
	FT_PROVIDER_STATUS_NOT_INITIALIZED,
	FT_PROVIDER_STATUS_INITIALIZING,
	FT_PROVIDER_STATUS_UNINITIALIZING,
	FT_PROVIDER_STATUS_DISABLING,
	FT_PROVIDER_STATUS_DISABLED,
	FT_PROVIDER_STATUS_ENABLING,
	FT_PROVIDER_STATUS_ENABLED
} FtProviderStatus;

#define FT_TYPE_PROVIDER_STATUS (ft_provider_status_get_type ())
typedef enum  {
	FT_PROVIDER_AVAILABILITY_UNKNOWN,
	FT_PROVIDER_AVAILABILITY_AVAILABLE,
	FT_PROVIDER_AVAILABILITY_UNAVAILABLE
} FtProviderAvailability;

#define FT_TYPE_PROVIDER_AVAILABILITY (ft_provider_availability_get_type ())

#define FT_TYPE_PROVIDER_INFO (ft_provider_info_get_type ())
#define FT_PROVIDER_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FT_TYPE_PROVIDER_INFO, FtProviderInfo))
#define FT_PROVIDER_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FT_TYPE_PROVIDER_INFO, FtProviderInfoClass))
#define FT_IS_PROVIDER_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FT_TYPE_PROVIDER_INFO))
#define FT_IS_PROVIDER_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FT_TYPE_PROVIDER_INFO))
#define FT_PROVIDER_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FT_TYPE_PROVIDER_INFO, FtProviderInfoClass))

typedef struct _FtProviderInfo FtProviderInfo;
typedef struct _FtProviderInfoClass FtProviderInfoClass;
typedef struct _FtProviderInfoPrivate FtProviderInfoPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block26Data Block26Data;
#define _ft_provider_info_unref0(var) ((var == NULL) ? NULL : (var = (ft_provider_info_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _FtParamSpecProviderInfo FtParamSpecProviderInfo;
enum  {
	FT_PROVIDER_SET_0_PROPERTY,
	FT_PROVIDER_SET_T_TYPE,
	FT_PROVIDER_SET_T_DUP_FUNC,
	FT_PROVIDER_SET_T_DESTROY_FUNC,
	FT_PROVIDER_SET_SELECTION_MODE_PROPERTY,
	FT_PROVIDER_SET_NUM_PROPERTIES
};
static GParamSpec* ft_provider_set_properties[FT_PROVIDER_SET_NUM_PROPERTIES];
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _Block27Data Block27Data;
typedef struct _Block28Data Block28Data;
typedef struct _Block29Data Block29Data;
typedef struct _Block30Data Block30Data;
typedef struct _Block31Data Block31Data;
typedef struct _Block32Data Block32Data;
typedef struct _Block33Data Block33Data;
typedef struct _Block34Data Block34Data;
typedef struct _Block35Data Block35Data;
typedef struct _Block36Data Block36Data;
typedef struct _Block37Data Block37Data;
enum  {
	FT_PROVIDER_SET_PROVIDER_SELECTED_SIGNAL,
	FT_PROVIDER_SET_PROVIDER_UNSELECTED_SIGNAL,
	FT_PROVIDER_SET_PROVIDER_ENABLED_SIGNAL,
	FT_PROVIDER_SET_PROVIDER_DISABLED_SIGNAL,
	FT_PROVIDER_SET_SELECTION_CHANGED_SIGNAL,
	FT_PROVIDER_SET_NUM_SIGNALS
};
static guint ft_provider_set_signals[FT_PROVIDER_SET_NUM_SIGNALS] = {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 _FtProviderInfo {
	GTypeInstance parent_instance;
	volatile int ref_count;
	FtProviderInfoPrivate * priv;
	FtProvider* instance;
	FtPriority priority;
	FtProviderStatus status;
	gboolean selected;
	GCancellable* cancellable;
	gint64 initialization_time;
	gboolean destroying;
};

struct _FtProviderInfoClass {
	GTypeClass parent_class;
	void (*finalize) (FtProviderInfo *self);
};

struct _Block26Data {
	int _ref_count_;
	FtProviderInfo* self;
	FtProvider* provider;
};

struct _FtParamSpecProviderInfo {
	GParamSpec parent_instance;
};

struct _FtProviderSetPrivate {
	GType t_type;
	GBoxedCopyFunc t_dup_func;
	GDestroyNotify t_destroy_func;
	FtSelectionMode _selection_mode;
	GHashTable* providers;
	PeasExtensionSet* extension_set;
	guint update_selection_timeout_id;
	guint update_selection_idle_id;
	gboolean selection_invalid;
	gboolean updating_selection;
	gboolean should_enable;
};

struct _Block27Data {
	int _ref_count_;
	FtProviderSet* self;
	FtProvider* provider;
	FtProviderInfo* provider_info;
};

struct _Block28Data {
	int _ref_count_;
	FtProviderSet* self;
	FtProviderInfo* tmp_preferred_provider_info;
	gint64 tmp_preferred_provider_timeout;
	gint64 monotonic_time;
};

struct _Block29Data {
	int _ref_count_;
	GHashTable* self;
	GFunc func;
	gpointer func_target;
};

struct _Block30Data {
	int _ref_count_;
	FtProviderSet* self;
	FtProviderInfo* preferred_provider_info;
	gboolean selection_changed;
};

struct _Block31Data {
	int _ref_count_;
	FtProviderSet* self;
	gboolean selection_changed;
};

struct _Block32Data {
	int _ref_count_;
	FtProviderSet* self;
	gboolean selection_changed;
};

struct _Block33Data {
	int _ref_count_;
	FtProviderSet* self;
	FtProviderInfo* provider_info;
	FtProvider* instance;
};

struct _Block34Data {
	int _ref_count_;
	FtProviderSet* self;
	FtProviderInfo** providers;
	gint providers_length1;
	gint _providers_size_;
};

struct _Block35Data {
	int _ref_count_;
	FtProviderSet* self;
	GFunc func;
	gpointer func_target;
};

struct _Block36Data {
	int _ref_count_;
	FtProviderSet* self;
	GFunc func;
	gpointer func_target;
};

struct _Block37Data {
	int _ref_count_;
	FtProviderSet* self;
	GFunc func;
	gpointer func_target;
};

static gpointer ft_provider_info_parent_class = NULL;
static gint FtProviderSet_private_offset;
static gpointer ft_provider_set_parent_class = NULL;

VALA_EXTERN GType ft_provider_status_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gboolean ft_provider_status_is_transient (FtProviderStatus self);
VALA_EXTERN GType ft_provider_availability_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gint ft_provider_availability_compare (FtProviderAvailability value,
                                       FtProviderAvailability other);
VALA_EXTERN gpointer ft_provider_info_ref (gpointer instance);
VALA_EXTERN void ft_provider_info_unref (gpointer instance);
VALA_EXTERN GParamSpec* ft_param_spec_provider_info (const gchar* name,
                                         const gchar* nick,
                                         const gchar* blurb,
                                         GType object_type,
                                         GParamFlags flags);
VALA_EXTERN void ft_value_set_provider_info (GValue* value,
                                 gpointer v_object);
VALA_EXTERN void ft_value_take_provider_info (GValue* value,
                                  gpointer v_object);
VALA_EXTERN gpointer ft_value_get_provider_info (const GValue* value);
VALA_EXTERN GType ft_provider_info_get_type (void) G_GNUC_CONST ;
VALA_EXTERN FtProviderInfo* ft_provider_info_new (FtProvider* instance,
                                      FtPriority priority);
VALA_EXTERN FtProviderInfo* ft_provider_info_construct (GType object_type,
                                            FtProvider* instance,
                                            FtPriority priority);
VALA_EXTERN gint64 ft_provider_info_get_availability_timeout (FtProviderInfo* self,
                                                  gint64* monotonic_time);
static void ft_provider_info_destroy_internal (FtProviderInfo* self);
static Block26Data* block26_data_ref (Block26Data* _data26_);
static void block26_data_unref (void * _userdata_);
VALA_EXTERN void ft_provider_set_enabled (FtProvider* self,
                              gboolean value);
static void ___lambda10_ (Block26Data* _data26_,
                   GObject* obj,
                   GAsyncResult* res);
static void ____lambda10__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void ____lambda11_ (Block26Data* _data26_,
                    GObject* obj,
                    GAsyncResult* res);
static void _____lambda11__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
VALA_EXTERN void ft_provider_info_destroy (FtProviderInfo* self);
static void ft_provider_info_finalize (FtProviderInfo * obj);
static GType ft_provider_info_get_type_once (void);
static void ft_provider_set_check_provider_status (FtProviderSet* self,
                                            FtProviderInfo* provider_info);
static Block27Data* block27_data_ref (Block27Data* _data27_);
static void block27_data_unref (void * _userdata_);
static void ____lambda12_ (Block27Data* _data27_,
                    GObject* obj,
                    GAsyncResult* res);
static void ft_provider_set_queue_update_selection (FtProviderSet* self);
static void _____lambda12__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void _____lambda19_ (Block27Data* _data27_,
                     GObject* obj,
                     GAsyncResult* res);
static void ______lambda19__gasync_ready_callback (GObject* source_object,
                                            GAsyncResult* res,
                                            gpointer self);
static void ______lambda20_ (Block27Data* _data27_,
                      GObject* obj,
                      GAsyncResult* res);
static void _______lambda20__gasync_ready_callback (GObject* source_object,
                                             GAsyncResult* res,
                                             gpointer self);
static void ____lambda21_ (Block27Data* _data27_,
                    GObject* obj,
                    GAsyncResult* res);
static void _____lambda21__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static FtProviderAvailability ft_provider_set_get_availability (FtProviderInfo* provider_info,
                                                         gint64 provider_timeout);
static gint ft_provider_set_compare (FtProviderInfo* provider_info,
                              gint64 provider_timeout,
                              FtProviderInfo* other_info,
                              gint64 other_timeout);
static void ft_provider_set_get_preferred_provider_info (FtProviderSet* self,
                                                  FtProviderInfo** preferred_provider_info,
                                                  gint64* preferred_provider_timeout);
static Block28Data* block28_data_ref (Block28Data* _data28_);
static void block28_data_unref (void * _userdata_);
static Block29Data* block29_data_ref (Block29Data* _data29_);
static void block29_data_unref (void * _userdata_);
static void ___lambda2__gh_func (gconstpointer key,
                          gconstpointer value,
                          gpointer self);
static void __lambda15_ (Block28Data* _data28_,
                  FtProviderInfo* provider_info);
static void ___lambda15__gfunc (gconstpointer data,
                         gpointer self);
static void ft_provider_set_select_single (FtProviderSet* self);
static Block30Data* block30_data_ref (Block30Data* _data30_);
static void block30_data_unref (void * _userdata_);
static void ft_provider_set_select_none (FtProviderSet* self);
static void ft_provider_set_schedule_update_selection (FtProviderSet* self,
                                                gint64 timeout);
static void __lambda17_ (Block30Data* _data30_,
                  FtProviderInfo* provider_info);
static void ___lambda17__gfunc (gconstpointer data,
                         gpointer self);
static Block31Data* block31_data_ref (Block31Data* _data31_);
static void block31_data_unref (void * _userdata_);
static void __lambda14_ (Block31Data* _data31_,
                  FtProviderInfo* provider_info);
static void ___lambda14__gfunc (gconstpointer data,
                         gpointer self);
static void ft_provider_set_select_all (FtProviderSet* self);
static Block32Data* block32_data_ref (Block32Data* _data32_);
static void block32_data_unref (void * _userdata_);
static void __lambda18_ (Block32Data* _data32_,
                  FtProviderInfo* provider_info);
static void ___lambda18__gfunc (gconstpointer data,
                         gpointer self);
static void ft_provider_set_update_selection (FtProviderSet* self);
static gboolean __lambda16_ (FtProviderSet* self);
static gboolean ___lambda16__gsource_func (gpointer self);
static gboolean __lambda13_ (FtProviderSet* self);
static gboolean ___lambda13__gsource_func (gpointer self);
static FtProviderInfo* ft_provider_set_lookup_info (FtProviderSet* self,
                                             FtProvider* instance);
static Block33Data* block33_data_ref (Block33Data* _data33_);
static void block33_data_unref (void * _userdata_);
static void __lambda22_ (Block33Data* _data33_,
                  FtProviderInfo* _provider_info);
static void ___lambda22__gfunc (gconstpointer data,
                         gpointer self);
static void ft_provider_set_on_provider_notify_available (FtProviderSet* self,
                                                   GObject* object,
                                                   GParamSpec* pspec);
static void ft_provider_set_on_provider_notify_enabled (FtProviderSet* self,
                                                 GObject* object,
                                                 GParamSpec* pspec);
static void ft_provider_set_destroy_info (FtProviderSet* self,
                                   FtProviderInfo* provider_info);
static void _ft_provider_set_on_provider_notify_available_g_object_notify (GObject* _sender,
                                                                    GParamSpec* pspec,
                                                                    gpointer self);
static void _ft_provider_set_on_provider_notify_enabled_g_object_notify (GObject* _sender,
                                                                  GParamSpec* pspec,
                                                                  gpointer self);
static Block34Data* block34_data_ref (Block34Data* _data34_);
static void block34_data_unref (void * _userdata_);
static void __lambda23_ (Block34Data* _data34_,
                  FtProviderInfo* provider_info);
static void _vala_array_add21 (FtProviderInfo** * array,
                        gint* length,
                        gint* size,
                        FtProviderInfo* value);
static void ___lambda23__gfunc (gconstpointer data,
                         gpointer self);
static void ft_provider_set_add_extension (FtProviderSet* self,
                                    PeasPluginInfo* info,
                                    GObject* extension);
static void _vala_GValue_array_free (GValue * array,
                              gssize array_length);
static void ft_provider_set_on_extension_added (FtProviderSet* self,
                                         PeasPluginInfo* info,
                                         GObject* extension);
static void _ft_provider_set_on_extension_added_peas_extension_set_extension_added (PeasExtensionSet* _sender,
                                                                             PeasPluginInfo* info,
                                                                             GObject* extension,
                                                                             gpointer self);
static void ft_provider_set_on_extension_removed (FtProviderSet* self,
                                           PeasPluginInfo* info,
                                           GObject* extension);
static void _ft_provider_set_on_extension_removed_peas_extension_set_extension_removed (PeasExtensionSet* _sender,
                                                                                 PeasPluginInfo* info,
                                                                                 GObject* extension,
                                                                                 gpointer self);
static void __lambda24_ (FtProviderSet* self,
                  FtProviderInfo* provider_info);
static void ___lambda24__gfunc (gconstpointer data,
                         gpointer self);
static void __lambda25_ (FtProviderSet* self,
                  FtProviderInfo* provider_info);
static void ___lambda25__gfunc (gconstpointer data,
                         gpointer self);
static Block35Data* block35_data_ref (Block35Data* _data35_);
static void block35_data_unref (void * _userdata_);
static void __lambda26_ (Block35Data* _data35_,
                  FtProviderInfo* provider_info);
static void ___lambda26__gfunc (gconstpointer data,
                         gpointer self);
static Block36Data* block36_data_ref (Block36Data* _data36_);
static void block36_data_unref (void * _userdata_);
static void __lambda27_ (Block36Data* _data36_,
                  FtProviderInfo* provider_info);
static void ___lambda27__gfunc (gconstpointer data,
                         gpointer self);
static Block37Data* block37_data_ref (Block37Data* _data37_);
static void block37_data_unref (void * _userdata_);
static void __lambda28_ (Block37Data* _data37_,
                  FtProviderInfo* provider_info);
static void ___lambda28__gfunc (gconstpointer data,
                         gpointer self);
static void ft_provider_set_real_dispose (GObject* base);
static GObject * ft_provider_set_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties);
static void _ft_provider_info_unref0_ (gpointer var);
static void ft_provider_set_finalize (GObject * obj);
static GType ft_provider_set_get_type_once (void);
static void _vala_ft_provider_set_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec);
static void _vala_ft_provider_set_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static GType
ft_selection_mode_get_type_once (void)
{
	static const GEnumValue values[] = {{FT_SELECTION_MODE_NONE, "FT_SELECTION_MODE_NONE", "none"}, {FT_SELECTION_MODE_SINGLE, "FT_SELECTION_MODE_SINGLE", "single"}, {FT_SELECTION_MODE_ALL, "FT_SELECTION_MODE_ALL", "all"}, {0, NULL, NULL}};
	GType ft_selection_mode_type_id;
	ft_selection_mode_type_id = g_enum_register_static ("FtSelectionMode", values);
	return ft_selection_mode_type_id;
}

GType
ft_selection_mode_get_type (void)
{
	static volatile gsize ft_selection_mode_type_id__once = 0;
	if (g_once_init_enter (&ft_selection_mode_type_id__once)) {
		GType ft_selection_mode_type_id;
		ft_selection_mode_type_id = ft_selection_mode_get_type_once ();
		g_once_init_leave (&ft_selection_mode_type_id__once, ft_selection_mode_type_id);
	}
	return ft_selection_mode_type_id__once;
}

gboolean
ft_provider_status_is_transient (FtProviderStatus self)
{
	gboolean result;
	switch (self) {
		case FT_PROVIDER_STATUS_INITIALIZING:
		case FT_PROVIDER_STATUS_UNINITIALIZING:
		case FT_PROVIDER_STATUS_DISABLING:
		case FT_PROVIDER_STATUS_ENABLING:
		{
			result = TRUE;
			return result;
		}
		default:
		{
			result = FALSE;
			return result;
		}
	}
}

static GType
ft_provider_status_get_type_once (void)
{
	static const GEnumValue values[] = {{FT_PROVIDER_STATUS_NOT_INITIALIZED, "FT_PROVIDER_STATUS_NOT_INITIALIZED", "not-initialized"}, {FT_PROVIDER_STATUS_INITIALIZING, "FT_PROVIDER_STATUS_INITIALIZING", "initializing"}, {FT_PROVIDER_STATUS_UNINITIALIZING, "FT_PROVIDER_STATUS_UNINITIALIZING", "uninitializing"}, {FT_PROVIDER_STATUS_DISABLING, "FT_PROVIDER_STATUS_DISABLING", "disabling"}, {FT_PROVIDER_STATUS_DISABLED, "FT_PROVIDER_STATUS_DISABLED", "disabled"}, {FT_PROVIDER_STATUS_ENABLING, "FT_PROVIDER_STATUS_ENABLING", "enabling"}, {FT_PROVIDER_STATUS_ENABLED, "FT_PROVIDER_STATUS_ENABLED", "enabled"}, {0, NULL, NULL}};
	GType ft_provider_status_type_id;
	ft_provider_status_type_id = g_enum_register_static ("FtProviderStatus", values);
	return ft_provider_status_type_id;
}

GType
ft_provider_status_get_type (void)
{
	static volatile gsize ft_provider_status_type_id__once = 0;
	if (g_once_init_enter (&ft_provider_status_type_id__once)) {
		GType ft_provider_status_type_id;
		ft_provider_status_type_id = ft_provider_status_get_type_once ();
		g_once_init_leave (&ft_provider_status_type_id__once, ft_provider_status_type_id);
	}
	return ft_provider_status_type_id__once;
}

gint
ft_provider_availability_compare (FtProviderAvailability value,
                                  FtProviderAvailability other)
{
	gint _tmp0_ = 0;
	gint result;
	if (value == other) {
		result = 0;
		return result;
	}
	if (value == FT_PROVIDER_AVAILABILITY_AVAILABLE) {
		result = -1;
		return result;
	}
	if (other == FT_PROVIDER_AVAILABILITY_AVAILABLE) {
		result = 1;
		return result;
	}
	if (value == FT_PROVIDER_AVAILABILITY_UNKNOWN) {
		_tmp0_ = -1;
	} else {
		_tmp0_ = 1;
	}
	result = _tmp0_;
	return result;
}

static GType
ft_provider_availability_get_type_once (void)
{
	static const GEnumValue values[] = {{FT_PROVIDER_AVAILABILITY_UNKNOWN, "FT_PROVIDER_AVAILABILITY_UNKNOWN", "unknown"}, {FT_PROVIDER_AVAILABILITY_AVAILABLE, "FT_PROVIDER_AVAILABILITY_AVAILABLE", "available"}, {FT_PROVIDER_AVAILABILITY_UNAVAILABLE, "FT_PROVIDER_AVAILABILITY_UNAVAILABLE", "unavailable"}, {0, NULL, NULL}};
	GType ft_provider_availability_type_id;
	ft_provider_availability_type_id = g_enum_register_static ("FtProviderAvailability", values);
	return ft_provider_availability_type_id;
}

GType
ft_provider_availability_get_type (void)
{
	static volatile gsize ft_provider_availability_type_id__once = 0;
	if (g_once_init_enter (&ft_provider_availability_type_id__once)) {
		GType ft_provider_availability_type_id;
		ft_provider_availability_type_id = ft_provider_availability_get_type_once ();
		g_once_init_leave (&ft_provider_availability_type_id__once, ft_provider_availability_type_id);
	}
	return ft_provider_availability_type_id__once;
}

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

FtProviderInfo*
ft_provider_info_construct (GType object_type,
                            FtProvider* instance,
                            FtPriority priority)
{
	FtProviderInfo* self = NULL;
	FtProvider* _tmp0_;
	g_return_val_if_fail (instance != NULL, NULL);
	self = (FtProviderInfo*) g_type_create_instance (object_type);
	_tmp0_ = _g_object_ref0 (instance);
	_g_object_unref0 (self->instance);
	self->instance = _tmp0_;
	self->priority = priority;
	return self;
}

FtProviderInfo*
ft_provider_info_new (FtProvider* instance,
                      FtPriority priority)
{
	return ft_provider_info_construct (FT_TYPE_PROVIDER_INFO, instance, priority);
}

/**
         * Return time since initialization.
         */
gint64
ft_provider_info_get_availability_timeout (FtProviderInfo* self,
                                           gint64* monotonic_time)
{
	FtProvider* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gint64 result;
	g_return_val_if_fail (self != NULL, -1LL);
	_tmp0_ = self->instance;
	_tmp1_ = ft_provider_get_available_set (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		result = (gint64) 0;
		return result;
	}
	if (ft_timestamp_is_undefined (self->initialization_time)) {
		result = (gint64) 0;
		return result;
	}
	if (ft_timestamp_is_undefined (*monotonic_time)) {
		*monotonic_time = g_get_monotonic_time ();
	}
	result = (*monotonic_time) - self->initialization_time;
	return result;
}

static Block26Data*
block26_data_ref (Block26Data* _data26_)
{
	g_atomic_int_inc (&_data26_->_ref_count_);
	return _data26_;
}

static void
block26_data_unref (void * _userdata_)
{
	Block26Data* _data26_;
	_data26_ = (Block26Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data26_->_ref_count_)) {
		FtProviderInfo* self;
		self = _data26_->self;
		_g_object_unref0 (_data26_->provider);
		_ft_provider_info_unref0 (self);
		g_slice_free (Block26Data, _data26_);
	}
}

static void
___lambda10_ (Block26Data* _data26_,
              GObject* obj,
              GAsyncResult* res)
{
	FtProviderInfo* self;
	GError* _inner_error0_ = NULL;
	self = _data26_->self;
	g_return_if_fail (res != NULL);
	{
		FtProvider* _tmp0_;
		_tmp0_ = _data26_->provider;
		ft_provider_disable_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		FtProvider* _tmp1_;
		const gchar* _tmp2_;
		GError* _tmp3_;
		const gchar* _tmp4_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = _data26_->provider;
		_tmp2_ = g_type_name (G_TYPE_FROM_INSTANCE ((GObject*) _tmp1_));
		_tmp3_ = _error_;
		_tmp4_ = _tmp3_->message;
		g_warning ("provider-set.vala:141: Error while disabling %s: %s", _tmp2_, _tmp4_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	self->status = FT_PROVIDER_STATUS_DISABLED;
	ft_provider_info_destroy_internal (self);
}

static void
____lambda10__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	___lambda10_ (self, source_object, res);
	block26_data_unref (self);
}

static void
____lambda11_ (Block26Data* _data26_,
               GObject* obj,
               GAsyncResult* res)
{
	FtProviderInfo* self;
	GError* _inner_error0_ = NULL;
	self = _data26_->self;
	g_return_if_fail (res != NULL);
	{
		FtProvider* _tmp0_;
		_tmp0_ = _data26_->provider;
		ft_provider_uninitialize_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		FtProvider* _tmp1_;
		const gchar* _tmp2_;
		GError* _tmp3_;
		const gchar* _tmp4_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = _data26_->provider;
		_tmp2_ = g_type_name (G_TYPE_FROM_INSTANCE ((GObject*) _tmp1_));
		_tmp3_ = _error_;
		_tmp4_ = _tmp3_->message;
		g_warning ("provider-set.vala:159: Error while uninitializing %s: %s", _tmp2_, _tmp4_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	self->status = FT_PROVIDER_STATUS_NOT_INITIALIZED;
	ft_provider_info_destroy_internal (self);
}

static void
_____lambda11__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda11_ (self, source_object, res);
	block26_data_unref (self);
}

static void
ft_provider_info_destroy_internal (FtProviderInfo* self)
{
	Block26Data* _data26_;
	FtProvider* _tmp0_;
	FtProvider* _tmp1_;
	gboolean _tmp2_ = FALSE;
	FtProvider* _tmp3_;
	g_return_if_fail (self != NULL);
	_data26_ = g_slice_new0 (Block26Data);
	_data26_->_ref_count_ = 1;
	_data26_->self = ft_provider_info_ref (self);
	_tmp0_ = self->instance;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_data26_->provider = _tmp1_;
	_tmp3_ = _data26_->provider;
	if (_tmp3_ == NULL) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = ft_provider_status_is_transient (self->status);
	}
	if (_tmp2_) {
		block26_data_unref (_data26_);
		_data26_ = NULL;
		return;
	}
	if (self->status == FT_PROVIDER_STATUS_ENABLED) {
		FtProvider* _tmp4_;
		FtProvider* _tmp5_;
		self->status = FT_PROVIDER_STATUS_DISABLING;
		_tmp4_ = _data26_->provider;
		ft_provider_set_enabled (_tmp4_, FALSE);
		_tmp5_ = _data26_->provider;
		ft_provider_disable (_tmp5_, ____lambda10__gasync_ready_callback, block26_data_ref (_data26_));
	} else {
		if (self->status == FT_PROVIDER_STATUS_DISABLED) {
			FtProvider* _tmp6_;
			self->status = FT_PROVIDER_STATUS_UNINITIALIZING;
			_tmp6_ = _data26_->provider;
			ft_provider_uninitialize (_tmp6_, _____lambda11__gasync_ready_callback, block26_data_ref (_data26_));
		} else {
			if (self->status == FT_PROVIDER_STATUS_NOT_INITIALIZED) {
				_g_object_unref0 (self->instance);
				self->instance = NULL;
			}
		}
	}
	block26_data_unref (_data26_);
	_data26_ = NULL;
}

void
ft_provider_info_destroy (FtProviderInfo* self)
{
	GCancellable* _tmp0_;
	g_return_if_fail (self != NULL);
	self->destroying = TRUE;
	_tmp0_ = self->cancellable;
	if (_tmp0_ != NULL) {
		GCancellable* _tmp1_;
		_tmp1_ = self->cancellable;
		g_cancellable_cancel (_tmp1_);
		_g_object_unref0 (self->cancellable);
		self->cancellable = NULL;
	}
	ft_provider_info_destroy_internal (self);
}

static void
ft_value_provider_info_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
ft_value_provider_info_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		ft_provider_info_unref (value->data[0].v_pointer);
	}
}

static void
ft_value_provider_info_copy_value (const GValue* src_value,
                                   GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = ft_provider_info_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
ft_value_provider_info_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
ft_value_provider_info_collect_value (GValue* value,
                                      guint n_collect_values,
                                      GTypeCValue* collect_values,
                                      guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		FtProviderInfo * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = ft_provider_info_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
ft_value_provider_info_lcopy_value (const GValue* value,
                                    guint n_collect_values,
                                    GTypeCValue* collect_values,
                                    guint collect_flags)
{
	FtProviderInfo ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = ft_provider_info_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
ft_param_spec_provider_info (const gchar* name,
                             const gchar* nick,
                             const gchar* blurb,
                             GType object_type,
                             GParamFlags flags)
{
	FtParamSpecProviderInfo* spec;
	g_return_val_if_fail (g_type_is_a (object_type, FT_TYPE_PROVIDER_INFO), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
ft_value_get_provider_info (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FT_TYPE_PROVIDER_INFO), NULL);
	return value->data[0].v_pointer;
}

void
ft_value_set_provider_info (GValue* value,
                            gpointer v_object)
{
	FtProviderInfo * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FT_TYPE_PROVIDER_INFO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FT_TYPE_PROVIDER_INFO));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		ft_provider_info_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		ft_provider_info_unref (old);
	}
}

void
ft_value_take_provider_info (GValue* value,
                             gpointer v_object)
{
	FtProviderInfo * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FT_TYPE_PROVIDER_INFO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FT_TYPE_PROVIDER_INFO));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		ft_provider_info_unref (old);
	}
}

static void
ft_provider_info_class_init (FtProviderInfoClass * klass,
                             gpointer klass_data)
{
	ft_provider_info_parent_class = g_type_class_peek_parent (klass);
	((FtProviderInfoClass *) klass)->finalize = ft_provider_info_finalize;
}

static void
ft_provider_info_instance_init (FtProviderInfo * self,
                                gpointer klass)
{
	self->status = FT_PROVIDER_STATUS_NOT_INITIALIZED;
	self->selected = FALSE;
	self->cancellable = NULL;
	self->initialization_time = FT_TIMESTAMP_UNDEFINED;
	self->destroying = FALSE;
	self->ref_count = 1;
}

static void
ft_provider_info_finalize (FtProviderInfo * obj)
{
	FtProviderInfo * self;
	FtProvider* _tmp0_;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_PROVIDER_INFO, FtProviderInfo);
	g_signal_handlers_destroy (self);
	_tmp0_ = self->instance;
	_vala_assert (_tmp0_ == NULL, "this.instance == null");
	_g_object_unref0 (self->instance);
	_g_object_unref0 (self->cancellable);
}

static GType
ft_provider_info_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { ft_value_provider_info_init, ft_value_provider_info_free_value, ft_value_provider_info_copy_value, ft_value_provider_info_peek_pointer, "p", ft_value_provider_info_collect_value, "p", ft_value_provider_info_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (FtProviderInfoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_provider_info_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtProviderInfo), 0, (GInstanceInitFunc) ft_provider_info_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType ft_provider_info_type_id;
	ft_provider_info_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FtProviderInfo", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return ft_provider_info_type_id;
}

GType
ft_provider_info_get_type (void)
{
	static volatile gsize ft_provider_info_type_id__once = 0;
	if (g_once_init_enter (&ft_provider_info_type_id__once)) {
		GType ft_provider_info_type_id;
		ft_provider_info_type_id = ft_provider_info_get_type_once ();
		g_once_init_leave (&ft_provider_info_type_id__once, ft_provider_info_type_id);
	}
	return ft_provider_info_type_id__once;
}

gpointer
ft_provider_info_ref (gpointer instance)
{
	FtProviderInfo * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
ft_provider_info_unref (gpointer instance)
{
	FtProviderInfo * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		FT_PROVIDER_INFO_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
ft_provider_set_get_instance_private (FtProviderSet* self)
{
	return G_STRUCT_MEMBER_P (self, FtProviderSet_private_offset);
}

FtProviderSet*
ft_provider_set_construct (GType object_type,
                           GType t_type,
                           GBoxedCopyFunc t_dup_func,
                           GDestroyNotify t_destroy_func,
                           FtSelectionMode selection_mode)
{
	FtProviderSet * self = NULL;
	self = (FtProviderSet*) g_object_new (object_type, "t-type", t_type, "t-dup-func", t_dup_func, "t-destroy-func", t_destroy_func, "selection-mode", selection_mode, NULL);
	self->priv->t_type = t_type;
	self->priv->t_dup_func = t_dup_func;
	self->priv->t_destroy_func = t_destroy_func;
	return self;
}

FtProviderSet*
ft_provider_set_new (GType t_type,
                     GBoxedCopyFunc t_dup_func,
                     GDestroyNotify t_destroy_func,
                     FtSelectionMode selection_mode)
{
	return ft_provider_set_construct (FT_TYPE_PROVIDER_SET, t_type, t_dup_func, t_destroy_func, selection_mode);
}

/**
         * Manage provider according to its status.
         *
         * It should be called after every async action or status changed.
         */
static gpointer
_ft_provider_info_ref0 (gpointer self)
{
	return self ? ft_provider_info_ref (self) : NULL;
}

static Block27Data*
block27_data_ref (Block27Data* _data27_)
{
	g_atomic_int_inc (&_data27_->_ref_count_);
	return _data27_;
}

static void
block27_data_unref (void * _userdata_)
{
	Block27Data* _data27_;
	_data27_ = (Block27Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data27_->_ref_count_)) {
		FtProviderSet* self;
		self = _data27_->self;
		_g_object_unref0 (_data27_->provider);
		_ft_provider_info_unref0 (_data27_->provider_info);
		_g_object_unref0 (self);
		g_slice_free (Block27Data, _data27_);
	}
}

static void
____lambda12_ (Block27Data* _data27_,
               GObject* obj,
               GAsyncResult* res)
{
	FtProviderSet* self;
	GError* _inner_error0_ = NULL;
	self = _data27_->self;
	g_return_if_fail (res != NULL);
	{
		FtProvider* _tmp0_;
		gboolean _tmp1_ = FALSE;
		_tmp0_ = _data27_->provider;
		ft_provider_initialize_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data27_->provider_info->status = FT_PROVIDER_STATUS_DISABLED;
		ft_provider_set_check_provider_status (self, _data27_->provider_info);
		if (_data27_->provider_info->selected) {
			FtProvider* _tmp2_;
			gboolean _tmp3_;
			gboolean _tmp4_;
			_tmp2_ = _data27_->provider;
			_tmp3_ = ft_provider_get_available_set (_tmp2_);
			_tmp4_ = _tmp3_;
			_tmp1_ = !_tmp4_;
		} else {
			_tmp1_ = FALSE;
		}
		if (_tmp1_) {
			ft_provider_set_queue_update_selection (self);
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		FtProvider* _tmp5_;
		const gchar* _tmp6_;
		GError* _tmp7_;
		const gchar* _tmp8_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = _data27_->provider;
		_tmp6_ = g_type_name (G_TYPE_FROM_INSTANCE ((GObject*) _tmp5_));
		_tmp7_ = _error_;
		_tmp8_ = _tmp7_->message;
		g_warning ("provider-set.vala:262: Error while initializing %s: %s", _tmp6_, _tmp8_);
		_data27_->provider_info->status = FT_PROVIDER_STATUS_NOT_INITIALIZED;
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
_____lambda12__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda12_ (self, source_object, res);
	block27_data_unref (self);
}

static void
_____lambda19_ (Block27Data* _data27_,
                GObject* obj,
                GAsyncResult* res)
{
	FtProviderSet* self;
	GError* _inner_error0_ = NULL;
	self = _data27_->self;
	g_return_if_fail (res != NULL);
	{
		FtProvider* _tmp0_;
		FtProvider* _tmp1_;
		_tmp0_ = _data27_->provider;
		ft_provider_enable_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data27_->provider_info->status = FT_PROVIDER_STATUS_ENABLED;
		_tmp1_ = _data27_->provider;
		ft_provider_set_enabled (_tmp1_, TRUE);
		ft_provider_set_check_provider_status (self, _data27_->provider_info);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		FtProvider* _tmp2_;
		const gchar* _tmp3_;
		GError* _tmp4_;
		const gchar* _tmp5_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = _data27_->provider;
		_tmp3_ = g_type_name (G_TYPE_FROM_INSTANCE ((GObject*) _tmp2_));
		_tmp4_ = _error_;
		_tmp5_ = _tmp4_->message;
		g_warning ("provider-set.vala:285: Error while enabling %s: %s", _tmp3_, _tmp5_);
		_data27_->provider_info->status = FT_PROVIDER_STATUS_DISABLED;
		if (_data27_->provider_info->destroying) {
			ft_provider_info_destroy (_data27_->provider_info);
		}
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
______lambda19__gasync_ready_callback (GObject* source_object,
                                       GAsyncResult* res,
                                       gpointer self)
{
	_____lambda19_ (self, source_object, res);
	block27_data_unref (self);
}

static void
______lambda20_ (Block27Data* _data27_,
                 GObject* obj,
                 GAsyncResult* res)
{
	FtProviderSet* self;
	GError* _inner_error0_ = NULL;
	self = _data27_->self;
	g_return_if_fail (res != NULL);
	{
		FtProvider* _tmp0_;
		_tmp0_ = _data27_->provider;
		ft_provider_disable_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data27_->provider_info->status = FT_PROVIDER_STATUS_DISABLED;
		ft_provider_set_check_provider_status (self, _data27_->provider_info);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		FtProvider* _tmp1_;
		const gchar* _tmp2_;
		GError* _tmp3_;
		const gchar* _tmp4_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = _data27_->provider;
		_tmp2_ = g_type_name (G_TYPE_FROM_INSTANCE ((GObject*) _tmp1_));
		_tmp3_ = _error_;
		_tmp4_ = _tmp3_->message;
		g_warning ("provider-set.vala:310: Error while disabling %s: %s", _tmp2_, _tmp4_);
		_data27_->provider_info->status = FT_PROVIDER_STATUS_DISABLED;
		if (_data27_->provider_info->destroying) {
			ft_provider_info_destroy (_data27_->provider_info);
		}
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
_______lambda20__gasync_ready_callback (GObject* source_object,
                                        GAsyncResult* res,
                                        gpointer self)
{
	______lambda20_ (self, source_object, res);
	block27_data_unref (self);
}

static void
____lambda21_ (Block27Data* _data27_,
               GObject* obj,
               GAsyncResult* res)
{
	FtProviderSet* self;
	GError* _inner_error0_ = NULL;
	self = _data27_->self;
	g_return_if_fail (res != NULL);
	{
		FtProvider* _tmp0_;
		_tmp0_ = _data27_->provider;
		ft_provider_disable_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		FtProvider* _tmp1_;
		const gchar* _tmp2_;
		GError* _tmp3_;
		const gchar* _tmp4_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = _data27_->provider;
		_tmp2_ = g_type_name (G_TYPE_FROM_INSTANCE ((GObject*) _tmp1_));
		_tmp3_ = _error_;
		_tmp4_ = _tmp3_->message;
		g_warning ("provider-set.vala:333: Error while disabling %s: %s", _tmp2_, _tmp4_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_data27_->provider_info->status = FT_PROVIDER_STATUS_DISABLED;
	ft_provider_set_check_provider_status (self, _data27_->provider_info);
}

static void
_____lambda21__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda21_ (self, source_object, res);
	block27_data_unref (self);
}

static void
ft_provider_set_check_provider_status (FtProviderSet* self,
                                       FtProviderInfo* provider_info)
{
	Block27Data* _data27_;
	FtProviderInfo* _tmp0_;
	FtProvider* _tmp1_;
	FtProvider* _tmp2_;
	gboolean _tmp3_ = FALSE;
	FtProvider* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (provider_info != NULL);
	_data27_ = g_slice_new0 (Block27Data);
	_data27_->_ref_count_ = 1;
	_data27_->self = g_object_ref (self);
	_tmp0_ = _ft_provider_info_ref0 (provider_info);
	_ft_provider_info_unref0 (_data27_->provider_info);
	_data27_->provider_info = _tmp0_;
	_tmp1_ = _data27_->provider_info->instance;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_data27_->provider = _tmp2_;
	_tmp4_ = _data27_->provider;
	if (_tmp4_ == NULL) {
		_tmp3_ = TRUE;
	} else {
		_tmp3_ = _data27_->provider_info->destroying;
	}
	if (_tmp3_) {
		block27_data_unref (_data27_);
		_data27_ = NULL;
		return;
	}
	if (ft_provider_status_is_transient (_data27_->provider_info->status)) {
		block27_data_unref (_data27_);
		_data27_ = NULL;
		return;
	}
	if (_data27_->provider_info->selected) {
		if (_data27_->provider_info->status == FT_PROVIDER_STATUS_NOT_INITIALIZED) {
			GCancellable* _tmp5_;
			FtProvider* _tmp6_;
			GCancellable* _tmp7_;
			_data27_->provider_info->status = FT_PROVIDER_STATUS_INITIALIZING;
			_tmp5_ = g_cancellable_new ();
			_g_object_unref0 (_data27_->provider_info->cancellable);
			_data27_->provider_info->cancellable = _tmp5_;
			_data27_->provider_info->initialization_time = g_get_monotonic_time ();
			_tmp6_ = _data27_->provider;
			_tmp7_ = _data27_->provider_info->cancellable;
			ft_provider_initialize (_tmp6_, _tmp7_, _____lambda12__gasync_ready_callback, block27_data_ref (_data27_));
		} else {
			gboolean _tmp8_ = FALSE;
			gboolean _tmp9_ = FALSE;
			if (self->priv->should_enable) {
				_tmp9_ = _data27_->provider_info->status == FT_PROVIDER_STATUS_DISABLED;
			} else {
				_tmp9_ = FALSE;
			}
			if (_tmp9_) {
				FtProvider* _tmp10_;
				gboolean _tmp11_;
				gboolean _tmp12_;
				_tmp10_ = _data27_->provider;
				_tmp11_ = ft_provider_get_available (_tmp10_);
				_tmp12_ = _tmp11_;
				_tmp8_ = _tmp12_;
			} else {
				_tmp8_ = FALSE;
			}
			if (_tmp8_) {
				GCancellable* _tmp13_;
				FtProvider* _tmp14_;
				GCancellable* _tmp15_;
				_data27_->provider_info->status = FT_PROVIDER_STATUS_ENABLING;
				_tmp13_ = g_cancellable_new ();
				_g_object_unref0 (_data27_->provider_info->cancellable);
				_data27_->provider_info->cancellable = _tmp13_;
				_tmp14_ = _data27_->provider;
				_tmp15_ = _data27_->provider_info->cancellable;
				ft_provider_enable (_tmp14_, _tmp15_, ______lambda19__gasync_ready_callback, block27_data_ref (_data27_));
			} else {
				gboolean _tmp16_ = FALSE;
				if (!self->priv->should_enable) {
					_tmp16_ = _data27_->provider_info->status == FT_PROVIDER_STATUS_ENABLED;
				} else {
					_tmp16_ = FALSE;
				}
				if (_tmp16_) {
					FtProvider* _tmp17_;
					FtProvider* _tmp18_;
					_data27_->provider_info->status = FT_PROVIDER_STATUS_DISABLING;
					_tmp17_ = _data27_->provider;
					ft_provider_set_enabled (_tmp17_, FALSE);
					_tmp18_ = _data27_->provider;
					ft_provider_disable (_tmp18_, _______lambda20__gasync_ready_callback, block27_data_ref (_data27_));
				}
			}
		}
	} else {
		if (_data27_->provider_info->status == FT_PROVIDER_STATUS_ENABLED) {
			FtProvider* _tmp19_;
			FtProvider* _tmp20_;
			_data27_->provider_info->status = FT_PROVIDER_STATUS_DISABLING;
			_tmp19_ = _data27_->provider;
			ft_provider_set_enabled (_tmp19_, FALSE);
			_tmp20_ = _data27_->provider;
			ft_provider_disable (_tmp20_, _____lambda21__gasync_ready_callback, block27_data_ref (_data27_));
		}
	}
	block27_data_unref (_data27_);
	_data27_ = NULL;
}

static FtProviderAvailability
ft_provider_set_get_availability (FtProviderInfo* provider_info,
                                  gint64 provider_timeout)
{
	FtProvider* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	FtProviderAvailability result;
	g_return_val_if_fail (provider_info != NULL, 0);
	_tmp0_ = provider_info->instance;
	_tmp1_ = ft_provider_get_available_set (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		FtProviderAvailability _tmp3_ = 0;
		FtProvider* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		_tmp4_ = provider_info->instance;
		_tmp5_ = ft_provider_get_available (_tmp4_);
		_tmp6_ = _tmp5_;
		if (_tmp6_) {
			_tmp3_ = FT_PROVIDER_AVAILABILITY_AVAILABLE;
		} else {
			_tmp3_ = FT_PROVIDER_AVAILABILITY_UNAVAILABLE;
		}
		result = _tmp3_;
		return result;
	}
	if (provider_info->status == FT_PROVIDER_STATUS_NOT_INITIALIZED) {
		_tmp8_ = TRUE;
	} else {
		_tmp8_ = provider_info->status == FT_PROVIDER_STATUS_INITIALIZING;
	}
	if (_tmp8_) {
		_tmp7_ = TRUE;
	} else {
		_tmp7_ = provider_timeout < FT_AVAILABILITY_TIMEOUT;
	}
	if (_tmp7_) {
		result = FT_PROVIDER_AVAILABILITY_UNKNOWN;
		return result;
	}
	result = FT_PROVIDER_AVAILABILITY_UNAVAILABLE;
	return result;
}

static gint
ft_provider_set_compare (FtProviderInfo* provider_info,
                         gint64 provider_timeout,
                         FtProviderInfo* other_info,
                         gint64 other_timeout)
{
	FtProviderAvailability provider_availability = 0;
	FtProviderAvailability other_availability = 0;
	gint result;
	g_return_val_if_fail (provider_info != NULL, -1);
	g_return_val_if_fail (other_info != NULL, -1);
	provider_availability = ft_provider_set_get_availability (provider_info, provider_timeout);
	other_availability = ft_provider_set_get_availability (other_info, other_timeout);
	if (provider_availability != other_availability) {
		gboolean _tmp0_ = FALSE;
		gboolean _tmp1_ = FALSE;
		if (provider_availability == FT_PROVIDER_AVAILABILITY_UNKNOWN) {
			_tmp0_ = provider_info->priority > other_info->priority;
		} else {
			_tmp0_ = FALSE;
		}
		if (_tmp0_) {
			result = -1;
			return result;
		}
		if (other_availability == FT_PROVIDER_AVAILABILITY_UNKNOWN) {
			_tmp1_ = other_info->priority > provider_info->priority;
		} else {
			_tmp1_ = FALSE;
		}
		if (_tmp1_) {
			result = 1;
			return result;
		}
		result = ft_provider_availability_compare (provider_availability, other_availability);
		return result;
	}
	if (provider_info->priority != other_info->priority) {
		gint _tmp2_ = 0;
		if (provider_info->priority > other_info->priority) {
			_tmp2_ = -1;
		} else {
			_tmp2_ = 1;
		}
		result = _tmp2_;
		return result;
	}
	if (provider_info->selected != other_info->selected) {
		gint _tmp3_ = 0;
		if (provider_info->selected) {
			_tmp3_ = -1;
		} else {
			_tmp3_ = 1;
		}
		result = _tmp3_;
		return result;
	}
	result = 0;
	return result;
}

static Block28Data*
block28_data_ref (Block28Data* _data28_)
{
	g_atomic_int_inc (&_data28_->_ref_count_);
	return _data28_;
}

static void
block28_data_unref (void * _userdata_)
{
	Block28Data* _data28_;
	_data28_ = (Block28Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data28_->_ref_count_)) {
		FtProviderSet* self;
		self = _data28_->self;
		_g_object_unref0 (self);
		g_slice_free (Block28Data, _data28_);
	}
}

static Block29Data*
block29_data_ref (Block29Data* _data29_)
{
	g_atomic_int_inc (&_data29_->_ref_count_);
	return _data29_;
}

static void
block29_data_unref (void * _userdata_)
{
	Block29Data* _data29_;
	_data29_ = (Block29Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data29_->_ref_count_)) {
		GHashTable* self;
		self = _data29_->self;
		_g_hash_table_unref0 (self);
		g_slice_free (Block29Data, _data29_);
	}
}

static void
__lambda2_ (Block29Data* _data29_,
            gconstpointer k,
            gconstpointer v)
{
	GHashTable* self;
	self = _data29_->self;
	_data29_->func (v, _data29_->func_target);
}

static void
___lambda2__gh_func (gconstpointer key,
                     gconstpointer value,
                     gpointer self)
{
	__lambda2_ (self, key, value);
}

static void
_vala_g_hash_set_foreach (GHashTable* self,
                          GFunc func,
                          gpointer func_target)
{
	Block29Data* _data29_;
	g_return_if_fail (self != NULL);
	_data29_ = g_slice_new0 (Block29Data);
	_data29_->_ref_count_ = 1;
	_data29_->self = g_hash_table_ref (self);
	_data29_->func = func;
	_data29_->func_target = func_target;
	g_hash_table_foreach ((GHashTable*) self, ___lambda2__gh_func, _data29_);
	block29_data_unref (_data29_);
	_data29_ = NULL;
}

static void
__lambda15_ (Block28Data* _data28_,
             FtProviderInfo* provider_info)
{
	FtProviderSet* self;
	gint64 provider_timeout = 0LL;
	gint64 _tmp0_;
	self = _data28_->self;
	g_return_if_fail (provider_info != NULL);
	_tmp0_ = ft_provider_info_get_availability_timeout (provider_info, &_data28_->monotonic_time);
	provider_timeout = _tmp0_;
	if (_data28_->tmp_preferred_provider_info == NULL) {
		_data28_->tmp_preferred_provider_info = provider_info;
		_data28_->tmp_preferred_provider_timeout = provider_timeout;
	} else {
		gint comparison_result = 0;
		comparison_result = ft_provider_set_compare (_data28_->tmp_preferred_provider_info, _data28_->tmp_preferred_provider_timeout, provider_info, provider_timeout);
		if (comparison_result > 0) {
			_data28_->tmp_preferred_provider_info = provider_info;
			_data28_->tmp_preferred_provider_timeout = provider_timeout;
		}
	}
}

static void
___lambda15__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda15_ (self, (FtProviderInfo*) data);
}

static void
ft_provider_set_get_preferred_provider_info (FtProviderSet* self,
                                             FtProviderInfo** preferred_provider_info,
                                             gint64* preferred_provider_timeout)
{
	FtProviderInfo* _vala_preferred_provider_info = NULL;
	gint64 _vala_preferred_provider_timeout = 0LL;
	Block28Data* _data28_;
	GHashTable* _tmp0_;
	g_return_if_fail (self != NULL);
	_data28_ = g_slice_new0 (Block28Data);
	_data28_->_ref_count_ = 1;
	_data28_->self = g_object_ref (self);
	_data28_->tmp_preferred_provider_info = NULL;
	_data28_->tmp_preferred_provider_timeout = (gint64) 0;
	_data28_->monotonic_time = FT_TIMESTAMP_UNDEFINED;
	_tmp0_ = self->priv->providers;
	_vala_g_hash_set_foreach (_tmp0_, ___lambda15__gfunc, _data28_);
	_vala_preferred_provider_info = _data28_->tmp_preferred_provider_info;
	_vala_preferred_provider_timeout = _data28_->tmp_preferred_provider_timeout;
	if (preferred_provider_info) {
		*preferred_provider_info = _vala_preferred_provider_info;
	}
	if (preferred_provider_timeout) {
		*preferred_provider_timeout = _vala_preferred_provider_timeout;
	}
	block28_data_unref (_data28_);
	_data28_ = NULL;
}

/**
         * Find best provider, preferably available with highest priority.
         */
static Block30Data*
block30_data_ref (Block30Data* _data30_)
{
	g_atomic_int_inc (&_data30_->_ref_count_);
	return _data30_;
}

static void
block30_data_unref (void * _userdata_)
{
	Block30Data* _data30_;
	_data30_ = (Block30Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data30_->_ref_count_)) {
		FtProviderSet* self;
		self = _data30_->self;
		_g_object_unref0 (self);
		g_slice_free (Block30Data, _data30_);
	}
}

static void
__lambda17_ (Block30Data* _data30_,
             FtProviderInfo* provider_info)
{
	FtProviderSet* self;
	gboolean selected = FALSE;
	FtProviderInfo* _tmp0_;
	self = _data30_->self;
	g_return_if_fail (provider_info != NULL);
	_tmp0_ = _data30_->preferred_provider_info;
	selected = provider_info == _tmp0_;
	if (provider_info->selected != selected) {
		provider_info->selected = selected;
		_data30_->selection_changed = TRUE;
		if (selected) {
			FtProvider* _tmp1_;
			_tmp1_ = provider_info->instance;
			g_signal_emit (self, ft_provider_set_signals[FT_PROVIDER_SET_PROVIDER_SELECTED_SIGNAL], 0, (gconstpointer) _tmp1_);
		} else {
			FtProvider* _tmp2_;
			_tmp2_ = provider_info->instance;
			g_signal_emit (self, ft_provider_set_signals[FT_PROVIDER_SET_PROVIDER_UNSELECTED_SIGNAL], 0, (gconstpointer) _tmp2_);
		}
		ft_provider_set_check_provider_status (self, provider_info);
	}
}

static void
___lambda17__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda17_ (self, (FtProviderInfo*) data);
}

static void
ft_provider_set_select_single (FtProviderSet* self)
{
	Block30Data* _data30_;
	gint64 preferred_provider_timeout = 0LL;
	FtProviderInfo* _tmp0_ = NULL;
	gint64 _tmp1_ = 0LL;
	FtProviderInfo* _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	FtProviderInfo* _tmp5_;
	FtProvider* _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	FtProviderInfo* _tmp9_;
	GHashTable* _tmp10_;
	g_return_if_fail (self != NULL);
	_data30_ = g_slice_new0 (Block30Data);
	_data30_->_ref_count_ = 1;
	_data30_->self = g_object_ref (self);
	_data30_->preferred_provider_info = NULL;
	preferred_provider_timeout = (gint64) 0;
	_data30_->selection_changed = FALSE;
	ft_provider_set_get_preferred_provider_info (self, &_tmp0_, &_tmp1_);
	_data30_->preferred_provider_info = _tmp0_;
	preferred_provider_timeout = _tmp1_;
	_tmp2_ = _data30_->preferred_provider_info;
	if (_tmp2_ == NULL) {
		ft_provider_set_select_none (self);
		block30_data_unref (_data30_);
		_data30_ = NULL;
		return;
	}
	_tmp5_ = _data30_->preferred_provider_info;
	_tmp6_ = _tmp5_->instance;
	_tmp7_ = ft_provider_get_available_set (_tmp6_);
	_tmp8_ = _tmp7_;
	if (!_tmp8_) {
		_tmp4_ = preferred_provider_timeout > ((gint64) 0);
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		_tmp3_ = preferred_provider_timeout < FT_AVAILABILITY_TIMEOUT;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		ft_provider_set_schedule_update_selection (self, preferred_provider_timeout);
		block30_data_unref (_data30_);
		_data30_ = NULL;
		return;
	}
	_tmp9_ = _data30_->preferred_provider_info;
	if (ft_provider_set_get_availability (_tmp9_, preferred_provider_timeout) == FT_PROVIDER_AVAILABILITY_UNAVAILABLE) {
		ft_provider_set_select_none (self);
		block30_data_unref (_data30_);
		_data30_ = NULL;
		return;
	}
	_tmp10_ = self->priv->providers;
	_vala_g_hash_set_foreach (_tmp10_, ___lambda17__gfunc, _data30_);
	if (_data30_->selection_changed) {
		g_signal_emit (self, ft_provider_set_signals[FT_PROVIDER_SET_SELECTION_CHANGED_SIGNAL], 0);
	}
	block30_data_unref (_data30_);
	_data30_ = NULL;
}

/**
         * Disable all providers.
         */
static Block31Data*
block31_data_ref (Block31Data* _data31_)
{
	g_atomic_int_inc (&_data31_->_ref_count_);
	return _data31_;
}

static void
block31_data_unref (void * _userdata_)
{
	Block31Data* _data31_;
	_data31_ = (Block31Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data31_->_ref_count_)) {
		FtProviderSet* self;
		self = _data31_->self;
		_g_object_unref0 (self);
		g_slice_free (Block31Data, _data31_);
	}
}

static void
__lambda14_ (Block31Data* _data31_,
             FtProviderInfo* provider_info)
{
	FtProviderSet* self;
	self = _data31_->self;
	g_return_if_fail (provider_info != NULL);
	if (provider_info->selected) {
		FtProvider* _tmp0_;
		provider_info->selected = FALSE;
		_data31_->selection_changed = TRUE;
		_tmp0_ = provider_info->instance;
		g_signal_emit (self, ft_provider_set_signals[FT_PROVIDER_SET_PROVIDER_UNSELECTED_SIGNAL], 0, (gconstpointer) _tmp0_);
		ft_provider_set_check_provider_status (self, provider_info);
	}
}

static void
___lambda14__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda14_ (self, (FtProviderInfo*) data);
}

static void
ft_provider_set_select_none (FtProviderSet* self)
{
	Block31Data* _data31_;
	GHashTable* _tmp0_;
	g_return_if_fail (self != NULL);
	_data31_ = g_slice_new0 (Block31Data);
	_data31_->_ref_count_ = 1;
	_data31_->self = g_object_ref (self);
	_data31_->selection_changed = FALSE;
	_tmp0_ = self->priv->providers;
	_vala_g_hash_set_foreach (_tmp0_, ___lambda14__gfunc, _data31_);
	if (_data31_->selection_changed) {
		g_signal_emit (self, ft_provider_set_signals[FT_PROVIDER_SET_SELECTION_CHANGED_SIGNAL], 0);
	}
	block31_data_unref (_data31_);
	_data31_ = NULL;
}

/**
         * Try enabling all providers.
         */
static Block32Data*
block32_data_ref (Block32Data* _data32_)
{
	g_atomic_int_inc (&_data32_->_ref_count_);
	return _data32_;
}

static void
block32_data_unref (void * _userdata_)
{
	Block32Data* _data32_;
	_data32_ = (Block32Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data32_->_ref_count_)) {
		FtProviderSet* self;
		self = _data32_->self;
		_g_object_unref0 (self);
		g_slice_free (Block32Data, _data32_);
	}
}

static void
__lambda18_ (Block32Data* _data32_,
             FtProviderInfo* provider_info)
{
	FtProviderSet* self;
	self = _data32_->self;
	g_return_if_fail (provider_info != NULL);
	if (!provider_info->selected) {
		FtProvider* _tmp0_;
		provider_info->selected = TRUE;
		_data32_->selection_changed = TRUE;
		_tmp0_ = provider_info->instance;
		g_signal_emit (self, ft_provider_set_signals[FT_PROVIDER_SET_PROVIDER_SELECTED_SIGNAL], 0, (gconstpointer) _tmp0_);
		ft_provider_set_check_provider_status (self, provider_info);
	}
}

static void
___lambda18__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda18_ (self, (FtProviderInfo*) data);
}

static void
ft_provider_set_select_all (FtProviderSet* self)
{
	Block32Data* _data32_;
	GHashTable* _tmp0_;
	g_return_if_fail (self != NULL);
	_data32_ = g_slice_new0 (Block32Data);
	_data32_->_ref_count_ = 1;
	_data32_->self = g_object_ref (self);
	_data32_->selection_changed = FALSE;
	_tmp0_ = self->priv->providers;
	_vala_g_hash_set_foreach (_tmp0_, ___lambda18__gfunc, _data32_);
	if (_data32_->selection_changed) {
		g_signal_emit (self, ft_provider_set_signals[FT_PROVIDER_SET_SELECTION_CHANGED_SIGNAL], 0);
	}
	block32_data_unref (_data32_);
	_data32_ = NULL;
}

static void
ft_provider_set_update_selection (FtProviderSet* self)
{
	GHashTable* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->providers;
	if (_tmp0_ == NULL) {
		return;
	}
	if (self->priv->updating_selection) {
		self->priv->selection_invalid = TRUE;
		return;
	}
	if (self->priv->update_selection_timeout_id != ((guint) 0)) {
		g_source_remove (self->priv->update_selection_timeout_id);
		self->priv->update_selection_timeout_id = (guint) 0;
	}
	if (self->priv->update_selection_idle_id != ((guint) 0)) {
		g_source_remove (self->priv->update_selection_idle_id);
		self->priv->update_selection_idle_id = (guint) 0;
	}
	self->priv->updating_selection = TRUE;
	self->priv->selection_invalid = FALSE;
	switch (self->priv->_selection_mode) {
		case FT_SELECTION_MODE_NONE:
		{
			ft_provider_set_select_none (self);
			break;
		}
		case FT_SELECTION_MODE_SINGLE:
		{
			ft_provider_set_select_single (self);
			break;
		}
		case FT_SELECTION_MODE_ALL:
		{
			ft_provider_set_select_all (self);
			break;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
	self->priv->updating_selection = FALSE;
	if (self->priv->selection_invalid) {
		ft_provider_set_update_selection (self);
	}
}

static gboolean
__lambda16_ (FtProviderSet* self)
{
	gboolean result;
	self->priv->update_selection_timeout_id = (guint) 0;
	ft_provider_set_update_selection (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda16__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda16_ ((FtProviderSet*) self);
	return result;
}

static void
ft_provider_set_schedule_update_selection (FtProviderSet* self,
                                           gint64 timeout)
{
	g_return_if_fail (self != NULL);
	if (self->priv->update_selection_timeout_id != ((guint) 0)) {
		return;
	}
	self->priv->update_selection_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, ft_timestamp_to_milliseconds_uint (timeout + FT_AVAILABILITY_TIMEOUT_TOLERANCE), ___lambda16__gsource_func, g_object_ref (self), g_object_unref);
	g_source_set_name_by_id (self->priv->update_selection_timeout_id, "Ft.ProviderSet.schedule_update_selection");
}

static gboolean
__lambda13_ (FtProviderSet* self)
{
	gboolean result;
	self->priv->update_selection_idle_id = (guint) 0;
	ft_provider_set_update_selection (self);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
___lambda13__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda13_ ((FtProviderSet*) self);
	return result;
}

static void
ft_provider_set_queue_update_selection (FtProviderSet* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->update_selection_idle_id != ((guint) 0)) {
		return;
	}
	self->priv->update_selection_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda13__gsource_func, g_object_ref (self), g_object_unref);
	g_source_set_name_by_id (self->priv->update_selection_idle_id, "Ft.ProviderSet.queue_update_selection");
}

static Block33Data*
block33_data_ref (Block33Data* _data33_)
{
	g_atomic_int_inc (&_data33_->_ref_count_);
	return _data33_;
}

static void
block33_data_unref (void * _userdata_)
{
	Block33Data* _data33_;
	_data33_ = (Block33Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data33_->_ref_count_)) {
		FtProviderSet* self;
		self = _data33_->self;
		_g_object_unref0 (_data33_->instance);
		_g_object_unref0 (self);
		g_slice_free (Block33Data, _data33_);
	}
}

static void
__lambda22_ (Block33Data* _data33_,
             FtProviderInfo* _provider_info)
{
	FtProviderSet* self;
	FtProvider* _tmp0_;
	self = _data33_->self;
	g_return_if_fail (_provider_info != NULL);
	_tmp0_ = _provider_info->instance;
	if (_tmp0_ == _data33_->instance) {
		_data33_->provider_info = _provider_info;
	}
}

static void
___lambda22__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda22_ (self, (FtProviderInfo*) data);
}

static FtProviderInfo*
ft_provider_set_lookup_info (FtProviderSet* self,
                             FtProvider* instance)
{
	Block33Data* _data33_;
	FtProvider* _tmp0_;
	GHashTable* _tmp1_;
	GHashTable* _tmp2_;
	FtProviderInfo* _tmp3_;
	FtProviderInfo* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (instance != NULL, NULL);
	_data33_ = g_slice_new0 (Block33Data);
	_data33_->_ref_count_ = 1;
	_data33_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (instance);
	_g_object_unref0 (_data33_->instance);
	_data33_->instance = _tmp0_;
	_data33_->provider_info = NULL;
	_tmp1_ = self->priv->providers;
	if (_tmp1_ == NULL) {
		result = NULL;
		block33_data_unref (_data33_);
		_data33_ = NULL;
		return result;
	}
	_tmp2_ = self->priv->providers;
	_vala_g_hash_set_foreach (_tmp2_, ___lambda22__gfunc, _data33_);
	_tmp3_ = _data33_->provider_info;
	result = _tmp3_;
	block33_data_unref (_data33_);
	_data33_ = NULL;
	return result;
}

static void
ft_provider_set_on_provider_notify_available (FtProviderSet* self,
                                              GObject* object,
                                              GParamSpec* pspec)
{
	FtProvider* provider = NULL;
	FtProvider* _tmp0_;
	FtProviderInfo* provider_info = NULL;
	FtProvider* _tmp1_;
	FtProviderInfo* _tmp2_;
	FtProviderInfo* _tmp3_;
	FtProviderInfo* _tmp4_;
	gboolean _tmp5_ = FALSE;
	FtProviderInfo* _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_PROVIDER, FtProvider));
	provider = _tmp0_;
	_tmp1_ = provider;
	_tmp2_ = ft_provider_set_lookup_info (self, _tmp1_);
	_tmp3_ = _ft_provider_info_ref0 (_tmp2_);
	provider_info = _tmp3_;
	_tmp4_ = provider_info;
	if (_tmp4_ == NULL) {
		_ft_provider_info_unref0 (provider_info);
		_g_object_unref0 (provider);
		return;
	}
	_tmp6_ = provider_info;
	if (_tmp6_->selected) {
		FtProvider* _tmp7_;
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp7_ = provider;
		_tmp8_ = ft_provider_get_available (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp5_ = _tmp9_;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		FtProviderInfo* _tmp10_;
		_tmp10_ = provider_info;
		ft_provider_set_check_provider_status (self, _tmp10_);
	} else {
		ft_provider_set_update_selection (self);
	}
	_ft_provider_info_unref0 (provider_info);
	_g_object_unref0 (provider);
}

static void
ft_provider_set_on_provider_notify_enabled (FtProviderSet* self,
                                            GObject* object,
                                            GParamSpec* pspec)
{
	FtProvider* provider = NULL;
	FtProvider* _tmp0_;
	FtProvider* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (pspec != NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_PROVIDER, FtProvider));
	provider = _tmp0_;
	_tmp1_ = provider;
	_tmp2_ = ft_provider_get_enabled (_tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		FtProvider* _tmp4_;
		_tmp4_ = provider;
		g_signal_emit (self, ft_provider_set_signals[FT_PROVIDER_SET_PROVIDER_ENABLED_SIGNAL], 0, (gconstpointer) _tmp4_);
	} else {
		FtProvider* _tmp5_;
		_tmp5_ = provider;
		g_signal_emit (self, ft_provider_set_signals[FT_PROVIDER_SET_PROVIDER_DISABLED_SIGNAL], 0, (gconstpointer) _tmp5_);
	}
	_g_object_unref0 (provider);
}

static void
_ft_provider_set_on_provider_notify_available_g_object_notify (GObject* _sender,
                                                               GParamSpec* pspec,
                                                               gpointer self)
{
	ft_provider_set_on_provider_notify_available ((FtProviderSet*) self, _sender, pspec);
}

static void
_ft_provider_set_on_provider_notify_enabled_g_object_notify (GObject* _sender,
                                                             GParamSpec* pspec,
                                                             gpointer self)
{
	ft_provider_set_on_provider_notify_enabled ((FtProviderSet*) self, _sender, pspec);
}

static void
ft_provider_set_destroy_info (FtProviderSet* self,
                              FtProviderInfo* provider_info)
{
	FtProvider* _tmp0_;
	guint _tmp1_;
	GQuark _tmp2_;
	FtProvider* _tmp3_;
	guint _tmp4_;
	GQuark _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (provider_info != NULL);
	_tmp0_ = provider_info->instance;
	g_signal_parse_name ("notify::available", G_TYPE_OBJECT, &_tmp1_, &_tmp2_, TRUE);
	g_signal_handlers_disconnect_matched ((GObject*) _tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, _tmp2_, NULL, (GCallback) _ft_provider_set_on_provider_notify_available_g_object_notify, self);
	_tmp3_ = provider_info->instance;
	g_signal_parse_name ("notify::enabled", G_TYPE_OBJECT, &_tmp4_, &_tmp5_, TRUE);
	g_signal_handlers_disconnect_matched ((GObject*) _tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, _tmp5_, NULL, (GCallback) _ft_provider_set_on_provider_notify_enabled_g_object_notify, self);
	ft_provider_info_destroy (provider_info);
}

void
ft_provider_set_add (FtProviderSet* self,
                     gconstpointer provider,
                     FtPriority priority)
{
	FtProvider* instance = NULL;
	FtProvider* _tmp0_;
	FtProvider* _tmp1_;
	GHashTable* _tmp2_;
	FtProviderInfo* existing_provider_info = NULL;
	FtProvider* _tmp3_;
	FtProviderInfo* _tmp4_;
	FtProviderInfo* _tmp5_;
	FtProviderInfo* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (FT_IS_PROVIDER (provider) ? ((FtProvider*) provider) : NULL);
	instance = _tmp0_;
	_tmp1_ = instance;
	_vala_assert (_tmp1_ != NULL, "instance != null");
	_tmp2_ = self->priv->providers;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (instance);
		return;
	}
	_tmp3_ = instance;
	_tmp4_ = ft_provider_set_lookup_info (self, _tmp3_);
	_tmp5_ = _ft_provider_info_ref0 (_tmp4_);
	existing_provider_info = _tmp5_;
	_tmp6_ = existing_provider_info;
	if (_tmp6_ != NULL) {
		FtProviderInfo* _tmp7_;
		_tmp7_ = existing_provider_info;
		_tmp7_->priority = priority;
	} else {
		FtProviderInfo* provider_info = NULL;
		FtProvider* _tmp8_;
		FtProviderInfo* _tmp9_;
		GHashTable* _tmp10_;
		FtProviderInfo* _tmp11_;
		FtProviderInfo* _tmp12_;
		_tmp8_ = instance;
		_tmp9_ = ft_provider_info_new (_tmp8_, priority);
		provider_info = _tmp9_;
		_tmp10_ = self->priv->providers;
		_tmp11_ = provider_info;
		_tmp12_ = _ft_provider_info_ref0 (_tmp11_);
		if (g_hash_table_add (_tmp10_, _tmp12_)) {
			FtProviderInfo* _tmp13_;
			FtProvider* _tmp14_;
			FtProviderInfo* _tmp15_;
			FtProvider* _tmp16_;
			_tmp13_ = provider_info;
			_tmp14_ = _tmp13_->instance;
			g_signal_connect_object ((GObject*) _tmp14_, "notify::available", (GCallback) _ft_provider_set_on_provider_notify_available_g_object_notify, self, 0);
			_tmp15_ = provider_info;
			_tmp16_ = _tmp15_->instance;
			g_signal_connect_object ((GObject*) _tmp16_, "notify::enabled", (GCallback) _ft_provider_set_on_provider_notify_enabled_g_object_notify, self, 0);
		}
		_ft_provider_info_unref0 (provider_info);
	}
	if (self->priv->should_enable) {
		ft_provider_set_update_selection (self);
	} else {
		ft_provider_set_queue_update_selection (self);
	}
	_ft_provider_info_unref0 (existing_provider_info);
	_g_object_unref0 (instance);
}

void
ft_provider_set_remove (FtProviderSet* self,
                        gconstpointer provider)
{
	FtProvider* instance = NULL;
	FtProvider* _tmp0_;
	FtProvider* _tmp1_;
	FtProviderInfo* provider_info = NULL;
	FtProvider* _tmp2_;
	FtProviderInfo* _tmp3_;
	FtProviderInfo* _tmp4_;
	gboolean _tmp5_ = FALSE;
	FtProviderInfo* _tmp6_;
	gboolean was_selected = FALSE;
	FtProviderInfo* _tmp8_;
	GHashTable* _tmp9_;
	FtProviderInfo* _tmp10_;
	FtProviderInfo* _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (FT_IS_PROVIDER (provider) ? ((FtProvider*) provider) : NULL);
	instance = _tmp0_;
	_tmp1_ = instance;
	_vala_assert (_tmp1_ != NULL, "instance != null");
	_tmp2_ = instance;
	_tmp3_ = ft_provider_set_lookup_info (self, _tmp2_);
	_tmp4_ = _ft_provider_info_ref0 (_tmp3_);
	provider_info = _tmp4_;
	_tmp6_ = provider_info;
	if (_tmp6_ == NULL) {
		_tmp5_ = TRUE;
	} else {
		FtProviderInfo* _tmp7_;
		_tmp7_ = provider_info;
		_tmp5_ = _tmp7_->destroying;
	}
	if (_tmp5_) {
		_ft_provider_info_unref0 (provider_info);
		_g_object_unref0 (instance);
		return;
	}
	_tmp8_ = provider_info;
	was_selected = _tmp8_->selected;
	_tmp9_ = self->priv->providers;
	_tmp10_ = provider_info;
	if (!g_hash_table_remove (_tmp9_, _tmp10_)) {
		_ft_provider_info_unref0 (provider_info);
		_g_object_unref0 (instance);
		return;
	}
	_tmp11_ = provider_info;
	ft_provider_set_destroy_info (self, _tmp11_);
	if (was_selected) {
		ft_provider_set_update_selection (self);
	}
	_ft_provider_info_unref0 (provider_info);
	_g_object_unref0 (instance);
}

static Block34Data*
block34_data_ref (Block34Data* _data34_)
{
	g_atomic_int_inc (&_data34_->_ref_count_);
	return _data34_;
}

static void
block34_data_unref (void * _userdata_)
{
	Block34Data* _data34_;
	_data34_ = (Block34Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data34_->_ref_count_)) {
		FtProviderSet* self;
		self = _data34_->self;
		_data34_->providers = (_vala_array_free (_data34_->providers, _data34_->providers_length1, (GDestroyNotify) ft_provider_info_unref), NULL);
		_g_object_unref0 (self);
		g_slice_free (Block34Data, _data34_);
	}
}

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

static void
__lambda23_ (Block34Data* _data34_,
             FtProviderInfo* provider_info)
{
	FtProviderSet* self;
	FtProviderInfo* _tmp0_;
	self = _data34_->self;
	g_return_if_fail (provider_info != NULL);
	_tmp0_ = _ft_provider_info_ref0 (provider_info);
	_vala_array_add21 (&_data34_->providers, &_data34_->providers_length1, &_data34_->_providers_size_, _tmp0_);
}

static void
___lambda23__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda23_ (self, (FtProviderInfo*) data);
}

void
ft_provider_set_remove_all (FtProviderSet* self)
{
	Block34Data* _data34_;
	GHashTable* _tmp0_;
	FtProviderInfo** _tmp1_;
	GHashTable* _tmp2_;
	GHashTable* _tmp3_;
	FtProviderInfo** _tmp4_;
	gint _tmp4__length1;
	g_return_if_fail (self != NULL);
	_data34_ = g_slice_new0 (Block34Data);
	_data34_->_ref_count_ = 1;
	_data34_->self = g_object_ref (self);
	_tmp0_ = self->priv->providers;
	if (_tmp0_ == NULL) {
		block34_data_unref (_data34_);
		_data34_ = NULL;
		return;
	}
	if (self->priv->update_selection_timeout_id != ((guint) 0)) {
		g_source_remove (self->priv->update_selection_timeout_id);
		self->priv->update_selection_timeout_id = (guint) 0;
	}
	if (self->priv->update_selection_idle_id != ((guint) 0)) {
		g_source_remove (self->priv->update_selection_idle_id);
		self->priv->update_selection_idle_id = (guint) 0;
	}
	_tmp1_ = g_new0 (FtProviderInfo*, 0 + 1);
	_data34_->providers = _tmp1_;
	_data34_->providers_length1 = 0;
	_data34_->_providers_size_ = _data34_->providers_length1;
	_tmp2_ = self->priv->providers;
	_vala_g_hash_set_foreach (_tmp2_, ___lambda23__gfunc, _data34_);
	_tmp3_ = self->priv->providers;
	g_hash_table_remove_all (_tmp3_);
	_tmp4_ = _data34_->providers;
	_tmp4__length1 = _data34_->providers_length1;
	{
		FtProviderInfo** provider_info_collection = NULL;
		gint provider_info_collection_length1 = 0;
		gint _provider_info_collection_size_ = 0;
		gint provider_info_it = 0;
		provider_info_collection = _tmp4_;
		provider_info_collection_length1 = _tmp4__length1;
		for (provider_info_it = 0; provider_info_it < provider_info_collection_length1; provider_info_it = provider_info_it + 1) {
			FtProviderInfo* _tmp5_;
			FtProviderInfo* provider_info = NULL;
			_tmp5_ = _ft_provider_info_ref0 (provider_info_collection[provider_info_it]);
			provider_info = _tmp5_;
			{
				FtProviderInfo* _tmp6_;
				_tmp6_ = provider_info;
				ft_provider_set_destroy_info (self, _tmp6_);
				_ft_provider_info_unref0 (provider_info);
			}
		}
	}
	block34_data_unref (_data34_);
	_data34_ = NULL;
}

static void
ft_provider_set_add_extension (FtProviderSet* self,
                               PeasPluginInfo* info,
                               GObject* extension)
{
	FtPriority priority = 0;
	GParamSpec* priority_pspec = NULL;
	GObjectClass* _tmp0_;
	GParamSpec* _tmp1_;
	GParamSpec* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (info != NULL);
	g_return_if_fail (extension != NULL);
	priority = FT_PRIORITY_DEFAULT;
	_tmp0_ = G_OBJECT_GET_CLASS (extension);
	_tmp1_ = g_object_class_find_property (_tmp0_, "priority");
	priority_pspec = _tmp1_;
	_tmp2_ = priority_pspec;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, G_TYPE_PARAM_ENUM)) {
		g_object_get (extension, "priority", &priority, NULL);
	} else {
		const gchar* _tmp3_;
		_tmp3_ = peas_plugin_info_get_external_data (info, "Priority");
		priority = ft_priority_from_string (_tmp3_);
	}
	ft_provider_set_add (self, (gconstpointer) extension, priority);
}

/**
         * Initialize Peas extensions discovery.
         */
static void
_vala_GValue_array_free (GValue * array,
                         gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			g_value_unset (&array[i]);
		}
	}
	g_free (array);
}

static void
_ft_provider_set_on_extension_added_peas_extension_set_extension_added (PeasExtensionSet* _sender,
                                                                        PeasPluginInfo* info,
                                                                        GObject* extension,
                                                                        gpointer self)
{
	ft_provider_set_on_extension_added ((FtProviderSet*) self, info, extension);
}

static void
_ft_provider_set_on_extension_removed_peas_extension_set_extension_removed (PeasExtensionSet* _sender,
                                                                            PeasPluginInfo* info,
                                                                            GObject* extension,
                                                                            gpointer self)
{
	ft_provider_set_on_extension_removed ((FtProviderSet*) self, info, extension);
}

void
ft_provider_set_discover (FtProviderSet* self)
{
	PeasExtensionSet* _tmp0_;
	PeasEngine* engine = NULL;
	PeasEngine* _tmp1_;
	PeasEngine* _tmp2_;
	guint n = 0U;
	PeasEngine* _tmp3_;
	PeasEngine* _tmp4_;
	gchar** _tmp5_;
	gchar** _tmp6_;
	gint _tmp6__length1;
	GValue* _tmp7_;
	GValue* _tmp8_;
	gint _tmp8__length1;
	PeasExtensionSet* _tmp9_;
	PeasExtensionSet* _tmp10_;
	PeasExtensionSet* _tmp11_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->extension_set;
	if (_tmp0_ != NULL) {
		return;
	}
	_tmp1_ = peas_engine_get_default ();
	_tmp2_ = _g_object_ref0 (_tmp1_);
	engine = _tmp2_;
	_tmp3_ = engine;
	n = g_list_model_get_n_items ((GListModel*) _tmp3_);
	_tmp4_ = engine;
	_tmp5_ = g_new0 (gchar*, 0 + 1);
	_tmp6_ = _tmp5_;
	_tmp6__length1 = 0;
	_tmp7_ = g_new0 (GValue, 0);
	_tmp8_ = _tmp7_;
	_tmp8__length1 = 0;
	_tmp9_ = peas_extension_set_new_with_properties (_tmp4_, self->priv->t_type, 0, _tmp6_, _tmp8_);
	_g_object_unref0 (self->priv->extension_set);
	self->priv->extension_set = _tmp9_;
	_tmp8_ = (_vala_GValue_array_free (_tmp8_, _tmp8__length1), NULL);
	_tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL);
	_tmp10_ = self->priv->extension_set;
	g_signal_connect_object (_tmp10_, "extension-added", (GCallback) _ft_provider_set_on_extension_added_peas_extension_set_extension_added, self, 0);
	_tmp11_ = self->priv->extension_set;
	g_signal_connect_object (_tmp11_, "extension-removed", (GCallback) _ft_provider_set_on_extension_removed_peas_extension_set_extension_removed, self, 0);
	{
		guint i = 0U;
		i = 0U;
		{
			gboolean _tmp12_ = FALSE;
			_tmp12_ = TRUE;
			while (TRUE) {
				PeasPluginInfo* info = NULL;
				PeasEngine* _tmp14_;
				GObject* _tmp15_;
				GObject* extension = NULL;
				PeasExtensionSet* _tmp16_;
				PeasPluginInfo* _tmp17_;
				GObject* _tmp18_;
				GObject* _tmp19_;
				gboolean _tmp20_ = FALSE;
				GObject* _tmp21_;
				if (!_tmp12_) {
					guint _tmp13_;
					_tmp13_ = i;
					i = _tmp13_ + 1;
				}
				_tmp12_ = FALSE;
				if (!(i < n)) {
					break;
				}
				_tmp14_ = engine;
				_tmp15_ = g_list_model_get_item ((GListModel*) _tmp14_, i);
				info = G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, peas_plugin_info_get_type (), PeasPluginInfo);
				_tmp16_ = self->priv->extension_set;
				_tmp17_ = info;
				_tmp18_ = peas_extension_set_get_extension (_tmp16_, _tmp17_);
				_tmp19_ = _g_object_ref0 (_tmp18_);
				extension = _tmp19_;
				_tmp21_ = extension;
				if (_tmp21_ != NULL) {
					GObject* _tmp22_;
					_tmp22_ = extension;
					_tmp20_ = FT_IS_PROVIDER (_tmp22_);
				} else {
					_tmp20_ = FALSE;
				}
				if (_tmp20_) {
					PeasPluginInfo* _tmp23_;
					GObject* _tmp24_;
					_tmp23_ = info;
					_tmp24_ = extension;
					ft_provider_set_add_extension (self, _tmp23_, _tmp24_);
				}
				_g_object_unref0 (extension);
				_g_object_unref0 (info);
			}
		}
	}
	_g_object_unref0 (engine);
}

static void
ft_provider_set_on_extension_added (FtProviderSet* self,
                                    PeasPluginInfo* info,
                                    GObject* extension)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (info != NULL);
	g_return_if_fail (extension != NULL);
	if (FT_IS_PROVIDER (extension)) {
		ft_provider_set_add_extension (self, info, extension);
	}
}

static void
ft_provider_set_on_extension_removed (FtProviderSet* self,
                                      PeasPluginInfo* info,
                                      GObject* extension)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (info != NULL);
	g_return_if_fail (extension != NULL);
	if (FT_IS_PROVIDER (extension)) {
		ft_provider_set_remove (self, (gconstpointer) extension);
	}
}

static void
__lambda24_ (FtProviderSet* self,
             FtProviderInfo* provider_info)
{
	g_return_if_fail (provider_info != NULL);
	ft_provider_set_check_provider_status (self, provider_info);
}

static void
___lambda24__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda24_ ((FtProviderSet*) self, (FtProviderInfo*) data);
}

void
ft_provider_set_enable (FtProviderSet* self)
{
	GHashTable* _tmp0_;
	GHashTable* _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->should_enable = TRUE;
	ft_provider_set_update_selection (self);
	_tmp0_ = self->priv->providers;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->providers;
	_vala_g_hash_set_foreach (_tmp1_, ___lambda24__gfunc, self);
}

static void
__lambda25_ (FtProviderSet* self,
             FtProviderInfo* provider_info)
{
	g_return_if_fail (provider_info != NULL);
	ft_provider_set_check_provider_status (self, provider_info);
}

static void
___lambda25__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda25_ ((FtProviderSet*) self, (FtProviderInfo*) data);
}

void
ft_provider_set_disable (FtProviderSet* self)
{
	GHashTable* _tmp0_;
	GHashTable* _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->should_enable = FALSE;
	_tmp0_ = self->priv->providers;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->providers;
	_vala_g_hash_set_foreach (_tmp1_, ___lambda25__gfunc, self);
}

static Block35Data*
block35_data_ref (Block35Data* _data35_)
{
	g_atomic_int_inc (&_data35_->_ref_count_);
	return _data35_;
}

static void
block35_data_unref (void * _userdata_)
{
	Block35Data* _data35_;
	_data35_ = (Block35Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data35_->_ref_count_)) {
		FtProviderSet* self;
		self = _data35_->self;
		_g_object_unref0 (self);
		g_slice_free (Block35Data, _data35_);
	}
}

static void
__lambda26_ (Block35Data* _data35_,
             FtProviderInfo* provider_info)
{
	FtProviderSet* self;
	FtProvider* _tmp0_;
	self = _data35_->self;
	g_return_if_fail (provider_info != NULL);
	_tmp0_ = provider_info->instance;
	_data35_->func ((gconstpointer) _tmp0_, _data35_->func_target);
}

static void
___lambda26__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda26_ (self, (FtProviderInfo*) data);
}

void
ft_provider_set_foreach (FtProviderSet* self,
                         GFunc func,
                         gpointer func_target)
{
	Block35Data* _data35_;
	GHashTable* _tmp0_;
	GHashTable* _tmp1_;
	g_return_if_fail (self != NULL);
	_data35_ = g_slice_new0 (Block35Data);
	_data35_->_ref_count_ = 1;
	_data35_->self = g_object_ref (self);
	_data35_->func = func;
	_data35_->func_target = func_target;
	_tmp0_ = self->priv->providers;
	if (_tmp0_ == NULL) {
		block35_data_unref (_data35_);
		_data35_ = NULL;
		return;
	}
	_tmp1_ = self->priv->providers;
	_vala_g_hash_set_foreach (_tmp1_, ___lambda26__gfunc, _data35_);
	block35_data_unref (_data35_);
	_data35_ = NULL;
}

static Block36Data*
block36_data_ref (Block36Data* _data36_)
{
	g_atomic_int_inc (&_data36_->_ref_count_);
	return _data36_;
}

static void
block36_data_unref (void * _userdata_)
{
	Block36Data* _data36_;
	_data36_ = (Block36Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data36_->_ref_count_)) {
		FtProviderSet* self;
		self = _data36_->self;
		_g_object_unref0 (self);
		g_slice_free (Block36Data, _data36_);
	}
}

static void
__lambda27_ (Block36Data* _data36_,
             FtProviderInfo* provider_info)
{
	FtProviderSet* self;
	self = _data36_->self;
	g_return_if_fail (provider_info != NULL);
	if (provider_info->selected) {
		FtProvider* _tmp0_;
		_tmp0_ = provider_info->instance;
		_data36_->func ((gconstpointer) _tmp0_, _data36_->func_target);
	}
}

static void
___lambda27__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda27_ (self, (FtProviderInfo*) data);
}

void
ft_provider_set_foreach_selected (FtProviderSet* self,
                                  GFunc func,
                                  gpointer func_target)
{
	Block36Data* _data36_;
	GHashTable* _tmp0_;
	GHashTable* _tmp1_;
	g_return_if_fail (self != NULL);
	_data36_ = g_slice_new0 (Block36Data);
	_data36_->_ref_count_ = 1;
	_data36_->self = g_object_ref (self);
	_data36_->func = func;
	_data36_->func_target = func_target;
	_tmp0_ = self->priv->providers;
	if (_tmp0_ == NULL) {
		block36_data_unref (_data36_);
		_data36_ = NULL;
		return;
	}
	_tmp1_ = self->priv->providers;
	_vala_g_hash_set_foreach (_tmp1_, ___lambda27__gfunc, _data36_);
	block36_data_unref (_data36_);
	_data36_ = NULL;
}

static Block37Data*
block37_data_ref (Block37Data* _data37_)
{
	g_atomic_int_inc (&_data37_->_ref_count_);
	return _data37_;
}

static void
block37_data_unref (void * _userdata_)
{
	Block37Data* _data37_;
	_data37_ = (Block37Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data37_->_ref_count_)) {
		FtProviderSet* self;
		self = _data37_->self;
		_g_object_unref0 (self);
		g_slice_free (Block37Data, _data37_);
	}
}

static void
__lambda28_ (Block37Data* _data37_,
             FtProviderInfo* provider_info)
{
	FtProviderSet* self;
	FtProvider* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data37_->self;
	g_return_if_fail (provider_info != NULL);
	_tmp0_ = provider_info->instance;
	_tmp1_ = ft_provider_get_enabled (_tmp0_);
	_tmp2_ = _tmp1_;
	if (_tmp2_) {
		FtProvider* _tmp3_;
		_tmp3_ = provider_info->instance;
		_data37_->func ((gconstpointer) _tmp3_, _data37_->func_target);
	}
}

static void
___lambda28__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda28_ (self, (FtProviderInfo*) data);
}

void
ft_provider_set_foreach_enabled (FtProviderSet* self,
                                 GFunc func,
                                 gpointer func_target)
{
	Block37Data* _data37_;
	GHashTable* _tmp0_;
	GHashTable* _tmp1_;
	g_return_if_fail (self != NULL);
	_data37_ = g_slice_new0 (Block37Data);
	_data37_->_ref_count_ = 1;
	_data37_->self = g_object_ref (self);
	_data37_->func = func;
	_data37_->func_target = func_target;
	_tmp0_ = self->priv->providers;
	if (_tmp0_ == NULL) {
		block37_data_unref (_data37_);
		_data37_ = NULL;
		return;
	}
	_tmp1_ = self->priv->providers;
	_vala_g_hash_set_foreach (_tmp1_, ___lambda28__gfunc, _data37_);
	block37_data_unref (_data37_);
	_data37_ = NULL;
}

static void
ft_provider_set_real_dispose (GObject* base)
{
	FtProviderSet * self;
	PeasExtensionSet* _tmp0_;
	self = (FtProviderSet*) base;
	if (self->priv->update_selection_timeout_id != ((guint) 0)) {
		g_source_remove (self->priv->update_selection_timeout_id);
		self->priv->update_selection_timeout_id = (guint) 0;
	}
	if (self->priv->update_selection_idle_id != ((guint) 0)) {
		g_source_remove (self->priv->update_selection_idle_id);
		self->priv->update_selection_idle_id = (guint) 0;
	}
	_tmp0_ = self->priv->extension_set;
	if (_tmp0_ != NULL) {
		PeasExtensionSet* _tmp1_;
		guint _tmp2_;
		PeasExtensionSet* _tmp3_;
		guint _tmp4_;
		_tmp1_ = self->priv->extension_set;
		g_signal_parse_name ("extension-added", peas_extension_set_get_type (), &_tmp2_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp1_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp2_, 0, NULL, (GCallback) _ft_provider_set_on_extension_added_peas_extension_set_extension_added, self);
		_tmp3_ = self->priv->extension_set;
		g_signal_parse_name ("extension-removed", peas_extension_set_get_type (), &_tmp4_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _ft_provider_set_on_extension_removed_peas_extension_set_extension_removed, self);
		_g_object_unref0 (self->priv->extension_set);
		self->priv->extension_set = NULL;
	}
	ft_provider_set_remove_all (self);
	G_OBJECT_CLASS (ft_provider_set_parent_class)->dispose (G_TYPE_CHECK_INSTANCE_CAST (self, G_TYPE_OBJECT, GObject));
}

FtSelectionMode
ft_provider_set_get_selection_mode (FtProviderSet* self)
{
	FtSelectionMode result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_selection_mode;
	return result;
}

static void
ft_provider_set_set_selection_mode (FtProviderSet* self,
                                    FtSelectionMode value)
{
	g_return_if_fail (self != NULL);
	self->priv->_selection_mode = value;
	g_object_notify_by_pspec ((GObject *) self, ft_provider_set_properties[FT_PROVIDER_SET_SELECTION_MODE_PROPERTY]);
}

static void
_ft_provider_info_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (ft_provider_info_unref (var), NULL));
}

static GObject *
ft_provider_set_constructor (GType type,
                             guint n_construct_properties,
                             GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FtProviderSet * self;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	parent_class = G_OBJECT_CLASS (ft_provider_set_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_PROVIDER_SET, FtProviderSet);
	_tmp0_ = g_direct_hash;
	_tmp1_ = g_direct_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, NULL, _ft_provider_info_unref0_);
	_g_hash_table_unref0 (self->priv->providers);
	self->priv->providers = _tmp2_;
	return obj;
}

static void
ft_provider_set_class_init (FtProviderSetClass * klass,
                            gpointer klass_data)
{
	ft_provider_set_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtProviderSet_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) ft_provider_set_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_ft_provider_set_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ft_provider_set_set_property;
	G_OBJECT_CLASS (klass)->constructor = ft_provider_set_constructor;
	G_OBJECT_CLASS (klass)->finalize = ft_provider_set_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_PROVIDER_SET_T_TYPE, g_param_spec_gtype ("t-type", "type", "type", G_TYPE_NONE, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_PROVIDER_SET_T_DUP_FUNC, g_param_spec_pointer ("t-dup-func", "dup func", "dup func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_PROVIDER_SET_T_DESTROY_FUNC, g_param_spec_pointer ("t-destroy-func", "destroy func", "destroy func", G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FT_PROVIDER_SET_SELECTION_MODE_PROPERTY, ft_provider_set_properties[FT_PROVIDER_SET_SELECTION_MODE_PROPERTY] = g_param_spec_enum ("selection-mode", "selection-mode", "selection-mode", FT_TYPE_SELECTION_MODE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	ft_provider_set_signals[FT_PROVIDER_SET_PROVIDER_SELECTED_SIGNAL] = g_signal_new ("provider-selected", FT_TYPE_PROVIDER_SET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
	ft_provider_set_signals[FT_PROVIDER_SET_PROVIDER_UNSELECTED_SIGNAL] = g_signal_new ("provider-unselected", FT_TYPE_PROVIDER_SET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
	ft_provider_set_signals[FT_PROVIDER_SET_PROVIDER_ENABLED_SIGNAL] = g_signal_new ("provider-enabled", FT_TYPE_PROVIDER_SET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
	ft_provider_set_signals[FT_PROVIDER_SET_PROVIDER_DISABLED_SIGNAL] = g_signal_new ("provider-disabled", FT_TYPE_PROVIDER_SET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
	ft_provider_set_signals[FT_PROVIDER_SET_SELECTION_CHANGED_SIGNAL] = g_signal_new ("selection-changed", FT_TYPE_PROVIDER_SET, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
ft_provider_set_instance_init (FtProviderSet * self,
                               gpointer klass)
{
	self->priv = ft_provider_set_get_instance_private (self);
	self->priv->_selection_mode = FT_SELECTION_MODE_ALL;
	self->priv->providers = NULL;
	self->priv->extension_set = NULL;
	self->priv->update_selection_timeout_id = (guint) 0;
	self->priv->update_selection_idle_id = (guint) 0;
	self->priv->selection_invalid = FALSE;
	self->priv->updating_selection = FALSE;
	self->priv->should_enable = FALSE;
}

static void
ft_provider_set_finalize (GObject * obj)
{
	FtProviderSet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_PROVIDER_SET, FtProviderSet);
	_g_hash_table_unref0 (self->priv->providers);
	_g_object_unref0 (self->priv->extension_set);
	G_OBJECT_CLASS (ft_provider_set_parent_class)->finalize (obj);
}

static GType
ft_provider_set_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtProviderSetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_provider_set_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtProviderSet), 0, (GInstanceInitFunc) ft_provider_set_instance_init, NULL };
	GType ft_provider_set_type_id;
	ft_provider_set_type_id = g_type_register_static (G_TYPE_OBJECT, "FtProviderSet", &g_define_type_info, 0);
	FtProviderSet_private_offset = g_type_add_instance_private (ft_provider_set_type_id, sizeof (FtProviderSetPrivate));
	return ft_provider_set_type_id;
}

GType
ft_provider_set_get_type (void)
{
	static volatile gsize ft_provider_set_type_id__once = 0;
	if (g_once_init_enter (&ft_provider_set_type_id__once)) {
		GType ft_provider_set_type_id;
		ft_provider_set_type_id = ft_provider_set_get_type_once ();
		g_once_init_leave (&ft_provider_set_type_id__once, ft_provider_set_type_id);
	}
	return ft_provider_set_type_id__once;
}

static void
_vala_ft_provider_set_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec)
{
	FtProviderSet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_PROVIDER_SET, FtProviderSet);
	switch (property_id) {
		case FT_PROVIDER_SET_SELECTION_MODE_PROPERTY:
		g_value_set_enum (value, ft_provider_set_get_selection_mode (self));
		break;
		case FT_PROVIDER_SET_T_TYPE:
		g_value_set_gtype (value, self->priv->t_type);
		break;
		case FT_PROVIDER_SET_T_DUP_FUNC:
		g_value_set_pointer (value, self->priv->t_dup_func);
		break;
		case FT_PROVIDER_SET_T_DESTROY_FUNC:
		g_value_set_pointer (value, self->priv->t_destroy_func);
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ft_provider_set_set_property (GObject * object,
                                    guint property_id,
                                    const GValue * value,
                                    GParamSpec * pspec)
{
	FtProviderSet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FT_TYPE_PROVIDER_SET, FtProviderSet);
	switch (property_id) {
		case FT_PROVIDER_SET_SELECTION_MODE_PROPERTY:
		ft_provider_set_set_selection_mode (self, g_value_get_enum (value));
		break;
		case FT_PROVIDER_SET_T_TYPE:
		self->priv->t_type = g_value_get_gtype (value);
		break;
		case FT_PROVIDER_SET_T_DUP_FUNC:
		self->priv->t_dup_func = g_value_get_pointer (value);
		break;
		case FT_PROVIDER_SET_T_DESTROY_FUNC:
		self->priv->t_destroy_func = g_value_get_pointer (value);
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

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

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

