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

/*-
 * Copyright (c) 2015-2023 elementary LLC. (https://elementary.io)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Library General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This 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 Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "bluetooth.h"
#include <gio/gio.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.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

enum  {
	BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_0_PROPERTY,
	BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_NUM_PROPERTIES
};
static GParamSpec* bluetooth_indicator_services_obex_manager_properties[BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _Block7Data Block7Data;
typedef struct _Block8Data Block8Data;
typedef struct _Block9Data Block9Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _BluetoothIndicatorServicesObexManagerCreateManagerData BluetoothIndicatorServicesObexManagerCreateManagerData;
typedef struct _Block10Data Block10Data;
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_TRANSFER_ADDED_SIGNAL,
	BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_TRANSFER_REMOVED_SIGNAL,
	BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_TRANSFER_ACTIVE_SIGNAL,
	BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_NUM_SIGNALS
};
static guint bluetooth_indicator_services_obex_manager_signals[BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_NUM_SIGNALS] = {0};

struct _BluetoothIndicatorServicesObexManagerPrivate {
	GDBusObjectManagerClient* object_manager;
};

struct _Block7Data {
	int _ref_count_;
	BluetoothIndicatorServicesObexManager* self;
	GDBusObject* object;
};

struct _Block8Data {
	int _ref_count_;
	BluetoothIndicatorServicesObexManager* self;
	GDBusObject* object;
};

struct _Block9Data {
	int _ref_count_;
	BluetoothIndicatorServicesObexManager* self;
	GDBusObject* object;
};

struct _BluetoothIndicatorServicesObexManagerCreateManagerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BluetoothIndicatorServicesObexManager* self;
	GDBusObjectManagerClient* _tmp0_;
	GDBusObjectManagerClient* _tmp1_;
	GDBusObjectManagerClient* _tmp2_;
	GDBusObjectManagerClient* _tmp3_;
	GList* _tmp4_;
	GList* _tmp5_;
	GDBusObjectManagerClient* _tmp6_;
	GDBusObjectManagerClient* _tmp7_;
	GDBusObjectManagerClient* _tmp8_;
	GDBusObjectManagerClient* _tmp9_;
	GError* e;
	GError* _tmp10_;
	const gchar* _tmp11_;
	GError* _inner_error0_;
};

struct _Block10Data {
	int _ref_count_;
	BluetoothIndicatorServicesObexManager* self;
	BluetoothIndicatorServicesObexSession* session;
};

static gint BluetoothIndicatorServicesObexManager_private_offset;
static gpointer bluetooth_indicator_services_obex_manager_parent_class = NULL;

static void bluetooth_indicator_services_obex_manager_create_manager_data_free (gpointer _data);
static void bluetooth_indicator_services_obex_manager_create_manager (BluetoothIndicatorServicesObexManager* self,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_);
static void bluetooth_indicator_services_obex_manager_create_manager_finish (BluetoothIndicatorServicesObexManager* self,
                                                                      GAsyncResult* _res_);
static gboolean bluetooth_indicator_services_obex_manager_create_manager_co (BluetoothIndicatorServicesObexManagerCreateManagerData* _data_);
static GType bluetooth_indicator_services_obex_manager_object_manager_proxy_get_type (BluetoothIndicatorServicesObexManager* self,
                                                                               GDBusObjectManagerClient* manager,
                                                                               const gchar* object_path,
                                                                               const gchar* interface_name);
static GType _bluetooth_indicator_services_obex_manager_object_manager_proxy_get_type_gd_bus_proxy_type_func (GDBusObjectManagerClient* manager,
                                                                                                       const gchar* object_path,
                                                                                                       const gchar* interface_name,
                                                                                                       gpointer self);
static void bluetooth_indicator_services_obex_manager_create_manager_ready (GObject* source_object,
                                                                     GAsyncResult* _res_,
                                                                     gpointer _user_data_);
static void ___lambda15_ (BluetoothIndicatorServicesObexManager* self,
                   GDBusObject* object);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static void __lambda16_ (Block7Data* _data7_,
                  GDBusInterface* iface);
static void bluetooth_indicator_services_obex_manager_on_interface_added (BluetoothIndicatorServicesObexManager* self,
                                                                   GDBusObject* object,
                                                                   GDBusInterface* iface);
static void ___lambda16__gfunc (gconstpointer data,
                         gpointer self);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void ____lambda15__gfunc (gconstpointer data,
                          gpointer self);
static void _bluetooth_indicator_services_obex_manager_on_interface_added_g_dbus_object_manager_interface_added (GDBusObjectManager* _sender,
                                                                                                          GDBusObject* object,
                                                                                                          GDBusInterface* interface_,
                                                                                                          gpointer self);
static void bluetooth_indicator_services_obex_manager_on_interface_removed (BluetoothIndicatorServicesObexManager* self,
                                                                     GDBusObject* object,
                                                                     GDBusInterface* iface);
static void _bluetooth_indicator_services_obex_manager_on_interface_removed_g_dbus_object_manager_interface_removed (GDBusObjectManager* _sender,
                                                                                                              GDBusObject* object,
                                                                                                              GDBusInterface* interface_,
                                                                                                              gpointer self);
static void ___lambda18_ (BluetoothIndicatorServicesObexManager* self,
                   GDBusObject* object);
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
static void __lambda19_ (Block8Data* _data8_,
                  GDBusInterface* iface);
static void ___lambda19__gfunc (gconstpointer data,
                         gpointer self);
static void ____lambda18__g_dbus_object_manager_object_added (GDBusObjectManager* _sender,
                                                       GDBusObject* object,
                                                       gpointer self);
static void ___lambda20_ (BluetoothIndicatorServicesObexManager* self,
                   GDBusObject* object);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
static void __lambda21_ (Block9Data* _data9_,
                  GDBusInterface* iface);
static void ___lambda21__gfunc (gconstpointer data,
                         gpointer self);
static void ____lambda20__g_dbus_object_manager_object_removed (GDBusObjectManager* _sender,
                                                         GDBusObject* object,
                                                         gpointer self);
GType bluetooth_indicator_services_obex_transfer_proxy_get_type (void);
static Block10Data* block10_data_ref (Block10Data* _data10_);
static void block10_data_unref (void * _userdata_);
static void ___lambda17_ (Block10Data* _data10_,
                   GVariant* changed,
                   gchar** invalid);
static void ____lambda17__g_dbus_proxy_g_properties_changed (GDBusProxy* _sender,
                                                      GVariant* changed_properties,
                                                      gchar** invalidated_properties,
                                                      gpointer self);
static void g_cclosure_user_marshal_VOID__STRING_OBJECT (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static GObject * bluetooth_indicator_services_obex_manager_constructor (GType type,
                                                                 guint n_construct_properties,
                                                                 GObjectConstructParam * construct_properties);
static void _g_free0_ (gpointer var);
static void bluetooth_indicator_services_obex_manager_finalize (GObject * obj);
static GType bluetooth_indicator_services_obex_manager_get_type_once (void);

static inline gpointer
bluetooth_indicator_services_obex_manager_get_instance_private (BluetoothIndicatorServicesObexManager* self)
{
	return G_STRUCT_MEMBER_P (self, BluetoothIndicatorServicesObexManager_private_offset);
}

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

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

static void
bluetooth_indicator_services_obex_manager_create_manager (BluetoothIndicatorServicesObexManager* self,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_)
{
	BluetoothIndicatorServicesObexManagerCreateManagerData* _data_;
	BluetoothIndicatorServicesObexManager* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (BluetoothIndicatorServicesObexManagerCreateManagerData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, bluetooth_indicator_services_obex_manager_create_manager_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	bluetooth_indicator_services_obex_manager_create_manager_co (_data_);
}

static void
bluetooth_indicator_services_obex_manager_create_manager_finish (BluetoothIndicatorServicesObexManager* self,
                                                                 GAsyncResult* _res_)
{
	BluetoothIndicatorServicesObexManagerCreateManagerData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static GType
_bluetooth_indicator_services_obex_manager_object_manager_proxy_get_type_gd_bus_proxy_type_func (GDBusObjectManagerClient* manager,
                                                                                                 const gchar* object_path,
                                                                                                 const gchar* interface_name,
                                                                                                 gpointer self)
{
	GType result;
	result = bluetooth_indicator_services_obex_manager_object_manager_proxy_get_type ((BluetoothIndicatorServicesObexManager*) self, manager, object_path, interface_name);
	return result;
}

static void
bluetooth_indicator_services_obex_manager_create_manager_ready (GObject* source_object,
                                                                GAsyncResult* _res_,
                                                                gpointer _user_data_)
{
	BluetoothIndicatorServicesObexManagerCreateManagerData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	bluetooth_indicator_services_obex_manager_create_manager_co (_data_);
}

static Block7Data*
block7_data_ref (Block7Data* _data7_)
{
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}

static void
block7_data_unref (void * _userdata_)
{
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		BluetoothIndicatorServicesObexManager* self;
		self = _data7_->self;
		_g_object_unref0 (_data7_->object);
		_g_object_unref0 (self);
		g_slice_free (Block7Data, _data7_);
	}
}

static void
__lambda16_ (Block7Data* _data7_,
             GDBusInterface* iface)
{
	BluetoothIndicatorServicesObexManager* self;
	self = _data7_->self;
	g_return_if_fail (iface != NULL);
	bluetooth_indicator_services_obex_manager_on_interface_added (self, _data7_->object, iface);
}

static void
___lambda16__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda16_ (self, (GDBusInterface*) data);
}

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

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

static void
___lambda15_ (BluetoothIndicatorServicesObexManager* self,
              GDBusObject* object)
{
	Block7Data* _data7_;
	GDBusObject* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	g_return_if_fail (object != NULL);
	_data7_ = g_slice_new0 (Block7Data);
	_data7_->_ref_count_ = 1;
	_data7_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (object);
	_g_object_unref0 (_data7_->object);
	_data7_->object = _tmp0_;
	_tmp1_ = g_dbus_object_get_interfaces (_data7_->object);
	_tmp2_ = _tmp1_;
	g_list_foreach (_tmp2_, ___lambda16__gfunc, _data7_);
	(_tmp2_ == NULL) ? NULL : (_tmp2_ = (_g_list_free__g_object_unref0_ (_tmp2_), NULL));
	block7_data_unref (_data7_);
	_data7_ = NULL;
}

static void
____lambda15__gfunc (gconstpointer data,
                     gpointer self)
{
	___lambda15_ ((BluetoothIndicatorServicesObexManager*) self, (GDBusObject*) data);
}

static void
_bluetooth_indicator_services_obex_manager_on_interface_added_g_dbus_object_manager_interface_added (GDBusObjectManager* _sender,
                                                                                                     GDBusObject* object,
                                                                                                     GDBusInterface* interface_,
                                                                                                     gpointer self)
{
	bluetooth_indicator_services_obex_manager_on_interface_added ((BluetoothIndicatorServicesObexManager*) self, object, interface_);
}

static void
_bluetooth_indicator_services_obex_manager_on_interface_removed_g_dbus_object_manager_interface_removed (GDBusObjectManager* _sender,
                                                                                                         GDBusObject* object,
                                                                                                         GDBusInterface* interface_,
                                                                                                         gpointer self)
{
	bluetooth_indicator_services_obex_manager_on_interface_removed ((BluetoothIndicatorServicesObexManager*) self, object, interface_);
}

static Block8Data*
block8_data_ref (Block8Data* _data8_)
{
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}

static void
block8_data_unref (void * _userdata_)
{
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		BluetoothIndicatorServicesObexManager* self;
		self = _data8_->self;
		_g_object_unref0 (_data8_->object);
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}

static void
__lambda19_ (Block8Data* _data8_,
             GDBusInterface* iface)
{
	BluetoothIndicatorServicesObexManager* self;
	self = _data8_->self;
	g_return_if_fail (iface != NULL);
	bluetooth_indicator_services_obex_manager_on_interface_added (self, _data8_->object, iface);
}

static void
___lambda19__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda19_ (self, (GDBusInterface*) data);
}

static void
___lambda18_ (BluetoothIndicatorServicesObexManager* self,
              GDBusObject* object)
{
	Block8Data* _data8_;
	GDBusObject* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	g_return_if_fail (object != NULL);
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_data8_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (object);
	_g_object_unref0 (_data8_->object);
	_data8_->object = _tmp0_;
	_tmp1_ = g_dbus_object_get_interfaces (_data8_->object);
	_tmp2_ = _tmp1_;
	g_list_foreach (_tmp2_, ___lambda19__gfunc, _data8_);
	(_tmp2_ == NULL) ? NULL : (_tmp2_ = (_g_list_free__g_object_unref0_ (_tmp2_), NULL));
	block8_data_unref (_data8_);
	_data8_ = NULL;
}

static void
____lambda18__g_dbus_object_manager_object_added (GDBusObjectManager* _sender,
                                                  GDBusObject* object,
                                                  gpointer self)
{
	___lambda18_ ((BluetoothIndicatorServicesObexManager*) self, object);
}

static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		BluetoothIndicatorServicesObexManager* self;
		self = _data9_->self;
		_g_object_unref0 (_data9_->object);
		_g_object_unref0 (self);
		g_slice_free (Block9Data, _data9_);
	}
}

static void
__lambda21_ (Block9Data* _data9_,
             GDBusInterface* iface)
{
	BluetoothIndicatorServicesObexManager* self;
	self = _data9_->self;
	g_return_if_fail (iface != NULL);
	bluetooth_indicator_services_obex_manager_on_interface_removed (self, _data9_->object, iface);
}

static void
___lambda21__gfunc (gconstpointer data,
                    gpointer self)
{
	__lambda21_ (self, (GDBusInterface*) data);
}

static void
___lambda20_ (BluetoothIndicatorServicesObexManager* self,
              GDBusObject* object)
{
	Block9Data* _data9_;
	GDBusObject* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	g_return_if_fail (object != NULL);
	_data9_ = g_slice_new0 (Block9Data);
	_data9_->_ref_count_ = 1;
	_data9_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (object);
	_g_object_unref0 (_data9_->object);
	_data9_->object = _tmp0_;
	_tmp1_ = g_dbus_object_get_interfaces (_data9_->object);
	_tmp2_ = _tmp1_;
	g_list_foreach (_tmp2_, ___lambda21__gfunc, _data9_);
	(_tmp2_ == NULL) ? NULL : (_tmp2_ = (_g_list_free__g_object_unref0_ (_tmp2_), NULL));
	block9_data_unref (_data9_);
	_data9_ = NULL;
}

static void
____lambda20__g_dbus_object_manager_object_removed (GDBusObjectManager* _sender,
                                                    GDBusObject* object,
                                                    gpointer self)
{
	___lambda20_ ((BluetoothIndicatorServicesObexManager*) self, object);
}

static gboolean
bluetooth_indicator_services_obex_manager_create_manager_co (BluetoothIndicatorServicesObexManagerCreateManagerData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_state_ = 1;
		g_dbus_object_manager_client_new_for_bus (G_BUS_TYPE_SESSION, G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, "org.bluez.obex", "/", _bluetooth_indicator_services_obex_manager_object_manager_proxy_get_type_gd_bus_proxy_type_func, g_object_ref (_data_->self), g_object_unref, NULL, bluetooth_indicator_services_obex_manager_create_manager_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp1_ = g_dbus_object_manager_client_new_for_bus_finish (_data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp0_ = _data_->_tmp1_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp2_ = _data_->_tmp0_;
		_data_->_tmp0_ = NULL;
		_g_object_unref0 (_data_->self->priv->object_manager);
		_data_->self->priv->object_manager = _data_->_tmp2_;
		_data_->_tmp3_ = _data_->self->priv->object_manager;
		_data_->_tmp4_ = g_dbus_object_manager_get_objects ((GDBusObjectManager*) _data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		g_list_foreach (_data_->_tmp5_, ____lambda15__gfunc, _data_->self);
		(_data_->_tmp5_ == NULL) ? NULL : (_data_->_tmp5_ = (_g_list_free__g_object_unref0_ (_data_->_tmp5_), NULL));
		_data_->_tmp6_ = _data_->self->priv->object_manager;
		g_signal_connect_object ((GDBusObjectManager*) _data_->_tmp6_, "interface-added", (GCallback) _bluetooth_indicator_services_obex_manager_on_interface_added_g_dbus_object_manager_interface_added, _data_->self, 0);
		_data_->_tmp7_ = _data_->self->priv->object_manager;
		g_signal_connect_object ((GDBusObjectManager*) _data_->_tmp7_, "interface-removed", (GCallback) _bluetooth_indicator_services_obex_manager_on_interface_removed_g_dbus_object_manager_interface_removed, _data_->self, 0);
		_data_->_tmp8_ = _data_->self->priv->object_manager;
		g_signal_connect_object ((GDBusObjectManager*) _data_->_tmp8_, "object-added", (GCallback) ____lambda18__g_dbus_object_manager_object_added, _data_->self, 0);
		_data_->_tmp9_ = _data_->self->priv->object_manager;
		g_signal_connect_object ((GDBusObjectManager*) _data_->_tmp9_, "object-removed", (GCallback) ____lambda20__g_dbus_object_manager_object_removed, _data_->self, 0);
		_g_object_unref0 (_data_->_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp10_ = _data_->e;
		_data_->_tmp11_ = _data_->_tmp10_->message;
		g_critical ("ObexManager.vala:51: %s", _data_->_tmp11_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		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;
}

static GType
bluetooth_indicator_services_obex_manager_object_manager_proxy_get_type (BluetoothIndicatorServicesObexManager* self,
                                                                         GDBusObjectManagerClient* manager,
                                                                         const gchar* object_path,
                                                                         const gchar* interface_name)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	GType result;
	g_return_val_if_fail (self != NULL, 0UL);
	g_return_val_if_fail (manager != NULL, 0UL);
	g_return_val_if_fail (object_path != NULL, 0UL);
	if (interface_name == NULL) {
		result = g_dbus_object_proxy_get_type ();
		return result;
	}
	_tmp0_ = interface_name;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("org.bluez.obex.Transfer1")))) {
		switch (0) {
			default:
			{
				result = bluetooth_indicator_services_obex_transfer_proxy_get_type ();
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				result = g_dbus_proxy_get_type ();
				return result;
			}
		}
	}
}

static Block10Data*
block10_data_ref (Block10Data* _data10_)
{
	g_atomic_int_inc (&_data10_->_ref_count_);
	return _data10_;
}

static void
block10_data_unref (void * _userdata_)
{
	Block10Data* _data10_;
	_data10_ = (Block10Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data10_->_ref_count_)) {
		BluetoothIndicatorServicesObexManager* self;
		self = _data10_->self;
		_g_object_unref0 (_data10_->session);
		_g_object_unref0 (self);
		g_slice_free (Block10Data, _data10_);
	}
}

static void
___lambda17_ (Block10Data* _data10_,
              GVariant* changed,
              gchar** invalid)
{
	BluetoothIndicatorServicesObexManager* self;
	BluetoothIndicatorServicesObexSession* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	self = _data10_->self;
	g_return_if_fail (changed != NULL);
	_tmp0_ = _data10_->session;
	_tmp1_ = bluetooth_indicator_services_obex_session_get_destination (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	g_signal_emit (self, bluetooth_indicator_services_obex_manager_signals[BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_TRANSFER_ACTIVE_SIGNAL], 0, _tmp3_);
	_g_free0 (_tmp3_);
}

static void
____lambda17__g_dbus_proxy_g_properties_changed (GDBusProxy* _sender,
                                                 GVariant* changed_properties,
                                                 gchar** invalidated_properties,
                                                 gpointer self)
{
	___lambda17_ (self, changed_properties, invalidated_properties);
}

static void
bluetooth_indicator_services_obex_manager_on_interface_added (BluetoothIndicatorServicesObexManager* self,
                                                              GDBusObject* object,
                                                              GDBusInterface* iface)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (iface != NULL);
	if (BLUETOOTH_INDICATOR_SERVICES_OBEX_IS_TRANSFER (iface)) {
		Block10Data* _data10_;
		BluetoothIndicatorServicesObexTransfer* transfer = NULL;
		GHashTable* _tmp10_;
		BluetoothIndicatorServicesObexTransfer* _tmp11_;
		BluetoothIndicatorServicesObexTransfer* _tmp12_;
		BluetoothIndicatorServicesObexSession* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		BluetoothIndicatorServicesObexTransfer* _tmp16_;
		BluetoothIndicatorServicesObexSession* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		gchar* _tmp20_;
		BluetoothIndicatorServicesObexTransfer* _tmp21_;
		_data10_ = g_slice_new0 (Block10Data);
		_data10_->_ref_count_ = 1;
		_data10_->self = g_object_ref (self);
		transfer = G_TYPE_CHECK_INSTANCE_CAST (iface, BLUETOOTH_INDICATOR_SERVICES_OBEX_TYPE_TRANSFER, BluetoothIndicatorServicesObexTransfer);
		_data10_->session = NULL;
		{
			BluetoothIndicatorServicesObexSession* _tmp0_ = NULL;
			BluetoothIndicatorServicesObexTransfer* _tmp1_;
			char* _tmp2_;
			char* _tmp3_;
			char* _tmp4_;
			BluetoothIndicatorServicesObexSession* _tmp5_;
			BluetoothIndicatorServicesObexSession* _tmp6_;
			BluetoothIndicatorServicesObexSession* _tmp7_;
			_tmp1_ = transfer;
			_tmp2_ = bluetooth_indicator_services_obex_transfer_get_session (_tmp1_);
			_tmp3_ = _tmp2_;
			_tmp4_ = _tmp3_;
			_tmp5_ = (BluetoothIndicatorServicesObexSession*) g_initable_new (BLUETOOTH_INDICATOR_SERVICES_OBEX_TYPE_SESSION_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", "org.bluez.obex", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", (const gchar*) _tmp4_, "g-interface-name", "org.bluez.obex.Session1", NULL);
			_tmp6_ = (BluetoothIndicatorServicesObexSession*) _tmp5_;
			_g_free0 (_tmp4_);
			_tmp0_ = _tmp6_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_tmp7_ = _tmp0_;
			_tmp0_ = NULL;
			_g_object_unref0 (_data10_->session);
			_data10_->session = _tmp7_;
			_g_object_unref0 (_tmp0_);
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			GError* _tmp8_;
			const gchar* _tmp9_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp8_ = e;
			_tmp9_ = _tmp8_->message;
			g_critical ("ObexManager.vala:78: %s", _tmp9_);
			_g_error_free0 (e);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			block10_data_unref (_data10_);
			_data10_ = 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;
		}
		_tmp10_ = self->active_transfers;
		_tmp11_ = transfer;
		_tmp12_ = _g_object_ref0 (_tmp11_);
		_tmp13_ = _data10_->session;
		_tmp14_ = bluetooth_indicator_services_obex_session_get_destination (_tmp13_);
		_tmp15_ = _tmp14_;
		g_hash_table_insert (_tmp10_, _tmp12_, _tmp15_);
		_tmp16_ = transfer;
		g_signal_connect_data (G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, g_dbus_proxy_get_type (), GDBusProxy), "g-properties-changed", (GCallback) ____lambda17__g_dbus_proxy_g_properties_changed, block10_data_ref (_data10_), (GClosureNotify) block10_data_unref, 0);
		_tmp17_ = _data10_->session;
		_tmp18_ = bluetooth_indicator_services_obex_session_get_destination (_tmp17_);
		_tmp19_ = _tmp18_;
		_tmp20_ = _tmp19_;
		_tmp21_ = transfer;
		g_signal_emit (self, bluetooth_indicator_services_obex_manager_signals[BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_TRANSFER_ADDED_SIGNAL], 0, _tmp20_, _tmp21_);
		_g_free0 (_tmp20_);
		block10_data_unref (_data10_);
		_data10_ = NULL;
	}
}

static void
bluetooth_indicator_services_obex_manager_on_interface_removed (BluetoothIndicatorServicesObexManager* self,
                                                                GDBusObject* object,
                                                                GDBusInterface* iface)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (object != NULL);
	g_return_if_fail (iface != NULL);
	if (BLUETOOTH_INDICATOR_SERVICES_OBEX_IS_TRANSFER (iface)) {
		BluetoothIndicatorServicesObexTransfer* transfer = NULL;
		GHashTable* _tmp0_;
		BluetoothIndicatorServicesObexTransfer* _tmp1_;
		BluetoothIndicatorServicesObexTransfer* _tmp4_;
		transfer = G_TYPE_CHECK_INSTANCE_CAST (iface, BLUETOOTH_INDICATOR_SERVICES_OBEX_TYPE_TRANSFER, BluetoothIndicatorServicesObexTransfer);
		_tmp0_ = self->active_transfers;
		_tmp1_ = transfer;
		if (g_hash_table_contains (_tmp0_, _tmp1_)) {
			GHashTable* _tmp2_;
			BluetoothIndicatorServicesObexTransfer* _tmp3_;
			_tmp2_ = self->active_transfers;
			_tmp3_ = transfer;
			g_hash_table_remove (_tmp2_, _tmp3_);
		}
		_tmp4_ = transfer;
		g_signal_emit (self, bluetooth_indicator_services_obex_manager_signals[BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_TRANSFER_REMOVED_SIGNAL], 0, _tmp4_);
	}
}

BluetoothIndicatorServicesObexManager*
bluetooth_indicator_services_obex_manager_construct (GType object_type)
{
	BluetoothIndicatorServicesObexManager * self = NULL;
	self = (BluetoothIndicatorServicesObexManager*) g_object_new (object_type, NULL);
	return self;
}

BluetoothIndicatorServicesObexManager*
bluetooth_indicator_services_obex_manager_new (void)
{
	return bluetooth_indicator_services_obex_manager_construct (BLUETOOTH_INDICATOR_SERVICES_TYPE_OBEX_MANAGER);
}

static void
g_cclosure_user_marshal_VOID__STRING_OBJECT (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__STRING_OBJECT) (gpointer data1, const char* arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__STRING_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__STRING_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_string (param_values + 1), g_value_get_object (param_values + 2), data2);
}

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

static GObject *
bluetooth_indicator_services_obex_manager_constructor (GType type,
                                                       guint n_construct_properties,
                                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	BluetoothIndicatorServicesObexManager * self;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	parent_class = G_OBJECT_CLASS (bluetooth_indicator_services_obex_manager_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BLUETOOTH_INDICATOR_SERVICES_TYPE_OBEX_MANAGER, BluetoothIndicatorServicesObexManager);
	_tmp0_ = g_direct_hash;
	_tmp1_ = g_direct_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_object_unref0_, _g_free0_);
	_g_hash_table_unref0 (self->active_transfers);
	self->active_transfers = _tmp2_;
	bluetooth_indicator_services_obex_manager_create_manager (self, NULL, NULL);
	return obj;
}

static void
bluetooth_indicator_services_obex_manager_class_init (BluetoothIndicatorServicesObexManagerClass * klass,
                                                      gpointer klass_data)
{
	bluetooth_indicator_services_obex_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BluetoothIndicatorServicesObexManager_private_offset);
	G_OBJECT_CLASS (klass)->constructor = bluetooth_indicator_services_obex_manager_constructor;
	G_OBJECT_CLASS (klass)->finalize = bluetooth_indicator_services_obex_manager_finalize;
	bluetooth_indicator_services_obex_manager_signals[BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_TRANSFER_ADDED_SIGNAL] = g_signal_new ("transfer-added", BLUETOOTH_INDICATOR_SERVICES_TYPE_OBEX_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__STRING_OBJECT, G_TYPE_NONE, 2, G_TYPE_STRING, BLUETOOTH_INDICATOR_SERVICES_OBEX_TYPE_TRANSFER);
	bluetooth_indicator_services_obex_manager_signals[BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_TRANSFER_REMOVED_SIGNAL] = g_signal_new ("transfer-removed", BLUETOOTH_INDICATOR_SERVICES_TYPE_OBEX_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, BLUETOOTH_INDICATOR_SERVICES_OBEX_TYPE_TRANSFER);
	bluetooth_indicator_services_obex_manager_signals[BLUETOOTH_INDICATOR_SERVICES_OBEX_MANAGER_TRANSFER_ACTIVE_SIGNAL] = g_signal_new ("transfer-active", BLUETOOTH_INDICATOR_SERVICES_TYPE_OBEX_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
}

static void
bluetooth_indicator_services_obex_manager_instance_init (BluetoothIndicatorServicesObexManager * self,
                                                         gpointer klass)
{
	self->priv = bluetooth_indicator_services_obex_manager_get_instance_private (self);
}

static void
bluetooth_indicator_services_obex_manager_finalize (GObject * obj)
{
	BluetoothIndicatorServicesObexManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BLUETOOTH_INDICATOR_SERVICES_TYPE_OBEX_MANAGER, BluetoothIndicatorServicesObexManager);
	_g_object_unref0 (self->priv->object_manager);
	_g_hash_table_unref0 (self->active_transfers);
	G_OBJECT_CLASS (bluetooth_indicator_services_obex_manager_parent_class)->finalize (obj);
}

static GType
bluetooth_indicator_services_obex_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BluetoothIndicatorServicesObexManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bluetooth_indicator_services_obex_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BluetoothIndicatorServicesObexManager), 0, (GInstanceInitFunc) bluetooth_indicator_services_obex_manager_instance_init, NULL };
	GType bluetooth_indicator_services_obex_manager_type_id;
	bluetooth_indicator_services_obex_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "BluetoothIndicatorServicesObexManager", &g_define_type_info, 0);
	BluetoothIndicatorServicesObexManager_private_offset = g_type_add_instance_private (bluetooth_indicator_services_obex_manager_type_id, sizeof (BluetoothIndicatorServicesObexManagerPrivate));
	return bluetooth_indicator_services_obex_manager_type_id;
}

GType
bluetooth_indicator_services_obex_manager_get_type (void)
{
	static volatile gsize bluetooth_indicator_services_obex_manager_type_id__once = 0;
	if (g_once_init_enter (&bluetooth_indicator_services_obex_manager_type_id__once)) {
		GType bluetooth_indicator_services_obex_manager_type_id;
		bluetooth_indicator_services_obex_manager_type_id = bluetooth_indicator_services_obex_manager_get_type_once ();
		g_once_init_leave (&bluetooth_indicator_services_obex_manager_type_id__once, bluetooth_indicator_services_obex_manager_type_id);
	}
	return bluetooth_indicator_services_obex_manager_type_id__once;
}

