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

/*
 * Copyright (c) 2026 focus-timer contributors
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * Authors: Kamil Prusko <kamilprusko@gmail.com>
 */

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

#define FT_TYPE_FALLBACK_NOTIFICATION_BACKEND_PROVIDER (ft_fallback_notification_backend_provider_get_type ())
#define FT_FALLBACK_NOTIFICATION_BACKEND_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FT_TYPE_FALLBACK_NOTIFICATION_BACKEND_PROVIDER, FtFallbackNotificationBackendProvider))
#define FT_FALLBACK_NOTIFICATION_BACKEND_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FT_TYPE_FALLBACK_NOTIFICATION_BACKEND_PROVIDER, FtFallbackNotificationBackendProviderClass))
#define FT_IS_FALLBACK_NOTIFICATION_BACKEND_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FT_TYPE_FALLBACK_NOTIFICATION_BACKEND_PROVIDER))
#define FT_IS_FALLBACK_NOTIFICATION_BACKEND_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FT_TYPE_FALLBACK_NOTIFICATION_BACKEND_PROVIDER))
#define FT_FALLBACK_NOTIFICATION_BACKEND_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FT_TYPE_FALLBACK_NOTIFICATION_BACKEND_PROVIDER, FtFallbackNotificationBackendProviderClass))

typedef struct _FtFallbackNotificationBackendProvider FtFallbackNotificationBackendProvider;
typedef struct _FtFallbackNotificationBackendProviderClass FtFallbackNotificationBackendProviderClass;
typedef struct _FtFallbackNotificationBackendProviderPrivate FtFallbackNotificationBackendProviderPrivate;
enum  {
	FT_FALLBACK_NOTIFICATION_BACKEND_PROVIDER_0_PROPERTY,
	FT_FALLBACK_NOTIFICATION_BACKEND_PROVIDER_NUM_PROPERTIES
};
static GParamSpec* ft_fallback_notification_backend_provider_properties[FT_FALLBACK_NOTIFICATION_BACKEND_PROVIDER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _ft_notification_unref0(var) ((var == NULL) ? NULL : (var = (ft_notification_unref (var), NULL)))
typedef struct _Block24Data Block24Data;
typedef struct _FtFallbackNotificationBackendProviderSendNotificationData FtFallbackNotificationBackendProviderSendNotificationData;
typedef struct _FtFallbackNotificationBackendProviderWithdrawNotificationData FtFallbackNotificationBackendProviderWithdrawNotificationData;
typedef struct _FtFallbackNotificationBackendProviderInitializeData FtFallbackNotificationBackendProviderInitializeData;
typedef struct _FtFallbackNotificationBackendProviderUninitializeData FtFallbackNotificationBackendProviderUninitializeData;
typedef struct _FtFallbackNotificationBackendProviderEnableData FtFallbackNotificationBackendProviderEnableData;
typedef struct _FtFallbackNotificationBackendProviderDisableData FtFallbackNotificationBackendProviderDisableData;
typedef struct _FtQueuedNotification FtQueuedNotification;
enum  {
	FT_NOTIFICATION_BACKEND_0_PROPERTY,
	FT_NOTIFICATION_BACKEND_NUM_PROPERTIES
};
static GParamSpec* ft_notification_backend_properties[FT_NOTIFICATION_BACKEND_NUM_PROPERTIES];
typedef struct _Block25Data Block25Data;
#define _ft_queued_notification_free0(var) ((var == NULL) ? NULL : (var = (ft_queued_notification_free (var), NULL)))

struct _FtFallbackNotificationBackendProvider {
	FtProvider parent_instance;
	FtFallbackNotificationBackendProviderPrivate * priv;
};

struct _FtFallbackNotificationBackendProviderClass {
	FtProviderClass parent_class;
};

struct _FtFallbackNotificationBackendProviderPrivate {
	GApplication* application;
};

struct _Block24Data {
	int _ref_count_;
	FtFallbackNotificationBackendProvider* self;
	GNotification* glib_notification;
	gpointer _async_data_;
};

struct _FtFallbackNotificationBackendProviderSendNotificationData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FtFallbackNotificationBackendProvider* self;
	gchar* id;
	FtNotification* notification;
	Block24Data* _data24_;
	const gchar* _tmp0_;
	GNotification* _tmp1_;
	GNotification* _tmp2_;
	const gchar* _tmp3_;
	GNotification* _tmp4_;
	const gchar* _tmp5_;
	GNotification* _tmp6_;
	const gchar* _tmp7_;
	GIcon* _tmp8_;
	GNotification* _tmp9_;
	GIcon* _tmp10_;
	const gchar* _tmp11_;
	GNotification* _tmp12_;
	const gchar* _tmp13_;
	GVariant* _tmp14_;
	GApplication* _tmp15_;
	GApplication* _tmp16_;
	GNotification* _tmp17_;
};

struct _FtFallbackNotificationBackendProviderWithdrawNotificationData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FtFallbackNotificationBackendProvider* self;
	gchar* id;
	GApplication* _tmp0_;
	GApplication* _tmp1_;
};

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

struct _FtFallbackNotificationBackendProviderUninitializeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FtFallbackNotificationBackendProvider* self;
};

struct _FtFallbackNotificationBackendProviderEnableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FtFallbackNotificationBackendProvider* self;
	GCancellable* cancellable;
	GApplication* _tmp0_;
	GApplication* _tmp1_;
};

struct _FtFallbackNotificationBackendProviderDisableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FtFallbackNotificationBackendProvider* self;
};

struct _FtQueuedNotification {
	gchar* id;
	FtNotification* notification;
	gulong serial;
};

struct _FtNotificationBackendPrivate {
	GQueue* queue;
	gboolean processing_queue;
	gulong next_serial;
};

struct _Block25Data {
	int _ref_count_;
	FtNotificationBackend* self;
	FtNotificationBackendProvider* provider;
};

static gint FtFallbackNotificationBackendProvider_private_offset;
static gpointer ft_fallback_notification_backend_provider_parent_class = NULL;
static FtNotificationBackendProviderIface * ft_fallback_notification_backend_provider_ft_notification_backend_provider_parent_iface = NULL;
static gint FtNotificationBackend_private_offset;
static gpointer ft_notification_backend_parent_class = NULL;
static FtNotificationBackendInterfaceIface * ft_notification_backend_ft_notification_backend_interface_parent_iface = NULL;

