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

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

#include "ft_plugin_freedesktop.h"
#include <glib.h>
#include "ft_core.h"
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	FREEDESKTOP_SLEEP_MONITOR_PROVIDER_0_PROPERTY,
	FREEDESKTOP_SLEEP_MONITOR_PROVIDER_NUM_PROPERTIES
};
static GParamSpec* freedesktop_sleep_monitor_provider_properties[FREEDESKTOP_SLEEP_MONITOR_PROVIDER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _FreedesktopSleepMonitorProviderInitializeData FreedesktopSleepMonitorProviderInitializeData;
typedef struct _FreedesktopSleepMonitorProviderUninitializeData FreedesktopSleepMonitorProviderUninitializeData;
typedef struct _FreedesktopSleepMonitorProviderEnableData FreedesktopSleepMonitorProviderEnableData;
typedef struct _FreedesktopSleepMonitorProviderDisableData FreedesktopSleepMonitorProviderDisableData;

struct _FreedesktopSleepMonitorProviderPrivate {
	FreedesktopLoginManager* login_manager_proxy;
	guint watcher_id;
};

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

struct _FreedesktopSleepMonitorProviderUninitializeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FreedesktopSleepMonitorProvider* self;
};

struct _FreedesktopSleepMonitorProviderEnableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FreedesktopSleepMonitorProvider* self;
	GCancellable* cancellable;
	FreedesktopLoginManager* _tmp0_;
	FreedesktopLoginManager* _tmp1_;
	FreedesktopLoginManager* _tmp2_;
	FreedesktopLoginManager* _tmp3_;
	GError* _inner_error0_;
};

struct _FreedesktopSleepMonitorProviderDisableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FreedesktopSleepMonitorProvider* self;
	FreedesktopLoginManager* _tmp0_;
	guint _tmp1_;
};

static gint FreedesktopSleepMonitorProvider_private_offset;
static gpointer freedesktop_sleep_monitor_provider_parent_class = NULL;
static FtSleepMonitorProviderIface * freedesktop_sleep_monitor_provider_ft_sleep_monitor_provider_parent_iface = NULL;
static GType freedesktop_sleep_monitor_provider_type_id = 0;

static void freedesktop_sleep_monitor_provider_on_name_appeared (FreedesktopSleepMonitorProvider* self,
                                                          GDBusConnection* connection,
                                                          const gchar* name,
                                                          const gchar* name_owner);
static void freedesktop_sleep_monitor_provider_on_name_vanished (FreedesktopSleepMonitorProvider* self,
                                                          GDBusConnection* connection,
                                                          const gchar* name);
static void freedesktop_sleep_monitor_provider_on_prepare_for_sleep (FreedesktopSleepMonitorProvider* self,
                                                              FreedesktopLoginManager* proxy,
                                                              gboolean about_to_suspend);
static void freedesktop_sleep_monitor_provider_real_initialize_data_free (gpointer _data);
static void freedesktop_sleep_monitor_provider_real_initialize (FtProvider* base,
                                                         GCancellable* cancellable,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
static gboolean freedesktop_sleep_monitor_provider_real_initialize_co (FreedesktopSleepMonitorProviderInitializeData* _data_);
static void _freedesktop_sleep_monitor_provider_on_name_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                       const gchar* name,
                                                                                       const gchar* name_owner,
                                                                                       gpointer self);
static void _freedesktop_sleep_monitor_provider_on_name_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                       const gchar* name,
                                                                                       gpointer self);
static void freedesktop_sleep_monitor_provider_real_uninitialize_data_free (gpointer _data);
static void freedesktop_sleep_monitor_provider_real_uninitialize (FtProvider* base,
                                                           GAsyncReadyCallback _callback_,
                                                           gpointer _user_data_);
static gboolean freedesktop_sleep_monitor_provider_real_uninitialize_co (FreedesktopSleepMonitorProviderUninitializeData* _data_);
static void freedesktop_sleep_monitor_provider_real_enable_data_free (gpointer _data);
static void freedesktop_sleep_monitor_provider_real_enable (FtProvider* base,
                                                     GCancellable* cancellable,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_);
