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

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

#include <glib.h>
#include "ft_core.h"
#include <stdlib.h>
#include <string.h>
#include "ft_plugin_portal.h"
#include <gio/gio.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  {
	PORTAL_NOTIFICATION_BACKEND_PROVIDER_0_PROPERTY,
	PORTAL_NOTIFICATION_BACKEND_PROVIDER_PRIORITY_PROPERTY,
	PORTAL_NOTIFICATION_BACKEND_PROVIDER_NUM_PROPERTIES
};
static GParamSpec* portal_notification_backend_provider_properties[PORTAL_NOTIFICATION_BACKEND_PROVIDER_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)))
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _PortalNotificationBackendProviderInitializeData PortalNotificationBackendProviderInitializeData;
typedef struct _PortalNotificationBackendProviderUninitializeData PortalNotificationBackendProviderUninitializeData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _PortalNotificationBackendProviderEnableData PortalNotificationBackendProviderEnableData;
typedef struct _PortalNotificationBackendProviderDisableData PortalNotificationBackendProviderDisableData;
#define _ft_notification_unref0(var) ((var == NULL) ? NULL : (var = (ft_notification_unref (var), NULL)))
typedef struct _Block7Data Block7Data;
#define _g_variant_builder_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_builder_unref (var), NULL)))
#define _g_variant_dict_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_dict_unref (var), NULL)))
typedef struct _PortalNotificationBackendProviderSendNotificationData PortalNotificationBackendProviderSendNotificationData;
typedef struct _PortalNotificationBackendProviderWithdrawNotificationData PortalNotificationBackendProviderWithdrawNotificationData;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _PortalNotificationBackendProviderPrivate {
	guint watcher_id;
	PortalNotification* proxy;
	GHashTable* notifications;
	GCancellable* cancellable;
	GApplication* application;
};

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

struct _PortalNotificationBackendProviderUninitializeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PortalNotificationBackendProvider* self;
};

struct _PortalNotificationBackendProviderEnableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PortalNotificationBackendProvider* self;
	GCancellable* cancellable;
	PortalNotification* _tmp0_;
	GCancellable* _tmp1_;
	GCancellable* _tmp2_;
	GCancellable* _tmp3_;
	GCancellable* _tmp4_;
	GHashFunc _tmp5_;
	GEqualFunc _tmp6_;
	GHashTable* _tmp7_;
	PortalNotification* _tmp8_;
	GCancellable* _tmp9_;
	PortalNotification* _tmp10_;
	PortalNotification* _tmp11_;
	PortalNotification* _tmp12_;
	GError* _error_;
	GError* _tmp13_;
	const gchar* _tmp14_;
	GError* _tmp15_;
	GError* _tmp16_;
	GError* _inner_error0_;
};

struct _PortalNotificationBackendProviderDisableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PortalNotificationBackendProvider* self;
	GCancellable* _tmp0_;
	GCancellable* _tmp1_;
	PortalNotification* _tmp2_;
	PortalNotification* _tmp3_;
	guint _tmp4_;
};

struct _Block7Data {
	int _ref_count_;
	PortalNotificationBackendProvider* self;
	GVariant** buttons;
	gint buttons_length1;
	gint _buttons_size_;
	gpointer _async_data_;
};

struct _PortalNotificationBackendProviderSendNotificationData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PortalNotificationBackendProvider* self;
	gchar* id;
	FtNotification* notification;
	PortalNotification* _tmp0_;
	Block7Data* _data7_;
	gboolean _tmp1_;
	GCancellable* _tmp2_;
	GCancellable* _tmp3_;
	FtNotification* existing_notification;
	GHashTable* _tmp4_;
	gconstpointer _tmp5_;
	gboolean _tmp6_;
	FtNotification* _tmp7_;
	FtNotification* _tmp8_;
	GVariantDict* notification_properties;
	GVariantDict* _tmp9_;
	GVariantDict* _tmp10_;
	const gchar* _tmp11_;
	GVariant* _tmp12_;
	GVariant* _tmp13_;
	GVariantDict* _tmp14_;
	const gchar* _tmp15_;
	GVariant* _tmp16_;
	GVariant* _tmp17_;
	GVariantDict* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	GVariant* _tmp21_;
	GVariant* _tmp22_;
	GIcon* _tmp23_;
	GVariantDict* _tmp24_;
	gchar* _tmp25_;
	gchar** _tmp26_;
	gchar** _tmp27_;
	gint _tmp27__length1;
	GVariant* _tmp28_;
	GVariant* _tmp29_;
	GVariantDict* _tmp30_;
	GVariant* _tmp31_;
	GVariant* _tmp32_;
	const gchar* _tmp33_;
	GVariantDict* _tmp34_;
	const gchar* _tmp35_;
	GVariant* _tmp36_;
	GVariant* _tmp37_;
	GVariant* _tmp38_;
	GVariantDict* _tmp39_;
	GVariant* _tmp40_;
	GVariant** _tmp41_;
	GVariant** _tmp42_;
	gint _tmp42__length1;
	GVariantDict* _tmp43_;
	const GVariantType* _tmp44_;
	GVariant** _tmp45_;
	gint _tmp45__length1;
	GVariant* _tmp46_;
	GVariant* _tmp47_;
	PortalNotification* _tmp48_;
	GVariantDict* _tmp49_;
	GVariant* _tmp50_;
	GVariant* _tmp51_;
	GCancellable* _tmp52_;
	GError* _error_;
	GError* _tmp53_;
	const gchar* _tmp54_;
	GError* _tmp55_;
	GError* _tmp56_;
	const gchar* _tmp57_;
	GError* _inner_error0_;
};

struct _PortalNotificationBackendProviderWithdrawNotificationData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PortalNotificationBackendProvider* self;
	gchar* id;
	PortalNotification* _tmp0_;
	gboolean _tmp1_;
	GCancellable* _tmp2_;
	GCancellable* _tmp3_;
	GHashTable* _tmp4_;
	PortalNotification* _tmp5_;
	GError* _error_;
	GError* _tmp6_;
	const gchar* _tmp7_;
	GError* _tmp8_;
	GError* _tmp9_;
	const gchar* _tmp10_;
	GError* _inner_error0_;
};

