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

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

#include "ft_plugin_kde.h"
#include <gio/gio.h>
#include "ft_core.h"
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <config.h>
#include "ft_ui.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  {
	KDE_APPLICATION_EXTENSION_0_PROPERTY,
	KDE_APPLICATION_EXTENSION_NUM_PROPERTIES
};
static GParamSpec* kde_application_extension_properties[KDE_APPLICATION_EXTENSION_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block1Data Block1Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _KdeApplicationExtensionPrivate {
	GSettings* settings;
	FtSessionManager* session_manager;
	guint notifications_watcher_id;
	KdeNotifications* notifications_proxy;
	guint32 notifications_inhibitor_id;
	GCancellable* cancellable;
};

struct _Block1Data {
	int _ref_count_;
	KdeApplicationExtension* self;
	KdeNotifications* proxy;
	guint32 notifications_inhibitor_id;
};

static gint KdeApplicationExtension_private_offset;
static gpointer kde_application_extension_parent_class = NULL;
static GType kde_application_extension_type_id = 0;

static void kde_application_extension_update_notifications_inhibitor (KdeApplicationExtension* self);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void _g_free0_ (gpointer var);
static void _g_variant_unref0_ (gpointer var);
static void ___lambda4_ (Block1Data* _data1_,
                  GObject* obj,
                  GAsyncResult* res);
static void ____lambda4__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void ___lambda5_ (Block1Data* _data1_,
                  GObject* obj,
                  GAsyncResult* res);
static void ____lambda5__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void kde_application_extension_on_notifications_proxy_name_appeared (KdeApplicationExtension* self,
                                                                     GDBusConnection* connection,
                                                                     const gchar* name,
                                                                     const gchar* name_owner);
static void kde_application_extension_on_notifications_proxy_name_vanished (KdeApplicationExtension* self,
                                                                     GDBusConnection* connection,
                                                                     const gchar* name);
static void kde_application_extension_on_notify_current_state (KdeApplicationExtension* self);
static void kde_application_extension_on_settings_changed (KdeApplicationExtension* self,
                                                    GSettings* settings,
                                                    const gchar* key);
static void kde_application_extension_real_dispose (GObject* base);
static void _kde_application_extension_on_settings_changed_g_settings_changed (GSettings* _sender,
                                                                        const gchar* key,
                                                                        gpointer self);
static GObject * kde_application_extension_constructor (GType type,
                                                 guint n_construct_properties,
                                                 GObjectConstructParam * construct_properties);
static void _kde_application_extension_on_notify_current_state_g_object_notify (GObject* _sender,
                                                                         GParamSpec* pspec,
                                                                         gpointer self);
static void _kde_application_extension_on_notifications_proxy_name_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                                  const gchar* name,
                                                                                                  const gchar* name_owner,
                                                                                                  gpointer self);
static void _kde_application_extension_on_notifications_proxy_name_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                                  const gchar* name,
                                                                                                  gpointer self);
static void kde_application_extension_finalize (GObject * obj);

static inline gpointer
kde_application_extension_get_instance_private (KdeApplicationExtension* self)
{
	return G_STRUCT_MEMBER_P (self, KdeApplicationExtension_private_offset);
}

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

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		KdeApplicationExtension* self;
		self = _data1_->self;
		_g_object_unref0 (_data1_->proxy);
		_g_object_unref0 (self);
		g_slice_free (Block1Data, _data1_);
	}
}

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

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

static void
_g_variant_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_variant_unref (var), NULL));
}