static GType ft_notification_backend_provider_get_type_once (void);
VALA_EXTERN GType ft_fallback_notification_backend_provider_get_type (void) G_GNUC_CONST ;
static GNotificationPriority ft_fallback_notification_backend_provider_transform_priority (FtNotificationPriority priority);
static void ft_fallback_notification_backend_provider_real_send_notification_data_free (gpointer _data);
static void ft_fallback_notification_backend_provider_real_send_notification (FtNotificationBackendProvider* base,
                                                                       const gchar* id,
                                                                       FtNotification* notification,
                                                                       GAsyncReadyCallback _callback_,
                                                                       gpointer _user_data_);
static gboolean ft_fallback_notification_backend_provider_real_send_notification_co (FtFallbackNotificationBackendProviderSendNotificationData* _data_);
static Block24Data* block24_data_ref (Block24Data* _data24_);
static void block24_data_unref (void * _userdata_);
static void __lambda77_ (Block24Data* _data24_,
                  const gchar* label,
                  const gchar* action,
                  GVariant* target_value);
static void ___lambda77__ft_notification_foreach_button_func (const gchar* label,
                                                       const gchar* action,
                                                       GVariant* target_value,
                                                       gpointer self);
static void ft_fallback_notification_backend_provider_real_withdraw_notification_data_free (gpointer _data);
static void ft_fallback_notification_backend_provider_real_withdraw_notification (FtNotificationBackendProvider* base,
                                                                           const gchar* id,
                                                                           GAsyncReadyCallback _callback_,
                                                                           gpointer _user_data_);
static gboolean ft_fallback_notification_backend_provider_real_withdraw_notification_co (FtFallbackNotificationBackendProviderWithdrawNotificationData* _data_);
static void ft_fallback_notification_backend_provider_real_initialize_data_free (gpointer _data);
static void ft_fallback_notification_backend_provider_real_initialize (FtProvider* base,
                                                                GCancellable* cancellable,
                                                                GAsyncReadyCallback _callback_,
                                                                gpointer _user_data_);
static gboolean ft_fallback_notification_backend_provider_real_initialize_co (FtFallbackNotificationBackendProviderInitializeData* _data_);
static void ft_fallback_notification_backend_provider_real_uninitialize_data_free (gpointer _data);
static void ft_fallback_notification_backend_provider_real_uninitialize (FtProvider* base,
                                                                  GAsyncReadyCallback _callback_,
                                                                  gpointer _user_data_);
static gboolean ft_fallback_notification_backend_provider_real_uninitialize_co (FtFallbackNotificationBackendProviderUninitializeData* _data_);
static void ft_fallback_notification_backend_provider_real_enable_data_free (gpointer _data);
static void ft_fallback_notification_backend_provider_real_enable (FtProvider* base,
                                                            GCancellable* cancellable,
                                                            GAsyncReadyCallback _callback_,
                                                            gpointer _user_data_);
static gboolean ft_fallback_notification_backend_provider_real_enable_co (FtFallbackNotificationBackendProviderEnableData* _data_);
static void ft_fallback_notification_backend_provider_real_disable_data_free (gpointer _data);
static void ft_fallback_notification_backend_provider_real_disable (FtProvider* base,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);
static gboolean ft_fallback_notification_backend_provider_real_disable_co (FtFallbackNotificationBackendProviderDisableData* _data_);
VALA_EXTERN FtFallbackNotificationBackendProvider* ft_fallback_notification_backend_provider_new (void);
VALA_EXTERN FtFallbackNotificationBackendProvider* ft_fallback_notification_backend_provider_construct (GType object_type);
static void ft_fallback_notification_backend_provider_finalize (GObject * obj);
static GType ft_fallback_notification_backend_provider_get_type_once (void);
VALA_EXTERN void ft_queued_notification_free (FtQueuedNotification * self);
static void ft_queued_notification_instance_init (FtQueuedNotification * self);
VALA_EXTERN FtQueuedNotification* ft_queued_notification_new (const gchar* id,
                                                  FtNotification* notification,
                                                  gulong serial);
static GType ft_notification_backend_interface_get_type_once (void);
static void _ft_queued_notification_free0_ (gpointer var);
static inline void _g_queue_free__ft_queued_notification_free0_ (GQueue* self);
static void ft_notification_backend_process_queue (FtNotificationBackend* self);
static Block25Data* block25_data_ref (Block25Data* _data25_);
static void block25_data_unref (void * _userdata_);
static void ____lambda75_ (Block25Data* _data25_,
                    GObject* obj,
                    GAsyncResult* res);
static void _____lambda75__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void ____lambda76_ (Block25Data* _data25_,
                    GObject* obj,
                    GAsyncResult* res);
static void _____lambda76__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void ft_notification_backend_remove_from_queue (FtNotificationBackend* self,
                                                const gchar* id);
static void ft_notification_backend_real_initialize (FtProvidedObject* base);
static void ft_notification_backend_real_setup_providers (FtProvidedObject* base);
static void ft_notification_backend_real_provider_enabled (FtProvidedObject* base,
                                                    FtNotificationBackendProvider* provider);
static void ft_notification_backend_real_provider_disabled (FtProvidedObject* base,
                                                     FtNotificationBackendProvider* provider);
static void ft_notification_backend_real_send_notification (FtNotificationBackendInterface* base,
                                                     const gchar* id,
                                                     FtNotification* notification);
static void ft_notification_backend_real_withdraw_notification (FtNotificationBackendInterface* base,
                                                         const gchar* id);
static gint __lambda78_ (FtNotificationBackend* self,
                  FtQueuedNotification* a,
                  FtQueuedNotification* b);
static gint ___lambda78__gcompare_data_func (gconstpointer a,
                                      gconstpointer b,
                                      gpointer self);
static void ft_notification_backend_real_dispose (GObject* base);
static GObject * ft_notification_backend_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties);
static void ft_notification_backend_finalize (GObject * obj);
static GType ft_notification_backend_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

void
ft_notification_backend_provider_send_notification (FtNotificationBackendProvider* self,
                                                    const gchar* id,
                                                    FtNotification* notification,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	FtNotificationBackendProviderIface* _iface_;
	_iface_ = FT_NOTIFICATION_BACKEND_PROVIDER_GET_INTERFACE (self);
	if (_iface_->send_notification) {
		_iface_->send_notification (self, id, notification, _callback_, _user_data_);
	}
}

void
ft_notification_backend_provider_send_notification_finish (FtNotificationBackendProvider* self,
                                                           GAsyncResult* _res_)
{
	FtNotificationBackendProviderIface* _iface_;
	_iface_ = FT_NOTIFICATION_BACKEND_PROVIDER_GET_INTERFACE (self);
	if (_iface_->send_notification_finish) {
		_iface_->send_notification_finish (self, _res_);
	}
}

