/* DateTimeWidget.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from DateTimeWidget.vala, do not modify */

/*
 * SPDX-License-Identifier: GPL-2.0-or-later
 * SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io)
 */

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <granite.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define GREETER_TYPE_DATE_TIME_WIDGET (greeter_date_time_widget_get_type ())
#define GREETER_DATE_TIME_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GREETER_TYPE_DATE_TIME_WIDGET, GreeterDateTimeWidget))
#define GREETER_DATE_TIME_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GREETER_TYPE_DATE_TIME_WIDGET, GreeterDateTimeWidgetClass))
#define GREETER_IS_DATE_TIME_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GREETER_TYPE_DATE_TIME_WIDGET))
#define GREETER_IS_DATE_TIME_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GREETER_TYPE_DATE_TIME_WIDGET))
#define GREETER_DATE_TIME_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GREETER_TYPE_DATE_TIME_WIDGET, GreeterDateTimeWidgetClass))

typedef struct _GreeterDateTimeWidget GreeterDateTimeWidget;
typedef struct _GreeterDateTimeWidgetClass GreeterDateTimeWidgetClass;
typedef struct _GreeterDateTimeWidgetPrivate GreeterDateTimeWidgetPrivate;

#define GREETER_DATE_TIME_WIDGET_TYPE_LOGIN_MANAGER (greeter_date_time_widget_login_manager_get_type ())
#define GREETER_DATE_TIME_WIDGET_LOGIN_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GREETER_DATE_TIME_WIDGET_TYPE_LOGIN_MANAGER, GreeterDateTimeWidgetLoginManager))
#define GREETER_DATE_TIME_WIDGET_IS_LOGIN_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GREETER_DATE_TIME_WIDGET_TYPE_LOGIN_MANAGER))
#define GREETER_DATE_TIME_WIDGET_LOGIN_MANAGER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GREETER_DATE_TIME_WIDGET_TYPE_LOGIN_MANAGER, GreeterDateTimeWidgetLoginManagerIface))

typedef struct _GreeterDateTimeWidgetLoginManager GreeterDateTimeWidgetLoginManager;
typedef struct _GreeterDateTimeWidgetLoginManagerIface GreeterDateTimeWidgetLoginManagerIface;

#define GREETER_DATE_TIME_WIDGET_TYPE_LOGIN_MANAGER_PROXY (greeter_date_time_widget_login_manager_proxy_get_type ())
enum  {
	GREETER_DATE_TIME_WIDGET_0_PROPERTY,
	GREETER_DATE_TIME_WIDGET_IS_24H_PROPERTY,
	GREETER_DATE_TIME_WIDGET_NUM_PROPERTIES
};
static GParamSpec* greeter_date_time_widget_properties[GREETER_DATE_TIME_WIDGET_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _GreeterDateTimeWidgetSetupForSleepData GreeterDateTimeWidgetSetupForSleepData;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
enum  {
	GREETER_DATE_TIME_WIDGET_LOGIN_MANAGER_PREPARE_FOR_SLEEP_SIGNAL,
	GREETER_DATE_TIME_WIDGET_LOGIN_MANAGER_NUM_SIGNALS
};
static guint greeter_date_time_widget_login_manager_signals[GREETER_DATE_TIME_WIDGET_LOGIN_MANAGER_NUM_SIGNALS] = {0};
typedef GDBusProxy GreeterDateTimeWidgetLoginManagerProxy;
typedef GDBusProxyClass GreeterDateTimeWidgetLoginManagerProxyClass;

struct _GreeterDateTimeWidget {
	GtkBox parent_instance;
	GreeterDateTimeWidgetPrivate * priv;
};

struct _GreeterDateTimeWidgetClass {
	GtkBoxClass parent_class;
};

struct _GreeterDateTimeWidgetLoginManagerIface {
	GTypeInterface parent_iface;
};

struct _GreeterDateTimeWidgetPrivate {
	gboolean _is_24h;
	GtkLabel* time_label;
	GtkLabel* date_label;
	guint timeout_id;
	GreeterDateTimeWidgetLoginManager* login_manager;
};

struct _GreeterDateTimeWidgetSetupForSleepData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GreeterDateTimeWidget* self;
	GreeterDateTimeWidgetLoginManager* _tmp0_;
	GreeterDateTimeWidgetLoginManager* _tmp1_;
	GreeterDateTimeWidgetLoginManager* _tmp2_;
	GreeterDateTimeWidgetLoginManager* _tmp3_;
	GError* e;
	GError* _tmp4_;
	const gchar* _tmp5_;
	GError* _inner_error0_;
};