static void
___lambda4_ (Block1Data* _data1_,
             GObject* obj,
             GAsyncResult* res)
{
	KdeApplicationExtension* self;
	GError* _inner_error0_ = NULL;
	self = _data1_->self;
	g_return_if_fail (res != NULL);
	{
		guint32 _tmp0_ = 0U;
		KdeNotifications* _tmp1_;
		_tmp1_ = _data1_->proxy;
		_tmp0_ = kde_notifications_inhibit_finish (_tmp1_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		self->priv->notifications_inhibitor_id = _tmp0_;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp2_;
		const gchar* _tmp3_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp2_ = _error_;
		_tmp3_ = _tmp2_->message;
		g_warning ("application-extension.vala:64: Unable to add notifications inhibitor: " \
"%s", _tmp3_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
____lambda4__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	___lambda4_ (self, source_object, res);
	block1_data_unref (self);
}

static void
___lambda5_ (Block1Data* _data1_,
             GObject* obj,
             GAsyncResult* res)
{
	KdeApplicationExtension* self;
	GError* _inner_error0_ = NULL;
	self = _data1_->self;
	g_return_if_fail (res != NULL);
	{
		KdeNotifications* _tmp0_;
		_tmp0_ = _data1_->proxy;
		kde_notifications_uninhibit_finish (_tmp0_, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (self->priv->notifications_inhibitor_id == _data1_->notifications_inhibitor_id) {
			self->priv->notifications_inhibitor_id = (guint32) 0U;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp1_;
		const gchar* _tmp2_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = _error_;
		_tmp2_ = _tmp1_->message;
		g_warning ("application-extension.vala:84: Unable to remove notifications inhibito" \
"r: %s", _tmp2_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
____lambda5__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	___lambda5_ (self, source_object, res);
	block1_data_unref (self);
}

static void
kde_application_extension_update_notifications_inhibitor (KdeApplicationExtension* self)
{
	Block1Data* _data1_;
	KdeNotifications* _tmp0_;
	KdeNotifications* _tmp1_;
	KdeNotifications* _tmp2_;
	gboolean _tmp3_ = FALSE;
	FtSessionManager* _tmp4_;
	gboolean should_inhibit = FALSE;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp11_ = FALSE;
	gboolean _tmp19_ = FALSE;
	gboolean _tmp20_ = FALSE;
	g_return_if_fail (self != NULL);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_data1_->self = g_object_ref (self);
	_tmp0_ = self->priv->notifications_proxy;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_data1_->proxy = _tmp1_;
	_tmp2_ = _data1_->proxy;
	if (_tmp2_ == NULL) {
		block1_data_unref (_data1_);
		_data1_ = NULL;
		return;
	}
	_tmp4_ = self->priv->session_manager;
	if (_tmp4_ != NULL) {
		gboolean _tmp5_ = FALSE;
		FtSessionManager* _tmp6_;
		FtState _tmp7_;
		FtState _tmp8_;
		_tmp6_ = self->priv->session_manager;
		_tmp7_ = ft_session_manager_get_current_state (_tmp6_);
		_tmp8_ = _tmp7_;
		if (_tmp8_ != FT_STATE_STOPPED) {
			GSettings* _tmp9_;
			_tmp9_ = self->priv->settings;
			_tmp5_ = g_settings_get_boolean (_tmp9_, "manage-notifications");
		} else {
			_tmp5_ = FALSE;
		}
		_tmp3_ = _tmp5_;
	} else {
		_tmp3_ = FALSE;
	}
	should_inhibit = _tmp3_;
	_data1_->notifications_inhibitor_id = self->priv->notifications_inhibitor_id;
	if (should_inhibit) {
		_tmp11_ = _data1_->notifications_inhibitor_id == ((guint32) 0);
	} else {
		_tmp11_ = FALSE;
	}
	if (_tmp11_) {
		GCancellable* _tmp12_;
		_tmp12_ = self->priv->cancellable;
		_tmp10_ = _tmp12_ != NULL;
	} else {
		_tmp10_ = FALSE;
	}
	if (_tmp10_) {
		GHashTable* inhibit_hints = NULL;
		GHashFunc _tmp13_;
		GEqualFunc _tmp14_;
		GHashTable* _tmp15_;
		KdeNotifications* _tmp16_;
		GHashTable* _tmp17_;
		GCancellable* _tmp18_;
		_tmp13_ = g_str_hash;
		_tmp14_ = g_str_equal;
		_tmp15_ = g_hash_table_new_full (_tmp13_, _tmp14_, _g_free0_, _g_variant_unref0_);
		inhibit_hints = _tmp15_;
		_tmp16_ = _data1_->proxy;
		_tmp17_ = inhibit_hints;
		_tmp18_ = self->priv->cancellable;
		kde_notifications_inhibit (_tmp16_, APPLICATION_ID, "", _tmp17_, _tmp18_, ____lambda4__gasync_ready_callback, block1_data_ref (_data1_));
		_g_hash_table_unref0 (inhibit_hints);
	}
	if (!should_inhibit) {
		_tmp20_ = _data1_->notifications_inhibitor_id != ((guint32) 0);
	} else {
		_tmp20_ = FALSE;
	}
	if (_tmp20_) {
		_tmp19_ = TRUE;
	} else {
		GCancellable* _tmp21_;
		_tmp21_ = self->priv->cancellable;
		_tmp19_ = _tmp21_ == NULL;
	}
	if (_tmp19_) {
		KdeNotifications* _tmp22_;
		_tmp22_ = _data1_->proxy;
		kde_notifications_uninhibit (_tmp22_, _data1_->notifications_inhibitor_id, ____lambda5__gasync_ready_callback, block1_data_ref (_data1_));
	}
	block1_data_unref (_data1_);
	_data1_ = NULL;
}

static void
kde_application_extension_on_notifications_proxy_name_appeared (KdeApplicationExtension* self,
                                                                GDBusConnection* connection,
                                                                const gchar* name,
                                                                const gchar* name_owner)
{
	gchar* server_name = NULL;
	gchar* server_vendor = NULL;
	gchar* version = NULL;
	gchar* spec_version = NULL;
	KdeNotifications* _tmp0_;
	GError* _inner_error0_ = NULL;
	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);
	_tmp0_ = self->priv->notifications_proxy;
	if (_tmp0_ != NULL) {
		_g_free0 (spec_version);
		_g_free0 (version);
		_g_free0 (server_vendor);
		_g_free0 (server_name);
		return;
	}
	{
		KdeNotifications* proxy = NULL;
		GCancellable* _tmp1_;
		KdeNotifications* _tmp2_;
		KdeNotifications* _tmp3_;
		gchar* _tmp4_ = NULL;
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		gchar* _tmp7_ = NULL;
		gboolean _tmp8_ = FALSE;
		const gchar* _tmp9_;
		KdeNotifications* _tmp13_;
		KdeNotifications* _tmp14_;
		_tmp1_ = self->priv->cancellable;
		_tmp2_ = (KdeNotifications*) g_initable_new (KDE_TYPE_NOTIFICATIONS_PROXY, _tmp1_, &_inner_error0_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, "g-name", "org.freedesktop.Notifications", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/freedesktop/Notifications", "g-interface-name", "org.freedesktop.Notifications", NULL);
		proxy = (KdeNotifications*) _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp3_ = proxy;
		kde_notifications_get_server_information (_tmp3_, &_tmp4_, &_tmp5_, &_tmp6_, &_tmp7_, &_inner_error0_);
		_g_free0 (server_name);
		server_name = _tmp4_;
		_g_free0 (server_vendor);
		server_vendor = _tmp5_;
		_g_free0 (version);
		version = _tmp6_;
		_g_free0 (spec_version);
		spec_version = _tmp7_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (proxy);
			goto __catch0_g_error;
		}
		_tmp9_ = server_name;
		if (g_strcmp0 (_tmp9_, "Plasma") != 0) {
			_tmp8_ = TRUE;
		} else {
			const gchar* _tmp10_;
			_tmp10_ = server_vendor;
			_tmp8_ = g_strcmp0 (_tmp10_, "KDE") != 0;
		}
		if (_tmp8_) {
			const gchar* _tmp11_;
			const gchar* _tmp12_;
			_tmp11_ = server_name;
			_tmp12_ = server_vendor;
			g_debug ("application-extension.vala:118: Notifications proxy is not from KDE: %" \
"s (%s)", _tmp11_, _tmp12_);
			_g_object_unref0 (proxy);
			_g_free0 (spec_version);
			_g_free0 (version);
			_g_free0 (server_vendor);
			_g_free0 (server_name);
			return;
		}
		_tmp13_ = proxy;
		_tmp14_ = _g_object_ref0 (_tmp13_);
		_g_object_unref0 (self->priv->notifications_proxy);
		self->priv->notifications_proxy = _tmp14_;
		kde_application_extension_update_notifications_inhibitor (self);
		_g_object_unref0 (proxy);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp15_;
		const gchar* _tmp16_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp15_ = _error_;
		_tmp16_ = _tmp15_->message;
		g_warning ("application-extension.vala:126: Error while initializing notifications" \
" proxy: %s", _tmp16_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (spec_version);
		_g_free0 (version);
		_g_free0 (server_vendor);
		_g_free0 (server_name);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_free0 (spec_version);
	_g_free0 (version);
	_g_free0 (server_vendor);
	_g_free0 (server_name);
}

static void
kde_application_extension_on_notifications_proxy_name_vanished (KdeApplicationExtension* self,
                                                                GDBusConnection* connection,
                                                                const gchar* name)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	_g_object_unref0 (self->priv->notifications_proxy);
	self->priv->notifications_proxy = NULL;
}

static void
kde_application_extension_on_notify_current_state (KdeApplicationExtension* self)
{
	g_return_if_fail (self != NULL);
	kde_application_extension_update_notifications_inhibitor (self);
}

static void
kde_application_extension_on_settings_changed (KdeApplicationExtension* self,
                                               GSettings* settings,
                                               const gchar* key)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (settings != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = key;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("manage-notifications")))) {
		switch (0) {
			default:
			{
				kde_application_extension_update_notifications_inhibitor (self);
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				break;
			}
		}
	}
}

static void
_kde_application_extension_on_settings_changed_g_settings_changed (GSettings* _sender,
                                                                   const gchar* key,
                                                                   gpointer self)
{
	kde_application_extension_on_settings_changed ((KdeApplicationExtension*) self, _sender, key);
}

static void
kde_application_extension_real_dispose (GObject* base)
{
	KdeApplicationExtension * self;
	GCancellable* _tmp0_;
	GSettings* _tmp2_;
	self = (KdeApplicationExtension*) base;
	_tmp0_ = self->priv->cancellable;
	if (_tmp0_ != NULL) {
		GCancellable* _tmp1_;
		_tmp1_ = self->priv->cancellable;
		g_cancellable_cancel (_tmp1_);
		_g_object_unref0 (self->priv->cancellable);
		self->priv->cancellable = NULL;
	}
	if (self->priv->notifications_watcher_id != ((guint) 0)) {
		g_bus_unwatch_name (self->priv->notifications_watcher_id);
		self->priv->notifications_watcher_id = (guint) 0;
	}
	_tmp2_ = self->priv->settings;
	if (_tmp2_ != NULL) {
		GSettings* _tmp3_;
		guint _tmp4_;
		kde_application_extension_update_notifications_inhibitor (self);
		_tmp3_ = self->priv->settings;
		g_signal_parse_name ("changed", g_settings_get_type (), &_tmp4_, NULL, FALSE);
		g_signal_handlers_disconnect_matched (_tmp3_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp4_, 0, NULL, (GCallback) _kde_application_extension_on_settings_changed_g_settings_changed, self);
		_g_object_unref0 (self->priv->settings);
		self->priv->settings = NULL;
	}
	_g_object_unref0 (self->priv->notifications_proxy);
	self->priv->notifications_proxy = NULL;
	G_OBJECT_CLASS (kde_application_extension_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, FT_TYPE_APPLICATION_EXTENSION, FtApplicationExtension));
}

KdeApplicationExtension*
kde_application_extension_construct (GType object_type)
{
	KdeApplicationExtension * self = NULL;
	self = (KdeApplicationExtension*) ft_application_extension_construct (object_type);
	return self;
}

KdeApplicationExtension*
kde_application_extension_new (void)
{
	return kde_application_extension_construct (KDE_TYPE_APPLICATION_EXTENSION);
}

static void
_kde_application_extension_on_notify_current_state_g_object_notify (GObject* _sender,
                                                                    GParamSpec* pspec,
                                                                    gpointer self)
{
	kde_application_extension_on_notify_current_state ((KdeApplicationExtension*) self);
}

static void
_kde_application_extension_on_notifications_proxy_name_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                             const gchar* name,
                                                                                             const gchar* name_owner,
                                                                                             gpointer self)
{
	kde_application_extension_on_notifications_proxy_name_appeared ((KdeApplicationExtension*) self, connection, name, name_owner);
}

static void
_kde_application_extension_on_notifications_proxy_name_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                             const gchar* name,
                                                                                             gpointer self)
{
	kde_application_extension_on_notifications_proxy_name_vanished ((KdeApplicationExtension*) self, connection, name);
}

static GObject *
kde_application_extension_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	KdeApplicationExtension * self;
	GCancellable* _tmp0_;
	FtSessionManager* _tmp1_;
	FtSessionManager* _tmp2_;
	FtSessionManager* _tmp3_;
	GSettings* _tmp4_;
	GSettings* _tmp5_;
	parent_class = G_OBJECT_CLASS (kde_application_extension_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, KDE_TYPE_APPLICATION_EXTENSION, KdeApplicationExtension);
	_tmp0_ = g_cancellable_new ();
	_g_object_unref0 (self->priv->cancellable);
	self->priv->cancellable = _tmp0_;
	_tmp1_ = ft_session_manager_get_default ();
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (self->priv->session_manager);
	self->priv->session_manager = _tmp2_;
	_tmp3_ = self->priv->session_manager;
	g_signal_connect_object ((GObject*) _tmp3_, "notify::current-state", (GCallback) _kde_application_extension_on_notify_current_state_g_object_notify, self, 0);
	_tmp4_ = g_settings_new ("io.github.focustimerhq.FocusTimer.plugins.kde");
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp4_;
	_tmp5_ = self->priv->settings;
	g_signal_connect_object (_tmp5_, "changed", (GCallback) _kde_application_extension_on_settings_changed_g_settings_changed, self, 0);
	self->priv->notifications_watcher_id = g_bus_watch_name_with_closures (G_BUS_TYPE_SESSION, "org.freedesktop.Notifications", G_BUS_NAME_WATCHER_FLAGS_NONE, (GClosure*) ((_kde_application_extension_on_notifications_proxy_name_appeared_gbus_name_appeared_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _kde_application_extension_on_notifications_proxy_name_appeared_gbus_name_appeared_callback, g_object_ref (self), (GClosureNotify) g_object_unref)), (GClosure*) ((_kde_application_extension_on_notifications_proxy_name_vanished_gbus_name_vanished_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _kde_application_extension_on_notifications_proxy_name_vanished_gbus_name_vanished_callback, g_object_ref (self), (GClosureNotify) g_object_unref)));
	return obj;
}

