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

/*
* Copyright 2021 elementary, Inc. (https://elementary.io)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
/*
* This class only exists to provide async methods that aren't present in older
* versions of LibFwupd. It should be removed when LibFwupd is updated.
*/

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

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

#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block1Data Block1Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_thread_unref0(var) ((var == NULL) ? NULL : (var = (g_thread_unref (var), NULL)))
typedef struct _AboutFirmwareClientGetDevicesData AboutFirmwareClientGetDevicesData;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block2Data Block2Data;
typedef struct _AboutFirmwareClientGetUpgradesData AboutFirmwareClientGetUpgradesData;
typedef struct _Block3Data Block3Data;
typedef struct _AboutFirmwareClientInstallData AboutFirmwareClientInstallData;
typedef struct _AboutParamSpecFirmwareClient AboutParamSpecFirmwareClient;

struct _Block1Data {
	int _ref_count_;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	GError* _error_;
	GPtrArray* devices;
	FwupdClient* client;
	gpointer _async_data_;
};

struct _AboutFirmwareClientGetDevicesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FwupdClient* client;
	GPtrArray* result;
	Block1Data* _data1_;
	GPtrArray* _tmp0_;
	GThread* _tmp1_;
	GThread* _tmp2_;
	GError* _tmp3_;
	GError* _tmp4_;
	GError* _tmp5_;
	GPtrArray* _tmp6_;
	GPtrArray* _tmp7_;
	GError* _inner_error0_;
};

struct _Block2Data {
	int _ref_count_;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	GError* _error_;
	GPtrArray* releases;
	FwupdClient* client;
	gchar* device_id;
	gpointer _async_data_;
};

struct _AboutFirmwareClientGetUpgradesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FwupdClient* client;
	gchar* device_id;
	GPtrArray* result;
	Block2Data* _data2_;
	GPtrArray* _tmp0_;
	GThread* _tmp1_;
	GThread* _tmp2_;
	GError* _tmp3_;
	GError* _tmp4_;
	GError* _tmp5_;
	GPtrArray* _tmp6_;
	GPtrArray* _tmp7_;
	GError* _inner_error0_;
};

struct _Block3Data {
	int _ref_count_;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	GError* _error_;
	gboolean _result_;
	FwupdClient* client;
	gchar* device_id;
	gchar* path;
	FwupdInstallFlags install_flags;
	gpointer _async_data_;
};

struct _AboutFirmwareClientInstallData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FwupdClient* client;
	gchar* device_id;
	gchar* path;
	FwupdInstallFlags install_flags;
	gboolean result;
	Block3Data* _data3_;
	GThread* _tmp0_;
	GThread* _tmp1_;
	GError* _tmp2_;
	GError* _tmp3_;
	GError* _tmp4_;
	GError* _inner_error0_;
};

struct _AboutParamSpecFirmwareClient {
	GParamSpec parent_instance;
};

static gpointer about_firmware_client_parent_class = NULL;

static void about_firmware_client_get_devices_data_free (gpointer _data);
static gboolean about_firmware_client_get_devices_co (AboutFirmwareClientGetDevicesData* _data_);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static gboolean _about_firmware_client_get_devices_co_gsource_func (gpointer self);
static void __lambda22_ (Block1Data* _data1_);
static gpointer ___lambda22__gthread_func (gpointer self);
static void about_firmware_client_get_upgrades_data_free (gpointer _data);
static gboolean about_firmware_client_get_upgrades_co (AboutFirmwareClientGetUpgradesData* _data_);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static gboolean _about_firmware_client_get_upgrades_co_gsource_func (gpointer self);
static void __lambda23_ (Block2Data* _data2_);
static gpointer ___lambda23__gthread_func (gpointer self);
static void about_firmware_client_install_data_free (gpointer _data);
static gboolean about_firmware_client_install_co (AboutFirmwareClientInstallData* _data_);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static gboolean _about_firmware_client_install_co_gsource_func (gpointer self);
static void __lambda24_ (Block3Data* _data3_);
static gpointer ___lambda24__gthread_func (gpointer self);
static void about_firmware_client_finalize (AboutFirmwareClient * obj);
static GType about_firmware_client_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static void
about_firmware_client_get_devices_data_free (gpointer _data)
{
	AboutFirmwareClientGetDevicesData* _data_;
	_data_ = _data;
	_g_ptr_array_unref0 (_data_->result);
	g_slice_free (AboutFirmwareClientGetDevicesData, _data_);
}

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