static gboolean freedesktop_sleep_monitor_provider_real_enable_co (FreedesktopSleepMonitorProviderEnableData* _data_);
static void freedesktop_sleep_monitor_provider_enable_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
static void _freedesktop_sleep_monitor_provider_on_prepare_for_sleep_freedesktop_login_manager_prepare_for_sleep (FreedesktopLoginManager* _sender,
                                                                                                           gboolean active,
                                                                                                           gpointer self);
static void freedesktop_sleep_monitor_provider_real_disable_data_free (gpointer _data);
static void freedesktop_sleep_monitor_provider_real_disable (FtProvider* base,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_);
static gboolean freedesktop_sleep_monitor_provider_real_disable_co (FreedesktopSleepMonitorProviderDisableData* _data_);
static void freedesktop_sleep_monitor_provider_finalize (GObject * obj);

static inline gpointer
freedesktop_sleep_monitor_provider_get_instance_private (FreedesktopSleepMonitorProvider* self)
{
	return G_STRUCT_MEMBER_P (self, FreedesktopSleepMonitorProvider_private_offset);
}

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

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

static void
freedesktop_sleep_monitor_provider_on_prepare_for_sleep (FreedesktopSleepMonitorProvider* self,
                                                         FreedesktopLoginManager* proxy,
                                                         gboolean about_to_suspend)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (proxy != NULL);
	if (about_to_suspend) {
		g_signal_emit_by_name ((FtSleepMonitorProvider*) self, "prepare-for-sleep");
	} else {
		g_signal_emit_by_name ((FtSleepMonitorProvider*) self, "woke-up");
	}
}

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

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

static void
freedesktop_sleep_monitor_provider_real_initialize (FtProvider* base,
                                                    GCancellable* cancellable,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	FreedesktopSleepMonitorProvider * self;
	FreedesktopSleepMonitorProviderInitializeData* _data_;
	FreedesktopSleepMonitorProvider* _tmp0_;
	GCancellable* _tmp1_;
	self = (FreedesktopSleepMonitorProvider*) base;
	_data_ = g_slice_new0 (FreedesktopSleepMonitorProviderInitializeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, freedesktop_sleep_monitor_provider_real_initialize_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	freedesktop_sleep_monitor_provider_real_initialize_co (_data_);
}

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

static void
_freedesktop_sleep_monitor_provider_on_name_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                  const gchar* name,
                                                                                  const gchar* name_owner,
                                                                                  gpointer self)
{
	freedesktop_sleep_monitor_provider_on_name_appeared ((FreedesktopSleepMonitorProvider*) self, connection, name, name_owner);
}

static void
_freedesktop_sleep_monitor_provider_on_name_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                  const gchar* name,
                                                                                  gpointer self)
{
	freedesktop_sleep_monitor_provider_on_name_vanished ((FreedesktopSleepMonitorProvider*) self, connection, name);
}