static gint GreeterDateTimeWidget_private_offset;
static gpointer greeter_date_time_widget_parent_class = NULL;

VALA_EXTERN GType greeter_date_time_widget_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GreeterDateTimeWidget, g_object_unref)
static GType greeter_date_time_widget_login_manager_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GreeterDateTimeWidgetLoginManager, g_object_unref)
VALA_EXTERN GType greeter_date_time_widget_login_manager_proxy_get_type (void) G_GNUC_CONST ;
static guint greeter_date_time_widget_login_manager_register_object (void* object,
                                                              GDBusConnection* connection,
                                                              const gchar* path,
                                                              GError** error);
static void greeter_date_time_widget_setup_for_sleep_data_free (gpointer _data);
static void greeter_date_time_widget_setup_for_sleep (GreeterDateTimeWidget* self,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
static void greeter_date_time_widget_setup_for_sleep_finish (GreeterDateTimeWidget* self,
                                                      GAsyncResult* _res_);
static gboolean greeter_date_time_widget_setup_for_sleep_co (GreeterDateTimeWidgetSetupForSleepData* _data_);
static void greeter_date_time_widget_setup_for_sleep_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_);
static void ___lambda16_ (GreeterDateTimeWidget* self,
                   gboolean about_to_suspend);
static gboolean greeter_date_time_widget_update_labels (GreeterDateTimeWidget* self);
static void ____lambda16__greeter_date_time_widget_login_manager_prepare_for_sleep (GreeterDateTimeWidgetLoginManager* _sender,
                                                                             gboolean about_to_suspend,
                                                                             gpointer self);
static gboolean greeter_date_time_widget_get_is_24h (GreeterDateTimeWidget* self);
static gboolean _greeter_date_time_widget_update_labels_gsource_func (gpointer self);
VALA_EXTERN GreeterDateTimeWidget* greeter_date_time_widget_new (void);
VALA_EXTERN GreeterDateTimeWidget* greeter_date_time_widget_construct (GType object_type);
VALA_EXTERN void greeter_date_time_widget_set_is_24h (GreeterDateTimeWidget* self,
                                          gboolean value);
static GType greeter_date_time_widget_login_manager_get_type_once (void);
static void greeter_date_time_widget_login_manager_proxy_g_signal (GDBusProxy* proxy,
                                                            const gchar* sender_name,
                                                            const gchar* signal_name,
                                                            GVariant* parameters);
static void _dbus_handle_greeter_date_time_widget_login_manager_prepare_for_sleep (GreeterDateTimeWidgetLoginManager* self,
                                                                            GVariant* parameters);
static void greeter_date_time_widget_login_manager_proxy_greeter_date_time_widget_login_manager_interface_init (GreeterDateTimeWidgetLoginManagerIface* iface);
static void greeter_date_time_widget_login_manager_dbus_interface_method_call (GDBusConnection* connection,
                                                                        const gchar* sender,
                                                                        const gchar* object_path,
                                                                        const gchar* interface_name,
                                                                        const gchar* method_name,
                                                                        GVariant* parameters,
                                                                        GDBusMethodInvocation* invocation,
                                                                        gpointer user_data);
static GVariant* greeter_date_time_widget_login_manager_dbus_interface_get_property (GDBusConnection* connection,
                                                                              const gchar* sender,
                                                                              const gchar* object_path,
                                                                              const gchar* interface_name,
                                                                              const gchar* property_name,
                                                                              GError** error,
                                                                              gpointer user_data);