static gint PortalNotificationBackendProvider_private_offset;
static gpointer portal_notification_backend_provider_parent_class = NULL;
static FtNotificationBackendProviderIface * portal_notification_backend_provider_ft_notification_backend_provider_parent_iface = NULL;
static GType portal_notification_backend_provider_type_id = 0;

VALA_EXTERN gboolean portal_have_notifications_portal (void);
static gboolean portal_notification_backend_provider_activate_action (PortalNotificationBackendProvider* self,
                                                               const gchar* action,
                                                               GVariant* parameter);
static void portal_notification_backend_provider_on_name_appeared (PortalNotificationBackendProvider* self,
                                                            GDBusConnection* connection,
                                                            const gchar* name,
                                                            const gchar* name_owner);
VALA_EXTERN gboolean portal_has_dbus_interface (GDBusConnection* connection,
                                    const gchar* bus_name,
                                    const gchar* object_path,
                                    const gchar* interface_name,
                                    gint timeout);
static void portal_notification_backend_provider_on_name_vanished (PortalNotificationBackendProvider* self,
                                                            GDBusConnection* connection,
                                                            const gchar* name);
static void portal_notification_backend_provider_on_action_invoked (PortalNotificationBackendProvider* self,
                                                             const gchar* id,
                                                             const gchar* action,
                                                             GVariant** parameter,
                                                             gint parameter_length1);
static void portal_notification_backend_provider_real_initialize_data_free (gpointer _data);
static void portal_notification_backend_provider_real_initialize (FtProvider* base,
                                                           GCancellable* cancellable,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_);
static gboolean portal_notification_backend_provider_real_initialize_co (PortalNotificationBackendProviderInitializeData* _data_);
static void _portal_notification_backend_provider_on_name_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                         const gchar* name,
                                                                                         const gchar* name_owner,
                                                                                         gpointer self);
static void _portal_notification_backend_provider_on_name_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                         const gchar* name,
                                                                                         gpointer self);
static void portal_notification_backend_provider_real_uninitialize_data_free (gpointer _data);
static void portal_notification_backend_provider_real_uninitialize (FtProvider* base,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);
static gboolean portal_notification_backend_provider_real_uninitialize_co (PortalNotificationBackendProviderUninitializeData* _data_);
static void portal_notification_backend_provider_real_enable_data_free (gpointer _data);
static void portal_notification_backend_provider_real_enable (FtProvider* base,
                                                       GCancellable* cancellable,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_);
static gboolean portal_notification_backend_provider_real_enable_co (PortalNotificationBackendProviderEnableData* _data_);
static void _g_free0_ (gpointer var);
static void _ft_notification_unref0_ (gpointer var);
static void portal_notification_backend_provider_enable_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_);
static void _portal_notification_backend_provider_on_action_invoked_portal_notification_action_invoked (PortalNotification* _sender,
                                                                                                 const gchar* id,
                                                                                                 const gchar* action,
                                                                                                 GVariant** parameter,
                                                                                                 gint parameter_length1,
                                                                                                 gpointer self);
static void portal_notification_backend_provider_real_disable_data_free (gpointer _data);
static void portal_notification_backend_provider_real_disable (FtProvider* base,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_);
static gboolean portal_notification_backend_provider_real_disable_co (PortalNotificationBackendProviderDisableData* _data_);
static void portal_notification_backend_provider_real_send_notification_data_free (gpointer _data);
static void portal_notification_backend_provider_real_send_notification (FtNotificationBackendProvider* base,
                                                                  const gchar* id,
                                                                  FtNotification* notification,
                                                                  GAsyncReadyCallback _callback_,
                                                                  gpointer _user_data_);
static gboolean portal_notification_backend_provider_real_send_notification_co (PortalNotificationBackendProviderSendNotificationData* _data_);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static void __lambda13_ (Block7Data* _data7_,
                  const gchar* label,
                  const gchar* action,
                  GVariant* target_value);
static void _vala_array_add14 (GVariant** * array,
                        gint* length,
                        gint* size,
                        GVariant* value);
static void ___lambda13__ft_notification_foreach_button_func (const gchar* label,
                                                       const gchar* action,
                                                       GVariant* target_value,
                                                       gpointer self);
static void portal_notification_backend_provider_send_notification_ready (GObject* source_object,
                                                                   GAsyncResult* _res_,
                                                                   gpointer _user_data_);
static void portal_notification_backend_provider_real_withdraw_notification_data_free (gpointer _data);
static void portal_notification_backend_provider_real_withdraw_notification (FtNotificationBackendProvider* base,
                                                                      const gchar* id,
                                                                      GAsyncReadyCallback _callback_,
                                                                      gpointer _user_data_);
static gboolean portal_notification_backend_provider_real_withdraw_notification_co (PortalNotificationBackendProviderWithdrawNotificationData* _data_);
static void portal_notification_backend_provider_withdraw_notification_ready (GObject* source_object,
                                                                       GAsyncResult* _res_,
                                                                       gpointer _user_data_);
static void portal_notification_backend_provider_real_dispose (GObject* base);
static GObject * portal_notification_backend_provider_constructor (GType type,
                                                            guint n_construct_properties,
                                                            GObjectConstructParam * construct_properties);
static void portal_notification_backend_provider_finalize (GObject * obj);
static void _vala_portal_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 gssize _vala_array_length (gpointer array);

/**
     * Return whether notifications portal is "on par" with Freedesktop one.
     */
gboolean
portal_have_notifications_portal (void)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	GQuark _tmp3_ = 0U;
	static GQuark _tmp2_label0 = 0;
	gboolean result;
	_tmp0_ = ft_get_desktop_name ();
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	g_free (_tmp1_);
	if (_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string ("gnome")))) {
		switch (0) {
			default:
			{
				result = !ft_is_devel ();
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				result = FALSE;
				return result;
			}
		}
	}
}

static inline gpointer
portal_notification_backend_provider_get_instance_private (PortalNotificationBackendProvider* self)
{
	return G_STRUCT_MEMBER_P (self, PortalNotificationBackendProvider_private_offset);
}

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

static gpointer
_g_variant_type_copy0 (gpointer self)
{
	return self ? g_variant_type_copy (self) : NULL;
}