void
ft_notification_backend_provider_withdraw_notification (FtNotificationBackendProvider* self,
                                                        const gchar* id,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_)
{
	FtNotificationBackendProviderIface* _iface_;
	_iface_ = FT_NOTIFICATION_BACKEND_PROVIDER_GET_INTERFACE (self);
	if (_iface_->withdraw_notification) {
		_iface_->withdraw_notification (self, id, _callback_, _user_data_);
	}
}

void
ft_notification_backend_provider_withdraw_notification_finish (FtNotificationBackendProvider* self,
                                                               GAsyncResult* _res_)
{
	FtNotificationBackendProviderIface* _iface_;
	_iface_ = FT_NOTIFICATION_BACKEND_PROVIDER_GET_INTERFACE (self);
	if (_iface_->withdraw_notification_finish) {
		_iface_->withdraw_notification_finish (self, _res_);
	}
}

static void
ft_notification_backend_provider_default_init (FtNotificationBackendProviderIface * iface,
                                               gpointer iface_data)
{
}

static GType
ft_notification_backend_provider_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtNotificationBackendProviderIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_notification_backend_provider_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType ft_notification_backend_provider_type_id;
	ft_notification_backend_provider_type_id = g_type_register_static (G_TYPE_INTERFACE, "FtNotificationBackendProvider", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (ft_notification_backend_provider_type_id, FT_TYPE_PROVIDER);
	return ft_notification_backend_provider_type_id;
}

GType
ft_notification_backend_provider_get_type (void)
{
	static volatile gsize ft_notification_backend_provider_type_id__once = 0;
	if (g_once_init_enter (&ft_notification_backend_provider_type_id__once)) {
		GType ft_notification_backend_provider_type_id;
		ft_notification_backend_provider_type_id = ft_notification_backend_provider_get_type_once ();
		g_once_init_leave (&ft_notification_backend_provider_type_id__once, ft_notification_backend_provider_type_id);
	}
	return ft_notification_backend_provider_type_id__once;
}

static inline gpointer
ft_fallback_notification_backend_provider_get_instance_private (FtFallbackNotificationBackendProvider* self)
{
	return G_STRUCT_MEMBER_P (self, FtFallbackNotificationBackendProvider_private_offset);
}

