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

/*
 * Copyright 2023 elementary, Inc. (https://elementary.io)
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * Authored by: Leonhard Kargl <leo.kargl@proton.me>
 */

#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <packagekit-glib2/packagekit.h>
#include <glib/gi18n-lib.h>

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

#define SETTINGS_DAEMON_BACKENDS_TYPE_UBUNTU_DRIVERS (settings_daemon_backends_ubuntu_drivers_get_type ())
#define SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SETTINGS_DAEMON_BACKENDS_TYPE_UBUNTU_DRIVERS, SettingsDaemonBackendsUbuntuDrivers))
#define SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SETTINGS_DAEMON_BACKENDS_TYPE_UBUNTU_DRIVERS, SettingsDaemonBackendsUbuntuDriversClass))
#define SETTINGS_DAEMON_BACKENDS_IS_UBUNTU_DRIVERS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SETTINGS_DAEMON_BACKENDS_TYPE_UBUNTU_DRIVERS))
#define SETTINGS_DAEMON_BACKENDS_IS_UBUNTU_DRIVERS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SETTINGS_DAEMON_BACKENDS_TYPE_UBUNTU_DRIVERS))
#define SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SETTINGS_DAEMON_BACKENDS_TYPE_UBUNTU_DRIVERS, SettingsDaemonBackendsUbuntuDriversClass))

typedef struct _SettingsDaemonBackendsUbuntuDrivers SettingsDaemonBackendsUbuntuDrivers;
typedef struct _SettingsDaemonBackendsUbuntuDriversClass SettingsDaemonBackendsUbuntuDriversClass;
typedef struct _SettingsDaemonBackendsUbuntuDriversPrivate SettingsDaemonBackendsUbuntuDriversPrivate;

#define SETTINGS_DAEMON_PK_UTILS_TYPE_CURRENT_STATE (settings_daemon_pk_utils_current_state_get_type ())
typedef struct _SettingsDaemonPkUtilsCurrentState SettingsDaemonPkUtilsCurrentState;
typedef enum  {
	SETTINGS_DAEMON_PK_UTILS_STATE_UP_TO_DATE,
	SETTINGS_DAEMON_PK_UTILS_STATE_CHECKING,
	SETTINGS_DAEMON_PK_UTILS_STATE_AVAILABLE,
	SETTINGS_DAEMON_PK_UTILS_STATE_DOWNLOADING,
	SETTINGS_DAEMON_PK_UTILS_STATE_RESTART_REQUIRED,
	SETTINGS_DAEMON_PK_UTILS_STATE_ERROR
} SettingsDaemonPkUtilsState;

#define SETTINGS_DAEMON_PK_UTILS_TYPE_STATE (settings_daemon_pk_utils_state_get_type ())

#define SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_TYPE_DEVICE (settings_daemon_backends_ubuntu_drivers_device_get_type ())
#define SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_TYPE_DEVICE, SettingsDaemonBackendsUbuntuDriversDevice))
#define SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_TYPE_DEVICE, SettingsDaemonBackendsUbuntuDriversDeviceClass))
#define SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_TYPE_DEVICE))
#define SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_TYPE_DEVICE))
#define SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_TYPE_DEVICE, SettingsDaemonBackendsUbuntuDriversDeviceClass))

typedef struct _SettingsDaemonBackendsUbuntuDriversDevice SettingsDaemonBackendsUbuntuDriversDevice;
typedef struct _SettingsDaemonBackendsUbuntuDriversDeviceClass SettingsDaemonBackendsUbuntuDriversDeviceClass;
enum  {
	SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_0_PROPERTY,
	SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_NUM_PROPERTIES
};
static GParamSpec* settings_daemon_backends_ubuntu_drivers_properties[SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_NUM_PROPERTIES];
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _SettingsDaemonBackendsUbuntuDriversGetDriversOutputData SettingsDaemonBackendsUbuntuDriversGetDriversOutputData;
typedef struct _SettingsDaemonBackendsUbuntuDriversDevicePrivate SettingsDaemonBackendsUbuntuDriversDevicePrivate;
typedef struct _SettingsDaemonBackendsUbuntuDriversCheckDevicesData SettingsDaemonBackendsUbuntuDriversCheckDevicesData;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
typedef struct _SettingsDaemonBackendsUbuntuDriversCheckForDriversData SettingsDaemonBackendsUbuntuDriversCheckForDriversData;
typedef struct _SettingsDaemonBackendsUbuntuDriversUpdateInstalledData SettingsDaemonBackendsUbuntuDriversUpdateInstalledData;
typedef struct _SettingsDaemonBackendsUbuntuDriversInstallData SettingsDaemonBackendsUbuntuDriversInstallData;
typedef struct _SettingsDaemonBackendsUbuntuDriversGetCurrentStateData SettingsDaemonBackendsUbuntuDriversGetCurrentStateData;
typedef struct _SettingsDaemonBackendsUbuntuDriversGetAvailableDriversData SettingsDaemonBackendsUbuntuDriversGetAvailableDriversData;
enum  {
	SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_DEVICE_0_PROPERTY,
	SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_DEVICE_NUM_PROPERTIES
};
static GParamSpec* settings_daemon_backends_ubuntu_drivers_device_properties[SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_DEVICE_NUM_PROPERTIES];
enum  {
	SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_STATE_CHANGED_SIGNAL,
	SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_NUM_SIGNALS
};
static guint settings_daemon_backends_ubuntu_drivers_signals[SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_NUM_SIGNALS] = {0};
typedef struct _SettingsDaemonBackendsUbuntuDriversCheckForDriversReadyData SettingsDaemonBackendsUbuntuDriversCheckForDriversReadyData;
typedef struct _SettingsDaemonBackendsUbuntuDriversInstallReadyData SettingsDaemonBackendsUbuntuDriversInstallReadyData;
typedef struct _SettingsDaemonBackendsUbuntuDriversGetCurrentStateReadyData SettingsDaemonBackendsUbuntuDriversGetCurrentStateReadyData;
typedef struct _SettingsDaemonBackendsUbuntuDriversGetAvailableDriversReadyData SettingsDaemonBackendsUbuntuDriversGetAvailableDriversReadyData;

struct _SettingsDaemonBackendsUbuntuDrivers {
	GObject parent_instance;
	SettingsDaemonBackendsUbuntuDriversPrivate * priv;
};

struct _SettingsDaemonBackendsUbuntuDriversClass {
	GObjectClass parent_class;
};

struct _SettingsDaemonPkUtilsCurrentState {
	SettingsDaemonPkUtilsState state;
	gchar* status;
	guint percentage;
	guint64 download_size_remaining;
};

struct _SettingsDaemonBackendsUbuntuDriversPrivate {
	SettingsDaemonPkUtilsCurrentState current_state;
	GHashTable* available_drivers;
	GHashTable* devices_by_drivers;
	SettingsDaemonBackendsUbuntuDriversDevice** devices;
	gint devices_length1;
	gint _devices_size_;
	PkTask* task;
	GCancellable* cancellable;
};

struct _SettingsDaemonBackendsUbuntuDriversGetDriversOutputData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SettingsDaemonBackendsUbuntuDrivers* self;
	gchar* verb;
	gchar* result;
	gchar* drivers_exec_path;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	GSubprocess* command;
	const gchar* _tmp2_;
	GSubprocess* _tmp3_;
	gchar* output;
	GSubprocess* _tmp4_;
	GCancellable* _tmp5_;
	gchar* _tmp6_;
	GError* e;
	GError* _tmp7_;
	const gchar* _tmp8_;
	GError* _inner_error0_;
};

struct _SettingsDaemonBackendsUbuntuDriversDevice {
	GObject parent_instance;
	SettingsDaemonBackendsUbuntuDriversDevicePrivate * priv;
	gchar* name;
	GHashTable* available_drivers_with_installed;
};

struct _SettingsDaemonBackendsUbuntuDriversDeviceClass {
	GObjectClass parent_class;
};

struct _SettingsDaemonBackendsUbuntuDriversCheckDevicesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SettingsDaemonBackendsUbuntuDrivers* self;
	gchar* output;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar** tokens;
	const gchar* _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
	gint tokens_length1;
	gint _tokens_size_;
	SettingsDaemonBackendsUbuntuDriversDevice* current_device;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gchar** token_collection;
	gint token_collection_length1;
	gint _token_collection_size_;
	gint token_it;
	gchar* _tmp6_;
	gchar* token;
	const gchar* _tmp7_;
	SettingsDaemonBackendsUbuntuDriversDevice* _tmp8_;
	SettingsDaemonBackendsUbuntuDriversDevice* _tmp9_;
	SettingsDaemonBackendsUbuntuDriversDevice* _tmp10_;
	SettingsDaemonBackendsUbuntuDriversDevice* _tmp11_;
	const gchar* _tmp12_;
	gchar* normalized_token;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	SettingsDaemonBackendsUbuntuDriversDevice* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	const gchar* _tmp18_;
	gchar* _vala1_normalized_token;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gchar** split_token;
	const gchar* _tmp21_;
	gchar** _tmp22_;
	gchar** _tmp23_;
	gint split_token_length1;
	gint _split_token_size_;
	gchar* driver;
	gchar** _tmp24_;
	gint _tmp24__length1;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	GHashTable* _tmp27_;
	const gchar* _tmp28_;
	gchar* _tmp29_;
	SettingsDaemonBackendsUbuntuDriversDevice* _tmp30_;
	SettingsDaemonBackendsUbuntuDriversDevice* _tmp31_;
};

struct _SettingsDaemonBackendsUbuntuDriversCheckForDriversData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SettingsDaemonBackendsUbuntuDrivers* self;
	gboolean notify;
	GHashTable* _tmp0_;
	gchar* command_output;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar** tokens;
	const gchar* _tmp3_;
	gchar** _tmp4_;
	gchar** _tmp5_;
	gint tokens_length1;
	gint _tokens_size_;
	gchar** _tmp6_;
	gint _tmp6__length1;
	gchar** line_collection;
	gint line_collection_length1;
	gint _line_collection_size_;
	gint line_it;
	const gchar* line;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gboolean _tmp10_;
	gboolean _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar** parts;
	const gchar* _tmp14_;
	gchar** _tmp15_;
	gchar** _tmp16_;
	gint parts_length1;
	gint _parts_size_;
	gchar* driver;
	gchar** _tmp17_;
	gint _tmp17__length1;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	gboolean _tmp20_;
	const gchar* _tmp21_;
	GHashTable* _tmp22_;
	const gchar* _tmp23_;
	gchar** package_names;
	gchar** _tmp24_;
	gint package_names_length1;
	gint _package_names_size_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	gchar** _tmp27_;
	gint _tmp27__length1;
	gchar** _tmp28_;
	gint _tmp28__length1;
	const gchar* _tmp29_;
	gchar** kernel_module_parts;
	gchar** _tmp30_;
	gint _tmp30__length1;
	const gchar* _tmp31_;
	gchar** _tmp32_;
	gchar** _tmp33_;
	gint kernel_module_parts_length1;
	gint _kernel_module_parts_size_;
	gchar* last_part;
	gchar** _tmp34_;
	gint _tmp34__length1;
	gchar** _tmp35_;
	gint _tmp35__length1;
	const gchar* _tmp36_;
	gchar* _tmp37_;
	const gchar* _tmp38_;
	gchar* _tmp39_;
	const gchar* _tmp40_;
	gchar** _tmp41_;
	gint _tmp41__length1;
	const gchar* _tmp42_;
	gchar* _tmp43_;
	const gchar* _tmp44_;
	GPtrArray* driver_available_packages;
	const gchar* _tmp45_;
	gchar** _tmp46_;
	gint _tmp46__length1;
	GPtrArray* _tmp47_;
	GPtrArray* _tmp48_;
	gint _tmp49_;
	gint _tmp50_;
	GHashTable* _tmp51_;
	const gchar* _tmp52_;
	gchar* _tmp53_;
	GPtrArray* _tmp54_;
	GPtrArray* _tmp55_;
	GHashTable* _tmp56_;
	guint _tmp57_;
	guint _tmp58_;
	gchar* title;
	GHashTable* _tmp59_;
	guint _tmp60_;
	guint _tmp61_;
	gchar* _tmp62_;
	gchar* body;
	GHashTable* _tmp63_;
	guint _tmp64_;
	guint _tmp65_;
	gchar* _tmp66_;
	GNotification* notification;
	const gchar* _tmp67_;
	GNotification* _tmp68_;
	GNotification* _tmp69_;
	GNotification* _tmp70_;
	const gchar* _tmp71_;
	GHashTable* _tmp72_;
	guint _tmp73_;
	guint _tmp74_;
	gchar* _tmp75_;
	gchar* _tmp76_;
	GNotification* _tmp77_;
	GThemedIcon* _tmp78_;
	GThemedIcon* _tmp79_;
	GApplication* _tmp80_;
	GNotification* _tmp81_;
};