static gboolean greeter_date_time_widget_login_manager_dbus_interface_set_property (GDBusConnection* connection,
                                                                             const gchar* sender,
                                                                             const gchar* object_path,
                                                                             const gchar* interface_name,
                                                                             const gchar* property_name,
                                                                             GVariant* value,
                                                                             GError** error,
                                                                             gpointer user_data);
static void _dbus_greeter_date_time_widget_login_manager_prepare_for_sleep (GObject* _sender,
                                                                     gboolean about_to_suspend,
                                                                     gpointer* _data);
static void _greeter_date_time_widget_login_manager_unregister_object (gpointer user_data);
static GObject * greeter_date_time_widget_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties);
static void greeter_date_time_widget_finalize (GObject * obj);
static GType greeter_date_time_widget_get_type_once (void);
static void _vala_greeter_date_time_widget_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec);
static void _vala_greeter_date_time_widget_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec);

static const GDBusMethodInfo * const _greeter_date_time_widget_login_manager_dbus_method_info[] = {NULL};
static const GDBusArgInfo _greeter_date_time_widget_login_manager_dbus_arg_info_prepare_for_sleep_about_to_suspend = {-1, "about_to_suspend", "b", NULL};
static const GDBusArgInfo * const _greeter_date_time_widget_login_manager_dbus_arg_info_prepare_for_sleep[] = {&_greeter_date_time_widget_login_manager_dbus_arg_info_prepare_for_sleep_about_to_suspend, NULL};
static const GDBusSignalInfo _greeter_date_time_widget_login_manager_dbus_signal_info_prepare_for_sleep = {-1, "PrepareForSleep", (GDBusArgInfo **) (&_greeter_date_time_widget_login_manager_dbus_arg_info_prepare_for_sleep), NULL};
static const GDBusSignalInfo * const _greeter_date_time_widget_login_manager_dbus_signal_info[] = {&_greeter_date_time_widget_login_manager_dbus_signal_info_prepare_for_sleep, NULL};
static const GDBusPropertyInfo * const _greeter_date_time_widget_login_manager_dbus_property_info[] = {NULL};
static const GDBusInterfaceInfo _greeter_date_time_widget_login_manager_dbus_interface_info = {-1, "org.freedesktop.login1.Manager", (GDBusMethodInfo **) (&_greeter_date_time_widget_login_manager_dbus_method_info), (GDBusSignalInfo **) (&_greeter_date_time_widget_login_manager_dbus_signal_info), (GDBusPropertyInfo **) (&_greeter_date_time_widget_login_manager_dbus_property_info), NULL};
static const GDBusInterfaceVTable _greeter_date_time_widget_login_manager_dbus_interface_vtable = {greeter_date_time_widget_login_manager_dbus_interface_method_call, greeter_date_time_widget_login_manager_dbus_interface_get_property, greeter_date_time_widget_login_manager_dbus_interface_set_property};

static inline gpointer
greeter_date_time_widget_get_instance_private (GreeterDateTimeWidget* self)
{
	return G_STRUCT_MEMBER_P (self, GreeterDateTimeWidget_private_offset);
}

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

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

