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

/*
 * Copyright (c) 2024-2026 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include "ft_plugin_freedesktop.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include "ft_core.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  {
	FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_0_PROPERTY,
	FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_NAME_PROPERTY,
	FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_VENDOR_PROPERTY,
	FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_VERSION_PROPERTY,
	FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_SPEC_VERSION_PROPERTY,
	FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_HAS_ACTIONS_PROPERTY,
	FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_NUM_PROPERTIES
};
static GParamSpec* freedesktop_notification_backend_provider_properties[FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _FreedesktopNotificationBackendProviderInitializeData FreedesktopNotificationBackendProviderInitializeData;
typedef struct _FreedesktopNotificationBackendProviderUninitializeData FreedesktopNotificationBackendProviderUninitializeData;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef struct _FreedesktopNotificationBackendProviderEnableData FreedesktopNotificationBackendProviderEnableData;
typedef struct _FreedesktopNotificationBackendProviderDisableData FreedesktopNotificationBackendProviderDisableData;

struct _FreedesktopNotificationBackendProviderPrivate {
	guint watcher_id;
	gchar* _name;
	gchar* _vendor;
	gchar* _version;
	gchar* _spec_version;
	gboolean _has_actions;
	GApplication* application;
};

struct _FreedesktopNotificationBackendProviderInitializeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FreedesktopNotificationBackendProvider* self;
	GCancellable* cancellable;
};

struct _FreedesktopNotificationBackendProviderUninitializeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FreedesktopNotificationBackendProvider* self;
};

struct _FreedesktopNotificationBackendProviderEnableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FreedesktopNotificationBackendProvider* self;
	GCancellable* cancellable;
	GHashTable* capabilities;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	gchar** capabilities_strv;
	gint capabilities_strv_length1;
	gint _capabilities_strv_size_;
	FreedesktopNotifications* proxy;
	FreedesktopNotifications* _tmp3_;
	FreedesktopNotifications* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	FreedesktopNotifications* _tmp9_;
	gchar** _tmp10_;
	gint _tmp11_;
	gchar** _tmp12_;
	gint _tmp12__length1;
	gchar** capability_collection;
	gint capability_collection_length1;
	gint _capability_collection_size_;
	gint capability_it;
	gchar* _tmp13_;
	gchar* capability;
	GHashTable* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	GHashTable* _tmp17_;
	GError* _inner_error0_;
};

struct _FreedesktopNotificationBackendProviderDisableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FreedesktopNotificationBackendProvider* self;
};

static gint FreedesktopNotificationBackendProvider_private_offset;
static gpointer freedesktop_notification_backend_provider_parent_class = NULL;
static FtNotificationBackendProviderIface * freedesktop_notification_backend_provider_ft_notification_backend_provider_parent_iface = NULL;
static GType freedesktop_notification_backend_provider_type_id = 0;

static void freedesktop_notification_backend_provider_on_name_appeared (FreedesktopNotificationBackendProvider* self,
                                                                 GDBusConnection* connection,
                                                                 const gchar* name,
                                                                 const gchar* name_owner);
static void freedesktop_notification_backend_provider_on_name_vanished (FreedesktopNotificationBackendProvider* self,
                                                                 GDBusConnection* connection,
                                                                 const gchar* name);
static void freedesktop_notification_backend_provider_real_initialize_data_free (gpointer _data);
static void freedesktop_notification_backend_provider_real_initialize (FtProvider* base,
                                                                GCancellable* cancellable,
                                                                GAsyncReadyCallback _callback_,
                                                                gpointer _user_data_);
static gboolean freedesktop_notification_backend_provider_real_initialize_co (FreedesktopNotificationBackendProviderInitializeData* _data_);
static void _freedesktop_notification_backend_provider_on_name_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                              const gchar* name,
                                                                                              const gchar* name_owner,
                                                                                              gpointer self);
static void _freedesktop_notification_backend_provider_on_name_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                              const gchar* name,
                                                                                              gpointer self);
static void freedesktop_notification_backend_provider_real_uninitialize_data_free (gpointer _data);
static void freedesktop_notification_backend_provider_real_uninitialize (FtProvider* base,
                                                                  GAsyncReadyCallback _callback_,
                                                                  gpointer _user_data_);
static gboolean freedesktop_notification_backend_provider_real_uninitialize_co (FreedesktopNotificationBackendProviderUninitializeData* _data_);
static void freedesktop_notification_backend_provider_real_enable_data_free (gpointer _data);
static void freedesktop_notification_backend_provider_real_enable (FtProvider* base,
                                                            GCancellable* cancellable,
                                                            GAsyncReadyCallback _callback_,
                                                            gpointer _user_data_);
static gboolean freedesktop_notification_backend_provider_real_enable_co (FreedesktopNotificationBackendProviderEnableData* _data_);
static void _g_free0_ (gpointer var);
static void freedesktop_notification_backend_provider_enable_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_);
static void freedesktop_notification_backend_provider_real_disable_data_free (gpointer _data);
static void freedesktop_notification_backend_provider_real_disable (FtProvider* base,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);
static gboolean freedesktop_notification_backend_provider_real_disable_co (FreedesktopNotificationBackendProviderDisableData* _data_);
static void freedesktop_notification_backend_provider_real_withdraw_notification (FtNotificationBackendProvider* base,
                                                                           const gchar* id);
static void freedesktop_notification_backend_provider_real_send_notification (FtNotificationBackendProvider* base,
                                                                       const gchar* id,
                                                                       GNotification* notification);
static void freedesktop_notification_backend_provider_real_dispose (GObject* base);
static GObject * freedesktop_notification_backend_provider_constructor (GType type,
                                                                 guint n_construct_properties,
                                                                 GObjectConstructParam * construct_properties);
static void freedesktop_notification_backend_provider_finalize (GObject * obj);
static void _vala_freedesktop_notification_backend_provider_get_property (GObject * object,
                                                                   guint property_id,
                                                                   GValue * value,
                                                                   GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
freedesktop_notification_backend_provider_get_instance_private (FreedesktopNotificationBackendProvider* self)
{
	return G_STRUCT_MEMBER_P (self, FreedesktopNotificationBackendProvider_private_offset);
}

static void
freedesktop_notification_backend_provider_on_name_appeared (FreedesktopNotificationBackendProvider* self,
                                                            GDBusConnection* connection,
                                                            const gchar* name,
                                                            const gchar* name_owner)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (connection != NULL);
	g_return_if_fail (name != NULL);
	g_return_if_fail (name_owner != NULL);
	ft_provider_set_available ((FtProvider*) self, TRUE);
}

static void
freedesktop_notification_backend_provider_on_name_vanished (FreedesktopNotificationBackendProvider* self,
                                                            GDBusConnection* connection,
                                                            const gchar* name)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	ft_provider_set_available ((FtProvider*) self, FALSE);
}

static void
freedesktop_notification_backend_provider_real_initialize_data_free (gpointer _data)
{
	FreedesktopNotificationBackendProviderInitializeData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (FreedesktopNotificationBackendProviderInitializeData, _data_);
}

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

static void
freedesktop_notification_backend_provider_real_initialize (FtProvider* base,
                                                           GCancellable* cancellable,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_)
{
	FreedesktopNotificationBackendProvider * self;
	FreedesktopNotificationBackendProviderInitializeData* _data_;
	FreedesktopNotificationBackendProvider* _tmp0_;
	GCancellable* _tmp1_;
	self = (FreedesktopNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (FreedesktopNotificationBackendProviderInitializeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, freedesktop_notification_backend_provider_real_initialize_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	freedesktop_notification_backend_provider_real_initialize_co (_data_);
}

static void
freedesktop_notification_backend_provider_initialize_finish (FtProvider* base,
                                                             GAsyncResult* _res_,
                                                             GError** error)
{
	FreedesktopNotificationBackendProviderInitializeData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
_freedesktop_notification_backend_provider_on_name_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                         const gchar* name,
                                                                                         const gchar* name_owner,
                                                                                         gpointer self)
{
	freedesktop_notification_backend_provider_on_name_appeared ((FreedesktopNotificationBackendProvider*) self, connection, name, name_owner);
}

static void
_freedesktop_notification_backend_provider_on_name_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                         const gchar* name,
                                                                                         gpointer self)
{
	freedesktop_notification_backend_provider_on_name_vanished ((FreedesktopNotificationBackendProvider*) self, connection, name);
}

static gboolean
freedesktop_notification_backend_provider_real_initialize_co (FreedesktopNotificationBackendProviderInitializeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->self->priv->watcher_id = g_bus_watch_name_with_closures (G_BUS_TYPE_SESSION, "org.freedesktop.Notifications", G_BUS_NAME_WATCHER_FLAGS_NONE, (GClosure*) ((_freedesktop_notification_backend_provider_on_name_appeared_gbus_name_appeared_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _freedesktop_notification_backend_provider_on_name_appeared_gbus_name_appeared_callback, g_object_ref (_data_->self), (GClosureNotify) g_object_unref)), (GClosure*) ((_freedesktop_notification_backend_provider_on_name_vanished_gbus_name_vanished_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _freedesktop_notification_backend_provider_on_name_vanished_gbus_name_vanished_callback, g_object_ref (_data_->self), (GClosureNotify) g_object_unref)));
	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
freedesktop_notification_backend_provider_real_uninitialize_data_free (gpointer _data)
{
	FreedesktopNotificationBackendProviderUninitializeData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (FreedesktopNotificationBackendProviderUninitializeData, _data_);
}

static void
freedesktop_notification_backend_provider_real_uninitialize (FtProvider* base,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_)
{
	FreedesktopNotificationBackendProvider * self;
	FreedesktopNotificationBackendProviderUninitializeData* _data_;
	FreedesktopNotificationBackendProvider* _tmp0_;
	self = (FreedesktopNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (FreedesktopNotificationBackendProviderUninitializeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, freedesktop_notification_backend_provider_real_uninitialize_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	freedesktop_notification_backend_provider_real_uninitialize_co (_data_);
}

static void
freedesktop_notification_backend_provider_uninitialize_finish (FtProvider* base,
                                                               GAsyncResult* _res_,
                                                               GError** error)
{
	FreedesktopNotificationBackendProviderUninitializeData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gboolean
freedesktop_notification_backend_provider_real_uninitialize_co (FreedesktopNotificationBackendProviderUninitializeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->self->priv->watcher_id != ((guint) 0)) {
		g_bus_unwatch_name (_data_->self->priv->watcher_id);
		_data_->self->priv->watcher_id = (guint) 0;
	}
	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
freedesktop_notification_backend_provider_real_enable_data_free (gpointer _data)
{
	FreedesktopNotificationBackendProviderEnableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (FreedesktopNotificationBackendProviderEnableData, _data_);
}

static void
freedesktop_notification_backend_provider_real_enable (FtProvider* base,
                                                       GCancellable* cancellable,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_)
{
	FreedesktopNotificationBackendProvider * self;
	FreedesktopNotificationBackendProviderEnableData* _data_;
	FreedesktopNotificationBackendProvider* _tmp0_;
	GCancellable* _tmp1_;
	self = (FreedesktopNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (FreedesktopNotificationBackendProviderEnableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, freedesktop_notification_backend_provider_real_enable_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	freedesktop_notification_backend_provider_real_enable_co (_data_);
}

static void
freedesktop_notification_backend_provider_enable_finish (FtProvider* base,
                                                         GAsyncResult* _res_,
                                                         GError** error)
{
	FreedesktopNotificationBackendProviderEnableData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

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

static void
freedesktop_notification_backend_provider_enable_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_)
{
	FreedesktopNotificationBackendProviderEnableData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	freedesktop_notification_backend_provider_real_enable_co (_data_);
}

static gboolean
freedesktop_notification_backend_provider_real_enable_co (FreedesktopNotificationBackendProviderEnableData* _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:
	_data_->_tmp0_ = g_str_hash;
	_data_->_tmp1_ = g_str_equal;
	_data_->_tmp2_ = g_hash_table_new_full (_data_->_tmp0_, _data_->_tmp1_, NULL, _g_free0_);
	_data_->capabilities = _data_->_tmp2_;
	_data_->capabilities_strv_length1 = 0;
	_data_->_capabilities_strv_size_ = 0;
	_data_->_state_ = 1;
	g_async_initable_new_async (FREEDESKTOP_TYPE_NOTIFICATIONS_PROXY, 0, NULL, freedesktop_notification_backend_provider_enable_ready, _data_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, "g-name", "org.freedesktop.Notifications", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/freedesktop/Notifications", "g-interface-name", "org.freedesktop.Notifications", NULL);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = (FreedesktopNotifications*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, _data_->_res_, &_data_->_inner_error0_);
	_data_->proxy = (FreedesktopNotifications*) _data_->_tmp3_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_data_->capabilities_strv = (_vala_array_free (_data_->capabilities_strv, _data_->capabilities_strv_length1, (GDestroyNotify) g_free), NULL);
		_g_hash_table_unref0 (_data_->capabilities);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = _data_->proxy;
	_data_->_tmp5_ = NULL;
	_data_->_tmp6_ = NULL;
	_data_->_tmp7_ = NULL;
	_data_->_tmp8_ = NULL;
	_data_->_state_ = 2;
	freedesktop_notifications_get_server_information (_data_->_tmp4_, freedesktop_notification_backend_provider_enable_ready, _data_);
	return FALSE;
	_state_2:
	freedesktop_notifications_get_server_information_finish (_data_->_tmp4_, _data_->_res_, &_data_->_tmp5_, &_data_->_tmp6_, &_data_->_tmp7_, &_data_->_tmp8_, &_data_->_inner_error0_);
	_g_free0 (_data_->self->priv->_name);
	_data_->self->priv->_name = _data_->_tmp5_;
	_g_free0 (_data_->self->priv->_vendor);
	_data_->self->priv->_vendor = _data_->_tmp6_;
	_g_free0 (_data_->self->priv->_version);
	_data_->self->priv->_version = _data_->_tmp7_;
	_g_free0 (_data_->self->priv->_spec_version);
	_data_->self->priv->_spec_version = _data_->_tmp8_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->proxy);
		_data_->capabilities_strv = (_vala_array_free (_data_->capabilities_strv, _data_->capabilities_strv_length1, (GDestroyNotify) g_free), NULL);
		_g_hash_table_unref0 (_data_->capabilities);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp9_ = _data_->proxy;
	_data_->_tmp10_ = NULL;
	_data_->_tmp11_ = 0;
	_data_->_state_ = 3;
	freedesktop_notifications_get_capabilities (_data_->_tmp9_, freedesktop_notification_backend_provider_enable_ready, _data_);
	return FALSE;
	_state_3:
	freedesktop_notifications_get_capabilities_finish (_data_->_tmp9_, _data_->_res_, &_data_->_tmp10_, &_data_->_tmp11_, &_data_->_inner_error0_);
	_data_->capabilities_strv = (_vala_array_free (_data_->capabilities_strv, _data_->capabilities_strv_length1, (GDestroyNotify) g_free), NULL);
	_data_->capabilities_strv = _data_->_tmp10_;
	_data_->capabilities_strv_length1 = _data_->_tmp11_;
	_data_->_capabilities_strv_size_ = _data_->capabilities_strv_length1;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->proxy);
		_data_->capabilities_strv = (_vala_array_free (_data_->capabilities_strv, _data_->capabilities_strv_length1, (GDestroyNotify) g_free), NULL);
		_g_hash_table_unref0 (_data_->capabilities);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp12_ = _data_->capabilities_strv;
	_data_->_tmp12__length1 = _data_->capabilities_strv_length1;
	{
		_data_->capability_collection_length1 = 0;
		_data_->_capability_collection_size_ = 0;
		_data_->capability_collection = _data_->_tmp12_;
		_data_->capability_collection_length1 = _data_->_tmp12__length1;
		for (_data_->capability_it = 0; _data_->capability_it < _data_->capability_collection_length1; _data_->capability_it = _data_->capability_it + 1) {
			_data_->_tmp13_ = g_strdup (_data_->capability_collection[_data_->capability_it]);
			_data_->capability = _data_->_tmp13_;
			{
				_data_->_tmp14_ = _data_->capabilities;
				_data_->_tmp15_ = _data_->capability;
				_data_->_tmp16_ = g_strdup (_data_->_tmp15_);
				g_hash_table_add (_data_->_tmp14_, _data_->_tmp16_);
				_g_free0 (_data_->capability);
			}
		}
	}
	_data_->_tmp17_ = _data_->capabilities;
	_data_->self->priv->_has_actions = g_hash_table_contains (_data_->_tmp17_, "actions");
	_g_object_unref0 (_data_->proxy);
	_data_->capabilities_strv = (_vala_array_free (_data_->capabilities_strv, _data_->capabilities_strv_length1, (GDestroyNotify) g_free), NULL);
	_g_hash_table_unref0 (_data_->capabilities);
	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
freedesktop_notification_backend_provider_real_disable_data_free (gpointer _data)
{
	FreedesktopNotificationBackendProviderDisableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (FreedesktopNotificationBackendProviderDisableData, _data_);
}

static void
freedesktop_notification_backend_provider_real_disable (FtProvider* base,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_)
{
	FreedesktopNotificationBackendProvider * self;
	FreedesktopNotificationBackendProviderDisableData* _data_;
	FreedesktopNotificationBackendProvider* _tmp0_;
	self = (FreedesktopNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (FreedesktopNotificationBackendProviderDisableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, freedesktop_notification_backend_provider_real_disable_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	freedesktop_notification_backend_provider_real_disable_co (_data_);
}

static void
freedesktop_notification_backend_provider_disable_finish (FtProvider* base,
                                                          GAsyncResult* _res_,
                                                          GError** error)
{
	FreedesktopNotificationBackendProviderDisableData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gboolean
freedesktop_notification_backend_provider_real_disable_co (FreedesktopNotificationBackendProviderDisableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_g_free0 (_data_->self->priv->_name);
	_data_->self->priv->_name = NULL;
	_g_free0 (_data_->self->priv->_vendor);
	_data_->self->priv->_vendor = NULL;
	_g_free0 (_data_->self->priv->_version);
	_data_->self->priv->_version = NULL;
	_g_free0 (_data_->self->priv->_spec_version);
	_data_->self->priv->_spec_version = NULL;
	_data_->self->priv->_has_actions = 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 void
freedesktop_notification_backend_provider_real_withdraw_notification (FtNotificationBackendProvider* base,
                                                                      const gchar* id)
{
	FreedesktopNotificationBackendProvider * self;
	GApplication* _tmp0_ = NULL;
	GApplication* _tmp1_;
	self = (FreedesktopNotificationBackendProvider*) base;
	g_return_if_fail (id != NULL);
	_tmp1_ = self->priv->application;
	_tmp0_ = _tmp1_;
	if (_tmp0_ != NULL) {
		g_application_withdraw_notification (_tmp0_, id);
	}
}

static void
freedesktop_notification_backend_provider_real_send_notification (FtNotificationBackendProvider* base,
                                                                  const gchar* id,
                                                                  GNotification* notification)
{
	FreedesktopNotificationBackendProvider * self;
	GApplication* _tmp0_ = NULL;
	GApplication* _tmp1_;
	self = (FreedesktopNotificationBackendProvider*) base;
	g_return_if_fail (id != NULL);
	g_return_if_fail (notification != NULL);
	_tmp1_ = self->priv->application;
	_tmp0_ = _tmp1_;
	if (_tmp0_ != NULL) {
		g_application_send_notification (_tmp0_, id, notification);
	}
}

static void
freedesktop_notification_backend_provider_real_dispose (GObject* base)
{
	FreedesktopNotificationBackendProvider * self;
	self = (FreedesktopNotificationBackendProvider*) base;
	_g_object_unref0 (self->priv->application);
	self->priv->application = NULL;
	G_OBJECT_CLASS (freedesktop_notification_backend_provider_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, FT_TYPE_PROVIDER, FtProvider));
}

FreedesktopNotificationBackendProvider*
freedesktop_notification_backend_provider_construct (GType object_type)
{
	FreedesktopNotificationBackendProvider * self = NULL;
	self = (FreedesktopNotificationBackendProvider*) ft_provider_construct (object_type);
	return self;
}

FreedesktopNotificationBackendProvider*
freedesktop_notification_backend_provider_new (void)
{
	return freedesktop_notification_backend_provider_construct (FREEDESKTOP_TYPE_NOTIFICATION_BACKEND_PROVIDER);
}

static const gchar*
freedesktop_notification_backend_provider_real_get_name (FtNotificationBackendProvider* base)
{
	const gchar* result;
	FreedesktopNotificationBackendProvider* self;
	const gchar* _tmp0_;
	self = (FreedesktopNotificationBackendProvider*) base;
	_tmp0_ = self->priv->_name;
	result = _tmp0_;
	return result;
}

static const gchar*
freedesktop_notification_backend_provider_real_get_vendor (FtNotificationBackendProvider* base)
{
	const gchar* result;
	FreedesktopNotificationBackendProvider* self;
	const gchar* _tmp0_;
	self = (FreedesktopNotificationBackendProvider*) base;
	_tmp0_ = self->priv->_vendor;
	result = _tmp0_;
	return result;
}

static const gchar*
freedesktop_notification_backend_provider_real_get_version (FtNotificationBackendProvider* base)
{
	const gchar* result;
	FreedesktopNotificationBackendProvider* self;
	const gchar* _tmp0_;
	self = (FreedesktopNotificationBackendProvider*) base;
	_tmp0_ = self->priv->_version;
	result = _tmp0_;
	return result;
}

const gchar*
freedesktop_notification_backend_provider_get_spec_version (FreedesktopNotificationBackendProvider* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_spec_version;
	result = _tmp0_;
	return result;
}

static gboolean
freedesktop_notification_backend_provider_real_get_has_actions (FtNotificationBackendProvider* base)
{
	gboolean result;
	FreedesktopNotificationBackendProvider* self;
	self = (FreedesktopNotificationBackendProvider*) base;
	result = self->priv->_has_actions;
	return result;
}

static GObject *
freedesktop_notification_backend_provider_constructor (GType type,
                                                       guint n_construct_properties,
                                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	FreedesktopNotificationBackendProvider * self;
	GApplication* _tmp0_;
	GApplication* _tmp1_;
	parent_class = G_OBJECT_CLASS (freedesktop_notification_backend_provider_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FREEDESKTOP_TYPE_NOTIFICATION_BACKEND_PROVIDER, FreedesktopNotificationBackendProvider);
	_tmp0_ = g_application_get_default ();
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->application);
	self->priv->application = _tmp1_;
	return obj;
}

static void
freedesktop_notification_backend_provider_class_init (FreedesktopNotificationBackendProviderClass * klass,
                                                      gpointer klass_data)
{
	freedesktop_notification_backend_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FreedesktopNotificationBackendProvider_private_offset);
	((FtProviderClass *) klass)->initialize = (void (*) (FtProvider*, GCancellable*, GAsyncReadyCallback, gpointer)) freedesktop_notification_backend_provider_real_initialize;
	((FtProviderClass *) klass)->initialize_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) freedesktop_notification_backend_provider_initialize_finish;
	((FtProviderClass *) klass)->uninitialize = (void (*) (FtProvider*, GAsyncReadyCallback, gpointer)) freedesktop_notification_backend_provider_real_uninitialize;
	((FtProviderClass *) klass)->uninitialize_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) freedesktop_notification_backend_provider_uninitialize_finish;
	((FtProviderClass *) klass)->enable = (void (*) (FtProvider*, GCancellable*, GAsyncReadyCallback, gpointer)) freedesktop_notification_backend_provider_real_enable;
	((FtProviderClass *) klass)->enable_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) freedesktop_notification_backend_provider_enable_finish;
	((FtProviderClass *) klass)->disable = (void (*) (FtProvider*, GAsyncReadyCallback, gpointer)) freedesktop_notification_backend_provider_real_disable;
	((FtProviderClass *) klass)->disable_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) freedesktop_notification_backend_provider_disable_finish;
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) freedesktop_notification_backend_provider_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_freedesktop_notification_backend_provider_get_property;
	G_OBJECT_CLASS (klass)->constructor = freedesktop_notification_backend_provider_constructor;
	G_OBJECT_CLASS (klass)->finalize = freedesktop_notification_backend_provider_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_NAME_PROPERTY, freedesktop_notification_backend_provider_properties[FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_NAME_PROPERTY] = g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_VENDOR_PROPERTY, freedesktop_notification_backend_provider_properties[FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_VENDOR_PROPERTY] = g_param_spec_string ("vendor", "vendor", "vendor", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_VERSION_PROPERTY, freedesktop_notification_backend_provider_properties[FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_VERSION_PROPERTY] = g_param_spec_string ("version", "version", "version", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_SPEC_VERSION_PROPERTY, freedesktop_notification_backend_provider_properties[FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_SPEC_VERSION_PROPERTY] = g_param_spec_string ("spec-version", "spec-version", "spec-version", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_HAS_ACTIONS_PROPERTY, freedesktop_notification_backend_provider_properties[FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_HAS_ACTIONS_PROPERTY] = g_param_spec_boolean ("has-actions", "has-actions", "has-actions", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
freedesktop_notification_backend_provider_ft_notification_backend_provider_interface_init (FtNotificationBackendProviderIface * iface,
                                                                                           gpointer iface_data)
{
	freedesktop_notification_backend_provider_ft_notification_backend_provider_parent_iface = g_type_interface_peek_parent (iface);
	iface->withdraw_notification = (void (*) (FtNotificationBackendProvider*, const gchar*)) freedesktop_notification_backend_provider_real_withdraw_notification;
	iface->send_notification = (void (*) (FtNotificationBackendProvider*, const gchar*, GNotification*)) freedesktop_notification_backend_provider_real_send_notification;
	iface->get_name = freedesktop_notification_backend_provider_real_get_name;
	iface->get_vendor = freedesktop_notification_backend_provider_real_get_vendor;
	iface->get_version = freedesktop_notification_backend_provider_real_get_version;
	iface->get_has_actions = freedesktop_notification_backend_provider_real_get_has_actions;
}

static void
freedesktop_notification_backend_provider_instance_init (FreedesktopNotificationBackendProvider * self,
                                                         gpointer klass)
{
	self->priv = freedesktop_notification_backend_provider_get_instance_private (self);
	self->priv->watcher_id = (guint) 0;
	self->priv->_name = NULL;
	self->priv->_vendor = NULL;
	self->priv->_version = NULL;
	self->priv->_spec_version = NULL;
	self->priv->_has_actions = FALSE;
	self->priv->application = NULL;
}

static void
freedesktop_notification_backend_provider_finalize (GObject * obj)
{
	FreedesktopNotificationBackendProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FREEDESKTOP_TYPE_NOTIFICATION_BACKEND_PROVIDER, FreedesktopNotificationBackendProvider);
	_g_free0 (self->priv->_name);
	_g_free0 (self->priv->_vendor);
	_g_free0 (self->priv->_version);
	_g_free0 (self->priv->_spec_version);
	_g_object_unref0 (self->priv->application);
	G_OBJECT_CLASS (freedesktop_notification_backend_provider_parent_class)->finalize (obj);
}

GType
freedesktop_notification_backend_provider_get_type (void)
{
	return freedesktop_notification_backend_provider_type_id;
}

GType
freedesktop_notification_backend_provider_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (FreedesktopNotificationBackendProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) freedesktop_notification_backend_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FreedesktopNotificationBackendProvider), 0, (GInstanceInitFunc) freedesktop_notification_backend_provider_instance_init, NULL };
	static const GInterfaceInfo ft_notification_backend_provider_info = { (GInterfaceInitFunc) freedesktop_notification_backend_provider_ft_notification_backend_provider_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	freedesktop_notification_backend_provider_type_id = g_type_module_register_type (module, FT_TYPE_PROVIDER, "FreedesktopNotificationBackendProvider", &g_define_type_info, 0);
	g_type_module_add_interface (module, freedesktop_notification_backend_provider_type_id, FT_TYPE_NOTIFICATION_BACKEND_PROVIDER, &ft_notification_backend_provider_info);
	FreedesktopNotificationBackendProvider_private_offset = sizeof (FreedesktopNotificationBackendProviderPrivate);
	return freedesktop_notification_backend_provider_type_id;
}

static void
_vala_freedesktop_notification_backend_provider_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec)
{
	FreedesktopNotificationBackendProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FREEDESKTOP_TYPE_NOTIFICATION_BACKEND_PROVIDER, FreedesktopNotificationBackendProvider);
	switch (property_id) {
		case FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_NAME_PROPERTY:
		g_value_set_string (value, ft_notification_backend_provider_get_name ((FtNotificationBackendProvider*) self));
		break;
		case FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_VENDOR_PROPERTY:
		g_value_set_string (value, ft_notification_backend_provider_get_vendor ((FtNotificationBackendProvider*) self));
		break;
		case FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_VERSION_PROPERTY:
		g_value_set_string (value, ft_notification_backend_provider_get_version ((FtNotificationBackendProvider*) self));
		break;
		case FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_SPEC_VERSION_PROPERTY:
		g_value_set_string (value, freedesktop_notification_backend_provider_get_spec_version (self));
		break;
		case FREEDESKTOP_NOTIFICATION_BACKEND_PROVIDER_HAS_ACTIONS_PROPERTY:
		g_value_set_boolean (value, ft_notification_backend_provider_get_has_actions ((FtNotificationBackendProvider*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

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