void
about_firmware_client_get_devices (FwupdClient* client,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	AboutFirmwareClientGetDevicesData* _data_;
	FwupdClient* _tmp0_;
	g_return_if_fail (client != NULL);
	_data_ = g_slice_new0 (AboutFirmwareClientGetDevicesData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, about_firmware_client_get_devices_data_free);
	_tmp0_ = _g_object_ref0 (client);
	_g_object_unref0 (_data_->client);
	_data_->client = _tmp0_;
	about_firmware_client_get_devices_co (_data_);
}

GPtrArray*
about_firmware_client_get_devices_finish (GAsyncResult* _res_,
                                          GError** error)
{
	GPtrArray* result;
	AboutFirmwareClientGetDevicesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

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

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		_g_ptr_array_unref0 (_data1_->devices);
		_g_error_free0 (_data1_->_error_);
		(_data1_->callback_target_destroy_notify == NULL) ? NULL : (_data1_->callback_target_destroy_notify (_data1_->callback_target), NULL);
		_data1_->callback = NULL;
		_data1_->callback_target = NULL;
		_data1_->callback_target_destroy_notify = NULL;
		_g_object_unref0 (_data1_->client);
		g_slice_free (Block1Data, _data1_);
	}
}

static gboolean
_about_firmware_client_get_devices_co_gsource_func (gpointer self)
{
	gboolean result;
	result = about_firmware_client_get_devices_co (self);
	return result;
}

static gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