static gboolean
portal_notification_backend_provider_activate_action (PortalNotificationBackendProvider* self,
                                                      const gchar* action,
                                                      GVariant* parameter)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (parameter != NULL) {
		_tmp0_ = g_variant_is_floating (parameter);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		result = FALSE;
		return result;
	}
	if (action != NULL) {
		_tmp1_ = g_str_has_prefix (action, "app.");
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		gchar* action_name = NULL;
		gchar** _tmp2_;
		gchar** _tmp3_;
		gchar** _tmp4_;
		gint _tmp4__length1;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		GVariantType* parameter_type = NULL;
		GActionGroup* action_group = NULL;
		GApplication* _tmp8_;
		GActionGroup* _tmp9_;
		gboolean _tmp10_ = FALSE;
		GActionGroup* _tmp11_;
		const gchar* _tmp12_;
		const GVariantType* _tmp13_ = NULL;
		gboolean _tmp14_;
		GVariantType* _tmp15_;
		_tmp3_ = _tmp2_ = g_strsplit (action, ".", 2);
		_tmp4_ = _tmp3_;
		_tmp4__length1 = _vala_array_length (_tmp2_);
		_tmp5_ = _tmp4_[1];
		_tmp6_ = g_strdup (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp4_ = (_vala_array_free (_tmp4_, _tmp4__length1, (GDestroyNotify) g_free), NULL);
		action_name = _tmp7_;
		parameter_type = NULL;
		_tmp8_ = self->priv->application;
		_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, g_action_group_get_type (), GActionGroup));
		action_group = _tmp9_;
		_tmp11_ = action_group;
		_tmp12_ = action_name;
		_tmp14_ = g_action_group_query_action (_tmp11_, _tmp12_, NULL, &_tmp13_, NULL, NULL, NULL);
		_g_variant_type_free0 (parameter_type);
		_tmp15_ = _g_variant_type_copy0 (_tmp13_);
		parameter_type = _tmp15_;
		if (_tmp14_) {
			gboolean _tmp16_ = FALSE;
			gboolean _tmp17_ = FALSE;
			const GVariantType* _tmp18_;
			_tmp18_ = parameter_type;
			if (_tmp18_ == NULL) {
				_tmp17_ = parameter == NULL;
			} else {
				_tmp17_ = FALSE;
			}
			if (_tmp17_) {
				_tmp16_ = TRUE;
			} else {
				gboolean _tmp19_ = FALSE;
				gboolean _tmp20_ = FALSE;
				const GVariantType* _tmp21_;
				_tmp21_ = parameter_type;
				if (_tmp21_ != NULL) {
					_tmp20_ = parameter != NULL;
				} else {
					_tmp20_ = FALSE;
				}
				if (_tmp20_) {
					const GVariantType* _tmp22_;
					_tmp22_ = parameter_type;
					_tmp19_ = g_variant_is_of_type (parameter, _tmp22_);
				} else {
					_tmp19_ = FALSE;
				}
				_tmp16_ = _tmp19_;
			}
			_tmp10_ = _tmp16_;
		} else {
			_tmp10_ = FALSE;
		}
		if (_tmp10_) {
			GActionGroup* _tmp23_;
			const gchar* _tmp24_;
			_tmp23_ = action_group;
			_tmp24_ = action_name;
			g_action_group_activate_action (_tmp23_, _tmp24_, parameter);
			result = TRUE;
			_g_object_unref0 (action_group);
			_g_variant_type_free0 (parameter_type);
			_g_free0 (action_name);
			return result;
		}
		_g_object_unref0 (action_group);
		_g_variant_type_free0 (parameter_type);
		_g_free0 (action_name);
	} else {
		if (action == NULL) {
			GApplication* _tmp25_;
			_tmp25_ = self->priv->application;
			g_application_activate (_tmp25_);
			result = TRUE;
			return result;
		}
	}
	result = FALSE;
	return result;
}

static void
portal_notification_backend_provider_on_name_appeared (PortalNotificationBackendProvider* 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);
	if (portal_has_dbus_interface (connection, name, "/org/freedesktop/portal/desktop", "org.freedesktop.portal.Notification", -1)) {
		ft_provider_set_available ((FtProvider*) self, TRUE);
	}
}

