/* timezone-monitor-provider.c generated by valac 0.56.19, the Vala compiler
 * generated from timezone-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 <stdlib.h>
#include <string.h>
#include "ft_core.h"
#include <gio/gio.h>
#include <glib-object.h>

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

enum  {
	FREEDESKTOP_TIME_ZONE_MONITOR_PROVIDER_0_PROPERTY,
	FREEDESKTOP_TIME_ZONE_MONITOR_PROVIDER_IDENTIFIER_PROPERTY,
	FREEDESKTOP_TIME_ZONE_MONITOR_PROVIDER_NUM_PROPERTIES
};
static GParamSpec* freedesktop_time_zone_monitor_provider_properties[FREEDESKTOP_TIME_ZONE_MONITOR_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 _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
typedef struct _FreedesktopTimeZoneMonitorProviderInitializeData FreedesktopTimeZoneMonitorProviderInitializeData;
typedef struct _FreedesktopTimeZoneMonitorProviderUninitializeData FreedesktopTimeZoneMonitorProviderUninitializeData;
typedef struct _FreedesktopTimeZoneMonitorProviderEnableData FreedesktopTimeZoneMonitorProviderEnableData;
typedef struct _FreedesktopTimeZoneMonitorProviderDisableData FreedesktopTimeZoneMonitorProviderDisableData;

struct _FreedesktopTimeZoneMonitorProviderPrivate {
	FreedesktopTimeDate* timedate_proxy;
	guint watcher_id;
	gulong properties_changed_id;
	gchar* _identifier;
};

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

struct _FreedesktopTimeZoneMonitorProviderUninitializeData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FreedesktopTimeZoneMonitorProvider* self;
};

struct _FreedesktopTimeZoneMonitorProviderEnableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FreedesktopTimeZoneMonitorProvider* self;
	GCancellable* cancellable;
	FreedesktopTimeDate* _tmp0_;
	FreedesktopTimeDate* _tmp1_;
	FreedesktopTimeDate* _tmp2_;
	GDBusProxy* timedate_dbus_proxy;
	FreedesktopTimeDate* _tmp3_;
	GDBusProxy* _tmp4_;
	GDBusProxy* _tmp5_;
	gulong _tmp6_;
	FreedesktopTimeDate* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	GError* _inner_error0_;
};

struct _FreedesktopTimeZoneMonitorProviderDisableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	FreedesktopTimeZoneMonitorProvider* self;
	FreedesktopTimeDate* _tmp0_;
};

static gint FreedesktopTimeZoneMonitorProvider_private_offset;
static gpointer freedesktop_time_zone_monitor_provider_parent_class = NULL;
static FtTimeZoneMonitorProviderIface * freedesktop_time_zone_monitor_provider_ft_time_zone_monitor_provider_parent_iface = NULL;
static GType freedesktop_time_zone_monitor_provider_type_id = 0;

static void freedesktop_time_zone_monitor_provider_on_name_appeared (FreedesktopTimeZoneMonitorProvider* self,
                                                              GDBusConnection* connection,
                                                              const gchar* name,
                                                              const gchar* name_owner);
static void freedesktop_time_zone_monitor_provider_on_name_vanished (FreedesktopTimeZoneMonitorProvider* self,
                                                              GDBusConnection* connection,
                                                              const gchar* name);
static void freedesktop_time_zone_monitor_provider_on_properties_changed (FreedesktopTimeZoneMonitorProvider* self,
                                                                   GVariant* changed_properties,
                                                                   gchar** invalidated_properties,
                                                                   gint invalidated_properties_length1);
static void freedesktop_time_zone_monitor_provider_real_initialize_data_free (gpointer _data);
static void freedesktop_time_zone_monitor_provider_real_initialize (FtProvider* base,
                                                             GCancellable* cancellable,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);
static gboolean freedesktop_time_zone_monitor_provider_real_initialize_co (FreedesktopTimeZoneMonitorProviderInitializeData* _data_);
static void _freedesktop_time_zone_monitor_provider_on_name_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                           const gchar* name,
                                                                                           const gchar* name_owner,
                                                                                           gpointer self);
static void _freedesktop_time_zone_monitor_provider_on_name_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                           const gchar* name,
                                                                                           gpointer self);
static void freedesktop_time_zone_monitor_provider_real_uninitialize_data_free (gpointer _data);
static void freedesktop_time_zone_monitor_provider_real_uninitialize (FtProvider* base,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_);
static gboolean freedesktop_time_zone_monitor_provider_real_uninitialize_co (FreedesktopTimeZoneMonitorProviderUninitializeData* _data_);
static void freedesktop_time_zone_monitor_provider_real_enable_data_free (gpointer _data);
static void freedesktop_time_zone_monitor_provider_real_enable (FtProvider* base,
                                                         GCancellable* cancellable,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
static gboolean freedesktop_time_zone_monitor_provider_real_enable_co (FreedesktopTimeZoneMonitorProviderEnableData* _data_);
static void freedesktop_time_zone_monitor_provider_enable_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_);
static void _freedesktop_time_zone_monitor_provider_on_properties_changed_g_dbus_proxy_g_properties_changed (GDBusProxy* _sender,
                                                                                                      GVariant* changed_properties,
                                                                                                      gchar** invalidated_properties,
                                                                                                      gpointer self);
static void freedesktop_time_zone_monitor_provider_real_disable_data_free (gpointer _data);
static void freedesktop_time_zone_monitor_provider_real_disable (FtProvider* base,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_);
static gboolean freedesktop_time_zone_monitor_provider_real_disable_co (FreedesktopTimeZoneMonitorProviderDisableData* _data_);
static void freedesktop_time_zone_monitor_provider_finalize (GObject * obj);
static void _vala_freedesktop_time_zone_monitor_provider_get_property (GObject * object,
                                                                guint property_id,
                                                                GValue * value,
                                                                GParamSpec * pspec);
static gssize _vala_array_length (gpointer array);

static inline gpointer
freedesktop_time_zone_monitor_provider_get_instance_private (FreedesktopTimeZoneMonitorProvider* self)
{
	return G_STRUCT_MEMBER_P (self, FreedesktopTimeZoneMonitorProvider_private_offset);
}

static void
freedesktop_time_zone_monitor_provider_on_name_appeared (FreedesktopTimeZoneMonitorProvider* 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_time_zone_monitor_provider_on_name_vanished (FreedesktopTimeZoneMonitorProvider* 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_time_zone_monitor_provider_on_properties_changed (FreedesktopTimeZoneMonitorProvider* self,
                                                              GVariant* changed_properties,
                                                              gchar** invalidated_properties,
                                                              gint invalidated_properties_length1)
{
	GVariant* identifier_value = NULL;
	const GVariantType* _tmp0_;
	GVariant* _tmp1_;
	GVariant* _tmp2_;
	gchar* identifier = NULL;
	GVariant* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (changed_properties != NULL);
	_tmp0_ = G_VARIANT_TYPE_STRING;
	_tmp1_ = g_variant_lookup_value (changed_properties, "Timezone", _tmp0_);
	identifier_value = _tmp1_;
	_tmp2_ = identifier_value;
	if (_tmp2_ == NULL) {
		_g_variant_unref0 (identifier_value);
		return;
	}
	_tmp3_ = identifier_value;
	_tmp4_ = g_variant_get_string (_tmp3_, NULL);
	_tmp5_ = g_strdup (_tmp4_);
	identifier = _tmp5_;
	_tmp6_ = self->priv->_identifier;
	_tmp7_ = identifier;
	if (g_strcmp0 (_tmp6_, _tmp7_) != 0) {
		const gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp8_ = identifier;
		_tmp9_ = g_strdup (_tmp8_);
		_g_free0 (self->priv->_identifier);
		self->priv->_identifier = _tmp9_;
		g_object_notify ((GObject*) self, "identifier");
	}
	_g_free0 (identifier);
	_g_variant_unref0 (identifier_value);
}

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

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

static void
freedesktop_time_zone_monitor_provider_real_initialize (FtProvider* base,
                                                        GCancellable* cancellable,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_)
{
	FreedesktopTimeZoneMonitorProvider * self;
	FreedesktopTimeZoneMonitorProviderInitializeData* _data_;
	FreedesktopTimeZoneMonitorProvider* _tmp0_;
	GCancellable* _tmp1_;
	self = (FreedesktopTimeZoneMonitorProvider*) base;
	_data_ = g_slice_new0 (FreedesktopTimeZoneMonitorProviderInitializeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, freedesktop_time_zone_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_time_zone_monitor_provider_real_initialize_co (_data_);
}

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

static void
_freedesktop_time_zone_monitor_provider_on_name_appeared_gbus_name_appeared_callback (GDBusConnection* connection,
                                                                                      const gchar* name,
                                                                                      const gchar* name_owner,
                                                                                      gpointer self)
{
	freedesktop_time_zone_monitor_provider_on_name_appeared ((FreedesktopTimeZoneMonitorProvider*) self, connection, name, name_owner);
}

static void
_freedesktop_time_zone_monitor_provider_on_name_vanished_gbus_name_vanished_callback (GDBusConnection* connection,
                                                                                      const gchar* name,
                                                                                      gpointer self)
{
	freedesktop_time_zone_monitor_provider_on_name_vanished ((FreedesktopTimeZoneMonitorProvider*) self, connection, name);
}

static gboolean
freedesktop_time_zone_monitor_provider_real_initialize_co (FreedesktopTimeZoneMonitorProviderInitializeData* _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.timedate1", G_BUS_NAME_WATCHER_FLAGS_NONE, (GClosure*) ((_freedesktop_time_zone_monitor_provider_on_name_appeared_gbus_name_appeared_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _freedesktop_time_zone_monitor_provider_on_name_appeared_gbus_name_appeared_callback, g_object_ref (_data_->self), (GClosureNotify) g_object_unref)), (GClosure*) ((_freedesktop_time_zone_monitor_provider_on_name_vanished_gbus_name_vanished_callback == NULL) ? NULL : g_cclosure_new ((GCallback) _freedesktop_time_zone_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_time_zone_monitor_provider_real_uninitialize_data_free (gpointer _data)
{
	FreedesktopTimeZoneMonitorProviderUninitializeData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (FreedesktopTimeZoneMonitorProviderUninitializeData, _data_);
}

static void
freedesktop_time_zone_monitor_provider_real_uninitialize (FtProvider* base,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_)
{
	FreedesktopTimeZoneMonitorProvider * self;
	FreedesktopTimeZoneMonitorProviderUninitializeData* _data_;
	FreedesktopTimeZoneMonitorProvider* _tmp0_;
	self = (FreedesktopTimeZoneMonitorProvider*) base;
	_data_ = g_slice_new0 (FreedesktopTimeZoneMonitorProviderUninitializeData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, freedesktop_time_zone_monitor_provider_real_uninitialize_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	freedesktop_time_zone_monitor_provider_real_uninitialize_co (_data_);
}

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

static gboolean
freedesktop_time_zone_monitor_provider_real_uninitialize_co (FreedesktopTimeZoneMonitorProviderUninitializeData* _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_time_zone_monitor_provider_real_enable_data_free (gpointer _data)
{
	FreedesktopTimeZoneMonitorProviderEnableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (FreedesktopTimeZoneMonitorProviderEnableData, _data_);
}

static void
freedesktop_time_zone_monitor_provider_real_enable (FtProvider* base,
                                                    GCancellable* cancellable,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	FreedesktopTimeZoneMonitorProvider * self;
	FreedesktopTimeZoneMonitorProviderEnableData* _data_;
	FreedesktopTimeZoneMonitorProvider* _tmp0_;
	GCancellable* _tmp1_;
	self = (FreedesktopTimeZoneMonitorProvider*) base;
	_data_ = g_slice_new0 (FreedesktopTimeZoneMonitorProviderEnableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, freedesktop_time_zone_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_time_zone_monitor_provider_real_enable_co (_data_);
}

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

static void
freedesktop_time_zone_monitor_provider_enable_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_)
{
	FreedesktopTimeZoneMonitorProviderEnableData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	freedesktop_time_zone_monitor_provider_real_enable_co (_data_);
}

static void
_freedesktop_time_zone_monitor_provider_on_properties_changed_g_dbus_proxy_g_properties_changed (GDBusProxy* _sender,
                                                                                                 GVariant* changed_properties,
                                                                                                 gchar** invalidated_properties,
                                                                                                 gpointer self)
{
	freedesktop_time_zone_monitor_provider_on_properties_changed ((FreedesktopTimeZoneMonitorProvider*) self, changed_properties, invalidated_properties, _vala_array_length (invalidated_properties));
}

static gboolean
freedesktop_time_zone_monitor_provider_real_enable_co (FreedesktopTimeZoneMonitorProviderEnableData* _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_TIME_DATE_PROXY, 0, NULL, freedesktop_time_zone_monitor_provider_enable_ready, _data_, "g-flags", 0, "g-name", "org.freedesktop.timedate1", "g-bus-type", G_BUS_TYPE_SYSTEM, "g-object-path", "/org/freedesktop/timedate1", "g-interface-name", "org.freedesktop.timedate1", NULL);
	return FALSE;
	_state_1:
	_data_->_tmp1_ = (FreedesktopTimeDate*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp0_ = (FreedesktopTimeDate*) _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->timedate_proxy);
	_data_->self->priv->timedate_proxy = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->self->priv->timedate_proxy;
	_data_->_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp3_, g_dbus_proxy_get_type (), GDBusProxy));
	_data_->timedate_dbus_proxy = _data_->_tmp4_;
	_data_->_tmp5_ = _data_->timedate_dbus_proxy;
	_data_->_tmp6_ = g_signal_connect_object (_data_->_tmp5_, "g-properties-changed", (GCallback) _freedesktop_time_zone_monitor_provider_on_properties_changed_g_dbus_proxy_g_properties_changed, _data_->self, 0);
	_data_->self->priv->properties_changed_id = _data_->_tmp6_;
	_data_->_tmp7_ = _data_->self->priv->timedate_proxy;
	_data_->_tmp8_ = freedesktop_time_date_get_timezone (_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_g_free0 (_data_->self->priv->_identifier);
	_data_->self->priv->_identifier = _data_->_tmp9_;
	g_object_notify ((GObject*) _data_->self, "identifier");
	_g_object_unref0 (_data_->timedate_dbus_proxy);
	_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_time_zone_monitor_provider_real_disable_data_free (gpointer _data)
{
	FreedesktopTimeZoneMonitorProviderDisableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (FreedesktopTimeZoneMonitorProviderDisableData, _data_);
}

static void
freedesktop_time_zone_monitor_provider_real_disable (FtProvider* base,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_)
{
	FreedesktopTimeZoneMonitorProvider * self;
	FreedesktopTimeZoneMonitorProviderDisableData* _data_;
	FreedesktopTimeZoneMonitorProvider* _tmp0_;
	self = (FreedesktopTimeZoneMonitorProvider*) base;
	_data_ = g_slice_new0 (FreedesktopTimeZoneMonitorProviderDisableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, freedesktop_time_zone_monitor_provider_real_disable_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	freedesktop_time_zone_monitor_provider_real_disable_co (_data_);
}

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

static gboolean
freedesktop_time_zone_monitor_provider_real_disable_co (FreedesktopTimeZoneMonitorProviderDisableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->self->priv->properties_changed_id != ((gulong) 0)) {
		_data_->_tmp0_ = _data_->self->priv->timedate_proxy;
		g_signal_handler_disconnect ((GObject*) _data_->_tmp0_, _data_->self->priv->properties_changed_id);
		_data_->self->priv->properties_changed_id = (gulong) 0;
	}
	_g_object_unref0 (_data_->self->priv->timedate_proxy);
	_data_->self->priv->timedate_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;
}

FreedesktopTimeZoneMonitorProvider*
freedesktop_time_zone_monitor_provider_construct (GType object_type)
{
	FreedesktopTimeZoneMonitorProvider * self = NULL;
	self = (FreedesktopTimeZoneMonitorProvider*) ft_provider_construct (object_type);
	return self;
}

FreedesktopTimeZoneMonitorProvider*
freedesktop_time_zone_monitor_provider_new (void)
{
	return freedesktop_time_zone_monitor_provider_construct (FREEDESKTOP_TYPE_TIME_ZONE_MONITOR_PROVIDER);
}

static const gchar*
freedesktop_time_zone_monitor_provider_real_get_identifier (FtTimeZoneMonitorProvider* base)
{
	const gchar* result;
	FreedesktopTimeZoneMonitorProvider* self;
	const gchar* _tmp0_;
	self = (FreedesktopTimeZoneMonitorProvider*) base;
	_tmp0_ = self->priv->_identifier;
	result = _tmp0_;
	return result;
}

static void
freedesktop_time_zone_monitor_provider_class_init (FreedesktopTimeZoneMonitorProviderClass * klass,
                                                   gpointer klass_data)
{
	freedesktop_time_zone_monitor_provider_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &FreedesktopTimeZoneMonitorProvider_private_offset);
	((FtProviderClass *) klass)->initialize = (void (*) (FtProvider*, GCancellable*, GAsyncReadyCallback, gpointer)) freedesktop_time_zone_monitor_provider_real_initialize;
	((FtProviderClass *) klass)->initialize_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) freedesktop_time_zone_monitor_provider_initialize_finish;
	((FtProviderClass *) klass)->uninitialize = (void (*) (FtProvider*, GAsyncReadyCallback, gpointer)) freedesktop_time_zone_monitor_provider_real_uninitialize;
	((FtProviderClass *) klass)->uninitialize_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) freedesktop_time_zone_monitor_provider_uninitialize_finish;
	((FtProviderClass *) klass)->enable = (void (*) (FtProvider*, GCancellable*, GAsyncReadyCallback, gpointer)) freedesktop_time_zone_monitor_provider_real_enable;
	((FtProviderClass *) klass)->enable_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) freedesktop_time_zone_monitor_provider_enable_finish;
	((FtProviderClass *) klass)->disable = (void (*) (FtProvider*, GAsyncReadyCallback, gpointer)) freedesktop_time_zone_monitor_provider_real_disable;
	((FtProviderClass *) klass)->disable_finish = (void (*) (FtProvider*, GAsyncResult*, GError**)) freedesktop_time_zone_monitor_provider_disable_finish;
	G_OBJECT_CLASS (klass)->get_property = _vala_freedesktop_time_zone_monitor_provider_get_property;
	G_OBJECT_CLASS (klass)->finalize = freedesktop_time_zone_monitor_provider_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), FREEDESKTOP_TIME_ZONE_MONITOR_PROVIDER_IDENTIFIER_PROPERTY, freedesktop_time_zone_monitor_provider_properties[FREEDESKTOP_TIME_ZONE_MONITOR_PROVIDER_IDENTIFIER_PROPERTY] = g_param_spec_string ("identifier", "identifier", "identifier", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
freedesktop_time_zone_monitor_provider_ft_time_zone_monitor_provider_interface_init (FtTimeZoneMonitorProviderIface * iface,
                                                                                     gpointer iface_data)
{
	freedesktop_time_zone_monitor_provider_ft_time_zone_monitor_provider_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_identifier = freedesktop_time_zone_monitor_provider_real_get_identifier;
}

static void
freedesktop_time_zone_monitor_provider_instance_init (FreedesktopTimeZoneMonitorProvider * self,
                                                      gpointer klass)
{
	self->priv = freedesktop_time_zone_monitor_provider_get_instance_private (self);
	self->priv->timedate_proxy = NULL;
	self->priv->watcher_id = (guint) 0;
	self->priv->properties_changed_id = (gulong) 0;
	self->priv->_identifier = NULL;
}

static void
freedesktop_time_zone_monitor_provider_finalize (GObject * obj)
{
	FreedesktopTimeZoneMonitorProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, FREEDESKTOP_TYPE_TIME_ZONE_MONITOR_PROVIDER, FreedesktopTimeZoneMonitorProvider);
	_g_object_unref0 (self->priv->timedate_proxy);
	_g_free0 (self->priv->_identifier);
	G_OBJECT_CLASS (freedesktop_time_zone_monitor_provider_parent_class)->finalize (obj);
}

GType
freedesktop_time_zone_monitor_provider_get_type (void)
{
	return freedesktop_time_zone_monitor_provider_type_id;
}

GType
freedesktop_time_zone_monitor_provider_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (FreedesktopTimeZoneMonitorProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) freedesktop_time_zone_monitor_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FreedesktopTimeZoneMonitorProvider), 0, (GInstanceInitFunc) freedesktop_time_zone_monitor_provider_instance_init, NULL };
	static const GInterfaceInfo ft_time_zone_monitor_provider_info = { (GInterfaceInitFunc) freedesktop_time_zone_monitor_provider_ft_time_zone_monitor_provider_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	freedesktop_time_zone_monitor_provider_type_id = g_type_module_register_type (module, FT_TYPE_PROVIDER, "FreedesktopTimeZoneMonitorProvider", &g_define_type_info, 0);
	g_type_module_add_interface (module, freedesktop_time_zone_monitor_provider_type_id, FT_TYPE_TIME_ZONE_MONITOR_PROVIDER, &ft_time_zone_monitor_provider_info);
	FreedesktopTimeZoneMonitorProvider_private_offset = sizeof (FreedesktopTimeZoneMonitorProviderPrivate);
	return freedesktop_time_zone_monitor_provider_type_id;
}

static void
_vala_freedesktop_time_zone_monitor_provider_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec)
{
	FreedesktopTimeZoneMonitorProvider * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, FREEDESKTOP_TYPE_TIME_ZONE_MONITOR_PROVIDER, FreedesktopTimeZoneMonitorProvider);
	switch (property_id) {
		case FREEDESKTOP_TIME_ZONE_MONITOR_PROVIDER_IDENTIFIER_PROPERTY:
		g_value_set_string (value, ft_time_zone_monitor_provider_get_identifier ((FtTimeZoneMonitorProvider*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