static void
greeter_date_time_widget_setup_for_sleep (GreeterDateTimeWidget* self,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	GreeterDateTimeWidgetSetupForSleepData* _data_;
	GreeterDateTimeWidget* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (GreeterDateTimeWidgetSetupForSleepData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, greeter_date_time_widget_setup_for_sleep_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	greeter_date_time_widget_setup_for_sleep_co (_data_);
}

static void
greeter_date_time_widget_setup_for_sleep_finish (GreeterDateTimeWidget* self,
                                                 GAsyncResult* _res_)
{
	GreeterDateTimeWidgetSetupForSleepData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
greeter_date_time_widget_setup_for_sleep_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_)
{
	GreeterDateTimeWidgetSetupForSleepData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	greeter_date_time_widget_setup_for_sleep_co (_data_);
}

static void
___lambda16_ (GreeterDateTimeWidget* self,
              gboolean about_to_suspend)
{
	if (!about_to_suspend) {
		greeter_date_time_widget_update_labels (self);
	}
}

static void
____lambda16__greeter_date_time_widget_login_manager_prepare_for_sleep (GreeterDateTimeWidgetLoginManager* _sender,
                                                                        gboolean about_to_suspend,
                                                                        gpointer self)
{
	___lambda16_ ((GreeterDateTimeWidget*) self, about_to_suspend);
}

static gboolean
greeter_date_time_widget_setup_for_sleep_co (GreeterDateTimeWidgetSetupForSleepData* _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 (GREETER_DATE_TIME_WIDGET_TYPE_LOGIN_MANAGER_PROXY, 0, NULL, greeter_date_time_widget_setup_for_sleep_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_ = (GreeterDateTimeWidgetLoginManager*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp0_ = (GreeterDateTimeWidgetLoginManager*) _data_->_tmp1_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			if (_data_->_inner_error0_->domain == G_IO_ERROR) {
				goto __catch0_g_io_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp2_ = _data_->_tmp0_;
		_data_->_tmp0_ = NULL;
		_g_object_unref0 (_data_->self->priv->login_manager);
		_data_->self->priv->login_manager = _data_->_tmp2_;
		_data_->_tmp3_ = _data_->self->priv->login_manager;
		g_signal_connect_object (_data_->_tmp3_, "prepare-for-sleep", (GCallback) ____lambda16__greeter_date_time_widget_login_manager_prepare_for_sleep, _data_->self, 0);
		_g_object_unref0 (_data_->_tmp0_);
	}
	goto __finally0;
	__catch0_g_io_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp4_ = _data_->e;
		_data_->_tmp5_ = _data_->_tmp4_->message;
		g_warning ("DateTimeWidget.vala:58: %s", _data_->_tmp5_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gboolean
_greeter_date_time_widget_update_labels_gsource_func (gpointer self)
{
	gboolean result;
	result = greeter_date_time_widget_update_labels ((GreeterDateTimeWidget*) self);
	return result;
}

static gboolean
greeter_date_time_widget_update_labels (GreeterDateTimeWidget* self)
{
	GDateTime* now = NULL;
	GDateTime* _tmp0_;
	GtkLabel* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GtkLabel* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->priv->timeout_id != ((guint) 0)) {
		g_source_remove (self->priv->timeout_id);
	}
	_tmp0_ = g_date_time_new_now_local ();
	now = _tmp0_;
	_tmp1_ = self->priv->time_label;
	_tmp2_ = greeter_date_time_widget_get_is_24h (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = granite_date_time_get_default_time_format (!_tmp3_, FALSE);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_date_time_format (now, _tmp5_);
	_tmp7_ = _tmp6_;
	gtk_label_set_label (_tmp1_, _tmp7_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	_tmp8_ = self->priv->date_label;
	_tmp9_ = granite_date_time_get_default_date_format (TRUE, TRUE, FALSE);
	_tmp10_ = _tmp9_;
	_tmp11_ = g_date_time_format (now, _tmp10_);
	_tmp12_ = _tmp11_;
	gtk_label_set_label (_tmp8_, _tmp12_);
	_g_free0 (_tmp12_);
	_g_free0 (_tmp10_);
	self->priv->timeout_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) (60 - g_date_time_get_second (now)), _greeter_date_time_widget_update_labels_gsource_func, g_object_ref (self), g_object_unref);
	result = G_SOURCE_REMOVE;
	_g_date_time_unref0 (now);
	return result;
}

GreeterDateTimeWidget*
greeter_date_time_widget_construct (GType object_type)
{
	GreeterDateTimeWidget * self = NULL;
	self = (GreeterDateTimeWidget*) g_object_new (object_type, NULL);
	return self;
}

GreeterDateTimeWidget*
greeter_date_time_widget_new (void)
{
	return greeter_date_time_widget_construct (GREETER_TYPE_DATE_TIME_WIDGET);
}

static gboolean
greeter_date_time_widget_get_is_24h (GreeterDateTimeWidget* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_is_24h;
	return result;
}

void
greeter_date_time_widget_set_is_24h (GreeterDateTimeWidget* self,
                                     gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_is_24h = value;
	greeter_date_time_widget_update_labels (self);
	g_object_notify_by_pspec ((GObject *) self, greeter_date_time_widget_properties[GREETER_DATE_TIME_WIDGET_IS_24H_PROPERTY]);
}

static void
greeter_date_time_widget_login_manager_default_init (GreeterDateTimeWidgetLoginManagerIface * iface,
                                                     gpointer iface_data)
{
	greeter_date_time_widget_login_manager_signals[GREETER_DATE_TIME_WIDGET_LOGIN_MANAGER_PREPARE_FOR_SLEEP_SIGNAL] = g_signal_new ("prepare-for-sleep", GREETER_DATE_TIME_WIDGET_TYPE_LOGIN_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
}

static GType
greeter_date_time_widget_login_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GreeterDateTimeWidgetLoginManagerIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) greeter_date_time_widget_login_manager_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType greeter_date_time_widget_login_manager_type_id;
	greeter_date_time_widget_login_manager_type_id = g_type_register_static (G_TYPE_INTERFACE, "GreeterDateTimeWidgetLoginManager", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (greeter_date_time_widget_login_manager_type_id, G_TYPE_OBJECT);
	g_type_set_qdata (greeter_date_time_widget_login_manager_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) greeter_date_time_widget_login_manager_proxy_get_type);
	g_type_set_qdata (greeter_date_time_widget_login_manager_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.freedesktop.login1.Manager");
	g_type_set_qdata (greeter_date_time_widget_login_manager_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_greeter_date_time_widget_login_manager_dbus_interface_info));
	g_type_set_qdata (greeter_date_time_widget_login_manager_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) greeter_date_time_widget_login_manager_register_object);
	return greeter_date_time_widget_login_manager_type_id;
}

static GType
greeter_date_time_widget_login_manager_get_type (void)
{
	static volatile gsize greeter_date_time_widget_login_manager_type_id__once = 0;
	if (g_once_init_enter (&greeter_date_time_widget_login_manager_type_id__once)) {
		GType greeter_date_time_widget_login_manager_type_id;
		greeter_date_time_widget_login_manager_type_id = greeter_date_time_widget_login_manager_get_type_once ();
		g_once_init_leave (&greeter_date_time_widget_login_manager_type_id__once, greeter_date_time_widget_login_manager_type_id);
	}
	return greeter_date_time_widget_login_manager_type_id__once;
}

G_DEFINE_TYPE_EXTENDED (GreeterDateTimeWidgetLoginManagerProxy, greeter_date_time_widget_login_manager_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (GREETER_DATE_TIME_WIDGET_TYPE_LOGIN_MANAGER, greeter_date_time_widget_login_manager_proxy_greeter_date_time_widget_login_manager_interface_init) )
static void
greeter_date_time_widget_login_manager_proxy_class_init (GreeterDateTimeWidgetLoginManagerProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = greeter_date_time_widget_login_manager_proxy_g_signal;
}

static void
_dbus_handle_greeter_date_time_widget_login_manager_prepare_for_sleep (GreeterDateTimeWidgetLoginManager* self,
                                                                       GVariant* parameters)
{
	GVariantIter _arguments_iter;
	gboolean about_to_suspend = FALSE;
	GVariant* _tmp0_;
	g_variant_iter_init (&_arguments_iter, parameters);
	_tmp0_ = g_variant_iter_next_value (&_arguments_iter);
	about_to_suspend = g_variant_get_boolean (_tmp0_);
	g_variant_unref (_tmp0_);
	g_signal_emit_by_name (self, "prepare-for-sleep", about_to_suspend);
}

static void
greeter_date_time_widget_login_manager_proxy_g_signal (GDBusProxy* proxy,
                                                       const gchar* sender_name,
                                                       const gchar* signal_name,
                                                       GVariant* parameters)
{
	if (strcmp (signal_name, "PrepareForSleep") == 0) {
		_dbus_handle_greeter_date_time_widget_login_manager_prepare_for_sleep ((GreeterDateTimeWidgetLoginManager*) proxy, parameters);
	}
}

static void
greeter_date_time_widget_login_manager_proxy_init (GreeterDateTimeWidgetLoginManagerProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_greeter_date_time_widget_login_manager_dbus_interface_info));
}