static void
portal_notification_backend_provider_on_name_vanished (PortalNotificationBackendProvider* 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 gpointer
_g_variant_ref0 (gpointer self)
{
	return self ? g_variant_ref (self) : NULL;
}

static void
portal_notification_backend_provider_on_action_invoked (PortalNotificationBackendProvider* self,
                                                        const gchar* id,
                                                        const gchar* action,
                                                        GVariant** parameter,
                                                        gint parameter_length1)
{
	GVariant* _tmp0_ = NULL;
	GVariant* target_value = NULL;
	GVariant* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (id != NULL);
	g_return_if_fail (action != NULL);
	if (parameter_length1 >= 1) {
		GVariant* _tmp1_;
		_tmp1_ = parameter[0];
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = NULL;
	}
	_tmp2_ = _g_variant_ref0 (_tmp0_);
	target_value = _tmp2_;
	portal_notification_backend_provider_activate_action (self, action, target_value);
	_g_variant_unref0 (target_value);
}

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

static void
portal_notification_backend_provider_real_initialize (FtProvider* base,
                                                      GCancellable* cancellable,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_)
{
	PortalNotificationBackendProvider * self;
	PortalNotificationBackendProviderInitializeData* _data_;
	PortalNotificationBackendProvider* _tmp0_;
	GCancellable* _tmp1_;
	self = (PortalNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (PortalNotificationBackendProviderInitializeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, portal_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_;
	portal_notification_backend_provider_real_initialize_co (_data_);
}

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

static void
_portal_notification_backend_provider_on_name_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                    const gchar* name,
                                                                                    const gchar* name_owner,
                                                                                    gpointer self)
{
	portal_notification_backend_provider_on_name_appeared ((PortalNotificationBackendProvider*) self, connection, name, name_owner);
}

static void
_portal_notification_backend_provider_on_name_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                    const gchar* name,
                                                                                    gpointer self)
{
	portal_notification_backend_provider_on_name_vanished ((PortalNotificationBackendProvider*) self, connection, name);
}

static gboolean
portal_notification_backend_provider_real_initialize_co (PortalNotificationBackendProviderInitializeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (!portal_have_notifications_portal ()) {
		ft_provider_set_available ((FtProvider*) _data_->self, 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;
	}
	_data_->self->priv->watcher_id = g_bus_watch_name_with_closures (G_BUS_TYPE_SESSION, "org.freedesktop.portal.Desktop", G_BUS_NAME_WATCHER_FLAGS_NONE, (GClosure*) ((_portal_notification_backend_provider_on_name_appeared_gbus_name_appeared_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _portal_notification_backend_provider_on_name_appeared_gbus_name_appeared_callback, g_object_ref (_data_->self), (GClosureNotify) g_object_unref)), (GClosure*) ((_portal_notification_backend_provider_on_name_vanished_gbus_name_vanished_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _portal_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
portal_notification_backend_provider_real_uninitialize_data_free (gpointer _data)
{
	PortalNotificationBackendProviderUninitializeData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (PortalNotificationBackendProviderUninitializeData, _data_);
}

static void
portal_notification_backend_provider_real_uninitialize (FtProvider* base,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_)
{
	PortalNotificationBackendProvider * self;
	PortalNotificationBackendProviderUninitializeData* _data_;
	PortalNotificationBackendProvider* _tmp0_;
	self = (PortalNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (PortalNotificationBackendProviderUninitializeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, portal_notification_backend_provider_real_uninitialize_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	portal_notification_backend_provider_real_uninitialize_co (_data_);
}

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

static gboolean
portal_notification_backend_provider_real_uninitialize_co (PortalNotificationBackendProviderUninitializeData* _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
portal_notification_backend_provider_real_enable_data_free (gpointer _data)
{
	PortalNotificationBackendProviderEnableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (PortalNotificationBackendProviderEnableData, _data_);
}

static void
portal_notification_backend_provider_real_enable (FtProvider* base,
                                                  GCancellable* cancellable,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_)
{
	PortalNotificationBackendProvider * self;
	PortalNotificationBackendProviderEnableData* _data_;
	PortalNotificationBackendProvider* _tmp0_;
	GCancellable* _tmp1_;
	self = (PortalNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (PortalNotificationBackendProviderEnableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, portal_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_;
	portal_notification_backend_provider_real_enable_co (_data_);
}

static void
portal_notification_backend_provider_enable_finish (FtProvider* base,
                                                    GAsyncResult* _res_,
                                                    GError** error)
{
	PortalNotificationBackendProviderEnableData* _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
_ft_notification_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (ft_notification_unref (var), NULL));
}

static void
portal_notification_backend_provider_enable_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_)
{
	PortalNotificationBackendProviderEnableData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	portal_notification_backend_provider_real_enable_co (_data_);
}

static void
_portal_notification_backend_provider_on_action_invoked_portal_notification_action_invoked (PortalNotification* _sender,
                                                                                            const gchar* id,
                                                                                            const gchar* action,
                                                                                            GVariant** parameter,
                                                                                            gint parameter_length1,
                                                                                            gpointer self)
{
	portal_notification_backend_provider_on_action_invoked ((PortalNotificationBackendProvider*) self, id, action, parameter, parameter_length1);
}

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

static gboolean
portal_notification_backend_provider_real_enable_co (PortalNotificationBackendProviderEnableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->proxy;
	if (_data_->_tmp0_ != 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;
	}
	if (_data_->cancellable != NULL) {
		_data_->_tmp2_ = _g_object_ref0 (_data_->cancellable);
		_g_object_unref0 (_data_->_tmp1_);
		_data_->_tmp1_ = _data_->_tmp2_;
	} else {
		_data_->_tmp3_ = g_cancellable_new ();
		_g_object_unref0 (_data_->_tmp1_);
		_data_->_tmp1_ = _data_->_tmp3_;
	}
	_data_->_tmp4_ = _data_->_tmp1_;
	_data_->_tmp1_ = NULL;
	_g_object_unref0 (_data_->self->priv->cancellable);
	_data_->self->priv->cancellable = _data_->_tmp4_;
	_data_->_tmp5_ = g_str_hash;
	_data_->_tmp6_ = g_str_equal;
	_data_->_tmp7_ = g_hash_table_new_full (_data_->_tmp5_, _data_->_tmp6_, _g_free0_, _ft_notification_unref0_);
	_g_hash_table_unref0 (_data_->self->priv->notifications);
	_data_->self->priv->notifications = _data_->_tmp7_;
	{
		_data_->_tmp9_ = _data_->self->priv->cancellable;
		_data_->_state_ = 1;
		g_async_initable_new_async (PORTAL_TYPE_NOTIFICATION_PROXY, 0, _data_->_tmp9_, portal_notification_backend_provider_enable_ready, _data_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, "g-name", "org.freedesktop.portal.Desktop", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/freedesktop/portal/desktop", "g-interface-name", "org.freedesktop.portal.Notification", NULL);
		return FALSE;
		_state_1:
		_data_->_tmp10_ = (PortalNotification*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp8_ = (PortalNotification*) _data_->_tmp10_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp11_ = _data_->_tmp8_;
		_data_->_tmp8_ = NULL;
		_g_object_unref0 (_data_->self->priv->proxy);
		_data_->self->priv->proxy = _data_->_tmp11_;
		_data_->_tmp12_ = _data_->self->priv->proxy;
		g_signal_connect_object (_data_->_tmp12_, "action-invoked", (GCallback) _portal_notification_backend_provider_on_action_invoked_portal_notification_action_invoked, _data_->self, 0);
		_g_object_unref0 (_data_->_tmp8_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp13_ = _data_->_error_;
		_data_->_tmp14_ = _data_->_tmp13_->message;
		g_warning ("notification-backend-provider.vala:147: Error while creating global sh" \
"ortcuts session: %s", _data_->_tmp14_);
		_data_->_tmp15_ = _data_->_error_;
		_data_->_tmp16_ = _g_error_copy0 (_data_->_tmp15_);
		_data_->_inner_error0_ = _data_->_tmp16_;
		_g_error_free0 (_data_->_error_);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->_tmp1_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->_tmp1_);
	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
portal_notification_backend_provider_real_disable_data_free (gpointer _data)
{
	PortalNotificationBackendProviderDisableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (PortalNotificationBackendProviderDisableData, _data_);
}

static void
portal_notification_backend_provider_real_disable (FtProvider* base,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	PortalNotificationBackendProvider * self;
	PortalNotificationBackendProviderDisableData* _data_;
	PortalNotificationBackendProvider* _tmp0_;
	self = (PortalNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (PortalNotificationBackendProviderDisableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, portal_notification_backend_provider_real_disable_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	portal_notification_backend_provider_real_disable_co (_data_);
}

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

static gboolean
portal_notification_backend_provider_real_disable_co (PortalNotificationBackendProviderDisableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = _data_->self->priv->cancellable;
	_data_->_tmp0_ = _data_->_tmp1_;
	if (_data_->_tmp0_ != NULL) {
		g_cancellable_cancel (_data_->_tmp0_);
	}
	_data_->_tmp2_ = _data_->self->priv->proxy;
	if (_data_->_tmp2_ != NULL) {
		_data_->_tmp3_ = _data_->self->priv->proxy;
		g_signal_parse_name ("action-invoked", PORTAL_TYPE_NOTIFICATION, &_data_->_tmp4_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_data_->_tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _data_->_tmp4_, 0, NULL, (GCallback) _portal_notification_backend_provider_on_action_invoked_portal_notification_action_invoked, _data_->self);
		_g_object_unref0 (_data_->self->priv->proxy);
		_data_->self->priv->proxy = NULL;
	}
	_g_hash_table_unref0 (_data_->self->priv->notifications);
	_data_->self->priv->notifications = NULL;
	_g_object_unref0 (_data_->self->priv->cancellable);
	_data_->self->priv->cancellable = 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
portal_notification_backend_provider_real_send_notification_data_free (gpointer _data)
{
	PortalNotificationBackendProviderSendNotificationData* _data_;
	_data_ = _data;
	_g_free0 (_data_->id);
	_ft_notification_unref0 (_data_->notification);
	_g_object_unref0 (_data_->self);
	g_slice_free (PortalNotificationBackendProviderSendNotificationData, _data_);
}

static gpointer
_ft_notification_ref0 (gpointer self)
{
	return self ? ft_notification_ref (self) : NULL;
}

static void
portal_notification_backend_provider_real_send_notification (FtNotificationBackendProvider* base,
                                                             const gchar* id,
                                                             FtNotification* notification,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_)
{
	PortalNotificationBackendProvider * self;
	PortalNotificationBackendProviderSendNotificationData* _data_;
	PortalNotificationBackendProvider* _tmp0_;
	gchar* _tmp1_;
	FtNotification* _tmp2_;
	g_return_if_fail (id != NULL);
	g_return_if_fail (notification != NULL);
	self = (PortalNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (PortalNotificationBackendProviderSendNotificationData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, portal_notification_backend_provider_real_send_notification_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (id);
	_g_free0 (_data_->id);
	_data_->id = _tmp1_;
	_tmp2_ = _ft_notification_ref0 (notification);
	_ft_notification_unref0 (_data_->notification);
	_data_->notification = _tmp2_;
	portal_notification_backend_provider_real_send_notification_co (_data_);
}

static void
portal_notification_backend_provider_send_notification_finish (FtNotificationBackendProvider* base,
                                                               GAsyncResult* _res_)
{
	PortalNotificationBackendProviderSendNotificationData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

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_)) {
		PortalNotificationBackendProvider* self;
		self = _data7_->self;
		_data7_->buttons = (_vala_array_free (_data7_->buttons, _data7_->buttons_length1, (GDestroyNotify) g_variant_unref), NULL);
		_g_object_unref0 (self);
		g_slice_free (Block7Data, _data7_);
	}
}

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

static void
__lambda13_ (Block7Data* _data7_,
             const gchar* label,
             const gchar* action,
             GVariant* target_value)
{
	PortalNotificationBackendProvider* self;
	GVariantBuilder* button = NULL;
	const GVariantType* _tmp0_;
	GVariantBuilder* _tmp1_;
	GVariantBuilder* _tmp2_;
	GVariant* _tmp3_;
	GVariant* _tmp4_;
	GVariantBuilder* _tmp5_;
	GVariant* _tmp6_;
	GVariant* _tmp7_;
	GVariantBuilder* _tmp9_;
	GVariant* _tmp10_;
	self = _data7_->self;
	g_return_if_fail (label != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = G_VARIANT_TYPE_VARDICT;
	_tmp1_ = g_variant_builder_new (_tmp0_);
	button = _tmp1_;
	_tmp2_ = button;
	_tmp3_ = g_variant_new_string (label);
	g_variant_ref_sink (_tmp3_);
	_tmp4_ = _tmp3_;
	g_variant_builder_add (_tmp2_, "{sv}", "label", _tmp4_, NULL);
	_g_variant_unref0 (_tmp4_);
	_tmp5_ = button;
	_tmp6_ = g_variant_new_string (action);
	g_variant_ref_sink (_tmp6_);
	_tmp7_ = _tmp6_;
	g_variant_builder_add (_tmp5_, "{sv}", "action", _tmp7_, NULL);
	_g_variant_unref0 (_tmp7_);
	if (target_value != NULL) {
		GVariantBuilder* _tmp8_;
		_tmp8_ = button;
		g_variant_builder_add (_tmp8_, "{sv}", "target", target_value, NULL);
	}
	_tmp9_ = button;
	_tmp10_ = g_variant_builder_end (_tmp9_);
	g_variant_ref_sink (_tmp10_);
	_vala_array_add14 (&_data7_->buttons, &_data7_->buttons_length1, &_data7_->_buttons_size_, _tmp10_);
	_g_variant_builder_unref0 (button);
}

static void
___lambda13__ft_notification_foreach_button_func (const gchar* label,
                                                  const gchar* action,
                                                  GVariant* target_value,
                                                  gpointer self)
{
	__lambda13_ (self, label, action, target_value);
}

static void
portal_notification_backend_provider_send_notification_ready (GObject* source_object,
                                                              GAsyncResult* _res_,
                                                              gpointer _user_data_)
{
	PortalNotificationBackendProviderSendNotificationData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	portal_notification_backend_provider_real_send_notification_co (_data_);
}

static gboolean
portal_notification_backend_provider_real_send_notification_co (PortalNotificationBackendProviderSendNotificationData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->proxy;
	_vala_return_val_if_fail (_data_->_tmp0_ != NULL, "this.proxy != null", FALSE);
	_data_->_data7_ = g_slice_new0 (Block7Data);
	_data_->_data7_->_ref_count_ = 1;
	_data_->_data7_->self = g_object_ref (_data_->self);
	_data_->_data7_->_async_data_ = _data_;
	_data_->_tmp2_ = _data_->self->priv->cancellable;
	if (_data_->_tmp2_ == NULL) {
		_data_->_tmp1_ = TRUE;
	} else {
		_data_->_tmp3_ = _data_->self->priv->cancellable;
		_data_->_tmp1_ = g_cancellable_is_cancelled (_data_->_tmp3_);
	}
	if (_data_->_tmp1_) {
		block7_data_unref (_data_->_data7_);
		_data_->_data7_ = NULL;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = _data_->self->priv->notifications;
	_data_->_tmp5_ = g_hash_table_lookup (_data_->_tmp4_, _data_->id);
	_data_->existing_notification = (FtNotification*) _data_->_tmp5_;
	_data_->_tmp7_ = _data_->existing_notification;
	if (_data_->_tmp7_ != NULL) {
		_data_->_tmp8_ = _data_->existing_notification;
		_data_->_tmp6_ = ft_notification_is_similar (_data_->_tmp8_, _data_->notification);
	} else {
		_data_->_tmp6_ = FALSE;
	}
	if (_data_->_tmp6_) {
		block7_data_unref (_data_->_data7_);
		_data_->_data7_ = NULL;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp9_ = g_variant_dict_new (NULL);
	_data_->notification_properties = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->notification_properties;
	_data_->_tmp11_ = _data_->notification->title;
	_data_->_tmp12_ = g_variant_new_string (_data_->_tmp11_);
	g_variant_ref_sink (_data_->_tmp12_);
	_data_->_tmp13_ = _data_->_tmp12_;
	g_variant_dict_insert_value (_data_->_tmp10_, "title", _data_->_tmp13_);
	_g_variant_unref0 (_data_->_tmp13_);
	_data_->_tmp14_ = _data_->notification_properties;
	_data_->_tmp15_ = _data_->notification->body;
	_data_->_tmp16_ = g_variant_new_string (_data_->_tmp15_);
	g_variant_ref_sink (_data_->_tmp16_);
	_data_->_tmp17_ = _data_->_tmp16_;
	g_variant_dict_insert_value (_data_->_tmp14_, "body", _data_->_tmp17_);
	_g_variant_unref0 (_data_->_tmp17_);
	_data_->_tmp18_ = _data_->notification_properties;
	_data_->_tmp19_ = ft_notification_priority_to_string (_data_->notification->priority);
	_data_->_tmp20_ = _data_->_tmp19_;
	_data_->_tmp21_ = g_variant_new_string (_data_->_tmp20_);
	g_variant_ref_sink (_data_->_tmp21_);
	_data_->_tmp22_ = _data_->_tmp21_;
	g_variant_dict_insert_value (_data_->_tmp18_, "priority", _data_->_tmp22_);
	_g_variant_unref0 (_data_->_tmp22_);
	_g_free0 (_data_->_tmp20_);
	_data_->_tmp23_ = _data_->notification->icon;
	if (_data_->_tmp23_ != NULL) {
	}
	if (_data_->notification->is_transient) {
		_data_->_tmp24_ = _data_->notification_properties;
		_data_->_tmp25_ = g_strdup ("transient");
		_data_->_tmp26_ = g_new0 (gchar*, 1 + 1);
		_data_->_tmp26_[0] = _data_->_tmp25_;
		_data_->_tmp27_ = _data_->_tmp26_;
		_data_->_tmp27__length1 = 1;
		_data_->_tmp28_ = g_variant_new_strv (_data_->_tmp27_, 1);
		g_variant_ref_sink (_data_->_tmp28_);
		_data_->_tmp29_ = _data_->_tmp28_;
		g_variant_dict_insert_value (_data_->_tmp24_, "display-hint", _data_->_tmp29_);
		_g_variant_unref0 (_data_->_tmp29_);
		_data_->_tmp27_ = (_vala_array_free (_data_->_tmp27_, _data_->_tmp27__length1, (GDestroyNotify) g_free), NULL);
	}
	if (_data_->notification->suppress_sound) {
		_data_->_tmp30_ = _data_->notification_properties;
		_data_->_tmp31_ = g_variant_new_string ("silent");
		g_variant_ref_sink (_data_->_tmp31_);
		_data_->_tmp32_ = _data_->_tmp31_;
		g_variant_dict_insert_value (_data_->_tmp30_, "sound", _data_->_tmp32_);
		_g_variant_unref0 (_data_->_tmp32_);
	}
	_data_->_tmp33_ = _data_->notification->default_action;
	if (_data_->_tmp33_ != NULL) {
		_data_->_tmp34_ = _data_->notification_properties;
		_data_->_tmp35_ = _data_->notification->default_action;
		_data_->_tmp36_ = g_variant_new_string (_data_->_tmp35_);
		g_variant_ref_sink (_data_->_tmp36_);
		_data_->_tmp37_ = _data_->_tmp36_;
		g_variant_dict_insert_value (_data_->_tmp34_, "default-action", _data_->_tmp37_);
		_g_variant_unref0 (_data_->_tmp37_);
	}
	_data_->_tmp38_ = _data_->notification->default_target_value;
	if (_data_->_tmp38_ != NULL) {
		_data_->_tmp39_ = _data_->notification_properties;
		_data_->_tmp40_ = _data_->notification->default_target_value;
		g_variant_dict_insert_value (_data_->_tmp39_, "default-action-target", _data_->_tmp40_);
	}
	_data_->_tmp41_ = g_new0 (GVariant*, 0 + 1);
	_data_->_data7_->buttons = _data_->_tmp41_;
	_data_->_data7_->buttons_length1 = 0;
	_data_->_data7_->_buttons_size_ = _data_->_data7_->buttons_length1;
	ft_notification_foreach_button (_data_->notification, ___lambda13__ft_notification_foreach_button_func, _data_->_data7_);
	_data_->_tmp42_ = _data_->_data7_->buttons;
	_data_->_tmp42__length1 = _data_->_data7_->buttons_length1;
	if (_data_->_tmp42__length1 > 0) {
		_data_->_tmp43_ = _data_->notification_properties;
		_data_->_tmp44_ = G_VARIANT_TYPE_VARDICT;
		_data_->_tmp45_ = _data_->_data7_->buttons;
		_data_->_tmp45__length1 = _data_->_data7_->buttons_length1;
		_data_->_tmp46_ = g_variant_new_array (_data_->_tmp44_, _data_->_tmp45_, _data_->_tmp45__length1);
		g_variant_ref_sink (_data_->_tmp46_);
		_data_->_tmp47_ = _data_->_tmp46_;
		g_variant_dict_insert_value (_data_->_tmp43_, "buttons", _data_->_tmp47_);
		_g_variant_unref0 (_data_->_tmp47_);
	}
	{
		_data_->_tmp48_ = _data_->self->priv->proxy;
		_data_->_tmp49_ = _data_->notification_properties;
		_data_->_tmp50_ = g_variant_dict_end (_data_->_tmp49_);
		g_variant_ref_sink (_data_->_tmp50_);
		_data_->_tmp51_ = _data_->_tmp50_;
		_data_->_tmp52_ = _data_->self->priv->cancellable;
		_data_->_state_ = 1;
		portal_notification_add_notification (_data_->_tmp48_, _data_->id, _data_->_tmp51_, _data_->_tmp52_, portal_notification_backend_provider_send_notification_ready, _data_);
		return FALSE;
		_state_1:
		portal_notification_add_notification_finish (_data_->_tmp48_, _data_->_res_, &_data_->_inner_error0_);
		_g_variant_unref0 (_data_->_tmp51_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp53_ = _data_->_error_;
		_data_->_tmp54_ = g_quark_to_string (_data_->_tmp53_->domain);
		_data_->_tmp55_ = _data_->_error_;
		_data_->_tmp56_ = _data_->_error_;
		_data_->_tmp57_ = _data_->_tmp56_->message;
		g_warning ("notification-backend-provider.vala:238: Failed to add notification [%s" \
".%d]: %s", _data_->_tmp54_, _data_->_tmp55_->code, _data_->_tmp57_);
		_g_error_free0 (_data_->_error_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_variant_dict_unref0 (_data_->notification_properties);
		block7_data_unref (_data_->_data7_);
		_data_->_data7_ = 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_variant_dict_unref0 (_data_->notification_properties);
	block7_data_unref (_data_->_data7_);
	_data_->_data7_ = 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
portal_notification_backend_provider_real_withdraw_notification_data_free (gpointer _data)
{
	PortalNotificationBackendProviderWithdrawNotificationData* _data_;
	_data_ = _data;
	_g_free0 (_data_->id);
	_g_object_unref0 (_data_->self);
	g_slice_free (PortalNotificationBackendProviderWithdrawNotificationData, _data_);
}

static void
portal_notification_backend_provider_real_withdraw_notification (FtNotificationBackendProvider* base,
                                                                 const gchar* id,
                                                                 GAsyncReadyCallback _callback_,
                                                                 gpointer _user_data_)
{
	PortalNotificationBackendProvider * self;
	PortalNotificationBackendProviderWithdrawNotificationData* _data_;
	PortalNotificationBackendProvider* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (id != NULL);
	self = (PortalNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (PortalNotificationBackendProviderWithdrawNotificationData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, portal_notification_backend_provider_real_withdraw_notification_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (id);
	_g_free0 (_data_->id);
	_data_->id = _tmp1_;
	portal_notification_backend_provider_real_withdraw_notification_co (_data_);
}

static void
portal_notification_backend_provider_withdraw_notification_finish (FtNotificationBackendProvider* base,
                                                                   GAsyncResult* _res_)
{
	PortalNotificationBackendProviderWithdrawNotificationData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
portal_notification_backend_provider_withdraw_notification_ready (GObject* source_object,
                                                                  GAsyncResult* _res_,
                                                                  gpointer _user_data_)
{
	PortalNotificationBackendProviderWithdrawNotificationData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	portal_notification_backend_provider_real_withdraw_notification_co (_data_);
}

static gboolean
portal_notification_backend_provider_real_withdraw_notification_co (PortalNotificationBackendProviderWithdrawNotificationData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->proxy;
	_vala_return_val_if_fail (_data_->_tmp0_ != NULL, "this.proxy != null", FALSE);
	_data_->_tmp2_ = _data_->self->priv->cancellable;
	if (_data_->_tmp2_ == NULL) {
		_data_->_tmp1_ = TRUE;
	} else {
		_data_->_tmp3_ = _data_->self->priv->cancellable;
		_data_->_tmp1_ = g_cancellable_is_cancelled (_data_->_tmp3_);
	}
	if (_data_->_tmp1_) {
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp4_ = _data_->self->priv->notifications;
	g_hash_table_remove (_data_->_tmp4_, _data_->id);
	{
		_data_->_tmp5_ = _data_->self->priv->proxy;
		_data_->_state_ = 1;
		portal_notification_remove_notification (_data_->_tmp5_, _data_->id, portal_notification_backend_provider_withdraw_notification_ready, _data_);
		return FALSE;
		_state_1:
		portal_notification_remove_notification_finish (_data_->_tmp5_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp6_ = _data_->_error_;
		_data_->_tmp7_ = g_quark_to_string (_data_->_tmp6_->domain);
		_data_->_tmp8_ = _data_->_error_;
		_data_->_tmp9_ = _data_->_error_;
		_data_->_tmp10_ = _data_->_tmp9_->message;
		g_warning ("notification-backend-provider.vala:256: Failed to remove notification " \
"[%s.%d]: %s", _data_->_tmp7_, _data_->_tmp8_->code, _data_->_tmp10_);
		_g_error_free0 (_data_->_error_);
	}
	__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 void
portal_notification_backend_provider_real_dispose (GObject* base)
{
	PortalNotificationBackendProvider * self;
	self = (PortalNotificationBackendProvider*) base;
	_g_object_unref0 (self->priv->application);
	self->priv->application = NULL;
	G_OBJECT_CLASS (portal_notification_backend_provider_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, FT_TYPE_PROVIDER, FtProvider));
}

PortalNotificationBackendProvider*
portal_notification_backend_provider_construct (GType object_type)
{
	PortalNotificationBackendProvider * self = NULL;
	self = (PortalNotificationBackendProvider*) ft_provider_construct (object_type);
	return self;
}

PortalNotificationBackendProvider*
portal_notification_backend_provider_new (void)
{
	return portal_notification_backend_provider_construct (PORTAL_TYPE_NOTIFICATION_BACKEND_PROVIDER);
}

FtPriority
portal_notification_backend_provider_get_priority (PortalNotificationBackendProvider* self)
{
	FtPriority result;
	g_return_val_if_fail (self != NULL, 0);
	result = FT_PRIORITY_HIGH;
	return result;
}

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

static void
portal_notification_backend_provider_class_init (PortalNotificationBackendProviderClass * klass,
                                                 gpointer klass_data)
{
	portal_notification_backend_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PortalNotificationBackendProvider_private_offset);
	((FtProviderClass *) klass)->initialize = (void (*) (FtProvider*, GCancellable*, GAsyncReadyCallback, gpointer)) portal_notification_backend_provider_real_initialize;
	((FtProviderClass *) klass)->initialize_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) portal_notification_backend_provider_initialize_finish;
	((FtProviderClass *) klass)->uninitialize = (void (*) (FtProvider*, GAsyncReadyCallback, gpointer)) portal_notification_backend_provider_real_uninitialize;
	((FtProviderClass *) klass)->uninitialize_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) portal_notification_backend_provider_uninitialize_finish;
	((FtProviderClass *) klass)->enable = (void (*) (FtProvider*, GCancellable*, GAsyncReadyCallback, gpointer)) portal_notification_backend_provider_real_enable;
	((FtProviderClass *) klass)->enable_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) portal_notification_backend_provider_enable_finish;
	((FtProviderClass *) klass)->disable = (void (*) (FtProvider*, GAsyncReadyCallback, gpointer)) portal_notification_backend_provider_real_disable;
	((FtProviderClass *) klass)->disable_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) portal_notification_backend_provider_disable_finish;
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) portal_notification_backend_provider_real_dispose;
	G_OBJECT_CLASS (klass)->get_property = _vala_portal_notification_backend_provider_get_property;
	G_OBJECT_CLASS (klass)->constructor = portal_notification_backend_provider_constructor;
	G_OBJECT_CLASS (klass)->finalize = portal_notification_backend_provider_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PORTAL_NOTIFICATION_BACKEND_PROVIDER_PRIORITY_PROPERTY, portal_notification_backend_provider_properties[PORTAL_NOTIFICATION_BACKEND_PROVIDER_PRIORITY_PROPERTY] = g_param_spec_enum ("priority", "priority", "priority", FT_TYPE_PRIORITY, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
portal_notification_backend_provider_ft_notification_backend_provider_interface_init (FtNotificationBackendProviderIface * iface,
                                                                                      gpointer iface_data)
{
	portal_notification_backend_provider_ft_notification_backend_provider_parent_iface = g_type_interface_peek_parent (iface);
	iface->send_notification = (void (*) (FtNotificationBackendProvider*, const gchar*, FtNotification*, GAsyncReadyCallback, gpointer)) portal_notification_backend_provider_real_send_notification;
	iface->send_notification_finish = (void (*) (FtNotificationBackendProvider*, GAsyncResult*)) portal_notification_backend_provider_send_notification_finish;
	iface->withdraw_notification = (void (*) (FtNotificationBackendProvider*, const gchar*, GAsyncReadyCallback, gpointer)) portal_notification_backend_provider_real_withdraw_notification;
	iface->withdraw_notification_finish = (void (*) (FtNotificationBackendProvider*, GAsyncResult*)) portal_notification_backend_provider_withdraw_notification_finish;
}

static void
portal_notification_backend_provider_instance_init (PortalNotificationBackendProvider * self,
                                                    gpointer klass)
{
	self->priv = portal_notification_backend_provider_get_instance_private (self);
	self->priv->watcher_id = (guint) 0;
	self->priv->proxy = NULL;
	self->priv->notifications = NULL;
	self->priv->cancellable = NULL;
}

static void
portal_notification_backend_provider_finalize (GObject * obj)
{
	PortalNotificationBackendProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PORTAL_TYPE_NOTIFICATION_BACKEND_PROVIDER, PortalNotificationBackendProvider);
	_g_object_unref0 (self->priv->proxy);
	_g_hash_table_unref0 (self->priv->notifications);
	_g_object_unref0 (self->priv->cancellable);
	_g_object_unref0 (self->priv->application);
	G_OBJECT_CLASS (portal_notification_backend_provider_parent_class)->finalize (obj);
}

GType
portal_notification_backend_provider_get_type (void)
{
	return portal_notification_backend_provider_type_id;
}

GType
portal_notification_backend_provider_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (PortalNotificationBackendProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) portal_notification_backend_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PortalNotificationBackendProvider), 0, (GInstanceInitFunc) portal_notification_backend_provider_instance_init, NULL };
	static const GInterfaceInfo ft_notification_backend_provider_info = { (GInterfaceInitFunc) portal_notification_backend_provider_ft_notification_backend_provider_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	portal_notification_backend_provider_type_id = g_type_module_register_type (module, FT_TYPE_PROVIDER, "PortalNotificationBackendProvider", &g_define_type_info, 0);
	g_type_module_add_interface (module, portal_notification_backend_provider_type_id, FT_TYPE_NOTIFICATION_BACKEND_PROVIDER, &ft_notification_backend_provider_info);
	PortalNotificationBackendProvider_private_offset = sizeof (PortalNotificationBackendProviderPrivate);
	return portal_notification_backend_provider_type_id;
}

static void
_vala_portal_notification_backend_provider_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec)
{
	PortalNotificationBackendProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PORTAL_TYPE_NOTIFICATION_BACKEND_PROVIDER, PortalNotificationBackendProvider);
	switch (property_id) {
		case PORTAL_NOTIFICATION_BACKEND_PROVIDER_PRIORITY_PROPERTY:
		g_value_set_enum (value, portal_notification_backend_provider_get_priority (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);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