struct _SettingsDaemonBackendsUbuntuDriversUpdateInstalledData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SettingsDaemonBackendsUbuntuDrivers* self;
	gchar* driver;
	gchar** package_names;
	gint package_names_length1;
	GPtrArray* result;
	GPtrArray* array;
	GPtrArray* _tmp0_;
	PkResults* _result_;
	PkTask* _tmp1_;
	PkResults* _tmp2_;
	GPtrArray* packages;
	PkResults* _tmp3_;
	GPtrArray* _tmp4_;
	gboolean all_installed;
	GPtrArray* _tmp5_;
	GPtrArray* package_collection;
	guint package_index;
	PkPackage* package;
	GHashTable* _tmp6_;
	gboolean _tmp7_;
	PkPackage* _tmp8_;
	PkInfoEnum _tmp9_;
	PkInfoEnum _tmp10_;
	GHashTable* _tmp11_;
	gconstpointer _tmp12_;
	GHashTable* _tmp13_;
	gchar* _tmp14_;
	GHashTable* _tmp15_;
	gconstpointer _tmp16_;
	GHashTable* _tmp17_;
	gchar* _tmp18_;
	GPtrArray* _tmp19_;
	PkPackage* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	GError* e;
	GError* _tmp23_;
	const gchar* _tmp24_;
	GError* _inner_error0_;
};

struct _SettingsDaemonBackendsUbuntuDriversInstallData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SettingsDaemonBackendsUbuntuDrivers* self;
	gchar* pkg_name;
	GHashTable* _tmp0_;
	SettingsDaemonPkUtilsCurrentState _tmp1_;
	GCancellable* _tmp2_;
	gchar** pkgs;
	GHashTable* _tmp3_;
	gconstpointer _tmp4_;
	gpointer* _tmp5_;
	gint _tmp5__length1;
	gchar** _tmp6_;
	gint _tmp6__length1;
	gint pkgs_length1;
	gint _pkgs_size_;
	PkResults* results;
	PkTask* _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	GCancellable* _tmp9_;
	PkResults* _tmp10_;
	PkResults* _tmp11_;
	GHashTable* _tmp12_;
	GList* _tmp13_;
	GList* driver_collection;
	GList* driver_it;
	const gchar* driver;
	gchar** driver_pkgs;
	GHashTable* _tmp14_;
	const gchar* _tmp15_;
	gconstpointer _tmp16_;
	gpointer* _tmp17_;
	gint _tmp17__length1;
	gchar** _tmp18_;
	gint _tmp18__length1;
	gint driver_pkgs_length1;
	gint _driver_pkgs_size_;
	const gchar* _tmp19_;
	gchar** _tmp20_;
	gint _tmp20__length1;
	GPtrArray* _tmp21_;
	GPtrArray* _tmp22_;
	GNotification* notification;
	GNotification* _tmp23_;
	GNotification* _tmp24_;
	GNotification* _tmp25_;
	GThemedIcon* _tmp26_;
	GThemedIcon* _tmp27_;
	GNotification* _tmp28_;
	GApplication* _tmp29_;
	GNotification* _tmp30_;
	GError* e;
	GError* _tmp31_;
	const gchar* _tmp32_;
	GError* _tmp33_;
	const gchar* _tmp34_;
	GError* _inner_error0_;
};

struct _SettingsDaemonBackendsUbuntuDriversGetCurrentStateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SettingsDaemonBackendsUbuntuDrivers* self;
	SettingsDaemonPkUtilsCurrentState result;
	SettingsDaemonPkUtilsCurrentState _tmp0_;
	SettingsDaemonPkUtilsCurrentState _tmp1_;
	SettingsDaemonPkUtilsCurrentState _tmp2_;
};

struct _SettingsDaemonBackendsUbuntuDriversGetAvailableDriversData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SettingsDaemonBackendsUbuntuDrivers* self;
	GHashTable* result;
	GHashTable* map;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	SettingsDaemonBackendsUbuntuDriversDevice** _tmp3_;
	gint _tmp3__length1;
	SettingsDaemonBackendsUbuntuDriversDevice** device_collection;
	gint device_collection_length1;
	gint _device_collection_size_;
	gint device_it;
	SettingsDaemonBackendsUbuntuDriversDevice* _tmp4_;
	SettingsDaemonBackendsUbuntuDriversDevice* device;
	GHashTable* _tmp5_;
	SettingsDaemonBackendsUbuntuDriversDevice* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	SettingsDaemonBackendsUbuntuDriversDevice* _tmp9_;
	GHashTable* _tmp10_;
	GHashTable* _tmp11_;
};

struct _SettingsDaemonBackendsUbuntuDriversCheckForDriversReadyData {
	GDBusMethodInvocation* _invocation_;
	gboolean notify;
};

struct _SettingsDaemonBackendsUbuntuDriversInstallReadyData {
	GDBusMethodInvocation* _invocation_;
	gchar* pkg_name;
};

struct _SettingsDaemonBackendsUbuntuDriversGetCurrentStateReadyData {
	GDBusMethodInvocation* _invocation_;
};

struct _SettingsDaemonBackendsUbuntuDriversGetAvailableDriversReadyData {
	GDBusMethodInvocation* _invocation_;
};

static gint SettingsDaemonBackendsUbuntuDrivers_private_offset;
static gpointer settings_daemon_backends_ubuntu_drivers_parent_class = NULL;
static gpointer settings_daemon_backends_ubuntu_drivers_device_parent_class = NULL;

VALA_EXTERN GType settings_daemon_backends_ubuntu_drivers_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SettingsDaemonBackendsUbuntuDrivers, g_object_unref)
VALA_EXTERN guint settings_daemon_backends_ubuntu_drivers_register_object (void* object,
                                                               GDBusConnection* connection,
                                                               const gchar* path,
                                                               GError** error);
VALA_EXTERN GType settings_daemon_pk_utils_current_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType settings_daemon_pk_utils_state_get_type (void) G_GNUC_CONST ;
VALA_EXTERN SettingsDaemonPkUtilsCurrentState* settings_daemon_pk_utils_current_state_dup (const SettingsDaemonPkUtilsCurrentState* self);
VALA_EXTERN void settings_daemon_pk_utils_current_state_free (SettingsDaemonPkUtilsCurrentState* self);
VALA_EXTERN void settings_daemon_pk_utils_current_state_copy (const SettingsDaemonPkUtilsCurrentState* self,
                                                  SettingsDaemonPkUtilsCurrentState* dest);
VALA_EXTERN void settings_daemon_pk_utils_current_state_destroy (SettingsDaemonPkUtilsCurrentState* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (SettingsDaemonPkUtilsCurrentState, settings_daemon_pk_utils_current_state_destroy)
static GType settings_daemon_backends_ubuntu_drivers_device_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SettingsDaemonBackendsUbuntuDriversDevice, g_object_unref)
static void settings_daemon_backends_ubuntu_drivers_get_drivers_output_data_free (gpointer _data);
static void settings_daemon_backends_ubuntu_drivers_get_drivers_output (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                 const gchar* verb,
                                                                 GAsyncReadyCallback _callback_,
                                                                 gpointer _user_data_);
static gchar* settings_daemon_backends_ubuntu_drivers_get_drivers_output_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                          GAsyncResult* _res_);
static gboolean settings_daemon_backends_ubuntu_drivers_get_drivers_output_co (SettingsDaemonBackendsUbuntuDriversGetDriversOutputData* _data_);
static void settings_daemon_backends_ubuntu_drivers_get_drivers_output_ready (GObject* source_object,
                                                                       GAsyncResult* _res_,
                                                                       gpointer _user_data_);
static void settings_daemon_backends_ubuntu_drivers_check_devices_data_free (gpointer _data);
static void settings_daemon_backends_ubuntu_drivers_check_devices (SettingsDaemonBackendsUbuntuDrivers* self,
                                                            GAsyncReadyCallback _callback_,
                                                            gpointer _user_data_);
static void settings_daemon_backends_ubuntu_drivers_check_devices_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                   GAsyncResult* _res_);
static gboolean settings_daemon_backends_ubuntu_drivers_check_devices_co (SettingsDaemonBackendsUbuntuDriversCheckDevicesData* _data_);
static void settings_daemon_backends_ubuntu_drivers_check_devices_ready (GObject* source_object,
                                                                  GAsyncResult* _res_,
                                                                  gpointer _user_data_);
static SettingsDaemonBackendsUbuntuDriversDevice* settings_daemon_backends_ubuntu_drivers_device_new (void);
static SettingsDaemonBackendsUbuntuDriversDevice* settings_daemon_backends_ubuntu_drivers_device_construct (GType object_type);
static void _vala_array_add14 (SettingsDaemonBackendsUbuntuDriversDevice** * array,
                        gint* length,
                        gint* size,
                        SettingsDaemonBackendsUbuntuDriversDevice* value);
static void settings_daemon_backends_ubuntu_drivers_check_for_drivers_data_free (gpointer _data);
VALA_EXTERN void settings_daemon_backends_ubuntu_drivers_check_for_drivers (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                gboolean notify,
                                                                GAsyncReadyCallback _callback_,
                                                                gpointer _user_data_);
VALA_EXTERN void settings_daemon_backends_ubuntu_drivers_check_for_drivers_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                       GAsyncResult* _res_,
                                                                       GError** error);
static gboolean settings_daemon_backends_ubuntu_drivers_check_for_drivers_co (SettingsDaemonBackendsUbuntuDriversCheckForDriversData* _data_);
static void settings_daemon_backends_ubuntu_drivers_update_state (SettingsDaemonBackendsUbuntuDrivers* self,
                                                           SettingsDaemonPkUtilsState state,
                                                           const gchar* message,
                                                           guint percentage,
                                                           guint64 download_size_remaining);
static void settings_daemon_backends_ubuntu_drivers_check_for_drivers_ready (GObject* source_object,
                                                                      GAsyncResult* _res_,
                                                                      gpointer _user_data_);
static void _vala_array_add15 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
static void _vala_array_add16 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static void settings_daemon_backends_ubuntu_drivers_update_installed (SettingsDaemonBackendsUbuntuDrivers* self,
                                                               const gchar* driver,
                                                               gchar** package_names,
                                                               gint package_names_length1,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_);
static GPtrArray* settings_daemon_backends_ubuntu_drivers_update_installed_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                            GAsyncResult* _res_);
static void settings_daemon_backends_ubuntu_drivers_update_installed_data_free (gpointer _data);
static gboolean settings_daemon_backends_ubuntu_drivers_update_installed_co (SettingsDaemonBackendsUbuntuDriversUpdateInstalledData* _data_);
static void _g_free0_ (gpointer var);
static void ___lambda23_ (SettingsDaemonBackendsUbuntuDrivers* self);
static void ____lambda23__pk_progress_callback (PkProgress* progress,
                                         PkProgressType type,
                                         gpointer self);
static void settings_daemon_backends_ubuntu_drivers_update_installed_ready (GObject* source_object,
                                                                     GAsyncResult* _res_,
                                                                     gpointer _user_data_);
static void settings_daemon_backends_ubuntu_drivers_install_data_free (gpointer _data);
VALA_EXTERN void settings_daemon_backends_ubuntu_drivers_install (SettingsDaemonBackendsUbuntuDrivers* self,
                                                      const gchar* pkg_name,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
VALA_EXTERN void settings_daemon_backends_ubuntu_drivers_install_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                             GAsyncResult* _res_,
                                                             GError** error);
static gboolean settings_daemon_backends_ubuntu_drivers_install_co (SettingsDaemonBackendsUbuntuDriversInstallData* _data_);
static gchar** _vala_array_dup9 (gchar** self,
                          gssize length);
static void settings_daemon_backends_ubuntu_drivers_progress_callback (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                PkProgress* progress,
                                                                PkProgressType progress_type);
static void _settings_daemon_backends_ubuntu_drivers_progress_callback_pk_progress_callback (PkProgress* progress,
                                                                                      PkProgressType type,
                                                                                      gpointer self);
static void settings_daemon_backends_ubuntu_drivers_install_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_);
static gchar** _vala_array_dup10 (gchar** self,
                           gssize length);
static void settings_daemon_backends_ubuntu_drivers_send_error (SettingsDaemonBackendsUbuntuDrivers* self,
                                                         const gchar* message);
VALA_EXTERN void settings_daemon_backends_ubuntu_drivers_cancel (SettingsDaemonBackendsUbuntuDrivers* self,
                                                     GError** error);
VALA_EXTERN const gchar* settings_daemon_pk_utils_status_to_title (PkStatusEnum status);
static void settings_daemon_backends_ubuntu_drivers_get_current_state_data_free (gpointer _data);
VALA_EXTERN void settings_daemon_backends_ubuntu_drivers_get_current_state (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                GAsyncReadyCallback _callback_,
                                                                gpointer _user_data_);
VALA_EXTERN void settings_daemon_backends_ubuntu_drivers_get_current_state_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                       GAsyncResult* _res_,
                                                                       SettingsDaemonPkUtilsCurrentState* result,
                                                                       GError** error);
static gboolean settings_daemon_backends_ubuntu_drivers_get_current_state_co (SettingsDaemonBackendsUbuntuDriversGetCurrentStateData* _data_);
static void settings_daemon_backends_ubuntu_drivers_get_available_drivers_data_free (gpointer _data);
VALA_EXTERN void settings_daemon_backends_ubuntu_drivers_get_available_drivers (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                    GAsyncReadyCallback _callback_,
                                                                    gpointer _user_data_);
VALA_EXTERN GHashTable* settings_daemon_backends_ubuntu_drivers_get_available_drivers_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                                  GAsyncResult* _res_,
                                                                                  GError** error);