static void
greeter_date_time_widget_login_manager_proxy_greeter_date_time_widget_login_manager_interface_init (GreeterDateTimeWidgetLoginManagerIface* iface)
{
}

static void
greeter_date_time_widget_login_manager_dbus_interface_method_call (GDBusConnection* connection,
                                                                   const gchar* sender,
                                                                   const gchar* object_path,
                                                                   const gchar* interface_name,
                                                                   const gchar* method_name,
                                                                   GVariant* parameters,
                                                                   GDBusMethodInvocation* invocation,
                                                                   gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	g_object_unref (invocation);
}

static GVariant*
greeter_date_time_widget_login_manager_dbus_interface_get_property (GDBusConnection* connection,
                                                                    const gchar* sender,
                                                                    const gchar* object_path,
                                                                    const gchar* interface_name,
                                                                    const gchar* property_name,
                                                                    GError** error,
                                                                    gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return NULL;
}

static gboolean
greeter_date_time_widget_login_manager_dbus_interface_set_property (GDBusConnection* connection,
                                                                    const gchar* sender,
                                                                    const gchar* object_path,
                                                                    const gchar* interface_name,
                                                                    const gchar* property_name,
                                                                    GVariant* value,
                                                                    GError** error,
                                                                    gpointer user_data)
{
	gpointer* data;
	gpointer object;
	data = user_data;
	object = data[0];
	return FALSE;
}