static GNotificationPriority
ft_fallback_notification_backend_provider_transform_priority (FtNotificationPriority priority)
{
	GNotificationPriority result;
	switch (priority) {
		case FT_NOTIFICATION_PRIORITY_LOW:
		{
			result = G_NOTIFICATION_PRIORITY_LOW;
			return result;
		}
		case FT_NOTIFICATION_PRIORITY_NORMAL:
		{
			result = G_NOTIFICATION_PRIORITY_NORMAL;
			return result;
		}
		case FT_NOTIFICATION_PRIORITY_HIGH:
		{
			result = G_NOTIFICATION_PRIORITY_HIGH;
			return result;
		}
		case FT_NOTIFICATION_PRIORITY_URGENT:
		{
			result = G_NOTIFICATION_PRIORITY_URGENT;
			return result;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
}

static void
ft_fallback_notification_backend_provider_real_send_notification_data_free (gpointer _data)
{
	FtFallbackNotificationBackendProviderSendNotificationData* _data_;
	_data_ = _data;
	_g_free0 (_data_->id);
	_ft_notification_unref0 (_data_->notification);
	_g_object_unref0 (_data_->self);
	g_slice_free (FtFallbackNotificationBackendProviderSendNotificationData, _data_);
}

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

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

static void
ft_fallback_notification_backend_provider_real_send_notification (FtNotificationBackendProvider* base,
                                                                  const gchar* id,
                                                                  FtNotification* notification,
                                                                  GAsyncReadyCallback _callback_,
                                                                  gpointer _user_data_)
{
	FtFallbackNotificationBackendProvider * self;
	FtFallbackNotificationBackendProviderSendNotificationData* _data_;
	FtFallbackNotificationBackendProvider* _tmp0_;
	gchar* _tmp1_;
	FtNotification* _tmp2_;
	g_return_if_fail (id != NULL);
	g_return_if_fail (notification != NULL);
	self = (FtFallbackNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (FtFallbackNotificationBackendProviderSendNotificationData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, ft_fallback_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_;
	ft_fallback_notification_backend_provider_real_send_notification_co (_data_);
}

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

static Block24Data*
block24_data_ref (Block24Data* _data24_)
{
	g_atomic_int_inc (&_data24_->_ref_count_);
	return _data24_;
}

static void
block24_data_unref (void * _userdata_)
{
	Block24Data* _data24_;
	_data24_ = (Block24Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data24_->_ref_count_)) {
		FtFallbackNotificationBackendProvider* self;
		self = _data24_->self;
		_g_object_unref0 (_data24_->glib_notification);
		_g_object_unref0 (self);
		g_slice_free (Block24Data, _data24_);
	}
}

static void
__lambda77_ (Block24Data* _data24_,
             const gchar* label,
             const gchar* action,
             GVariant* target_value)
{
	FtFallbackNotificationBackendProvider* self;
	GNotification* _tmp0_;
	self = _data24_->self;
	g_return_if_fail (label != NULL);
	g_return_if_fail (action != NULL);
	_tmp0_ = _data24_->glib_notification;
	g_notification_add_button_with_target_value (_tmp0_, label, action, target_value);
}

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

static gboolean
ft_fallback_notification_backend_provider_real_send_notification_co (FtFallbackNotificationBackendProviderSendNotificationData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data24_ = g_slice_new0 (Block24Data);
	_data_->_data24_->_ref_count_ = 1;
	_data_->_data24_->self = g_object_ref (_data_->self);
	_data_->_data24_->_async_data_ = _data_;
	_data_->_tmp0_ = _data_->notification->title;
	_data_->_tmp1_ = g_notification_new (_data_->_tmp0_);
	_data_->_data24_->glib_notification = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->_data24_->glib_notification;
	_data_->_tmp3_ = _data_->notification->body;
	g_notification_set_body (_data_->_tmp2_, _data_->_tmp3_);
	_data_->_tmp4_ = _data_->_data24_->glib_notification;
	g_notification_set_priority (_data_->_tmp4_, ft_fallback_notification_backend_provider_transform_priority (_data_->notification->priority));
	_data_->_tmp5_ = _data_->notification->category;
	if (_data_->_tmp5_ != NULL) {
		_data_->_tmp6_ = _data_->_data24_->glib_notification;
		_data_->_tmp7_ = _data_->notification->category;
		g_notification_set_category (_data_->_tmp6_, _data_->_tmp7_);
	}
	_data_->_tmp8_ = _data_->notification->icon;
	if (_data_->_tmp8_ != NULL) {
		_data_->_tmp9_ = _data_->_data24_->glib_notification;
		_data_->_tmp10_ = _data_->notification->icon;
		g_notification_set_icon (_data_->_tmp9_, _data_->_tmp10_);
	}
	_data_->_tmp11_ = _data_->notification->default_action;
	if (_data_->_tmp11_ != NULL) {
		_data_->_tmp12_ = _data_->_data24_->glib_notification;
		_data_->_tmp13_ = _data_->notification->default_action;
		_data_->_tmp14_ = _data_->notification->default_target_value;
		g_notification_set_default_action_and_target_value (_data_->_tmp12_, _data_->_tmp13_, _data_->_tmp14_);
	}
	ft_notification_foreach_button (_data_->notification, ___lambda77__ft_notification_foreach_button_func, _data_->_data24_);
	_data_->_tmp16_ = _data_->self->priv->application;
	_data_->_tmp15_ = _data_->_tmp16_;
	if (_data_->_tmp15_ != NULL) {
		_data_->_tmp17_ = _data_->_data24_->glib_notification;
		g_application_send_notification (_data_->_tmp15_, _data_->id, _data_->_tmp17_);
	}
	block24_data_unref (_data_->_data24_);
	_data_->_data24_ = 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
ft_fallback_notification_backend_provider_real_withdraw_notification_data_free (gpointer _data)
{
	FtFallbackNotificationBackendProviderWithdrawNotificationData* _data_;
	_data_ = _data;
	_g_free0 (_data_->id);
	_g_object_unref0 (_data_->self);
	g_slice_free (FtFallbackNotificationBackendProviderWithdrawNotificationData, _data_);
}

static void
ft_fallback_notification_backend_provider_real_withdraw_notification (FtNotificationBackendProvider* base,
                                                                      const gchar* id,
                                                                      GAsyncReadyCallback _callback_,
                                                                      gpointer _user_data_)
{
	FtFallbackNotificationBackendProvider * self;
	FtFallbackNotificationBackendProviderWithdrawNotificationData* _data_;
	FtFallbackNotificationBackendProvider* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (id != NULL);
	self = (FtFallbackNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (FtFallbackNotificationBackendProviderWithdrawNotificationData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, ft_fallback_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_;
	ft_fallback_notification_backend_provider_real_withdraw_notification_co (_data_);
}

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

static gboolean
ft_fallback_notification_backend_provider_real_withdraw_notification_co (FtFallbackNotificationBackendProviderWithdrawNotificationData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = _data_->self->priv->application;
	_data_->_tmp0_ = _data_->_tmp1_;
	if (_data_->_tmp0_ != NULL) {
		g_application_withdraw_notification (_data_->_tmp0_, _data_->id);
	}
	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
ft_fallback_notification_backend_provider_real_initialize_data_free (gpointer _data)
{
	FtFallbackNotificationBackendProviderInitializeData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (FtFallbackNotificationBackendProviderInitializeData, _data_);
}

static void
ft_fallback_notification_backend_provider_real_initialize (FtProvider* base,
                                                           GCancellable* cancellable,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_)
{
	FtFallbackNotificationBackendProvider * self;
	FtFallbackNotificationBackendProviderInitializeData* _data_;
	FtFallbackNotificationBackendProvider* _tmp0_;
	GCancellable* _tmp1_;
	self = (FtFallbackNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (FtFallbackNotificationBackendProviderInitializeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, ft_fallback_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_;
	ft_fallback_notification_backend_provider_real_initialize_co (_data_);
}

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

static gboolean
ft_fallback_notification_backend_provider_real_initialize_co (FtFallbackNotificationBackendProviderInitializeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	ft_provider_set_available ((FtProvider*) _data_->self, TRUE);
	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
ft_fallback_notification_backend_provider_real_uninitialize_data_free (gpointer _data)
{
	FtFallbackNotificationBackendProviderUninitializeData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (FtFallbackNotificationBackendProviderUninitializeData, _data_);
}

static void
ft_fallback_notification_backend_provider_real_uninitialize (FtProvider* base,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_)
{
	FtFallbackNotificationBackendProvider * self;
	FtFallbackNotificationBackendProviderUninitializeData* _data_;
	FtFallbackNotificationBackendProvider* _tmp0_;
	self = (FtFallbackNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (FtFallbackNotificationBackendProviderUninitializeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, ft_fallback_notification_backend_provider_real_uninitialize_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	ft_fallback_notification_backend_provider_real_uninitialize_co (_data_);
}

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

static gboolean
ft_fallback_notification_backend_provider_real_uninitialize_co (FtFallbackNotificationBackendProviderUninitializeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_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
ft_fallback_notification_backend_provider_real_enable_data_free (gpointer _data)
{
	FtFallbackNotificationBackendProviderEnableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (FtFallbackNotificationBackendProviderEnableData, _data_);
}

static void
ft_fallback_notification_backend_provider_real_enable (FtProvider* base,
                                                       GCancellable* cancellable,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_)
{
	FtFallbackNotificationBackendProvider * self;
	FtFallbackNotificationBackendProviderEnableData* _data_;
	FtFallbackNotificationBackendProvider* _tmp0_;
	GCancellable* _tmp1_;
	self = (FtFallbackNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (FtFallbackNotificationBackendProviderEnableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, ft_fallback_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_;
	ft_fallback_notification_backend_provider_real_enable_co (_data_);
}

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

static gboolean
ft_fallback_notification_backend_provider_real_enable_co (FtFallbackNotificationBackendProviderEnableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_application_get_default ();
	_data_->_tmp1_ = _g_object_ref0 (_data_->_tmp0_);
	_g_object_unref0 (_data_->self->priv->application);
	_data_->self->priv->application = _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
ft_fallback_notification_backend_provider_real_disable_data_free (gpointer _data)
{
	FtFallbackNotificationBackendProviderDisableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (FtFallbackNotificationBackendProviderDisableData, _data_);
}

static void
ft_fallback_notification_backend_provider_real_disable (FtProvider* base,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_)
{
	FtFallbackNotificationBackendProvider * self;
	FtFallbackNotificationBackendProviderDisableData* _data_;
	FtFallbackNotificationBackendProvider* _tmp0_;
	self = (FtFallbackNotificationBackendProvider*) base;
	_data_ = g_slice_new0 (FtFallbackNotificationBackendProviderDisableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, ft_fallback_notification_backend_provider_real_disable_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	ft_fallback_notification_backend_provider_real_disable_co (_data_);
}

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

static gboolean
ft_fallback_notification_backend_provider_real_disable_co (FtFallbackNotificationBackendProviderDisableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_g_object_unref0 (_data_->self->priv->application);
	_data_->self->priv->application = 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;
}

FtFallbackNotificationBackendProvider*
ft_fallback_notification_backend_provider_construct (GType object_type)
{
	FtFallbackNotificationBackendProvider * self = NULL;
	self = (FtFallbackNotificationBackendProvider*) ft_provider_construct (object_type);
	return self;
}

FtFallbackNotificationBackendProvider*
ft_fallback_notification_backend_provider_new (void)
{
	return ft_fallback_notification_backend_provider_construct (FT_TYPE_FALLBACK_NOTIFICATION_BACKEND_PROVIDER);
}

static void
ft_fallback_notification_backend_provider_class_init (FtFallbackNotificationBackendProviderClass * klass,
                                                      gpointer klass_data)
{
	ft_fallback_notification_backend_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtFallbackNotificationBackendProvider_private_offset);
	((FtProviderClass *) klass)->initialize = (void (*) (FtProvider*, GCancellable*, GAsyncReadyCallback, gpointer)) ft_fallback_notification_backend_provider_real_initialize;
	((FtProviderClass *) klass)->initialize_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) ft_fallback_notification_backend_provider_initialize_finish;
	((FtProviderClass *) klass)->uninitialize = (void (*) (FtProvider*, GAsyncReadyCallback, gpointer)) ft_fallback_notification_backend_provider_real_uninitialize;
	((FtProviderClass *) klass)->uninitialize_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) ft_fallback_notification_backend_provider_uninitialize_finish;
	((FtProviderClass *) klass)->enable = (void (*) (FtProvider*, GCancellable*, GAsyncReadyCallback, gpointer)) ft_fallback_notification_backend_provider_real_enable;
	((FtProviderClass *) klass)->enable_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) ft_fallback_notification_backend_provider_enable_finish;
	((FtProviderClass *) klass)->disable = (void (*) (FtProvider*, GAsyncReadyCallback, gpointer)) ft_fallback_notification_backend_provider_real_disable;
	((FtProviderClass *) klass)->disable_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) ft_fallback_notification_backend_provider_disable_finish;
	G_OBJECT_CLASS (klass)->finalize = ft_fallback_notification_backend_provider_finalize;
}

static void
ft_fallback_notification_backend_provider_ft_notification_backend_provider_interface_init (FtNotificationBackendProviderIface * iface,
                                                                                           gpointer iface_data)
{
	ft_fallback_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)) ft_fallback_notification_backend_provider_real_send_notification;
	iface->send_notification_finish = (void (*) (FtNotificationBackendProvider*, GAsyncResult*)) ft_fallback_notification_backend_provider_send_notification_finish;
	iface->withdraw_notification = (void (*) (FtNotificationBackendProvider*, const gchar*, GAsyncReadyCallback, gpointer)) ft_fallback_notification_backend_provider_real_withdraw_notification;
	iface->withdraw_notification_finish = (void (*) (FtNotificationBackendProvider*, GAsyncResult*)) ft_fallback_notification_backend_provider_withdraw_notification_finish;
}

static void
ft_fallback_notification_backend_provider_instance_init (FtFallbackNotificationBackendProvider * self,
                                                         gpointer klass)
{
	self->priv = ft_fallback_notification_backend_provider_get_instance_private (self);
	self->priv->application = NULL;
}

static void
ft_fallback_notification_backend_provider_finalize (GObject * obj)
{
	FtFallbackNotificationBackendProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_FALLBACK_NOTIFICATION_BACKEND_PROVIDER, FtFallbackNotificationBackendProvider);
	_g_object_unref0 (self->priv->application);
	G_OBJECT_CLASS (ft_fallback_notification_backend_provider_parent_class)->finalize (obj);
}

static GType
ft_fallback_notification_backend_provider_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtFallbackNotificationBackendProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_fallback_notification_backend_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtFallbackNotificationBackendProvider), 0, (GInstanceInitFunc) ft_fallback_notification_backend_provider_instance_init, NULL };
	static const GInterfaceInfo ft_notification_backend_provider_info = { (GInterfaceInitFunc) ft_fallback_notification_backend_provider_ft_notification_backend_provider_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType ft_fallback_notification_backend_provider_type_id;
	ft_fallback_notification_backend_provider_type_id = g_type_register_static (FT_TYPE_PROVIDER, "FtFallbackNotificationBackendProvider", &g_define_type_info, 0);
	g_type_add_interface_static (ft_fallback_notification_backend_provider_type_id, FT_TYPE_NOTIFICATION_BACKEND_PROVIDER, &ft_notification_backend_provider_info);
	FtFallbackNotificationBackendProvider_private_offset = g_type_add_instance_private (ft_fallback_notification_backend_provider_type_id, sizeof (FtFallbackNotificationBackendProviderPrivate));
	return ft_fallback_notification_backend_provider_type_id;
}

GType
ft_fallback_notification_backend_provider_get_type (void)
{
	static volatile gsize ft_fallback_notification_backend_provider_type_id__once = 0;
	if (g_once_init_enter (&ft_fallback_notification_backend_provider_type_id__once)) {
		GType ft_fallback_notification_backend_provider_type_id;
		ft_fallback_notification_backend_provider_type_id = ft_fallback_notification_backend_provider_get_type_once ();
		g_once_init_leave (&ft_fallback_notification_backend_provider_type_id__once, ft_fallback_notification_backend_provider_type_id);
	}
	return ft_fallback_notification_backend_provider_type_id__once;
}

FtQueuedNotification*
ft_queued_notification_new (const gchar* id,
                            FtNotification* notification,
                            gulong serial)
{
	FtQueuedNotification* self;
	gchar* _tmp0_;
	FtNotification* _tmp1_;
	g_return_val_if_fail (id != NULL, NULL);
	self = g_slice_new0 (FtQueuedNotification);
	ft_queued_notification_instance_init (self);
	_tmp0_ = g_strdup (id);
	_g_free0 (self->id);
	self->id = _tmp0_;
	_tmp1_ = _ft_notification_ref0 (notification);
	_ft_notification_unref0 (self->notification);
	self->notification = _tmp1_;
	self->serial = serial;
	return self;
}

static void
ft_queued_notification_instance_init (FtQueuedNotification * self)
{
}

void
ft_queued_notification_free (FtQueuedNotification * self)
{
	_ft_notification_unref0 (self->notification);
	self->notification = NULL;
	_g_free0 (self->id);
	_ft_notification_unref0 (self->notification);
	g_slice_free (FtQueuedNotification, self);
}

void
ft_notification_backend_interface_send_notification (FtNotificationBackendInterface* self,
                                                     const gchar* id,
                                                     FtNotification* notification)
{
	FtNotificationBackendInterfaceIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = FT_NOTIFICATION_BACKEND_INTERFACE_GET_INTERFACE (self);
	if (_iface_->send_notification) {
		_iface_->send_notification (self, id, notification);
	}
}

void
ft_notification_backend_interface_withdraw_notification (FtNotificationBackendInterface* self,
                                                         const gchar* id)
{
	FtNotificationBackendInterfaceIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = FT_NOTIFICATION_BACKEND_INTERFACE_GET_INTERFACE (self);
	if (_iface_->withdraw_notification) {
		_iface_->withdraw_notification (self, id);
	}
}

static void
ft_notification_backend_interface_default_init (FtNotificationBackendInterfaceIface * iface,
                                                gpointer iface_data)
{
}

static GType
ft_notification_backend_interface_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtNotificationBackendInterfaceIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_notification_backend_interface_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType ft_notification_backend_interface_type_id;
	ft_notification_backend_interface_type_id = g_type_register_static (G_TYPE_INTERFACE, "FtNotificationBackendInterface", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (ft_notification_backend_interface_type_id, G_TYPE_OBJECT);
	return ft_notification_backend_interface_type_id;
}

GType
ft_notification_backend_interface_get_type (void)
{
	static volatile gsize ft_notification_backend_interface_type_id__once = 0;
	if (g_once_init_enter (&ft_notification_backend_interface_type_id__once)) {
		GType ft_notification_backend_interface_type_id;
		ft_notification_backend_interface_type_id = ft_notification_backend_interface_get_type_once ();
		g_once_init_leave (&ft_notification_backend_interface_type_id__once, ft_notification_backend_interface_type_id);
	}
	return ft_notification_backend_interface_type_id__once;
}

static inline gpointer
ft_notification_backend_get_instance_private (FtNotificationBackend* self)
{
	return G_STRUCT_MEMBER_P (self, FtNotificationBackend_private_offset);
}

static void
_ft_queued_notification_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (ft_queued_notification_free (var), NULL));
}

static inline void
_g_queue_free__ft_queued_notification_free0_ (GQueue* self)
{
	g_queue_free_full (self, (GDestroyNotify) _ft_queued_notification_free0_);
}

static Block25Data*
block25_data_ref (Block25Data* _data25_)
{
	g_atomic_int_inc (&_data25_->_ref_count_);
	return _data25_;
}

static void
block25_data_unref (void * _userdata_)
{
	Block25Data* _data25_;
	_data25_ = (Block25Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data25_->_ref_count_)) {
		FtNotificationBackend* self;
		self = _data25_->self;
		_g_object_unref0 (_data25_->provider);
		_g_object_unref0 (self);
		g_slice_free (Block25Data, _data25_);
	}
}

static void
____lambda75_ (Block25Data* _data25_,
               GObject* obj,
               GAsyncResult* res)
{
	FtNotificationBackend* self;
	FtNotificationBackendProvider* _tmp0_;
	self = _data25_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data25_->provider;
	ft_notification_backend_provider_send_notification_finish (_tmp0_, res);
	self->priv->processing_queue = FALSE;
	ft_notification_backend_process_queue (self);
}

static void
_____lambda75__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda75_ (self, source_object, res);
	block25_data_unref (self);
}

static void
____lambda76_ (Block25Data* _data25_,
               GObject* obj,
               GAsyncResult* res)
{
	FtNotificationBackend* self;
	FtNotificationBackendProvider* _tmp0_;
	self = _data25_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data25_->provider;
	ft_notification_backend_provider_withdraw_notification_finish (_tmp0_, res);
	self->priv->processing_queue = FALSE;
	ft_notification_backend_process_queue (self);
}

static void
_____lambda76__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda76_ (self, source_object, res);
	block25_data_unref (self);
}

static void
ft_notification_backend_process_queue (FtNotificationBackend* self)
{
	Block25Data* _data25_;
	gconstpointer _tmp0_;
	gconstpointer _tmp1_;
	FtNotificationBackendProvider* _tmp2_;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	FtNotificationBackendProvider* _tmp5_;
	FtQueuedNotification* item = NULL;
	GQueue* _tmp9_;
	gpointer _tmp10_;
	FtQueuedNotification* _tmp11_;
	g_return_if_fail (self != NULL);
	_data25_ = g_slice_new0 (Block25Data);
	_data25_->_ref_count_ = 1;
	_data25_->self = g_object_ref (self);
	_tmp0_ = ft_provided_object_get_provider ((FtProvidedObject*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 ((FtNotificationBackendProvider*) _tmp1_);
	_data25_->provider = _tmp2_;
	_tmp5_ = _data25_->provider;
	if (_tmp5_ == NULL) {
		_tmp4_ = TRUE;
	} else {
		FtNotificationBackendProvider* _tmp6_;
		gboolean _tmp7_;
		gboolean _tmp8_;
		_tmp6_ = _data25_->provider;
		_tmp7_ = ft_provider_get_enabled ((FtProvider*) _tmp6_);
		_tmp8_ = _tmp7_;
		_tmp4_ = !_tmp8_;
	}
	if (_tmp4_) {
		_tmp3_ = TRUE;
	} else {
		_tmp3_ = self->priv->processing_queue;
	}
	if (_tmp3_) {
		block25_data_unref (_data25_);
		_data25_ = NULL;
		return;
	}
	_tmp9_ = self->priv->queue;
	_tmp10_ = g_queue_pop_head (_tmp9_);
	item = (FtQueuedNotification*) _tmp10_;
	_tmp11_ = item;
	if (_tmp11_ != NULL) {
		FtQueuedNotification* _tmp12_;
		FtNotification* _tmp13_;
		self->priv->processing_queue = TRUE;
		_tmp12_ = item;
		_tmp13_ = _tmp12_->notification;
		if (_tmp13_ != NULL) {
			FtNotificationBackendProvider* _tmp14_;
			FtQueuedNotification* _tmp15_;
			const gchar* _tmp16_;
			FtQueuedNotification* _tmp17_;
			FtNotification* _tmp18_;
			_tmp14_ = _data25_->provider;
			_tmp15_ = item;
			_tmp16_ = _tmp15_->id;
			_tmp17_ = item;
			_tmp18_ = _tmp17_->notification;
			ft_notification_backend_provider_send_notification (_tmp14_, _tmp16_, _tmp18_, _____lambda75__gasync_ready_callback, block25_data_ref (_data25_));
		} else {
			FtNotificationBackendProvider* _tmp19_;
			FtQueuedNotification* _tmp20_;
			const gchar* _tmp21_;
			_tmp19_ = _data25_->provider;
			_tmp20_ = item;
			_tmp21_ = _tmp20_->id;
			ft_notification_backend_provider_withdraw_notification (_tmp19_, _tmp21_, _____lambda76__gasync_ready_callback, block25_data_ref (_data25_));
		}
	}
	_ft_queued_notification_free0 (item);
	block25_data_unref (_data25_);
	_data25_ = NULL;
}

static void
ft_notification_backend_remove_from_queue (FtNotificationBackend* self,
                                           const gchar* id)
{
	GList* link = NULL;
	GQueue* _tmp0_;
	GList* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (id != NULL);
	_tmp0_ = self->priv->queue;
	_tmp1_ = _tmp0_->head;
	link = _tmp1_;
	while (TRUE) {
		GList* _tmp2_;
		GList* _tmp3_;
		gconstpointer _tmp4_;
		const gchar* _tmp5_;
		_tmp2_ = link;
		if (!(_tmp2_ != NULL)) {
			break;
		}
		_tmp3_ = link;
		_tmp4_ = _tmp3_->data;
		_tmp5_ = ((FtQueuedNotification*) _tmp4_)->id;
		if (g_strcmp0 (_tmp5_, id) == 0) {
			GList* next_link = NULL;
			GList* _tmp6_;
			GList* _tmp7_;
			GQueue* _tmp8_;
			GList* _tmp9_;
			GList* _tmp10_;
			_tmp6_ = link;
			_tmp7_ = _tmp6_->next;
			next_link = _tmp7_;
			_tmp8_ = self->priv->queue;
			_tmp9_ = link;
			g_queue_delete_link (_tmp8_, _tmp9_);
			_tmp10_ = next_link;
			link = _tmp10_;
		} else {
			GList* _tmp11_;
			GList* _tmp12_;
			_tmp11_ = link;
			_tmp12_ = _tmp11_->next;
			link = _tmp12_;
		}
	}
}

static void
ft_notification_backend_real_initialize (FtProvidedObject* base)
{
	FtNotificationBackend * self;
	self = (FtNotificationBackend*) base;
}

static void
ft_notification_backend_real_setup_providers (FtProvidedObject* base)
{
	FtNotificationBackend * self;
	FtProviderSet* _tmp0_;
	FtFallbackNotificationBackendProvider* _tmp1_;
	FtFallbackNotificationBackendProvider* _tmp2_;
	self = (FtNotificationBackend*) base;
	_tmp0_ = ((FtProvidedObject*) self)->providers;
	_tmp1_ = ft_fallback_notification_backend_provider_new ();
	_tmp2_ = _tmp1_;
	ft_provider_set_add (_tmp0_, (FtNotificationBackendProvider*) _tmp2_, FT_PRIORITY_LOW);
	_g_object_unref0 (_tmp2_);
}

static void
ft_notification_backend_real_provider_enabled (FtProvidedObject* base,
                                               FtNotificationBackendProvider* provider)
{
	FtNotificationBackend * self;
	self = (FtNotificationBackend*) base;
	g_return_if_fail (provider != NULL);
	ft_notification_backend_process_queue (self);
}

static void
ft_notification_backend_real_provider_disabled (FtProvidedObject* base,
                                                FtNotificationBackendProvider* provider)
{
	FtNotificationBackend * self;
	self = (FtNotificationBackend*) base;
	g_return_if_fail (provider != NULL);
}

static void
ft_notification_backend_real_send_notification (FtNotificationBackendInterface* base,
                                                const gchar* id,
                                                FtNotification* notification)
{
	FtNotificationBackend * self;
	GQueue* _tmp0_;
	const gchar* _tmp1_;
	FtNotification* _tmp2_;
	gulong _tmp3_;
	FtQueuedNotification* _tmp4_;
	self = (FtNotificationBackend*) base;
	g_return_if_fail (id != NULL);
	g_return_if_fail (notification != NULL);
	ft_notification_backend_remove_from_queue (self, id);
	_tmp0_ = self->priv->queue;
	_tmp1_ = id;
	_tmp2_ = notification;
	_tmp3_ = self->priv->next_serial;
	self->priv->next_serial = _tmp3_ + 1;
	_tmp4_ = ft_queued_notification_new (_tmp1_, _tmp2_, _tmp3_);
	g_queue_push_tail (_tmp0_, _tmp4_);
	ft_notification_backend_process_queue (self);
}

static gint
__lambda78_ (FtNotificationBackend* self,
             FtQueuedNotification* a,
             FtQueuedNotification* b)
{
	gboolean _tmp0_ = FALSE;
	FtNotification* _tmp1_;
	gboolean _tmp3_ = FALSE;
	FtNotification* _tmp4_;
	gint _tmp6_ = 0;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	_tmp1_ = a->notification;
	if (_tmp1_ == NULL) {
		FtNotification* _tmp2_;
		_tmp2_ = b->notification;
		_tmp0_ = _tmp2_ != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		result = -1;
		return result;
	}
	_tmp4_ = a->notification;
	if (_tmp4_ != NULL) {
		FtNotification* _tmp5_;
		_tmp5_ = b->notification;
		_tmp3_ = _tmp5_ == NULL;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		result = 1;
		return result;
	}
	if (a->serial < b->serial) {
		_tmp6_ = -1;
	} else {
		_tmp6_ = 1;
	}
	result = _tmp6_;
	return result;
}

static gint
___lambda78__gcompare_data_func (gconstpointer a,
                                 gconstpointer b,
                                 gpointer self)
{
	gint result;
	result = __lambda78_ ((FtNotificationBackend*) self, (FtQueuedNotification*) a, (FtQueuedNotification*) b);
	return result;
}

static void
ft_notification_backend_real_withdraw_notification (FtNotificationBackendInterface* base,
                                                    const gchar* id)
{
	FtNotificationBackend * self;
	GQueue* _tmp0_;
	const gchar* _tmp1_;
	gulong _tmp2_;
	FtQueuedNotification* _tmp3_;
	GQueue* _tmp4_;
	self = (FtNotificationBackend*) base;
	g_return_if_fail (id != NULL);
	ft_notification_backend_remove_from_queue (self, id);
	_tmp0_ = self->priv->queue;
	_tmp1_ = id;
	_tmp2_ = self->priv->next_serial;
	self->priv->next_serial = _tmp2_ + 1;
	_tmp3_ = ft_queued_notification_new (_tmp1_, NULL, _tmp2_);
	g_queue_push_tail (_tmp0_, _tmp3_);
	_tmp4_ = self->priv->queue;
	g_queue_sort (_tmp4_, ___lambda78__gcompare_data_func, self);
	ft_notification_backend_process_queue (self);
}

static void
ft_notification_backend_real_dispose (GObject* base)
{
	FtNotificationBackend * self;
	GQueue* _tmp0_;
	self = (FtNotificationBackend*) base;
	_tmp0_ = self->priv->queue;
	if (_tmp0_ != NULL) {
		GQueue* _tmp1_;
		_tmp1_ = self->priv->queue;
		g_queue_clear (_tmp1_);
		(self->priv->queue == NULL) ? NULL : (self->priv->queue = (_g_queue_free__ft_queued_notification_free0_ (self->priv->queue), NULL));
		self->priv->queue = NULL;
	}
	G_OBJECT_CLASS (ft_notification_backend_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, FT_TYPE_PROVIDED_OBJECT, FtProvidedObject));
}

FtNotificationBackend*
ft_notification_backend_construct (GType object_type)
{
	FtNotificationBackend * self = NULL;
	self = (FtNotificationBackend*) ft_provided_object_construct (object_type, FT_TYPE_NOTIFICATION_BACKEND_PROVIDER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
	return self;
}

FtNotificationBackend*
ft_notification_backend_new (void)
{
	return ft_notification_backend_construct (FT_TYPE_NOTIFICATION_BACKEND);
}

static GObject *
ft_notification_backend_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	static GWeakRef FtNotificationBackend_singleton__ref;
	static GMutex FtNotificationBackend_singleton__lock;
	FtNotificationBackend * self;
	GQueue* _tmp0_;
	g_mutex_lock (&FtNotificationBackend_singleton__lock);
	obj = g_weak_ref_get (&FtNotificationBackend_singleton__ref);
	if (obj != NULL) {
		g_mutex_unlock (&FtNotificationBackend_singleton__lock);
		return obj;
	}
	parent_class = G_OBJECT_CLASS (ft_notification_backend_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_NOTIFICATION_BACKEND, FtNotificationBackend);
	_tmp0_ = g_queue_new ();
	(self->priv->queue == NULL) ? NULL : (self->priv->queue = (_g_queue_free__ft_queued_notification_free0_ (self->priv->queue), NULL));
	self->priv->queue = _tmp0_;
	g_weak_ref_set (&FtNotificationBackend_singleton__ref, obj);
	g_mutex_unlock (&FtNotificationBackend_singleton__lock);
	return obj;
}

static void
ft_notification_backend_class_init (FtNotificationBackendClass * klass,
                                    gpointer klass_data)
{
	ft_notification_backend_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FtNotificationBackend_private_offset);
	((FtProvidedObjectClass *) klass)->initialize = (void (*) (FtProvidedObject*)) ft_notification_backend_real_initialize;
	((FtProvidedObjectClass *) klass)->setup_providers = (void (*) (FtProvidedObject*)) ft_notification_backend_real_setup_providers;
	((FtProvidedObjectClass *) klass)->provider_enabled = (void (*) (FtProvidedObject*, gconstpointer)) ft_notification_backend_real_provider_enabled;
	((FtProvidedObjectClass *) klass)->provider_disabled = (void (*) (FtProvidedObject*, gconstpointer)) ft_notification_backend_real_provider_disabled;
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) ft_notification_backend_real_dispose;
	G_OBJECT_CLASS (klass)->constructor = ft_notification_backend_constructor;
	G_OBJECT_CLASS (klass)->finalize = ft_notification_backend_finalize;
}

static void
ft_notification_backend_ft_notification_backend_interface_interface_init (FtNotificationBackendInterfaceIface * iface,
                                                                          gpointer iface_data)
{
	ft_notification_backend_ft_notification_backend_interface_parent_iface = g_type_interface_peek_parent (iface);
	iface->send_notification = (void (*) (FtNotificationBackendInterface*, const gchar*, FtNotification*)) ft_notification_backend_real_send_notification;
	iface->withdraw_notification = (void (*) (FtNotificationBackendInterface*, const gchar*)) ft_notification_backend_real_withdraw_notification;
}

static void
ft_notification_backend_instance_init (FtNotificationBackend * self,
                                       gpointer klass)
{
	self->priv = ft_notification_backend_get_instance_private (self);
	self->priv->processing_queue = FALSE;
	self->priv->next_serial = (gulong) 1U;
}

static void
ft_notification_backend_finalize (GObject * obj)
{
	FtNotificationBackend * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FT_TYPE_NOTIFICATION_BACKEND, FtNotificationBackend);
	(self->priv->queue == NULL) ? NULL : (self->priv->queue = (_g_queue_free__ft_queued_notification_free0_ (self->priv->queue), NULL));
	G_OBJECT_CLASS (ft_notification_backend_parent_class)->finalize (obj);
}