static gboolean
freedesktop_sleep_monitor_provider_real_initialize_co (FreedesktopSleepMonitorProviderInitializeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->self->priv->watcher_id = g_bus_watch_name_with_closures (G_BUS_TYPE_SYSTEM, "org.freedesktop.login1", G_BUS_NAME_WATCHER_FLAGS_NONE, (GClosure*) ((_freedesktop_sleep_monitor_provider_on_name_appeared_gbus_name_appeared_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _freedesktop_sleep_monitor_provider_on_name_appeared_gbus_name_appeared_callback, g_object_ref (_data_->self), (GClosureNotify) g_object_unref)), (GClosure*) ((_freedesktop_sleep_monitor_provider_on_name_vanished_gbus_name_vanished_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _freedesktop_sleep_monitor_provider_on_name_vanished_gbus_name_vanished_callback, g_object_ref (_data_->self), (GClosureNotify) g_object_unref)));
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
freedesktop_sleep_monitor_provider_real_uninitialize (FtProvider* base,
                                                      GAsyncReadyCallback _callback_,
                                                      gpointer _user_data_)
{
	FreedesktopSleepMonitorProvider * self;
	FreedesktopSleepMonitorProviderUninitializeData* _data_;
	FreedesktopSleepMonitorProvider* _tmp0_;
	self = (FreedesktopSleepMonitorProvider*) base;
	_data_ = g_slice_new0 (FreedesktopSleepMonitorProviderUninitializeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, freedesktop_sleep_monitor_provider_real_uninitialize_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	freedesktop_sleep_monitor_provider_real_uninitialize_co (_data_);
}

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

static gboolean
freedesktop_sleep_monitor_provider_real_uninitialize_co (FreedesktopSleepMonitorProviderUninitializeData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->self->priv->watcher_id != ((guint) 0)) {
		g_bus_unwatch_name (_data_->self->priv->watcher_id);
		_data_->self->priv->watcher_id = (guint) 0;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
freedesktop_sleep_monitor_provider_real_enable (FtProvider* base,
                                                GCancellable* cancellable,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_)
{
	FreedesktopSleepMonitorProvider * self;
	FreedesktopSleepMonitorProviderEnableData* _data_;
	FreedesktopSleepMonitorProvider* _tmp0_;
	GCancellable* _tmp1_;
	self = (FreedesktopSleepMonitorProvider*) base;
	_data_ = g_slice_new0 (FreedesktopSleepMonitorProviderEnableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, freedesktop_sleep_monitor_provider_real_enable_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	freedesktop_sleep_monitor_provider_real_enable_co (_data_);
}

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

static void
freedesktop_sleep_monitor_provider_enable_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_)
{
	FreedesktopSleepMonitorProviderEnableData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	freedesktop_sleep_monitor_provider_real_enable_co (_data_);
}

static void
_freedesktop_sleep_monitor_provider_on_prepare_for_sleep_freedesktop_login_manager_prepare_for_sleep (FreedesktopLoginManager* _sender,
                                                                                                      gboolean active,
                                                                                                      gpointer self)
{
	freedesktop_sleep_monitor_provider_on_prepare_for_sleep ((FreedesktopSleepMonitorProvider*) self, _sender, active);
}

static gboolean
freedesktop_sleep_monitor_provider_real_enable_co (FreedesktopSleepMonitorProviderEnableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	g_async_initable_new_async (FREEDESKTOP_TYPE_LOGIN_MANAGER_PROXY, 0, NULL, freedesktop_sleep_monitor_provider_enable_ready, _data_, "g-flags", 0, "g-name", "org.freedesktop.login1", "g-bus-type", G_BUS_TYPE_SYSTEM, "g-object-path", "/org/freedesktop/login1", "g-interface-name", "org.freedesktop.login1.Manager", NULL);
	return FALSE;
	_state_1:
	_data_->_tmp1_ = (FreedesktopLoginManager*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp0_ = (FreedesktopLoginManager*) _data_->_tmp1_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = _data_->_tmp0_;
	_data_->_tmp0_ = NULL;
	_g_object_unref0 (_data_->self->priv->login_manager_proxy);
	_data_->self->priv->login_manager_proxy = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->self->priv->login_manager_proxy;
	g_signal_connect_object (_data_->_tmp3_, "prepare-for-sleep", (GCallback) _freedesktop_sleep_monitor_provider_on_prepare_for_sleep_freedesktop_login_manager_prepare_for_sleep, _data_->self, 0);
	_g_object_unref0 (_data_->_tmp0_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

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

static void
freedesktop_sleep_monitor_provider_real_disable (FtProvider* base,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	FreedesktopSleepMonitorProvider * self;
	FreedesktopSleepMonitorProviderDisableData* _data_;
	FreedesktopSleepMonitorProvider* _tmp0_;
	self = (FreedesktopSleepMonitorProvider*) base;
	_data_ = g_slice_new0 (FreedesktopSleepMonitorProviderDisableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, freedesktop_sleep_monitor_provider_real_disable_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	freedesktop_sleep_monitor_provider_real_disable_co (_data_);
}

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

static gboolean
freedesktop_sleep_monitor_provider_real_disable_co (FreedesktopSleepMonitorProviderDisableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->login_manager_proxy;
	g_signal_parse_name ("prepare-for-sleep", FREEDESKTOP_TYPE_LOGIN_MANAGER, &_data_->_tmp1_, NULL, FALSE);
	g_signal_handlers_disconnect_matched (_data_->_tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _data_->_tmp1_, 0, NULL, (GCallback) _freedesktop_sleep_monitor_provider_on_prepare_for_sleep_freedesktop_login_manager_prepare_for_sleep, _data_->self);
	_g_object_unref0 (_data_->self->priv->login_manager_proxy);
	_data_->self->priv->login_manager_proxy = 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;
}

FreedesktopSleepMonitorProvider*
freedesktop_sleep_monitor_provider_construct (GType object_type)
{
	FreedesktopSleepMonitorProvider * self = NULL;
	self = (FreedesktopSleepMonitorProvider*) ft_provider_construct (object_type);
	return self;
}

FreedesktopSleepMonitorProvider*
freedesktop_sleep_monitor_provider_new (void)
{
	return freedesktop_sleep_monitor_provider_construct (FREEDESKTOP_TYPE_SLEEP_MONITOR_PROVIDER);
}

static void
freedesktop_sleep_monitor_provider_class_init (FreedesktopSleepMonitorProviderClass * klass,
                                               gpointer klass_data)
{
	freedesktop_sleep_monitor_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FreedesktopSleepMonitorProvider_private_offset);
	((FtProviderClass *) klass)->initialize = (void (*) (FtProvider*, GCancellable*, GAsyncReadyCallback, gpointer)) freedesktop_sleep_monitor_provider_real_initialize;
	((FtProviderClass *) klass)->initialize_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) freedesktop_sleep_monitor_provider_initialize_finish;
	((FtProviderClass *) klass)->uninitialize = (void (*) (FtProvider*, GAsyncReadyCallback, gpointer)) freedesktop_sleep_monitor_provider_real_uninitialize;
	((FtProviderClass *) klass)->uninitialize_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) freedesktop_sleep_monitor_provider_uninitialize_finish;
	((FtProviderClass *) klass)->enable = (void (*) (FtProvider*, GCancellable*, GAsyncReadyCallback, gpointer)) freedesktop_sleep_monitor_provider_real_enable;
	((FtProviderClass *) klass)->enable_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) freedesktop_sleep_monitor_provider_enable_finish;
	((FtProviderClass *) klass)->disable = (void (*) (FtProvider*, GAsyncReadyCallback, gpointer)) freedesktop_sleep_monitor_provider_real_disable;
	((FtProviderClass *) klass)->disable_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) freedesktop_sleep_monitor_provider_disable_finish;
	G_OBJECT_CLASS (klass)->finalize = freedesktop_sleep_monitor_provider_finalize;
}

static void
freedesktop_sleep_monitor_provider_ft_sleep_monitor_provider_interface_init (FtSleepMonitorProviderIface * iface,
                                                                             gpointer iface_data)
{
	freedesktop_sleep_monitor_provider_ft_sleep_monitor_provider_parent_iface = g_type_interface_peek_parent (iface);
}

static void
freedesktop_sleep_monitor_provider_instance_init (FreedesktopSleepMonitorProvider * self,
                                                  gpointer klass)
{
	self->priv = freedesktop_sleep_monitor_provider_get_instance_private (self);
	self->priv->login_manager_proxy = NULL;
	self->priv->watcher_id = (guint) 0;
}

static void
freedesktop_sleep_monitor_provider_finalize (GObject * obj)
{
	FreedesktopSleepMonitorProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FREEDESKTOP_TYPE_SLEEP_MONITOR_PROVIDER, FreedesktopSleepMonitorProvider);
	_g_object_unref0 (self->priv->login_manager_proxy);
	G_OBJECT_CLASS (freedesktop_sleep_monitor_provider_parent_class)->finalize (obj);
}

GType
freedesktop_sleep_monitor_provider_get_type (void)
{
	return freedesktop_sleep_monitor_provider_type_id;
}

GType
freedesktop_sleep_monitor_provider_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (FreedesktopSleepMonitorProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) freedesktop_sleep_monitor_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FreedesktopSleepMonitorProvider), 0, (GInstanceInitFunc) freedesktop_sleep_monitor_provider_instance_init, NULL };
	static const GInterfaceInfo ft_sleep_monitor_provider_info = { (GInterfaceInitFunc) freedesktop_sleep_monitor_provider_ft_sleep_monitor_provider_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	freedesktop_sleep_monitor_provider_type_id = g_type_module_register_type (module, FT_TYPE_PROVIDER, "FreedesktopSleepMonitorProvider", &g_define_type_info, 0);
	g_type_module_add_interface (module, freedesktop_sleep_monitor_provider_type_id, FT_TYPE_SLEEP_MONITOR_PROVIDER, &ft_sleep_monitor_provider_info);
	FreedesktopSleepMonitorProvider_private_offset = sizeof (FreedesktopSleepMonitorProviderPrivate);
	return freedesktop_sleep_monitor_provider_type_id;
}