static void
kde_application_extension_class_init (KdeApplicationExtensionClass * klass,
                                      gpointer klass_data)
{
	kde_application_extension_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &KdeApplicationExtension_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) kde_application_extension_real_dispose;
	G_OBJECT_CLASS (klass)->constructor = kde_application_extension_constructor;
	G_OBJECT_CLASS (klass)->finalize = kde_application_extension_finalize;
}

static void
kde_application_extension_instance_init (KdeApplicationExtension * self,
                                         gpointer klass)
{
	self->priv = kde_application_extension_get_instance_private (self);
	self->priv->settings = NULL;
	self->priv->session_manager = NULL;
	self->priv->notifications_watcher_id = (guint) 0;
	self->priv->notifications_proxy = NULL;
	self->priv->notifications_inhibitor_id = (guint32) 0;
	self->priv->cancellable = NULL;
}

static void
kde_application_extension_finalize (GObject * obj)
{
	KdeApplicationExtension * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, KDE_TYPE_APPLICATION_EXTENSION, KdeApplicationExtension);
	_g_object_unref0 (self->priv->settings);
	_g_object_unref0 (self->priv->session_manager);
	_g_object_unref0 (self->priv->notifications_proxy);
	_g_object_unref0 (self->priv->cancellable);
	G_OBJECT_CLASS (kde_application_extension_parent_class)->finalize (obj);
}

GType
kde_application_extension_get_type (void)
{
	return kde_application_extension_type_id;
}

GType
kde_application_extension_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (KdeApplicationExtensionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) kde_application_extension_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (KdeApplicationExtension), 0, (GInstanceInitFunc) kde_application_extension_instance_init, NULL };
	kde_application_extension_type_id = g_type_module_register_type (module, FT_TYPE_APPLICATION_EXTENSION, "KdeApplicationExtension", &g_define_type_info, 0);
	KdeApplicationExtension_private_offset = sizeof (KdeApplicationExtensionPrivate);
	return kde_application_extension_type_id;
}