static void
_dbus_greeter_date_time_widget_login_manager_prepare_for_sleep (GObject* _sender,
                                                                gboolean about_to_suspend,
                                                                gpointer* _data)
{
	GDBusConnection * _connection;
	const gchar * _path;
	GVariant *_arguments;
	GVariantBuilder _arguments_builder;
	_connection = _data[1];
	_path = _data[2];
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (about_to_suspend));
	_arguments = g_variant_builder_end (&_arguments_builder);
	g_dbus_connection_emit_signal (_connection, NULL, _path, "org.freedesktop.login1.Manager", "PrepareForSleep", _arguments, NULL);
}

static guint
greeter_date_time_widget_login_manager_register_object (gpointer object,
                                                        GDBusConnection* connection,
                                                        const gchar* path,
                                                        GError** error)
{
	guint result;
	gpointer *data;
	data = g_new (gpointer, 3);
	data[0] = g_object_ref (object);
	data[1] = g_object_ref (connection);
	data[2] = g_strdup (path);
	result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_greeter_date_time_widget_login_manager_dbus_interface_info), &_greeter_date_time_widget_login_manager_dbus_interface_vtable, data, _greeter_date_time_widget_login_manager_unregister_object, error);
	if (!result) {
		return 0;
	}
	g_signal_connect (object, "prepare-for-sleep", (GCallback) _dbus_greeter_date_time_widget_login_manager_prepare_for_sleep, data);
	return result;
}

static void
_greeter_date_time_widget_login_manager_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_signal_handlers_disconnect_by_func (data[0], _dbus_greeter_date_time_widget_login_manager_prepare_for_sleep, data);
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}

static GObject *
greeter_date_time_widget_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GreeterDateTimeWidget * self;
	GtkLabel* _tmp0_;
	GtkLabel* _tmp1_;
	GtkStyleContext* _tmp2_;
	GtkLabel* _tmp3_;
	GtkLabel* _tmp4_;
	GtkStyleContext* _tmp5_;
	GtkLabel* _tmp6_;
	GtkLabel* _tmp7_;
	parent_class = G_OBJECT_CLASS (greeter_date_time_widget_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GREETER_TYPE_DATE_TIME_WIDGET, GreeterDateTimeWidget);
	_tmp0_ = (GtkLabel*) gtk_label_new (NULL);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->time_label);
	self->priv->time_label = _tmp0_;
	_tmp1_ = self->priv->time_label;
	_tmp2_ = gtk_widget_get_style_context ((GtkWidget*) _tmp1_);
	gtk_style_context_add_class (_tmp2_, "time");
	_tmp3_ = (GtkLabel*) gtk_label_new (NULL);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->date_label);
	self->priv->date_label = _tmp3_;
	_tmp4_ = self->priv->date_label;
	_tmp5_ = gtk_widget_get_style_context ((GtkWidget*) _tmp4_);
	gtk_style_context_add_class (_tmp5_, "date");
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	_tmp6_ = self->priv->time_label;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp6_);
	_tmp7_ = self->priv->date_label;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp7_);
	greeter_date_time_widget_update_labels (self);
	greeter_date_time_widget_setup_for_sleep (self, NULL, NULL);
	return obj;
}