static void
__lambda22_ (Block1Data* _data1_)
{
	GSourceFunc _tmp5_;
	gpointer _tmp5__target;
	GDestroyNotify _tmp5__target_destroy_notify;
	GError* _inner_error0_ = NULL;
	{
		GPtrArray* _tmp0_ = NULL;
		GPtrArray* _tmp1_;
		GPtrArray* _tmp2_;
		_tmp1_ = fwupd_client_get_devices (_data1_->client, NULL, &_inner_error0_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = _tmp0_;
		_tmp0_ = NULL;
		_g_ptr_array_unref0 (_data1_->devices);
		_data1_->devices = _tmp2_;
		_g_ptr_array_unref0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		GError* _tmp4_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp3_ = e;
		_tmp4_ = _g_error_copy0 (_tmp3_);
		_g_error_free0 (_data1_->_error_);
		_data1_->_error_ = _tmp4_;
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_tmp5_ = _data1_->callback;
	_tmp5__target = _data1_->callback_target;
	_tmp5__target_destroy_notify = _data1_->callback_target_destroy_notify;
	_data1_->callback = NULL;
	_data1_->callback_target = NULL;
	_data1_->callback_target_destroy_notify = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp5_, _tmp5__target, _tmp5__target_destroy_notify);
}

static gpointer
___lambda22__gthread_func (gpointer self)
{
	gpointer result;
	__lambda22_ (self);
	result = NULL;
	block1_data_unref (self);
	return result;
}

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

static gboolean
about_firmware_client_get_devices_co (AboutFirmwareClientGetDevicesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data1_ = g_slice_new0 (Block1Data);
	_data_->_data1_->_ref_count_ = 1;
	_g_object_unref0 (_data_->_data1_->client);
	_data_->_data1_->client = _data_->client;
	_data_->_data1_->_async_data_ = _data_;
	_data_->_data1_->callback = _about_firmware_client_get_devices_co_gsource_func;
	_data_->_data1_->callback_target = _data_;
	_data_->_data1_->callback_target_destroy_notify = NULL;
	_data_->_data1_->_error_ = NULL;
	_data_->_tmp0_ = g_ptr_array_new_full ((guint) 0, NULL);
	_data_->_data1_->devices = _data_->_tmp0_;
	_data_->_tmp1_ = g_thread_new ("get_devices", ___lambda22__gthread_func, block1_data_ref (_data_->_data1_));
	_data_->_tmp2_ = _data_->_tmp1_;
	_g_thread_unref0 (_data_->_tmp2_);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp3_ = _data_->_data1_->_error_;
	if (_data_->_tmp3_ != NULL) {
		_data_->_tmp4_ = _data_->_data1_->_error_;
		_data_->_tmp5_ = _g_error_copy0 (_data_->_tmp4_);
		_data_->_inner_error0_ = _data_->_tmp5_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		block1_data_unref (_data_->_data1_);
		_data_->_data1_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp6_ = _data_->_data1_->devices;
	_data_->_tmp7_ = _g_ptr_array_ref0 (_data_->_tmp6_);
	_data_->result = _data_->_tmp7_;
	block1_data_unref (_data_->_data1_);
	_data_->_data1_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
about_firmware_client_get_upgrades_data_free (gpointer _data)
{
	AboutFirmwareClientGetUpgradesData* _data_;
	_data_ = _data;
	_g_ptr_array_unref0 (_data_->result);
	g_slice_free (AboutFirmwareClientGetUpgradesData, _data_);
}

void
about_firmware_client_get_upgrades (FwupdClient* client,
                                    const gchar* device_id,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	AboutFirmwareClientGetUpgradesData* _data_;
	FwupdClient* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (client != NULL);
	g_return_if_fail (device_id != NULL);
	_data_ = g_slice_new0 (AboutFirmwareClientGetUpgradesData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, about_firmware_client_get_upgrades_data_free);
	_tmp0_ = _g_object_ref0 (client);
	_g_object_unref0 (_data_->client);
	_data_->client = _tmp0_;
	_tmp1_ = g_strdup (device_id);
	_g_free0 (_data_->device_id);
	_data_->device_id = _tmp1_;
	about_firmware_client_get_upgrades_co (_data_);
}

GPtrArray*
about_firmware_client_get_upgrades_finish (GAsyncResult* _res_,
                                           GError** error)
{
	GPtrArray* result;
	AboutFirmwareClientGetUpgradesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static Block2Data*
block2_data_ref (Block2Data* _data2_)
{
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}

static void
block2_data_unref (void * _userdata_)
{
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		_g_ptr_array_unref0 (_data2_->releases);
		_g_error_free0 (_data2_->_error_);
		(_data2_->callback_target_destroy_notify == NULL) ? NULL : (_data2_->callback_target_destroy_notify (_data2_->callback_target), NULL);
		_data2_->callback = NULL;
		_data2_->callback_target = NULL;
		_data2_->callback_target_destroy_notify = NULL;
		_g_object_unref0 (_data2_->client);
		_g_free0 (_data2_->device_id);
		g_slice_free (Block2Data, _data2_);
	}
}

static gboolean
_about_firmware_client_get_upgrades_co_gsource_func (gpointer self)
{
	gboolean result;
	result = about_firmware_client_get_upgrades_co (self);
	return result;
}

static void
__lambda23_ (Block2Data* _data2_)
{
	GSourceFunc _tmp5_;
	gpointer _tmp5__target;
	GDestroyNotify _tmp5__target_destroy_notify;
	GError* _inner_error0_ = NULL;
	{
		GPtrArray* _tmp0_ = NULL;
		GPtrArray* _tmp1_;
		GPtrArray* _tmp2_;
		_tmp1_ = fwupd_client_get_upgrades (_data2_->client, _data2_->device_id, NULL, &_inner_error0_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = _tmp0_;
		_tmp0_ = NULL;
		_g_ptr_array_unref0 (_data2_->releases);
		_data2_->releases = _tmp2_;
		_g_ptr_array_unref0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		GError* _tmp4_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp3_ = e;
		_tmp4_ = _g_error_copy0 (_tmp3_);
		_g_error_free0 (_data2_->_error_);
		_data2_->_error_ = _tmp4_;
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_tmp5_ = _data2_->callback;
	_tmp5__target = _data2_->callback_target;
	_tmp5__target_destroy_notify = _data2_->callback_target_destroy_notify;
	_data2_->callback = NULL;
	_data2_->callback_target = NULL;
	_data2_->callback_target_destroy_notify = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp5_, _tmp5__target, _tmp5__target_destroy_notify);
}

static gpointer
___lambda23__gthread_func (gpointer self)
{
	gpointer result;
	__lambda23_ (self);
	result = NULL;
	block2_data_unref (self);
	return result;
}

static gboolean
about_firmware_client_get_upgrades_co (AboutFirmwareClientGetUpgradesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data2_ = g_slice_new0 (Block2Data);
	_data_->_data2_->_ref_count_ = 1;
	_g_object_unref0 (_data_->_data2_->client);
	_data_->_data2_->client = _data_->client;
	_g_free0 (_data_->_data2_->device_id);
	_data_->_data2_->device_id = _data_->device_id;
	_data_->_data2_->_async_data_ = _data_;
	_data_->_data2_->callback = _about_firmware_client_get_upgrades_co_gsource_func;
	_data_->_data2_->callback_target = _data_;
	_data_->_data2_->callback_target_destroy_notify = NULL;
	_data_->_data2_->_error_ = NULL;
	_data_->_tmp0_ = g_ptr_array_new_full ((guint) 0, NULL);
	_data_->_data2_->releases = _data_->_tmp0_;
	_data_->_tmp1_ = g_thread_new ("get_upgrades", ___lambda23__gthread_func, block2_data_ref (_data_->_data2_));
	_data_->_tmp2_ = _data_->_tmp1_;
	_g_thread_unref0 (_data_->_tmp2_);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp3_ = _data_->_data2_->_error_;
	if (_data_->_tmp3_ != NULL) {
		_data_->_tmp4_ = _data_->_data2_->_error_;
		_data_->_tmp5_ = _g_error_copy0 (_data_->_tmp4_);
		_data_->_inner_error0_ = _data_->_tmp5_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		block2_data_unref (_data_->_data2_);
		_data_->_data2_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp6_ = _data_->_data2_->releases;
	_data_->_tmp7_ = _g_ptr_array_ref0 (_data_->_tmp6_);
	_data_->result = _data_->_tmp7_;
	block2_data_unref (_data_->_data2_);
	_data_->_data2_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
about_firmware_client_install_data_free (gpointer _data)
{
	AboutFirmwareClientInstallData* _data_;
	_data_ = _data;
	g_slice_free (AboutFirmwareClientInstallData, _data_);
}

void
about_firmware_client_install (FwupdClient* client,
                               const gchar* device_id,
                               const gchar* path,
                               FwupdInstallFlags install_flags,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	AboutFirmwareClientInstallData* _data_;
	FwupdClient* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (client != NULL);
	g_return_if_fail (device_id != NULL);
	g_return_if_fail (path != NULL);
	_data_ = g_slice_new0 (AboutFirmwareClientInstallData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, about_firmware_client_install_data_free);
	_tmp0_ = _g_object_ref0 (client);
	_g_object_unref0 (_data_->client);
	_data_->client = _tmp0_;
	_tmp1_ = g_strdup (device_id);
	_g_free0 (_data_->device_id);
	_data_->device_id = _tmp1_;
	_tmp2_ = g_strdup (path);
	_g_free0 (_data_->path);
	_data_->path = _tmp2_;
	_data_->install_flags = install_flags;
	about_firmware_client_install_co (_data_);
}

gboolean
about_firmware_client_install_finish (GAsyncResult* _res_,
                                      GError** error)
{
	gboolean result;
	AboutFirmwareClientInstallData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		gboolean _tmp0_ = FALSE;
		return _tmp0_;
	}
	result = _data_->result;
	return result;
}

static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}

static void
block3_data_unref (void * _userdata_)
{
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		_g_error_free0 (_data3_->_error_);
		(_data3_->callback_target_destroy_notify == NULL) ? NULL : (_data3_->callback_target_destroy_notify (_data3_->callback_target), NULL);
		_data3_->callback = NULL;
		_data3_->callback_target = NULL;
		_data3_->callback_target_destroy_notify = NULL;
		_g_object_unref0 (_data3_->client);
		_g_free0 (_data3_->device_id);
		_g_free0 (_data3_->path);
		g_slice_free (Block3Data, _data3_);
	}
}

static gboolean
_about_firmware_client_install_co_gsource_func (gpointer self)
{
	gboolean result;
	result = about_firmware_client_install_co (self);
	return result;
}

static void
__lambda24_ (Block3Data* _data3_)
{
	GSourceFunc _tmp3_;
	gpointer _tmp3__target;
	GDestroyNotify _tmp3__target_destroy_notify;
	GError* _inner_error0_ = NULL;
	{
		gboolean _tmp0_ = FALSE;
		_tmp0_ = fwupd_client_install (_data3_->client, _data3_->device_id, _data3_->path, _data3_->install_flags, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data3_->_result_ = _tmp0_;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp1_;
		GError* _tmp2_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = e;
		_tmp2_ = _g_error_copy0 (_tmp1_);
		_g_error_free0 (_data3_->_error_);
		_data3_->_error_ = _tmp2_;
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_tmp3_ = _data3_->callback;
	_tmp3__target = _data3_->callback_target;
	_tmp3__target_destroy_notify = _data3_->callback_target_destroy_notify;
	_data3_->callback = NULL;
	_data3_->callback_target = NULL;
	_data3_->callback_target_destroy_notify = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp3_, _tmp3__target, _tmp3__target_destroy_notify);
}

static gpointer
___lambda24__gthread_func (gpointer self)
{
	gpointer result;
	__lambda24_ (self);
	result = NULL;
	block3_data_unref (self);
	return result;
}

static gboolean
about_firmware_client_install_co (AboutFirmwareClientInstallData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data3_ = g_slice_new0 (Block3Data);
	_data_->_data3_->_ref_count_ = 1;
	_g_object_unref0 (_data_->_data3_->client);
	_data_->_data3_->client = _data_->client;
	_g_free0 (_data_->_data3_->device_id);
	_data_->_data3_->device_id = _data_->device_id;
	_g_free0 (_data_->_data3_->path);
	_data_->_data3_->path = _data_->path;
	_data_->_data3_->install_flags = _data_->install_flags;
	_data_->_data3_->_async_data_ = _data_;
	_data_->_data3_->callback = _about_firmware_client_install_co_gsource_func;
	_data_->_data3_->callback_target = _data_;
	_data_->_data3_->callback_target_destroy_notify = NULL;
	_data_->_data3_->_error_ = NULL;
	_data_->_data3_->_result_ = FALSE;
	_data_->_tmp0_ = g_thread_new ("install", ___lambda24__gthread_func, block3_data_ref (_data_->_data3_));
	_data_->_tmp1_ = _data_->_tmp0_;
	_g_thread_unref0 (_data_->_tmp1_);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp2_ = _data_->_data3_->_error_;
	if (_data_->_tmp2_ != NULL) {
		_data_->_tmp3_ = _data_->_data3_->_error_;
		_data_->_tmp4_ = _g_error_copy0 (_data_->_tmp3_);
		_data_->_inner_error0_ = _data_->_tmp4_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		block3_data_unref (_data_->_data3_);
		_data_->_data3_ = NULL;
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = _data_->_data3_->_result_;
	block3_data_unref (_data_->_data3_);
	_data_->_data3_ = 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;
}

AboutFirmwareClient*
about_firmware_client_construct (GType object_type)
{
	AboutFirmwareClient* self = NULL;
	self = (AboutFirmwareClient*) g_type_create_instance (object_type);
	return self;
}

AboutFirmwareClient*
about_firmware_client_new (void)
{
	return about_firmware_client_construct (ABOUT_TYPE_FIRMWARE_CLIENT);
}

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

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

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

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

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

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

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

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

void
about_value_set_firmware_client (GValue* value,
                                 gpointer v_object)
{
	AboutFirmwareClient * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ABOUT_TYPE_FIRMWARE_CLIENT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, ABOUT_TYPE_FIRMWARE_CLIENT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		about_firmware_client_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		about_firmware_client_unref (old);
	}
}

void
about_value_take_firmware_client (GValue* value,
                                  gpointer v_object)
{
	AboutFirmwareClient * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, ABOUT_TYPE_FIRMWARE_CLIENT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, ABOUT_TYPE_FIRMWARE_CLIENT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		about_firmware_client_unref (old);
	}
}

static void
about_firmware_client_class_init (AboutFirmwareClientClass * klass,
                                  gpointer klass_data)
{
	about_firmware_client_parent_class = g_type_class_peek_parent (klass);
	((AboutFirmwareClientClass *) klass)->finalize = about_firmware_client_finalize;
}

static void
about_firmware_client_instance_init (AboutFirmwareClient * self,
                                     gpointer klass)
{
	self->ref_count = 1;
}

static void
about_firmware_client_finalize (AboutFirmwareClient * obj)
{
	AboutFirmwareClient * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, ABOUT_TYPE_FIRMWARE_CLIENT, AboutFirmwareClient);
	g_signal_handlers_destroy (self);
}

 G_GNUC_NO_INLINE static GType
about_firmware_client_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { about_value_firmware_client_init, about_value_firmware_client_free_value, about_value_firmware_client_copy_value, about_value_firmware_client_peek_pointer, "p", about_value_firmware_client_collect_value, "p", about_value_firmware_client_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (AboutFirmwareClientClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) about_firmware_client_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AboutFirmwareClient), 0, (GInstanceInitFunc) about_firmware_client_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType about_firmware_client_type_id;
	about_firmware_client_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AboutFirmwareClient", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return about_firmware_client_type_id;
}

GType
about_firmware_client_get_type (void)
{
	static volatile gsize about_firmware_client_type_id__once = 0;
	if (g_once_init_enter (&about_firmware_client_type_id__once)) {
		GType about_firmware_client_type_id;
		about_firmware_client_type_id = about_firmware_client_get_type_once ();
		g_once_init_leave (&about_firmware_client_type_id__once, about_firmware_client_type_id);
	}
	return about_firmware_client_type_id__once;
}

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

void
about_firmware_client_unref (gpointer instance)
{
	AboutFirmwareClient * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		ABOUT_FIRMWARE_CLIENT_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

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