static gboolean settings_daemon_backends_ubuntu_drivers_get_available_drivers_co (SettingsDaemonBackendsUbuntuDriversGetAvailableDriversData* _data_);
static void _g_hash_table_unref0_ (gpointer var);
VALA_EXTERN SettingsDaemonBackendsUbuntuDrivers* settings_daemon_backends_ubuntu_drivers_new (void);
VALA_EXTERN SettingsDaemonBackendsUbuntuDrivers* settings_daemon_backends_ubuntu_drivers_construct (GType object_type);
static void settings_daemon_backends_ubuntu_drivers_device_finalize (GObject * obj);
static GType settings_daemon_backends_ubuntu_drivers_device_get_type_once (void);
static GObject * settings_daemon_backends_ubuntu_drivers_constructor (GType type,
                                                               guint n_construct_properties,
                                                               GObjectConstructParam * construct_properties);
static void _g_ptr_array_unref0_ (gpointer var);
static void _g_object_unref0_ (gpointer var);
static void settings_daemon_backends_ubuntu_drivers_finalize (GObject * obj);
static GType settings_daemon_backends_ubuntu_drivers_get_type_once (void);
static void _dbus_settings_daemon_backends_ubuntu_drivers_check_for_drivers (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                      GVariant* _parameters_,
                                                                      GDBusMethodInvocation* invocation);
static void _dbus_settings_daemon_backends_ubuntu_drivers_check_for_drivers_ready (GObject * source_object,
                                                                            GAsyncResult * _res_,
                                                                            gpointer _user_data_);
static void _dbus_settings_daemon_backends_ubuntu_drivers_install (SettingsDaemonBackendsUbuntuDrivers* self,
                                                            GVariant* _parameters_,
                                                            GDBusMethodInvocation* invocation);
static void _dbus_settings_daemon_backends_ubuntu_drivers_install_ready (GObject * source_object,
                                                                  GAsyncResult * _res_,
                                                                  gpointer _user_data_);
static void _dbus_settings_daemon_backends_ubuntu_drivers_cancel (SettingsDaemonBackendsUbuntuDrivers* self,
                                                           GVariant* _parameters_,
                                                           GDBusMethodInvocation* invocation);
static void _dbus_settings_daemon_backends_ubuntu_drivers_get_current_state (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                      GVariant* _parameters_,
                                                                      GDBusMethodInvocation* invocation);
static void _dbus_settings_daemon_backends_ubuntu_drivers_get_current_state_ready (GObject * source_object,
                                                                            GAsyncResult * _res_,
                                                                            gpointer _user_data_);
static void _dbus_settings_daemon_backends_ubuntu_drivers_get_available_drivers (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                          GVariant* _parameters_,
                                                                          GDBusMethodInvocation* invocation);
static void _dbus_settings_daemon_backends_ubuntu_drivers_get_available_drivers_ready (GObject * source_object,
                                                                                GAsyncResult * _res_,
                                                                                gpointer _user_data_);
static void settings_daemon_backends_ubuntu_drivers_dbus_interface_method_call (GDBusConnection* connection,
                                                                         const gchar* sender,
                                                                         const gchar* object_path,
                                                                         const gchar* interface_name,
                                                                         const gchar* method_name,
                                                                         GVariant* parameters,
                                                                         GDBusMethodInvocation* invocation,
                                                                         gpointer user_data);
static GVariant* settings_daemon_backends_ubuntu_drivers_dbus_interface_get_property (GDBusConnection* connection,
                                                                               const gchar* sender,
                                                                               const gchar* object_path,
                                                                               const gchar* interface_name,
                                                                               const gchar* property_name,
                                                                               GError** error,
                                                                               gpointer user_data);
static gboolean settings_daemon_backends_ubuntu_drivers_dbus_interface_set_property (GDBusConnection* connection,
                                                                              const gchar* sender,
                                                                              const gchar* object_path,
                                                                              const gchar* interface_name,
                                                                              const gchar* property_name,
                                                                              GVariant* value,
                                                                              GError** error,
                                                                              gpointer user_data);
static void _dbus_settings_daemon_backends_ubuntu_drivers_state_changed (GObject* _sender,
                                                                  gpointer* _data);
static void _settings_daemon_backends_ubuntu_drivers_unregister_object (gpointer user_data);
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 gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static const GDBusArgInfo _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_check_for_drivers_notify = {-1, "notify", "b", NULL};
static const GDBusArgInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_check_for_drivers_in[] = {&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_check_for_drivers_notify, NULL};
static const GDBusArgInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_check_for_drivers_out[] = {NULL};
static const GDBusMethodInfo _settings_daemon_backends_ubuntu_drivers_dbus_method_info_check_for_drivers = {-1, "CheckForDrivers", (GDBusArgInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_check_for_drivers_in), (GDBusArgInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_check_for_drivers_out), NULL};
static const GDBusArgInfo _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_install_pkg_name = {-1, "pkg_name", "s", NULL};
static const GDBusArgInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_install_in[] = {&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_install_pkg_name, NULL};
static const GDBusArgInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_install_out[] = {NULL};
static const GDBusMethodInfo _settings_daemon_backends_ubuntu_drivers_dbus_method_info_install = {-1, "Install", (GDBusArgInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_install_in), (GDBusArgInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_install_out), NULL};
static const GDBusArgInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_cancel_in[] = {NULL};
static const GDBusArgInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_cancel_out[] = {NULL};
static const GDBusMethodInfo _settings_daemon_backends_ubuntu_drivers_dbus_method_info_cancel = {-1, "Cancel", (GDBusArgInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_cancel_in), (GDBusArgInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_cancel_out), NULL};
static const GDBusArgInfo _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_get_current_state_result = {-1, "result", "(isut)", NULL};
static const GDBusArgInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_get_current_state_in[] = {NULL};
static const GDBusArgInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_get_current_state_out[] = {&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_get_current_state_result, NULL};
static const GDBusMethodInfo _settings_daemon_backends_ubuntu_drivers_dbus_method_info_get_current_state = {-1, "GetCurrentState", (GDBusArgInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_get_current_state_in), (GDBusArgInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_get_current_state_out), NULL};
static const GDBusArgInfo _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_get_available_drivers_result = {-1, "result", "a{sa{sb}}", NULL};
static const GDBusArgInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_get_available_drivers_in[] = {NULL};
static const GDBusArgInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_get_available_drivers_out[] = {&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_get_available_drivers_result, NULL};
static const GDBusMethodInfo _settings_daemon_backends_ubuntu_drivers_dbus_method_info_get_available_drivers = {-1, "GetAvailableDrivers", (GDBusArgInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_get_available_drivers_in), (GDBusArgInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_get_available_drivers_out), NULL};
static const GDBusMethodInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_method_info[] = {&_settings_daemon_backends_ubuntu_drivers_dbus_method_info_check_for_drivers, &_settings_daemon_backends_ubuntu_drivers_dbus_method_info_install, &_settings_daemon_backends_ubuntu_drivers_dbus_method_info_cancel, &_settings_daemon_backends_ubuntu_drivers_dbus_method_info_get_current_state, &_settings_daemon_backends_ubuntu_drivers_dbus_method_info_get_available_drivers, NULL};
static const GDBusArgInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_arg_info_state_changed[] = {NULL};
static const GDBusSignalInfo _settings_daemon_backends_ubuntu_drivers_dbus_signal_info_state_changed = {-1, "StateChanged", (GDBusArgInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_arg_info_state_changed), NULL};
static const GDBusSignalInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_signal_info[] = {&_settings_daemon_backends_ubuntu_drivers_dbus_signal_info_state_changed, NULL};
static const GDBusPropertyInfo * const _settings_daemon_backends_ubuntu_drivers_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _settings_daemon_backends_ubuntu_drivers_dbus_interface_info = {-1, "io.elementary.settings_daemon.Drivers", (GDBusMethodInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_method_info), (GDBusSignalInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_signal_info), (GDBusPropertyInfo **) (&_settings_daemon_backends_ubuntu_drivers_dbus_property_info), NULL};
static const GDBusInterfaceVTable _settings_daemon_backends_ubuntu_drivers_dbus_interface_vtable = {settings_daemon_backends_ubuntu_drivers_dbus_interface_method_call, settings_daemon_backends_ubuntu_drivers_dbus_interface_get_property, settings_daemon_backends_ubuntu_drivers_dbus_interface_set_property};

static inline gpointer
settings_daemon_backends_ubuntu_drivers_get_instance_private (SettingsDaemonBackendsUbuntuDrivers* self)
{
	return G_STRUCT_MEMBER_P (self, SettingsDaemonBackendsUbuntuDrivers_private_offset);
}

static void
settings_daemon_backends_ubuntu_drivers_get_drivers_output_data_free (gpointer _data)
{
	SettingsDaemonBackendsUbuntuDriversGetDriversOutputData* _data_;
	_data_ = _data;
	_g_free0 (_data_->verb);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (SettingsDaemonBackendsUbuntuDriversGetDriversOutputData, _data_);
}

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