static void
greeter_date_time_widget_class_init (GreeterDateTimeWidgetClass * klass,
                                     gpointer klass_data)
{
	greeter_date_time_widget_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GreeterDateTimeWidget_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_greeter_date_time_widget_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_greeter_date_time_widget_set_property;
	G_OBJECT_CLASS (klass)->constructor = greeter_date_time_widget_constructor;
	G_OBJECT_CLASS (klass)->finalize = greeter_date_time_widget_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GREETER_DATE_TIME_WIDGET_IS_24H_PROPERTY, greeter_date_time_widget_properties[GREETER_DATE_TIME_WIDGET_IS_24H_PROPERTY] = g_param_spec_boolean ("is-24h", "is-24h", "is-24h", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
}

static void
greeter_date_time_widget_instance_init (GreeterDateTimeWidget * self,
                                        gpointer klass)
{
	self->priv = greeter_date_time_widget_get_instance_private (self);
	self->priv->_is_24h = TRUE;
	self->priv->timeout_id = (guint) 0;
}

static void
greeter_date_time_widget_finalize (GObject * obj)
{
	GreeterDateTimeWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GREETER_TYPE_DATE_TIME_WIDGET, GreeterDateTimeWidget);
	_g_object_unref0 (self->priv->time_label);
	_g_object_unref0 (self->priv->date_label);
	_g_object_unref0 (self->priv->login_manager);
	G_OBJECT_CLASS (greeter_date_time_widget_parent_class)->finalize (obj);
}

static GType
greeter_date_time_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GreeterDateTimeWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) greeter_date_time_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GreeterDateTimeWidget), 0, (GInstanceInitFunc) greeter_date_time_widget_instance_init, NULL };
	GType greeter_date_time_widget_type_id;
	greeter_date_time_widget_type_id = g_type_register_static (gtk_box_get_type (), "GreeterDateTimeWidget", &g_define_type_info, 0);
	GreeterDateTimeWidget_private_offset = g_type_add_instance_private (greeter_date_time_widget_type_id, sizeof (GreeterDateTimeWidgetPrivate));
	return greeter_date_time_widget_type_id;
}

GType
greeter_date_time_widget_get_type (void)
{
	static volatile gsize greeter_date_time_widget_type_id__once = 0;
	if (g_once_init_enter (&greeter_date_time_widget_type_id__once)) {
		GType greeter_date_time_widget_type_id;
		greeter_date_time_widget_type_id = greeter_date_time_widget_get_type_once ();
		g_once_init_leave (&greeter_date_time_widget_type_id__once, greeter_date_time_widget_type_id);
	}
	return greeter_date_time_widget_type_id__once;
}

static void
_vala_greeter_date_time_widget_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec)
{
	GreeterDateTimeWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GREETER_TYPE_DATE_TIME_WIDGET, GreeterDateTimeWidget);
	switch (property_id) {
		case GREETER_DATE_TIME_WIDGET_IS_24H_PROPERTY:
		g_value_set_boolean (value, greeter_date_time_widget_get_is_24h (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_greeter_date_time_widget_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec)
{
	GreeterDateTimeWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GREETER_TYPE_DATE_TIME_WIDGET, GreeterDateTimeWidget);
	switch (property_id) {
		case GREETER_DATE_TIME_WIDGET_IS_24H_PROPERTY:
		greeter_date_time_widget_set_is_24h (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