/**
     * `Application.send_notification()` already supports multiple backends, which works fine on
     * GNOME, but not so much on other desktops - especially when using "portal" backend.
     * On top of it, we would like some lower-level access to suppress notification sounds and to
     * handle rate limits. That's why a custom backend is needed in our case.
     */
static GType
ft_notification_backend_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (FtNotificationBackendClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ft_notification_backend_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FtNotificationBackend), 0, (GInstanceInitFunc) ft_notification_backend_instance_init, NULL };
	static const GInterfaceInfo ft_notification_backend_interface_info = { (GInterfaceInitFunc) ft_notification_backend_ft_notification_backend_interface_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType ft_notification_backend_type_id;
	ft_notification_backend_type_id = g_type_register_static (FT_TYPE_PROVIDED_OBJECT, "FtNotificationBackend", &g_define_type_info, 0);
	g_type_add_interface_static (ft_notification_backend_type_id, FT_TYPE_NOTIFICATION_BACKEND_INTERFACE, &ft_notification_backend_interface_info);
	FtNotificationBackend_private_offset = g_type_add_instance_private (ft_notification_backend_type_id, sizeof (FtNotificationBackendPrivate));
	return ft_notification_backend_type_id;
}

GType
ft_notification_backend_get_type (void)
{
	static volatile gsize ft_notification_backend_type_id__once = 0;
	if (g_once_init_enter (&ft_notification_backend_type_id__once)) {
		GType ft_notification_backend_type_id;
		ft_notification_backend_type_id = ft_notification_backend_get_type_once ();
		g_once_init_leave (&ft_notification_backend_type_id__once, ft_notification_backend_type_id);
	}
	return ft_notification_backend_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