static void
settings_daemon_backends_ubuntu_drivers_get_drivers_output (SettingsDaemonBackendsUbuntuDrivers* self,
                                                            const gchar* verb,
                                                            GAsyncReadyCallback _callback_,
                                                            gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversGetDriversOutputData* _data_;
	SettingsDaemonBackendsUbuntuDrivers* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (verb != NULL);
	_data_ = g_slice_new0 (SettingsDaemonBackendsUbuntuDriversGetDriversOutputData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, settings_daemon_backends_ubuntu_drivers_get_drivers_output_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (verb);
	_g_free0 (_data_->verb);
	_data_->verb = _tmp1_;
	settings_daemon_backends_ubuntu_drivers_get_drivers_output_co (_data_);
}

static gchar*
settings_daemon_backends_ubuntu_drivers_get_drivers_output_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                   GAsyncResult* _res_)
{
	gchar* result;
	SettingsDaemonBackendsUbuntuDriversGetDriversOutputData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
settings_daemon_backends_ubuntu_drivers_get_drivers_output_ready (GObject* source_object,
                                                                  GAsyncResult* _res_,
                                                                  gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversGetDriversOutputData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	settings_daemon_backends_ubuntu_drivers_get_drivers_output_co (_data_);
}

static gboolean
settings_daemon_backends_ubuntu_drivers_get_drivers_output_co (SettingsDaemonBackendsUbuntuDriversGetDriversOutputData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_find_program_in_path ("ubuntu-drivers");
	_data_->drivers_exec_path = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->drivers_exec_path;
	if (_data_->_tmp1_ == NULL) {
		_data_->result = NULL;
		_g_free0 (_data_->drivers_exec_path);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp2_ = _data_->drivers_exec_path;
		_data_->_tmp3_ = g_subprocess_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE, &_data_->_inner_error0_, _data_->_tmp2_, _data_->verb, NULL);
		_data_->command = _data_->_tmp3_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp4_ = _data_->command;
		_data_->_tmp5_ = _data_->self->priv->cancellable;
		_data_->_tmp6_ = NULL;
		_data_->_state_ = 1;
		g_subprocess_communicate_utf8_async (_data_->_tmp4_, NULL, _data_->_tmp5_, settings_daemon_backends_ubuntu_drivers_get_drivers_output_ready, _data_);
		return FALSE;
		_state_1:
		g_subprocess_communicate_utf8_finish (_data_->_tmp4_, _data_->_res_, &_data_->_tmp6_, NULL, &_data_->_inner_error0_);
		_g_free0 (_data_->output);
		_data_->output = _data_->_tmp6_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_free0 (_data_->output);
			_g_object_unref0 (_data_->command);
			goto __catch0_g_error;
		}
		_data_->result = _data_->output;
		_g_object_unref0 (_data_->command);
		_g_free0 (_data_->drivers_exec_path);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = _data_->e;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		g_critical ("UbuntuDrivers.vala:59: Failed to launch ubuntu-drivers: %s", _data_->_tmp8_);
		_data_->result = NULL;
		_g_error_free0 (_data_->e);
		_g_free0 (_data_->drivers_exec_path);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	_g_free0 (_data_->drivers_exec_path);
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
	g_clear_error (&_data_->_inner_error0_);
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
settings_daemon_backends_ubuntu_drivers_check_devices (SettingsDaemonBackendsUbuntuDrivers* self,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversCheckDevicesData* _data_;
	SettingsDaemonBackendsUbuntuDrivers* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (SettingsDaemonBackendsUbuntuDriversCheckDevicesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, settings_daemon_backends_ubuntu_drivers_check_devices_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	settings_daemon_backends_ubuntu_drivers_check_devices_co (_data_);
}

static void
settings_daemon_backends_ubuntu_drivers_check_devices_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                              GAsyncResult* _res_)
{
	SettingsDaemonBackendsUbuntuDriversCheckDevicesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
settings_daemon_backends_ubuntu_drivers_check_devices_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversCheckDevicesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	settings_daemon_backends_ubuntu_drivers_check_devices_co (_data_);
}

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

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

static gchar*
string_splice (const gchar* self,
               glong start,
               glong end,
               const gchar* str)
{
	glong string_length = 0L;
	gint _tmp0_;
	gint _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gsize str_size = 0UL;
	const gchar* _result_ = NULL;
	void* _tmp6_;
	gchar* dest = NULL;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	string_length = (glong) _tmp1_;
	if (start < ((glong) 0)) {
		start = string_length + start;
	}
	if (end < ((glong) 0)) {
		end = string_length + end;
	}
	if (start >= ((glong) 0)) {
		_tmp2_ = start <= string_length;
	} else {
		_tmp2_ = FALSE;
	}
	g_return_val_if_fail (_tmp2_, NULL);
	if (end >= ((glong) 0)) {
		_tmp3_ = end <= string_length;
	} else {
		_tmp3_ = FALSE;
	}
	g_return_val_if_fail (_tmp3_, NULL);
	g_return_val_if_fail (start <= end, NULL);
	if (str == NULL) {
		str_size = (gsize) 0;
	} else {
		gint _tmp4_;
		gint _tmp5_;
		_tmp4_ = strlen ((const gchar*) str);
		_tmp5_ = _tmp4_;
		str_size = (gsize) _tmp5_;
	}
	_tmp6_ = g_malloc0 (((string_length - (end - start)) + str_size) + 1);
	_result_ = _tmp6_;
	_tmp7_ = _result_;
	dest = (gchar*) _tmp7_;
	_tmp8_ = dest;
	memcpy (_tmp8_, self, (gsize) start);
	_tmp9_ = dest;
	dest = _tmp9_ + start;
	if (str != NULL) {
		gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp10_ = dest;
		memcpy (_tmp10_, str, str_size);
		_tmp11_ = dest;
		dest = _tmp11_ + str_size;
	}
	_tmp12_ = dest;
	memcpy (_tmp12_, ((gchar*) self) + end, (gsize) (string_length - end));
	_tmp13_ = _result_;
	_result_ = NULL;
	result = (gchar*) _tmp13_;
	return result;
}

static gboolean
settings_daemon_backends_ubuntu_drivers_check_devices_co (SettingsDaemonBackendsUbuntuDriversCheckDevicesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	settings_daemon_backends_ubuntu_drivers_get_drivers_output (_data_->self, "devices", settings_daemon_backends_ubuntu_drivers_check_devices_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = settings_daemon_backends_ubuntu_drivers_get_drivers_output_finish (_data_->self, _data_->_res_);
	_data_->output = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->output;
	if (_data_->_tmp1_ == NULL) {
		g_critical ("UbuntuDrivers.vala:67: Failed to get ubuntu-drivers output");
		_g_free0 (_data_->output);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = _data_->output;
	_data_->_tmp4_ = _data_->_tmp3_ = g_strsplit (_data_->_tmp2_, "\n", 0);
	_data_->tokens = _data_->_tmp4_;
	_data_->tokens_length1 = _vala_array_length (_data_->_tmp3_);
	_data_->_tokens_size_ = _data_->tokens_length1;
	_data_->current_device = NULL;
	_data_->_tmp5_ = _data_->tokens;
	_data_->_tmp5__length1 = _data_->tokens_length1;
	{
		_data_->token_collection_length1 = 0;
		_data_->_token_collection_size_ = 0;
		_data_->token_collection = _data_->_tmp5_;
		_data_->token_collection_length1 = _data_->_tmp5__length1;
		for (_data_->token_it = 0; _data_->token_it < _data_->token_collection_length1; _data_->token_it = _data_->token_it + 1) {
			_data_->_tmp6_ = g_strdup (_data_->token_collection[_data_->token_it]);
			_data_->token = _data_->_tmp6_;
			{
				_data_->_tmp7_ = _data_->token;
				if (string_contains (_data_->_tmp7_, "==")) {
					_data_->_tmp8_ = settings_daemon_backends_ubuntu_drivers_device_new ();
					_g_object_unref0 (_data_->current_device);
					_data_->current_device = _data_->_tmp8_;
					_data_->_tmp9_ = _data_->current_device;
					_data_->_tmp10_ = _g_object_ref0 (_data_->_tmp9_);
					_vala_array_add14 (&_data_->self->priv->devices, &_data_->self->priv->devices_length1, &_data_->self->priv->_devices_size_, _data_->_tmp10_);
					_g_free0 (_data_->token);
					continue;
				}
				_data_->_tmp11_ = _data_->current_device;
				if (_data_->_tmp11_ == NULL) {
					_g_free0 (_data_->token);
					continue;
				}
				_data_->_tmp12_ = _data_->token;
				if (g_str_has_prefix (_data_->_tmp12_, "model")) {
					_data_->_tmp13_ = _data_->token;
					_data_->_tmp14_ = string_splice (_data_->_tmp13_, (glong) 0, (glong) 11, NULL);
					_data_->normalized_token = _data_->_tmp14_;
					_data_->_tmp15_ = _data_->current_device;
					_data_->_tmp16_ = _data_->normalized_token;
					_data_->_tmp17_ = g_strdup (_data_->_tmp16_);
					_g_free0 (_data_->_tmp15_->name);
					_data_->_tmp15_->name = _data_->_tmp17_;
					_g_free0 (_data_->normalized_token);
					_g_free0 (_data_->token);
					continue;
				}
				_data_->_tmp18_ = _data_->token;
				if (g_str_has_prefix (_data_->_tmp18_, "driver")) {
					_data_->_tmp19_ = _data_->token;
					_data_->_tmp20_ = string_splice (_data_->_tmp19_, (glong) 0, (glong) 11, NULL);
					_data_->_vala1_normalized_token = _data_->_tmp20_;
					_data_->_tmp21_ = _data_->_vala1_normalized_token;
					_data_->_tmp23_ = _data_->_tmp22_ = g_strsplit (_data_->_tmp21_, " - ", 0);
					_data_->split_token = _data_->_tmp23_;
					_data_->split_token_length1 = _vala_array_length (_data_->_tmp22_);
					_data_->_split_token_size_ = _data_->split_token_length1;
					_data_->_tmp24_ = _data_->split_token;
					_data_->_tmp24__length1 = _data_->split_token_length1;
					_data_->_tmp25_ = _data_->_tmp24_[0];
					_data_->_tmp26_ = g_strdup (_data_->_tmp25_);
					_data_->driver = _data_->_tmp26_;
					_data_->_tmp27_ = _data_->self->priv->devices_by_drivers;
					_data_->_tmp28_ = _data_->driver;
					_data_->_tmp29_ = g_strdup (_data_->_tmp28_);
					_data_->_tmp30_ = _data_->current_device;
					_data_->_tmp31_ = _g_object_ref0 (_data_->_tmp30_);
					g_hash_table_insert (_data_->_tmp27_, _data_->_tmp29_, _data_->_tmp31_);
					_g_free0 (_data_->driver);
					_data_->split_token = (_vala_array_free (_data_->split_token, _data_->split_token_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (_data_->_vala1_normalized_token);
					_g_free0 (_data_->token);
					continue;
				}
				_g_free0 (_data_->token);
			}
		}
	}
	_g_object_unref0 (_data_->current_device);
	_data_->tokens = (_vala_array_free (_data_->tokens, _data_->tokens_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (_data_->output);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

void
settings_daemon_backends_ubuntu_drivers_check_for_drivers (SettingsDaemonBackendsUbuntuDrivers* self,
                                                           gboolean notify,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversCheckForDriversData* _data_;
	SettingsDaemonBackendsUbuntuDrivers* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (SettingsDaemonBackendsUbuntuDriversCheckForDriversData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, settings_daemon_backends_ubuntu_drivers_check_for_drivers_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->notify = notify;
	settings_daemon_backends_ubuntu_drivers_check_for_drivers_co (_data_);
}

void
settings_daemon_backends_ubuntu_drivers_check_for_drivers_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                  GAsyncResult* _res_,
                                                                  GError** error)
{
	SettingsDaemonBackendsUbuntuDriversCheckForDriversData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
settings_daemon_backends_ubuntu_drivers_check_for_drivers_ready (GObject* source_object,
                                                                 GAsyncResult* _res_,
                                                                 gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversCheckForDriversData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	settings_daemon_backends_ubuntu_drivers_check_for_drivers_co (_data_);
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

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

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	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 NULL;
}

static gboolean
_vala_string_array_contains (gchar* * stack,
                             gssize stack_length,
                             const gchar* needle)
{
	gssize i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}

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

static gint
vala_g_ptr_array_get_length (GPtrArray* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = (gint) self->len;
	return result;
}

static gpointer
_g_ptr_array_ref0 (gpointer self)
{
	return self ? g_ptr_array_ref (self) : NULL;
}

static gboolean
settings_daemon_backends_ubuntu_drivers_check_for_drivers_co (SettingsDaemonBackendsUbuntuDriversCheckForDriversData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	settings_daemon_backends_ubuntu_drivers_update_state (_data_->self, SETTINGS_DAEMON_PK_UTILS_STATE_CHECKING, "", (guint) 0, (guint64) 0);
	_data_->_tmp0_ = _data_->self->priv->available_drivers;
	g_hash_table_remove_all (_data_->_tmp0_);
	_data_->_state_ = 1;
	settings_daemon_backends_ubuntu_drivers_check_devices (_data_->self, settings_daemon_backends_ubuntu_drivers_check_for_drivers_ready, _data_);
	return FALSE;
	_state_1:
	settings_daemon_backends_ubuntu_drivers_check_devices_finish (_data_->self, _data_->_res_);
	_data_->_state_ = 2;
	settings_daemon_backends_ubuntu_drivers_get_drivers_output (_data_->self, "list", settings_daemon_backends_ubuntu_drivers_check_for_drivers_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp1_ = settings_daemon_backends_ubuntu_drivers_get_drivers_output_finish (_data_->self, _data_->_res_);
	_data_->command_output = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->command_output;
	if (_data_->_tmp2_ == NULL) {
		settings_daemon_backends_ubuntu_drivers_update_state (_data_->self, SETTINGS_DAEMON_PK_UTILS_STATE_UP_TO_DATE, "", (guint) 0, (guint64) 0);
		g_critical ("UbuntuDrivers.vala:111: Failed to get ubuntu-drivers output");
		_g_free0 (_data_->command_output);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = _data_->command_output;
	_data_->_tmp5_ = _data_->_tmp4_ = g_strsplit (_data_->_tmp3_, "\n", 0);
	_data_->tokens = _data_->_tmp5_;
	_data_->tokens_length1 = _vala_array_length (_data_->_tmp4_);
	_data_->_tokens_size_ = _data_->tokens_length1;
	_data_->_tmp6_ = _data_->tokens;
	_data_->_tmp6__length1 = _data_->tokens_length1;
	{
		_data_->line_collection_length1 = 0;
		_data_->_line_collection_size_ = 0;
		_data_->line_collection = _data_->_tmp6_;
		_data_->line_collection_length1 = _data_->_tmp6__length1;
		for (_data_->line_it = 0; _data_->line_it < _data_->line_collection_length1; _data_->line_it = _data_->line_it + 1) {
			_data_->line = _data_->line_collection[_data_->line_it];
			{
				_data_->_tmp7_ = _data_->line;
				_data_->_tmp8_ = string_strip (_data_->_tmp7_);
				_data_->_tmp9_ = _data_->_tmp8_;
				_data_->_tmp10_ = g_strcmp0 (_data_->_tmp9_, "") == 0;
				_g_free0 (_data_->_tmp9_);
				if (_data_->_tmp10_) {
					continue;
				}
				_data_->_tmp12_ = _data_->line;
				if (string_contains (_data_->_tmp12_, "nvidia")) {
					_data_->_tmp13_ = _data_->line;
					_data_->_tmp11_ = string_contains (_data_->_tmp13_, "-server");
				} else {
					_data_->_tmp11_ = FALSE;
				}
				if (_data_->_tmp11_) {
					continue;
				}
				_data_->_tmp14_ = _data_->line;
				_data_->_tmp16_ = _data_->_tmp15_ = g_strsplit (_data_->_tmp14_, ",", 0);
				_data_->parts = _data_->_tmp16_;
				_data_->parts_length1 = _vala_array_length (_data_->_tmp15_);
				_data_->_parts_size_ = _data_->parts_length1;
				_data_->_tmp17_ = _data_->parts;
				_data_->_tmp17__length1 = _data_->parts_length1;
				_data_->_tmp18_ = _data_->_tmp17_[0];
				_data_->_tmp19_ = g_strdup (_data_->_tmp18_);
				_data_->driver = _data_->_tmp19_;
				_data_->_tmp21_ = _data_->driver;
				if (_data_->_tmp21_ == NULL) {
					_data_->_tmp20_ = TRUE;
				} else {
					_data_->_tmp22_ = _data_->self->priv->devices_by_drivers;
					_data_->_tmp23_ = _data_->driver;
					_data_->_tmp20_ = !g_hash_table_contains (_data_->_tmp22_, _data_->_tmp23_);
				}
				if (_data_->_tmp20_) {
					_g_free0 (_data_->driver);
					_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
					continue;
				}
				_data_->_tmp24_ = g_new0 (gchar*, 0 + 1);
				_data_->package_names = _data_->_tmp24_;
				_data_->package_names_length1 = 0;
				_data_->_package_names_size_ = _data_->package_names_length1;
				_data_->_tmp25_ = _data_->driver;
				_data_->_tmp26_ = g_strdup (_data_->_tmp25_);
				_vala_array_add15 (&_data_->package_names, &_data_->package_names_length1, &_data_->_package_names_size_, _data_->_tmp26_);
				_data_->_tmp27_ = _data_->parts;
				_data_->_tmp27__length1 = _data_->parts_length1;
				if (_data_->_tmp27__length1 > 1) {
					_data_->_tmp28_ = _data_->parts;
					_data_->_tmp28__length1 = _data_->parts_length1;
					_data_->_tmp29_ = _data_->_tmp28_[1];
					if (string_contains (_data_->_tmp29_, "kernel modules provided by")) {
						_data_->_tmp30_ = _data_->parts;
						_data_->_tmp30__length1 = _data_->parts_length1;
						_data_->_tmp31_ = _data_->_tmp30_[1];
						_data_->_tmp33_ = _data_->_tmp32_ = g_strsplit (_data_->_tmp31_, " ", 0);
						_data_->kernel_module_parts = _data_->_tmp33_;
						_data_->kernel_module_parts_length1 = _vala_array_length (_data_->_tmp32_);
						_data_->_kernel_module_parts_size_ = _data_->kernel_module_parts_length1;
						_data_->_tmp34_ = _data_->kernel_module_parts;
						_data_->_tmp34__length1 = _data_->kernel_module_parts_length1;
						_data_->_tmp35_ = _data_->kernel_module_parts;
						_data_->_tmp35__length1 = _data_->kernel_module_parts_length1;
						_data_->_tmp36_ = _data_->_tmp34_[_data_->_tmp35__length1 - 1];
						_data_->_tmp37_ = g_strdup (_data_->_tmp36_);
						_data_->last_part = _data_->_tmp37_;
						_data_->_tmp38_ = _data_->last_part;
						_data_->_tmp39_ = string_replace (_data_->_tmp38_, ")", "");
						_g_free0 (_data_->last_part);
						_data_->last_part = _data_->_tmp39_;
						_data_->_tmp40_ = _data_->last_part;
						_data_->_tmp41_ = _data_->package_names;
						_data_->_tmp41__length1 = _data_->package_names_length1;
						if (!_vala_string_array_contains (_data_->_tmp41_, _data_->_tmp41__length1, _data_->_tmp40_)) {
							_data_->_tmp42_ = _data_->last_part;
							_data_->_tmp43_ = g_strdup (_data_->_tmp42_);
							_vala_array_add16 (&_data_->package_names, &_data_->package_names_length1, &_data_->_package_names_size_, _data_->_tmp43_);
						}
						_g_free0 (_data_->last_part);
						_data_->kernel_module_parts = (_vala_array_free (_data_->kernel_module_parts, _data_->kernel_module_parts_length1, (GDestroyNotify) g_free), NULL);
					} else {
						_data_->_tmp44_ = _data_->line;
						g_warning ("UbuntuDrivers.vala:156: Unrecognised line from ubuntu-drivers, needs c" \
"hecking: %s", _data_->_tmp44_);
					}
				}
				_data_->_tmp45_ = _data_->driver;
				_data_->_tmp46_ = _data_->package_names;
				_data_->_tmp46__length1 = _data_->package_names_length1;
				_data_->_state_ = 3;
				settings_daemon_backends_ubuntu_drivers_update_installed (_data_->self, _data_->_tmp45_, _data_->_tmp46_, (gint) _data_->_tmp46__length1, settings_daemon_backends_ubuntu_drivers_check_for_drivers_ready, _data_);
				return FALSE;
				_state_3:
				_data_->_tmp47_ = settings_daemon_backends_ubuntu_drivers_update_installed_finish (_data_->self, _data_->_res_);
				_data_->driver_available_packages = _data_->_tmp47_;
				_data_->_tmp48_ = _data_->driver_available_packages;
				_data_->_tmp49_ = vala_g_ptr_array_get_length (_data_->_tmp48_);
				_data_->_tmp50_ = _data_->_tmp49_;
				if (_data_->_tmp50_ > 0) {
					_data_->_tmp51_ = _data_->self->priv->available_drivers;
					_data_->_tmp52_ = _data_->driver;
					_data_->_tmp53_ = g_strdup (_data_->_tmp52_);
					_data_->_tmp54_ = _data_->driver_available_packages;
					_data_->_tmp55_ = _g_ptr_array_ref0 (_data_->_tmp54_);
					g_hash_table_insert (_data_->_tmp51_, _data_->_tmp53_, _data_->_tmp55_);
				}
				_g_ptr_array_unref0 (_data_->driver_available_packages);
				_data_->package_names = (_vala_array_free (_data_->package_names, _data_->package_names_length1, (GDestroyNotify) g_free), NULL);
				_g_free0 (_data_->driver);
				_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
			}
		}
	}
	_data_->_tmp56_ = _data_->self->priv->available_drivers;
	_data_->_tmp57_ = g_hash_table_size (_data_->_tmp56_);
	_data_->_tmp58_ = _data_->_tmp57_;
	if (_data_->_tmp58_ == ((guint) 0)) {
		settings_daemon_backends_ubuntu_drivers_update_state (_data_->self, SETTINGS_DAEMON_PK_UTILS_STATE_UP_TO_DATE, "", (guint) 0, (guint64) 0);
		_data_->tokens = (_vala_array_free (_data_->tokens, _data_->tokens_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (_data_->command_output);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	settings_daemon_backends_ubuntu_drivers_update_state (_data_->self, SETTINGS_DAEMON_PK_UTILS_STATE_AVAILABLE, "", (guint) 0, (guint64) 0);
	if (_data_->notify) {
		_data_->_tmp59_ = _data_->self->priv->available_drivers;
		_data_->_tmp60_ = g_hash_table_size (_data_->_tmp59_);
		_data_->_tmp61_ = _data_->_tmp60_;
		_data_->_tmp62_ = g_strdup (ngettext ("Driver Available", "Drivers Available", (gulong) _data_->_tmp61_));
		_data_->title = _data_->_tmp62_;
		_data_->_tmp63_ = _data_->self->priv->available_drivers;
		_data_->_tmp64_ = g_hash_table_size (_data_->_tmp63_);
		_data_->_tmp65_ = _data_->_tmp64_;
		_data_->_tmp66_ = g_strdup (ngettext ("%u driver is available for your hardware", "%u drivers are available for your hardware", (gulong) _data_->_tmp65_));
		_data_->body = _data_->_tmp66_;
		_data_->_tmp67_ = _data_->title;
		_data_->_tmp68_ = g_notification_new (_data_->_tmp67_);
		_data_->notification = _data_->_tmp68_;
		_data_->_tmp69_ = _data_->notification;
		g_notification_set_default_action (_data_->_tmp69_, SETTINGS_DAEMON_APPLICATION_ACTION_PREFIX SETTINGS_DAEMON_APPLICATION_SHOW_UPDATES_ACTION);
		_data_->_tmp70_ = _data_->notification;
		_data_->_tmp71_ = _data_->body;
		_data_->_tmp72_ = _data_->self->priv->available_drivers;
		_data_->_tmp73_ = g_hash_table_size (_data_->_tmp72_);
		_data_->_tmp74_ = _data_->_tmp73_;
		_data_->_tmp75_ = g_strdup_printf (_data_->_tmp71_, _data_->_tmp74_);
		_data_->_tmp76_ = _data_->_tmp75_;
		g_notification_set_body (_data_->_tmp70_, _data_->_tmp76_);
		_g_free0 (_data_->_tmp76_);
		_data_->_tmp77_ = _data_->notification;
		_data_->_tmp78_ = (GThemedIcon*) g_themed_icon_new ("software-update-available");
		_data_->_tmp79_ = _data_->_tmp78_;
		g_notification_set_icon (_data_->_tmp77_, (GIcon*) _data_->_tmp79_);
		_g_object_unref0 (_data_->_tmp79_);
		_data_->_tmp80_ = g_application_get_default ();
		_data_->_tmp81_ = _data_->notification;
		g_application_send_notification (_data_->_tmp80_, SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_NOTIFICATION_ID, _data_->_tmp81_);
		_g_object_unref0 (_data_->notification);
		_g_free0 (_data_->body);
		_g_free0 (_data_->title);
	}
	_data_->tokens = (_vala_array_free (_data_->tokens, _data_->tokens_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (_data_->command_output);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
settings_daemon_backends_ubuntu_drivers_update_installed_data_free (gpointer _data)
{
	SettingsDaemonBackendsUbuntuDriversUpdateInstalledData* _data_;
	_data_ = _data;
	_g_free0 (_data_->driver);
	_g_ptr_array_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (SettingsDaemonBackendsUbuntuDriversUpdateInstalledData, _data_);
}

static void
settings_daemon_backends_ubuntu_drivers_update_installed (SettingsDaemonBackendsUbuntuDrivers* self,
                                                          const gchar* driver,
                                                          gchar** package_names,
                                                          gint package_names_length1,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversUpdateInstalledData* _data_;
	SettingsDaemonBackendsUbuntuDrivers* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (driver != NULL);
	_data_ = g_slice_new0 (SettingsDaemonBackendsUbuntuDriversUpdateInstalledData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, settings_daemon_backends_ubuntu_drivers_update_installed_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (driver);
	_g_free0 (_data_->driver);
	_data_->driver = _tmp1_;
	_data_->package_names = package_names;
	_data_->package_names_length1 = package_names_length1;
	settings_daemon_backends_ubuntu_drivers_update_installed_co (_data_);
}

static GPtrArray*
settings_daemon_backends_ubuntu_drivers_update_installed_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                 GAsyncResult* _res_)
{
	GPtrArray* result;
	SettingsDaemonBackendsUbuntuDriversUpdateInstalledData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

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

static void
___lambda23_ (SettingsDaemonBackendsUbuntuDrivers* self)
{
}

static void
____lambda23__pk_progress_callback (PkProgress* progress,
                                    PkProgressType type,
                                    gpointer self)
{
	___lambda23_ ((SettingsDaemonBackendsUbuntuDrivers*) self);
}

static void
settings_daemon_backends_ubuntu_drivers_update_installed_ready (GObject* source_object,
                                                                GAsyncResult* _res_,
                                                                gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversUpdateInstalledData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	settings_daemon_backends_ubuntu_drivers_update_installed_co (_data_);
}

static gboolean
settings_daemon_backends_ubuntu_drivers_update_installed_co (SettingsDaemonBackendsUbuntuDriversUpdateInstalledData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_ptr_array_new_full ((guint) 0, _g_free0_);
	_data_->array = _data_->_tmp0_;
	{
		_data_->_tmp1_ = _data_->self->priv->task;
		_data_->_state_ = 1;
		pk_task_resolve_async (_data_->_tmp1_, (PkBitfield) PK_FILTER_ENUM_NONE, _data_->package_names, NULL, ____lambda23__pk_progress_callback, _data_->self, settings_daemon_backends_ubuntu_drivers_update_installed_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp2_ = pk_task_generic_finish (_data_->_tmp1_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_result_ = _data_->_tmp2_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp3_ = _data_->_result_;
		_data_->_tmp4_ = pk_results_get_package_array (_data_->_tmp3_);
		_data_->packages = _data_->_tmp4_;
		_data_->all_installed = TRUE;
		_data_->_tmp5_ = _data_->packages;
		{
			_data_->package_collection = _data_->_tmp5_;
			for (_data_->package_index = 0; _data_->package_index < _data_->package_collection->len; _data_->package_index = _data_->package_index + 1) {
				_data_->package = (PkPackage*) g_ptr_array_index (_data_->package_collection, _data_->package_index);
				{
					_data_->_tmp6_ = _data_->self->priv->devices_by_drivers;
					if (!g_hash_table_contains (_data_->_tmp6_, _data_->driver)) {
						continue;
					}
					if (_data_->all_installed) {
						_data_->_tmp8_ = _data_->package;
						_data_->_tmp9_ = pk_package_get_info (_data_->_tmp8_);
						_data_->_tmp10_ = _data_->_tmp9_;
						_data_->_tmp7_ = PK_INFO_ENUM_INSTALLED == _data_->_tmp10_;
					} else {
						_data_->_tmp7_ = FALSE;
					}
					if (_data_->_tmp7_) {
						_data_->_tmp11_ = _data_->self->priv->devices_by_drivers;
						_data_->_tmp12_ = g_hash_table_lookup (_data_->_tmp11_, _data_->driver);
						_data_->_tmp13_ = ((SettingsDaemonBackendsUbuntuDriversDevice*) _data_->_tmp12_)->available_drivers_with_installed;
						_data_->_tmp14_ = g_strdup (_data_->driver);
						g_hash_table_insert (_data_->_tmp13_, _data_->_tmp14_, (gpointer) ((gintptr) TRUE));
					} else {
						_data_->all_installed = FALSE;
						_data_->_tmp15_ = _data_->self->priv->devices_by_drivers;
						_data_->_tmp16_ = g_hash_table_lookup (_data_->_tmp15_, _data_->driver);
						_data_->_tmp17_ = ((SettingsDaemonBackendsUbuntuDriversDevice*) _data_->_tmp16_)->available_drivers_with_installed;
						_data_->_tmp18_ = g_strdup (_data_->driver);
						g_hash_table_insert (_data_->_tmp17_, _data_->_tmp18_, (gpointer) ((gintptr) FALSE));
						_data_->_tmp19_ = _data_->array;
						_data_->_tmp20_ = _data_->package;
						g_object_get (_data_->_tmp20_, "package-id", &_data_->_tmp21_, NULL);
						_data_->_tmp22_ = _data_->_tmp21_;
						g_ptr_array_add (_data_->_tmp19_, _data_->_tmp22_);
					}
				}
			}
		}
		_g_ptr_array_unref0 (_data_->packages);
		_g_object_unref0 (_data_->_result_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp23_ = _data_->e;
		_data_->_tmp24_ = _data_->_tmp23_->message;
		g_critical ("UbuntuDrivers.vala:212: Failed to get package details, treating as not" \
" installed: %s", _data_->_tmp24_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_ptr_array_unref0 (_data_->array);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = _data_->array;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
settings_daemon_backends_ubuntu_drivers_install_data_free (gpointer _data)
{
	SettingsDaemonBackendsUbuntuDriversInstallData* _data_;
	_data_ = _data;
	_g_free0 (_data_->pkg_name);
	_g_object_unref0 (_data_->self);
	g_slice_free (SettingsDaemonBackendsUbuntuDriversInstallData, _data_);
}

void
settings_daemon_backends_ubuntu_drivers_install (SettingsDaemonBackendsUbuntuDrivers* self,
                                                 const gchar* pkg_name,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversInstallData* _data_;
	SettingsDaemonBackendsUbuntuDrivers* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (pkg_name != NULL);
	_data_ = g_slice_new0 (SettingsDaemonBackendsUbuntuDriversInstallData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, settings_daemon_backends_ubuntu_drivers_install_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (pkg_name);
	_g_free0 (_data_->pkg_name);
	_data_->pkg_name = _tmp1_;
	settings_daemon_backends_ubuntu_drivers_install_co (_data_);
}

void
settings_daemon_backends_ubuntu_drivers_install_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                        GAsyncResult* _res_,
                                                        GError** error)
{
	SettingsDaemonBackendsUbuntuDriversInstallData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

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

static void
_settings_daemon_backends_ubuntu_drivers_progress_callback_pk_progress_callback (PkProgress* progress,
                                                                                 PkProgressType type,
                                                                                 gpointer self)
{
	settings_daemon_backends_ubuntu_drivers_progress_callback ((SettingsDaemonBackendsUbuntuDrivers*) self, progress, type);
}

static void
settings_daemon_backends_ubuntu_drivers_install_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversInstallData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	settings_daemon_backends_ubuntu_drivers_install_co (_data_);
}

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

static gboolean
settings_daemon_backends_ubuntu_drivers_install_co (SettingsDaemonBackendsUbuntuDriversInstallData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->available_drivers;
	if (!g_hash_table_contains (_data_->_tmp0_, _data_->pkg_name)) {
		g_critical ("UbuntuDrivers.vala:220: Driver not found");
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = _data_->self->priv->current_state;
	if (_data_->_tmp1_.state != SETTINGS_DAEMON_PK_UTILS_STATE_AVAILABLE) {
		g_warning ("UbuntuDrivers.vala:225: No drivers available, or already downloading a" \
" driver.");
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = _data_->self->priv->cancellable;
	g_cancellable_reset (_data_->_tmp2_);
	settings_daemon_backends_ubuntu_drivers_update_state (_data_->self, SETTINGS_DAEMON_PK_UTILS_STATE_DOWNLOADING, "", (guint) 0, (guint64) 0);
	{
		_data_->_tmp3_ = _data_->self->priv->available_drivers;
		_data_->_tmp4_ = g_hash_table_lookup (_data_->_tmp3_, _data_->pkg_name);
		_data_->_tmp5_ = ((GPtrArray*) _data_->_tmp4_)->pdata;
		_data_->_tmp5__length1 = ((GPtrArray*) _data_->_tmp4_)->len;
		_data_->_tmp6_ = (_data_->_tmp5_ != NULL) ? _vala_array_dup9 (_data_->_tmp5_, _data_->_tmp5__length1) : _data_->_tmp5_;
		_data_->_tmp6__length1 = _data_->_tmp5__length1;
		_data_->pkgs = _data_->_tmp6_;
		_data_->pkgs_length1 = _data_->_tmp6__length1;
		_data_->_pkgs_size_ = _data_->pkgs_length1;
		_data_->_tmp7_ = _data_->self->priv->task;
		_data_->_tmp8_ = _data_->pkgs;
		_data_->_tmp8__length1 = _data_->pkgs_length1;
		_data_->_tmp9_ = _data_->self->priv->cancellable;
		_data_->_state_ = 1;
		pk_task_install_packages_async (_data_->_tmp7_, _data_->_tmp8_, _data_->_tmp9_, _settings_daemon_backends_ubuntu_drivers_progress_callback_pk_progress_callback, _data_->self, settings_daemon_backends_ubuntu_drivers_install_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp10_ = pk_task_generic_finish (_data_->_tmp7_, _data_->_res_, &_data_->_inner_error0_);
		_data_->results = _data_->_tmp10_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_data_->pkgs = (_vala_array_free (_data_->pkgs, _data_->pkgs_length1, (GDestroyNotify) g_free), NULL);
			goto __catch0_g_error;
		}
		_data_->_tmp11_ = _data_->results;
		if (pk_results_get_exit_code (_data_->_tmp11_) == PK_EXIT_ENUM_CANCELLED) {
			g_debug ("UbuntuDrivers.vala:238: Installation was cancelled");
			settings_daemon_backends_ubuntu_drivers_update_state (_data_->self, SETTINGS_DAEMON_PK_UTILS_STATE_AVAILABLE, "", (guint) 0, (guint64) 0);
			_g_object_unref0 (_data_->results);
			_data_->pkgs = (_vala_array_free (_data_->pkgs, _data_->pkgs_length1, (GDestroyNotify) g_free), NULL);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp12_ = _data_->self->priv->available_drivers;
		_data_->_tmp13_ = g_hash_table_get_keys (_data_->_tmp12_);
		{
			_data_->driver_collection = _data_->_tmp13_;
			for (_data_->driver_it = _data_->driver_collection; _data_->driver_it != NULL; _data_->driver_it = _data_->driver_it->next) {
				_data_->driver = (const gchar*) _data_->driver_it->data;
				{
					_data_->_tmp14_ = _data_->self->priv->available_drivers;
					_data_->_tmp15_ = _data_->driver;
					_data_->_tmp16_ = g_hash_table_lookup (_data_->_tmp14_, _data_->_tmp15_);
					_data_->_tmp17_ = ((GPtrArray*) _data_->_tmp16_)->pdata;
					_data_->_tmp17__length1 = ((GPtrArray*) _data_->_tmp16_)->len;
					_data_->_tmp18_ = (_data_->_tmp17_ != NULL) ? _vala_array_dup10 (_data_->_tmp17_, _data_->_tmp17__length1) : _data_->_tmp17_;
					_data_->_tmp18__length1 = _data_->_tmp17__length1;
					_data_->driver_pkgs = _data_->_tmp18_;
					_data_->driver_pkgs_length1 = _data_->_tmp18__length1;
					_data_->_driver_pkgs_size_ = _data_->driver_pkgs_length1;
					_data_->_tmp19_ = _data_->driver;
					_data_->_tmp20_ = _data_->driver_pkgs;
					_data_->_tmp20__length1 = _data_->driver_pkgs_length1;
					_data_->_state_ = 2;
					settings_daemon_backends_ubuntu_drivers_update_installed (_data_->self, _data_->_tmp19_, _data_->_tmp20_, (gint) _data_->_tmp20__length1, settings_daemon_backends_ubuntu_drivers_install_ready, _data_);
					return FALSE;
					_state_2:
					_data_->_tmp21_ = settings_daemon_backends_ubuntu_drivers_update_installed_finish (_data_->self, _data_->_res_);
					_data_->_tmp22_ = _data_->_tmp21_;
					_g_ptr_array_unref0 (_data_->_tmp22_);
					_data_->driver_pkgs = (_vala_array_free (_data_->driver_pkgs, _data_->driver_pkgs_length1, (GDestroyNotify) g_free), NULL);
				}
			}
			(_data_->driver_collection == NULL) ? NULL : (_data_->driver_collection = (g_list_free (_data_->driver_collection), NULL));
		}
		_data_->_tmp23_ = g_notification_new (_ ("Restart required"));
		_data_->notification = _data_->_tmp23_;
		_data_->_tmp24_ = _data_->notification;
		g_notification_set_body (_data_->_tmp24_, _ ("Please restart your system to finalize driver installation"));
		_data_->_tmp25_ = _data_->notification;
		_data_->_tmp26_ = (GThemedIcon*) g_themed_icon_new ("system-reboot");
		_data_->_tmp27_ = _data_->_tmp26_;
		g_notification_set_icon (_data_->_tmp25_, (GIcon*) _data_->_tmp27_);
		_g_object_unref0 (_data_->_tmp27_);
		_data_->_tmp28_ = _data_->notification;
		g_notification_set_default_action (_data_->_tmp28_, SETTINGS_DAEMON_APPLICATION_ACTION_PREFIX SETTINGS_DAEMON_APPLICATION_SHOW_UPDATES_ACTION);
		_data_->_tmp29_ = g_application_get_default ();
		_data_->_tmp30_ = _data_->notification;
		g_application_send_notification (_data_->_tmp29_, SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_NOTIFICATION_ID, _data_->_tmp30_);
		settings_daemon_backends_ubuntu_drivers_update_state (_data_->self, SETTINGS_DAEMON_PK_UTILS_STATE_AVAILABLE, "", (guint) 0, (guint64) 0);
		_g_object_unref0 (_data_->notification);
		_g_object_unref0 (_data_->results);
		_data_->pkgs = (_vala_array_free (_data_->pkgs, _data_->pkgs_length1, (GDestroyNotify) g_free), NULL);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp31_ = _data_->e;
		_data_->_tmp32_ = _data_->_tmp31_->message;
		g_critical ("UbuntuDrivers.vala:257: Failed to install driver: %s", _data_->_tmp32_);
		_data_->_tmp33_ = _data_->e;
		_data_->_tmp34_ = _data_->_tmp33_->message;
		settings_daemon_backends_ubuntu_drivers_send_error (_data_->self, _data_->_tmp34_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		if ((_data_->_inner_error0_->domain == G_DBUS_ERROR) || (_data_->_inner_error0_->domain == G_IO_ERROR)) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
settings_daemon_backends_ubuntu_drivers_cancel (SettingsDaemonBackendsUbuntuDrivers* self,
                                                GError** error)
{
	GCancellable* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->cancellable;
	g_cancellable_cancel (_tmp0_);
}

static void
settings_daemon_backends_ubuntu_drivers_progress_callback (SettingsDaemonBackendsUbuntuDrivers* self,
                                                           PkProgress* progress,
                                                           PkProgressType progress_type)
{
	SettingsDaemonPkUtilsCurrentState _tmp0_;
	guint _tmp1_;
	guint _tmp2_;
	const gchar* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	guint64 _tmp6_;
	guint64 _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (progress != NULL);
	_tmp0_ = self->priv->current_state;
	_tmp1_ = pk_progress_get_status (progress);
	_tmp2_ = _tmp1_;
	_tmp3_ = settings_daemon_pk_utils_status_to_title (_tmp2_);
	_tmp4_ = pk_progress_get_percentage (progress);
	_tmp5_ = _tmp4_;
	_tmp6_ = pk_progress_get_download_size_remaining (progress);
	_tmp7_ = _tmp6_;
	settings_daemon_backends_ubuntu_drivers_update_state (self, _tmp0_.state, _tmp3_, (guint) _tmp5_, _tmp7_);
}

static void
settings_daemon_backends_ubuntu_drivers_send_error (SettingsDaemonBackendsUbuntuDrivers* self,
                                                    const gchar* message)
{
	GNotification* notification = NULL;
	GNotification* _tmp0_;
	GThemedIcon* _tmp1_;
	GThemedIcon* _tmp2_;
	GApplication* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = g_notification_new (_ ("A driver couldn't be installed"));
	notification = _tmp0_;
	g_notification_set_body (notification, _ ("An error occurred while trying to install a driver"));
	_tmp1_ = (GThemedIcon*) g_themed_icon_new ("dialog-error");
	_tmp2_ = _tmp1_;
	g_notification_set_icon (notification, (GIcon*) _tmp2_);
	_g_object_unref0 (_tmp2_);
	g_notification_set_default_action (notification, SETTINGS_DAEMON_APPLICATION_ACTION_PREFIX SETTINGS_DAEMON_APPLICATION_SHOW_UPDATES_ACTION);
	_tmp3_ = g_application_get_default ();
	g_application_send_notification (_tmp3_, SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_NOTIFICATION_ID, notification);
	settings_daemon_backends_ubuntu_drivers_update_state (self, SETTINGS_DAEMON_PK_UTILS_STATE_ERROR, message, (guint) 0, (guint64) 0);
	_g_object_unref0 (notification);
}

static void
settings_daemon_backends_ubuntu_drivers_update_state (SettingsDaemonBackendsUbuntuDrivers* self,
                                                      SettingsDaemonPkUtilsState state,
                                                      const gchar* message,
                                                      guint percentage,
                                                      guint64 download_size_remaining)
{
	gchar* _tmp0_;
	SettingsDaemonPkUtilsCurrentState _tmp1_ = {0};
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = g_strdup (message);
	_tmp1_.state = state;
	_g_free0 (_tmp1_.status);
	_tmp1_.status = _tmp0_;
	_tmp1_.percentage = percentage;
	_tmp1_.download_size_remaining = download_size_remaining;
	settings_daemon_pk_utils_current_state_destroy (&self->priv->current_state);
	self->priv->current_state = _tmp1_;
	g_signal_emit (self, settings_daemon_backends_ubuntu_drivers_signals[SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_STATE_CHANGED_SIGNAL], 0);
}

static void
settings_daemon_backends_ubuntu_drivers_get_current_state_data_free (gpointer _data)
{
	SettingsDaemonBackendsUbuntuDriversGetCurrentStateData* _data_;
	_data_ = _data;
	settings_daemon_pk_utils_current_state_destroy (&_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (SettingsDaemonBackendsUbuntuDriversGetCurrentStateData, _data_);
}

void
settings_daemon_backends_ubuntu_drivers_get_current_state (SettingsDaemonBackendsUbuntuDrivers* self,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversGetCurrentStateData* _data_;
	SettingsDaemonBackendsUbuntuDrivers* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (SettingsDaemonBackendsUbuntuDriversGetCurrentStateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, settings_daemon_backends_ubuntu_drivers_get_current_state_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	settings_daemon_backends_ubuntu_drivers_get_current_state_co (_data_);
}

void
settings_daemon_backends_ubuntu_drivers_get_current_state_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                  GAsyncResult* _res_,
                                                                  SettingsDaemonPkUtilsCurrentState* result,
                                                                  GError** error)
{
	SettingsDaemonBackendsUbuntuDriversGetCurrentStateData* _data_;
	SettingsDaemonPkUtilsCurrentState _tmp0_;
	SettingsDaemonPkUtilsCurrentState _tmp1_ = {0};
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
	_tmp0_ = _data_->result;
	settings_daemon_pk_utils_current_state_copy (&_tmp0_, &_tmp1_);
	*result = _tmp1_;
}

static gboolean
settings_daemon_backends_ubuntu_drivers_get_current_state_co (SettingsDaemonBackendsUbuntuDriversGetCurrentStateData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->current_state;
	_data_->_tmp1_ = _data_->_tmp0_;
	memset (&_data_->_tmp2_, 0, sizeof (SettingsDaemonPkUtilsCurrentState));
	settings_daemon_pk_utils_current_state_copy (&_data_->_tmp1_, &_data_->_tmp2_);
	_data_->result = _data_->_tmp2_;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
settings_daemon_backends_ubuntu_drivers_get_available_drivers_data_free (gpointer _data)
{
	SettingsDaemonBackendsUbuntuDriversGetAvailableDriversData* _data_;
	_data_ = _data;
	_g_hash_table_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (SettingsDaemonBackendsUbuntuDriversGetAvailableDriversData, _data_);
}

void
settings_daemon_backends_ubuntu_drivers_get_available_drivers (SettingsDaemonBackendsUbuntuDrivers* self,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversGetAvailableDriversData* _data_;
	SettingsDaemonBackendsUbuntuDrivers* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (SettingsDaemonBackendsUbuntuDriversGetAvailableDriversData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, settings_daemon_backends_ubuntu_drivers_get_available_drivers_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	settings_daemon_backends_ubuntu_drivers_get_available_drivers_co (_data_);
}

GHashTable*
settings_daemon_backends_ubuntu_drivers_get_available_drivers_finish (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                      GAsyncResult* _res_,
                                                                      GError** error)
{
	GHashTable* result;
	SettingsDaemonBackendsUbuntuDriversGetAvailableDriversData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

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

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

static gboolean
settings_daemon_backends_ubuntu_drivers_get_available_drivers_co (SettingsDaemonBackendsUbuntuDriversGetAvailableDriversData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_str_hash;
	_data_->_tmp1_ = g_str_equal;
	_data_->_tmp2_ = g_hash_table_new_full (_data_->_tmp0_, _data_->_tmp1_, _g_free0_, _g_hash_table_unref0_);
	_data_->map = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->self->priv->devices;
	_data_->_tmp3__length1 = _data_->self->priv->devices_length1;
	{
		_data_->device_collection_length1 = 0;
		_data_->_device_collection_size_ = 0;
		_data_->device_collection = _data_->_tmp3_;
		_data_->device_collection_length1 = _data_->_tmp3__length1;
		for (_data_->device_it = 0; _data_->device_it < _data_->device_collection_length1; _data_->device_it = _data_->device_it + 1) {
			_data_->_tmp4_ = _g_object_ref0 (_data_->device_collection[_data_->device_it]);
			_data_->device = _data_->_tmp4_;
			{
				_data_->_tmp5_ = _data_->map;
				_data_->_tmp6_ = _data_->device;
				_data_->_tmp7_ = _data_->_tmp6_->name;
				_data_->_tmp8_ = g_strdup (_data_->_tmp7_);
				_data_->_tmp9_ = _data_->device;
				_data_->_tmp10_ = _data_->_tmp9_->available_drivers_with_installed;
				_data_->_tmp11_ = _g_hash_table_ref0 (_data_->_tmp10_);
				g_hash_table_insert (_data_->_tmp5_, _data_->_tmp8_, _data_->_tmp11_);
				_g_object_unref0 (_data_->device);
			}
		}
	}
	_data_->result = _data_->map;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

SettingsDaemonBackendsUbuntuDrivers*
settings_daemon_backends_ubuntu_drivers_construct (GType object_type)
{
	SettingsDaemonBackendsUbuntuDrivers * self = NULL;
	self = (SettingsDaemonBackendsUbuntuDrivers*) g_object_new (object_type, NULL);
	return self;
}

SettingsDaemonBackendsUbuntuDrivers*
settings_daemon_backends_ubuntu_drivers_new (void)
{
	return settings_daemon_backends_ubuntu_drivers_construct (SETTINGS_DAEMON_BACKENDS_TYPE_UBUNTU_DRIVERS);
}

static SettingsDaemonBackendsUbuntuDriversDevice*
settings_daemon_backends_ubuntu_drivers_device_construct (GType object_type)
{
	SettingsDaemonBackendsUbuntuDriversDevice * self = NULL;
	self = (SettingsDaemonBackendsUbuntuDriversDevice*) g_object_new (object_type, NULL);
	return self;
}

static SettingsDaemonBackendsUbuntuDriversDevice*
settings_daemon_backends_ubuntu_drivers_device_new (void)
{
	return settings_daemon_backends_ubuntu_drivers_device_construct (SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_TYPE_DEVICE);
}

static void
settings_daemon_backends_ubuntu_drivers_device_class_init (SettingsDaemonBackendsUbuntuDriversDeviceClass * klass,
                                                           gpointer klass_data)
{
	settings_daemon_backends_ubuntu_drivers_device_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = settings_daemon_backends_ubuntu_drivers_device_finalize;
}

static void
settings_daemon_backends_ubuntu_drivers_device_instance_init (SettingsDaemonBackendsUbuntuDriversDevice * self,
                                                              gpointer klass)
{
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, NULL);
	self->available_drivers_with_installed = _tmp2_;
}

static void
settings_daemon_backends_ubuntu_drivers_device_finalize (GObject * obj)
{
	SettingsDaemonBackendsUbuntuDriversDevice * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_TYPE_DEVICE, SettingsDaemonBackendsUbuntuDriversDevice);
	_g_free0 (self->name);
	_g_hash_table_unref0 (self->available_drivers_with_installed);
	G_OBJECT_CLASS (settings_daemon_backends_ubuntu_drivers_device_parent_class)->finalize (obj);
}

static GType
settings_daemon_backends_ubuntu_drivers_device_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SettingsDaemonBackendsUbuntuDriversDeviceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) settings_daemon_backends_ubuntu_drivers_device_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SettingsDaemonBackendsUbuntuDriversDevice), 0, (GInstanceInitFunc) settings_daemon_backends_ubuntu_drivers_device_instance_init, NULL };
	GType settings_daemon_backends_ubuntu_drivers_device_type_id;
	settings_daemon_backends_ubuntu_drivers_device_type_id = g_type_register_static (G_TYPE_OBJECT, "SettingsDaemonBackendsUbuntuDriversDevice", &g_define_type_info, 0);
	return settings_daemon_backends_ubuntu_drivers_device_type_id;
}

static GType
settings_daemon_backends_ubuntu_drivers_device_get_type (void)
{
	static volatile gsize settings_daemon_backends_ubuntu_drivers_device_type_id__once = 0;
	if (g_once_init_enter (&settings_daemon_backends_ubuntu_drivers_device_type_id__once)) {
		GType settings_daemon_backends_ubuntu_drivers_device_type_id;
		settings_daemon_backends_ubuntu_drivers_device_type_id = settings_daemon_backends_ubuntu_drivers_device_get_type_once ();
		g_once_init_leave (&settings_daemon_backends_ubuntu_drivers_device_type_id__once, settings_daemon_backends_ubuntu_drivers_device_type_id);
	}
	return settings_daemon_backends_ubuntu_drivers_device_type_id__once;
}

static void
_g_ptr_array_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL));
}

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

static GObject *
settings_daemon_backends_ubuntu_drivers_constructor (GType type,
                                                     guint n_construct_properties,
                                                     GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	SettingsDaemonBackendsUbuntuDrivers * self;
	gchar* _tmp0_;
	SettingsDaemonPkUtilsCurrentState _tmp1_ = {0};
	GHashFunc _tmp2_;
	GEqualFunc _tmp3_;
	GHashTable* _tmp4_;
	GHashFunc _tmp5_;
	GEqualFunc _tmp6_;
	GHashTable* _tmp7_;
	PkTask* _tmp8_;
	GCancellable* _tmp9_;
	parent_class = G_OBJECT_CLASS (settings_daemon_backends_ubuntu_drivers_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SETTINGS_DAEMON_BACKENDS_TYPE_UBUNTU_DRIVERS, SettingsDaemonBackendsUbuntuDrivers);
	_tmp0_ = g_strdup ("");
	_tmp1_.state = SETTINGS_DAEMON_PK_UTILS_STATE_UP_TO_DATE;
	_g_free0 (_tmp1_.status);
	_tmp1_.status = _tmp0_;
	_tmp1_.percentage = (guint) 0;
	_tmp1_.download_size_remaining = (guint64) 0;
	settings_daemon_pk_utils_current_state_destroy (&self->priv->current_state);
	self->priv->current_state = _tmp1_;
	_tmp2_ = g_str_hash;
	_tmp3_ = g_str_equal;
	_tmp4_ = g_hash_table_new_full (_tmp2_, _tmp3_, _g_free0_, _g_ptr_array_unref0_);
	_g_hash_table_unref0 (self->priv->available_drivers);
	self->priv->available_drivers = _tmp4_;
	_tmp5_ = g_str_hash;
	_tmp6_ = g_str_equal;
	_tmp7_ = g_hash_table_new_full (_tmp5_, _tmp6_, _g_free0_, _g_object_unref0_);
	_g_hash_table_unref0 (self->priv->devices_by_drivers);
	self->priv->devices_by_drivers = _tmp7_;
	_tmp8_ = pk_task_new ();
	_g_object_unref0 (self->priv->task);
	self->priv->task = _tmp8_;
	_tmp9_ = g_cancellable_new ();
	_g_object_unref0 (self->priv->cancellable);
	self->priv->cancellable = _tmp9_;
	settings_daemon_backends_ubuntu_drivers_check_for_drivers (self, TRUE, NULL, NULL);
	return obj;
}

static void
settings_daemon_backends_ubuntu_drivers_class_init (SettingsDaemonBackendsUbuntuDriversClass * klass,
                                                    gpointer klass_data)
{
	settings_daemon_backends_ubuntu_drivers_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SettingsDaemonBackendsUbuntuDrivers_private_offset);
	G_OBJECT_CLASS (klass)->constructor = settings_daemon_backends_ubuntu_drivers_constructor;
	G_OBJECT_CLASS (klass)->finalize = settings_daemon_backends_ubuntu_drivers_finalize;
	settings_daemon_backends_ubuntu_drivers_signals[SETTINGS_DAEMON_BACKENDS_UBUNTU_DRIVERS_STATE_CHANGED_SIGNAL] = g_signal_new ("state-changed", SETTINGS_DAEMON_BACKENDS_TYPE_UBUNTU_DRIVERS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
settings_daemon_backends_ubuntu_drivers_instance_init (SettingsDaemonBackendsUbuntuDrivers * self,
                                                       gpointer klass)
{
	SettingsDaemonBackendsUbuntuDriversDevice** _tmp0_;
	self->priv = settings_daemon_backends_ubuntu_drivers_get_instance_private (self);
	_tmp0_ = g_new0 (SettingsDaemonBackendsUbuntuDriversDevice*, 0 + 1);
	self->priv->devices = _tmp0_;
	self->priv->devices_length1 = 0;
	self->priv->_devices_size_ = self->priv->devices_length1;
}

static void
settings_daemon_backends_ubuntu_drivers_finalize (GObject * obj)
{
	SettingsDaemonBackendsUbuntuDrivers * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SETTINGS_DAEMON_BACKENDS_TYPE_UBUNTU_DRIVERS, SettingsDaemonBackendsUbuntuDrivers);
	settings_daemon_pk_utils_current_state_destroy (&self->priv->current_state);
	_g_hash_table_unref0 (self->priv->available_drivers);
	_g_hash_table_unref0 (self->priv->devices_by_drivers);
	self->priv->devices = (_vala_array_free (self->priv->devices, self->priv->devices_length1, (GDestroyNotify) g_object_unref), NULL);
	_g_object_unref0 (self->priv->task);
	_g_object_unref0 (self->priv->cancellable);
	G_OBJECT_CLASS (settings_daemon_backends_ubuntu_drivers_parent_class)->finalize (obj);
}

static GType
settings_daemon_backends_ubuntu_drivers_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SettingsDaemonBackendsUbuntuDriversClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) settings_daemon_backends_ubuntu_drivers_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SettingsDaemonBackendsUbuntuDrivers), 0, (GInstanceInitFunc) settings_daemon_backends_ubuntu_drivers_instance_init, NULL };
	GType settings_daemon_backends_ubuntu_drivers_type_id;
	settings_daemon_backends_ubuntu_drivers_type_id = g_type_register_static (G_TYPE_OBJECT, "SettingsDaemonBackendsUbuntuDrivers", &g_define_type_info, 0);
	g_type_set_qdata (settings_daemon_backends_ubuntu_drivers_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) settings_daemon_backends_ubuntu_drivers_register_object);
	SettingsDaemonBackendsUbuntuDrivers_private_offset = g_type_add_instance_private (settings_daemon_backends_ubuntu_drivers_type_id, sizeof (SettingsDaemonBackendsUbuntuDriversPrivate));
	return settings_daemon_backends_ubuntu_drivers_type_id;
}

GType
settings_daemon_backends_ubuntu_drivers_get_type (void)
{
	static volatile gsize settings_daemon_backends_ubuntu_drivers_type_id__once = 0;
	if (g_once_init_enter (&settings_daemon_backends_ubuntu_drivers_type_id__once)) {
		GType settings_daemon_backends_ubuntu_drivers_type_id;
		settings_daemon_backends_ubuntu_drivers_type_id = settings_daemon_backends_ubuntu_drivers_get_type_once ();
		g_once_init_leave (&settings_daemon_backends_ubuntu_drivers_type_id__once, settings_daemon_backends_ubuntu_drivers_type_id);
	}
	return settings_daemon_backends_ubuntu_drivers_type_id__once;
}

static void
_dbus_settings_daemon_backends_ubuntu_drivers_check_for_drivers (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                 GVariant* _parameters_,
                                                                 GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	SettingsDaemonBackendsUbuntuDriversCheckForDriversReadyData* _ready_data;
	GVariant* _tmp209_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (SettingsDaemonBackendsUbuntuDriversCheckForDriversReadyData);
	_ready_data->_invocation_ = invocation;
	_tmp209_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->notify = g_variant_get_boolean (_tmp209_);
	g_variant_unref (_tmp209_);
	settings_daemon_backends_ubuntu_drivers_check_for_drivers (self, _ready_data->notify, (GAsyncReadyCallback) _dbus_settings_daemon_backends_ubuntu_drivers_check_for_drivers_ready, _ready_data);
}

static void
_dbus_settings_daemon_backends_ubuntu_drivers_check_for_drivers_ready (GObject * source_object,
                                                                       GAsyncResult * _res_,
                                                                       gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversCheckForDriversReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	settings_daemon_backends_ubuntu_drivers_check_for_drivers_finish ((SettingsDaemonBackendsUbuntuDrivers*) source_object, _res_, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	g_slice_free (SettingsDaemonBackendsUbuntuDriversCheckForDriversReadyData, _ready_data);
}

static void
_dbus_settings_daemon_backends_ubuntu_drivers_install (SettingsDaemonBackendsUbuntuDrivers* self,
                                                       GVariant* _parameters_,
                                                       GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	SettingsDaemonBackendsUbuntuDriversInstallReadyData* _ready_data;
	GVariant* _tmp210_;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (SettingsDaemonBackendsUbuntuDriversInstallReadyData);
	_ready_data->_invocation_ = invocation;
	_tmp210_ = g_variant_iter_next_value (&_arguments_iter);
	_ready_data->pkg_name = g_variant_dup_string (_tmp210_, NULL);
	g_variant_unref (_tmp210_);
	settings_daemon_backends_ubuntu_drivers_install (self, _ready_data->pkg_name, (GAsyncReadyCallback) _dbus_settings_daemon_backends_ubuntu_drivers_install_ready, _ready_data);
	_error:
	;
}

static void
_dbus_settings_daemon_backends_ubuntu_drivers_install_ready (GObject * source_object,
                                                             GAsyncResult * _res_,
                                                             gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversInstallReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	settings_daemon_backends_ubuntu_drivers_install_finish ((SettingsDaemonBackendsUbuntuDrivers*) source_object, _res_, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	_g_free0 (_ready_data->pkg_name);
	g_slice_free (SettingsDaemonBackendsUbuntuDriversInstallReadyData, _ready_data);
}

static void
_dbus_settings_daemon_backends_ubuntu_drivers_cancel (SettingsDaemonBackendsUbuntuDrivers* self,
                                                      GVariant* _parameters_,
                                                      GDBusMethodInvocation* invocation)
{
	GError* error = NULL;
	GVariantIter _arguments_iter;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	settings_daemon_backends_ubuntu_drivers_cancel (self, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		return;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
}

static void
_dbus_settings_daemon_backends_ubuntu_drivers_get_current_state (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                 GVariant* _parameters_,
                                                                 GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	SettingsDaemonBackendsUbuntuDriversGetCurrentStateReadyData* _ready_data;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (SettingsDaemonBackendsUbuntuDriversGetCurrentStateReadyData);
	_ready_data->_invocation_ = invocation;
	settings_daemon_backends_ubuntu_drivers_get_current_state (self, (GAsyncReadyCallback) _dbus_settings_daemon_backends_ubuntu_drivers_get_current_state_ready, _ready_data);
}

static void
_dbus_settings_daemon_backends_ubuntu_drivers_get_current_state_ready (GObject * source_object,
                                                                       GAsyncResult * _res_,
                                                                       gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversGetCurrentStateReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	SettingsDaemonPkUtilsCurrentState result = {0};
	GVariantBuilder _tmp211_;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	settings_daemon_backends_ubuntu_drivers_get_current_state_finish ((SettingsDaemonBackendsUbuntuDrivers*) source_object, _res_, &result, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_init (&_tmp211_, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_tmp211_, g_variant_new_int32 (result.state));
	g_variant_builder_add_value (&_tmp211_, g_variant_new_string (result.status));
	g_variant_builder_add_value (&_tmp211_, g_variant_new_uint32 (result.percentage));
	g_variant_builder_add_value (&_tmp211_, g_variant_new_uint64 (result.download_size_remaining));
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp211_));
	settings_daemon_pk_utils_current_state_destroy (&result);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	g_slice_free (SettingsDaemonBackendsUbuntuDriversGetCurrentStateReadyData, _ready_data);
}

static void
_dbus_settings_daemon_backends_ubuntu_drivers_get_available_drivers (SettingsDaemonBackendsUbuntuDrivers* self,
                                                                     GVariant* _parameters_,
                                                                     GDBusMethodInvocation* invocation)
{
	GVariantIter _arguments_iter;
	SettingsDaemonBackendsUbuntuDriversGetAvailableDriversReadyData* _ready_data;
	g_variant_iter_init (&_arguments_iter, _parameters_);
	_ready_data = g_slice_new0 (SettingsDaemonBackendsUbuntuDriversGetAvailableDriversReadyData);
	_ready_data->_invocation_ = invocation;
	settings_daemon_backends_ubuntu_drivers_get_available_drivers (self, (GAsyncReadyCallback) _dbus_settings_daemon_backends_ubuntu_drivers_get_available_drivers_ready, _ready_data);
}

static void
_dbus_settings_daemon_backends_ubuntu_drivers_get_available_drivers_ready (GObject * source_object,
                                                                           GAsyncResult * _res_,
                                                                           gpointer _user_data_)
{
	SettingsDaemonBackendsUbuntuDriversGetAvailableDriversReadyData* _ready_data;
	GDBusMethodInvocation* invocation;
	GError* error = NULL;
	GDBusMessage* _reply_message = NULL;
	GVariant* _reply;
	GVariantBuilder _reply_builder;
	GHashTable* result;
	GVariantBuilder _tmp212_;
	GHashTableIter _tmp213_;
	gpointer _tmp214_;
	gpointer _tmp215_;
	_ready_data = _user_data_;
	invocation = _ready_data->_invocation_;
	result = settings_daemon_backends_ubuntu_drivers_get_available_drivers_finish ((SettingsDaemonBackendsUbuntuDrivers*) source_object, _res_, &error);
	if (error) {
		g_dbus_method_invocation_take_error (invocation, error);
		goto _error;
	}
	_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
	g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
	g_hash_table_iter_init (&_tmp213_, result);
	g_variant_builder_init (&_tmp212_, G_VARIANT_TYPE ("a{sa{sb}}"));
	while (g_hash_table_iter_next (&_tmp213_, &_tmp214_, &_tmp215_)) {
		gchar* _key;
		GHashTable* _value;
		GVariantBuilder _tmp216_;
		GHashTableIter _tmp217_;
		gpointer _tmp218_;
		gpointer _tmp219_;
		_key = (gchar*) _tmp214_;
		_value = (GHashTable*) _tmp215_;
		g_hash_table_iter_init (&_tmp217_, _value);
		g_variant_builder_init (&_tmp216_, G_VARIANT_TYPE ("a{sb}"));
		while (g_hash_table_iter_next (&_tmp217_, &_tmp218_, &_tmp219_)) {
			gchar* _key;
			gboolean _value;
			_key = (gchar*) _tmp218_;
			_value = (gboolean) ((gintptr) _tmp219_);
			g_variant_builder_add (&_tmp216_, "{?*}", g_variant_new_string (_key), g_variant_new_boolean (_value));
		}
		g_variant_builder_add (&_tmp212_, "{?*}", g_variant_new_string (_key), g_variant_builder_end (&_tmp216_));
	}
	g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp212_));
	_g_hash_table_unref0 (result);
	_reply = g_variant_builder_end (&_reply_builder);
	g_dbus_message_set_body (_reply_message, _reply);
	g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
	g_object_unref (invocation);
	g_object_unref (_reply_message);
	_error:
	g_slice_free (SettingsDaemonBackendsUbuntuDriversGetAvailableDriversReadyData, _ready_data);
}

static void
settings_daemon_backends_ubuntu_drivers_dbus_interface_method_call (GDBusConnection* connection,
                                                                    const gchar* sender,
                                                                    const gchar* object_path,
                                                                    const gchar* interface_name,
                                                                    const gchar* method_name,
                                                                    GVariant* parameters,
                                                                    GDBusMethodInvocation* invocation,
                                                                    gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	if (strcmp (method_name, "CheckForDrivers") == 0) {
		_dbus_settings_daemon_backends_ubuntu_drivers_check_for_drivers (object, parameters, invocation);
	} else if (strcmp (method_name, "Install") == 0) {
		_dbus_settings_daemon_backends_ubuntu_drivers_install (object, parameters, invocation);
	} else if (strcmp (method_name, "Cancel") == 0) {
		_dbus_settings_daemon_backends_ubuntu_drivers_cancel (object, parameters, invocation);
	} else if (strcmp (method_name, "GetCurrentState") == 0) {
		_dbus_settings_daemon_backends_ubuntu_drivers_get_current_state (object, parameters, invocation);
	} else if (strcmp (method_name, "GetAvailableDrivers") == 0) {
		_dbus_settings_daemon_backends_ubuntu_drivers_get_available_drivers (object, parameters, invocation);
	} else {
		g_object_unref (invocation);
	}
}

static GVariant*
settings_daemon_backends_ubuntu_drivers_dbus_interface_get_property (GDBusConnection* connection,
                                                                     const gchar* sender,
                                                                     const gchar* object_path,
                                                                     const gchar* interface_name,
                                                                     const gchar* property_name,
                                                                     GError** error,
                                                                     gpointer user_data)
{
	return NULL;
}

static gboolean
settings_daemon_backends_ubuntu_drivers_dbus_interface_set_property (GDBusConnection* connection,
                                                                     const gchar* sender,
                                                                     const gchar* object_path,
                                                                     const gchar* interface_name,
                                                                     const gchar* property_name,
                                                                     GVariant* value,
                                                                     GError** error,
                                                                     gpointer user_data)
{
	return FALSE;
}

static void
_dbus_settings_daemon_backends_ubuntu_drivers_state_changed (GObject* _sender,
                                                             gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "io.elementary.settings_daemon.Drivers", "StateChanged", _arguments, NULL);
}

guint
settings_daemon_backends_ubuntu_drivers_register_object (gpointer object,
                                                         GDBusConnection* connection,
                                                         const gchar* path,
                                                         GError** error)
{
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_settings_daemon_backends_ubuntu_drivers_dbus_interface_info), &_settings_daemon_backends_ubuntu_drivers_dbus_interface_vtable, data, _settings_daemon_backends_ubuntu_drivers_unregister_object, error);
	if (!result) {
		return 0;
	}
	g_signal_connect (object, "state-changed", (GCallback) _dbus_settings_daemon_backends_ubuntu_drivers_state_changed, data);
	return result;
}

static void
_settings_daemon_backends_ubuntu_drivers_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_signal_handlers_disconnect_by_func (data[0], _dbus_settings_daemon_backends_ubuntu_drivers_state_changed, data);
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}

static void
_vala_array_destroy (gpointer array,
                     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 gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

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

