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

/*
 * Copyright (c) 2017 elementary LLC. (https://elementary.io)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 */

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

typedef GDBusProxy NightLightColorInterfaceProxy;
typedef GDBusProxyClass NightLightColorInterfaceProxyClass;
enum  {
	NIGHT_LIGHT_MANAGER_0_PROPERTY,
	NIGHT_LIGHT_MANAGER_SNOOZED_PROPERTY,
	NIGHT_LIGHT_MANAGER_ACTIVE_PROPERTY,
	NIGHT_LIGHT_MANAGER_NUM_PROPERTIES
};
static GParamSpec* night_light_manager_properties[NIGHT_LIGHT_MANAGER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _NightLightManagerInitInterfaceData NightLightManagerInitInterfaceData;

struct _NightLightManagerPrivate {
	NightLightColorInterface* interface;
	gboolean _snoozed;
};

struct _NightLightManagerInitInterfaceData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	NightLightManager* self;
	NightLightColorInterface* _tmp0_;
	NightLightColorInterface* _tmp1_;
	NightLightColorInterface* _tmp2_;
	NightLightColorInterface* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	NightLightColorInterface* _tmp6_;
	GError* e;
	GError* _tmp7_;
	const gchar* _tmp8_;
	GError* _inner_error0_;
};

static gint NightLightManager_private_offset;
static gpointer night_light_manager_parent_class = NULL;
static NightLightManager* night_light_manager_instance;
static NightLightManager* night_light_manager_instance = NULL;

static GType night_light_color_interface_get_type_once (void);
static void night_light_color_interface_proxy_g_signal (GDBusProxy* proxy,
                                                 const gchar* sender_name,
                                                 const gchar* signal_name,
                                                 GVariant* parameters);
static gboolean night_light_color_interface_dbus_proxy_get_disabled_until_tomorrow (NightLightColorInterface* self);
static void night_light_color_interface_dbus_proxy_set_disabled_until_tomorrow (NightLightColorInterface* self,
                                                                         gboolean value);
static gboolean night_light_color_interface_dbus_proxy_get_night_light_active (NightLightColorInterface* self);
static void night_light_color_interface_proxy_night_light_color_interface_interface_init (NightLightColorInterfaceIface* iface);
static void night_light_color_interface_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* night_light_color_interface_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 GVariant* _dbus_night_light_color_interface_get_disabled_until_tomorrow (NightLightColorInterface* self);
static GVariant* _dbus_night_light_color_interface_get_night_light_active (NightLightColorInterface* self);
static gboolean night_light_color_interface_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_night_light_color_interface_set_disabled_until_tomorrow (NightLightColorInterface* self,
                                                                    GVariant* _value);
static void _night_light_color_interface_unregister_object (gpointer user_data);
static NightLightManager* night_light_manager_new (void);
static NightLightManager* night_light_manager_construct (GType object_type);
static void night_light_manager_init_interface_data_free (gpointer _data);
static void night_light_manager_init_interface (NightLightManager* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static void night_light_manager_init_interface_finish (NightLightManager* self,
                                                GAsyncResult* _res_);
static gboolean night_light_manager_init_interface_co (NightLightManagerInitInterfaceData* _data_);
static void night_light_manager_init_interface_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void ___lambda6_ (NightLightManager* self,
                  GVariant* changed,
                  gchar** invalid);
static void ____lambda6__g_dbus_proxy_g_properties_changed (GDBusProxy* _sender,
                                                     GVariant* changed_properties,
                                                     gchar** invalidated_properties,
                                                     gpointer self);
static GObject * night_light_manager_constructor (GType type,
                                           guint n_construct_properties,
                                           GObjectConstructParam * construct_properties);
static void night_light_manager_finalize (GObject * obj);
static GType night_light_manager_get_type_once (void);
static void _vala_night_light_manager_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_night_light_manager_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);

static const GDBusMethodInfo * const _night_light_color_interface_dbus_method_info[] = {NULL};
static const GDBusSignalInfo * const _night_light_color_interface_dbus_signal_info[] = {NULL};
static const GDBusPropertyInfo _night_light_color_interface_dbus_property_info_disabled_until_tomorrow = {-1, "DisabledUntilTomorrow", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL};
static const GDBusPropertyInfo _night_light_color_interface_dbus_property_info_night_light_active = {-1, "NightLightActive", "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL};
static const GDBusPropertyInfo * const _night_light_color_interface_dbus_property_info[] = {&_night_light_color_interface_dbus_property_info_disabled_until_tomorrow, &_night_light_color_interface_dbus_property_info_night_light_active, NULL};
static const GDBusInterfaceInfo _night_light_color_interface_dbus_interface_info = {-1, "org.gnome.SettingsDaemon.Color", (GDBusMethodInfo **) (&_night_light_color_interface_dbus_method_info), (GDBusSignalInfo **) (&_night_light_color_interface_dbus_signal_info), (GDBusPropertyInfo **) (&_night_light_color_interface_dbus_property_info), NULL};
static const GDBusInterfaceVTable _night_light_color_interface_dbus_interface_vtable = {night_light_color_interface_dbus_interface_method_call, night_light_color_interface_dbus_interface_get_property, night_light_color_interface_dbus_interface_set_property};

gboolean
night_light_color_interface_get_disabled_until_tomorrow (NightLightColorInterface* self)
{
	NightLightColorInterfaceIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = NIGHT_LIGHT_COLOR_INTERFACE_GET_INTERFACE (self);
	if (_iface_->get_disabled_until_tomorrow) {
		return _iface_->get_disabled_until_tomorrow (self);
	}
	return FALSE;
}

void
night_light_color_interface_set_disabled_until_tomorrow (NightLightColorInterface* self,
                                                         gboolean value)
{
	NightLightColorInterfaceIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = NIGHT_LIGHT_COLOR_INTERFACE_GET_INTERFACE (self);
	if (_iface_->set_disabled_until_tomorrow) {
		_iface_->set_disabled_until_tomorrow (self, value);
	}
}

gboolean
night_light_color_interface_get_night_light_active (NightLightColorInterface* self)
{
	NightLightColorInterfaceIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = NIGHT_LIGHT_COLOR_INTERFACE_GET_INTERFACE (self);
	if (_iface_->get_night_light_active) {
		return _iface_->get_night_light_active (self);
	}
	return FALSE;
}

static void
night_light_color_interface_default_init (NightLightColorInterfaceIface * iface,
                                          gpointer iface_data)
{
}

static GType
night_light_color_interface_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (NightLightColorInterfaceIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) night_light_color_interface_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType night_light_color_interface_type_id;
	night_light_color_interface_type_id = g_type_register_static (G_TYPE_INTERFACE, "NightLightColorInterface", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (night_light_color_interface_type_id, g_dbus_proxy_get_type ());
	g_type_set_qdata (night_light_color_interface_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) night_light_color_interface_proxy_get_type);
	g_type_set_qdata (night_light_color_interface_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.gnome.SettingsDaemon.Color");
	g_type_set_qdata (night_light_color_interface_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_night_light_color_interface_dbus_interface_info));
	g_type_set_qdata (night_light_color_interface_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) night_light_color_interface_register_object);
	return night_light_color_interface_type_id;
}

GType
night_light_color_interface_get_type (void)
{
	static volatile gsize night_light_color_interface_type_id__once = 0;
	if (g_once_init_enter (&night_light_color_interface_type_id__once)) {
		GType night_light_color_interface_type_id;
		night_light_color_interface_type_id = night_light_color_interface_get_type_once ();
		g_once_init_leave (&night_light_color_interface_type_id__once, night_light_color_interface_type_id);
	}
	return night_light_color_interface_type_id__once;
}

G_DEFINE_TYPE_EXTENDED (NightLightColorInterfaceProxy, night_light_color_interface_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (NIGHT_LIGHT_TYPE_COLOR_INTERFACE, night_light_color_interface_proxy_night_light_color_interface_interface_init) )
static void
night_light_color_interface_proxy_class_init (NightLightColorInterfaceProxyClass* klass)
{
	G_DBUS_PROXY_CLASS (klass)->g_signal = night_light_color_interface_proxy_g_signal;
}

static void
night_light_color_interface_proxy_g_signal (GDBusProxy* proxy,
                                            const gchar* sender_name,
                                            const gchar* signal_name,
                                            GVariant* parameters)
{
}

static void
night_light_color_interface_proxy_init (NightLightColorInterfaceProxy* self)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_night_light_color_interface_dbus_interface_info));
}

static gboolean
night_light_color_interface_dbus_proxy_get_disabled_until_tomorrow (NightLightColorInterface* self)
{
	GVariant *_inner_reply;
	gboolean _result;
	_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "DisabledUntilTomorrow");
	if (!_inner_reply) {
		GVariant *_arguments;
		GVariant *_reply;
		GVariantBuilder _arguments_builder;
		g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.gnome.SettingsDaemon.Color"));
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("DisabledUntilTomorrow"));
		_arguments = g_variant_builder_end (&_arguments_builder);
		_reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
		if (!_reply) {
			gboolean _tmp0_ = FALSE;
			return _tmp0_;
		}
		g_variant_get (_reply, "(v)", &_inner_reply);
		g_variant_unref (_reply);
	}
	_result = g_variant_get_boolean (_inner_reply);
	g_variant_unref (_inner_reply);
	return _result;
}

static void
night_light_color_interface_dbus_proxy_set_disabled_until_tomorrow (NightLightColorInterface* self,
                                                                    gboolean value)
{
	GVariant *_arguments;
	GVariant *_reply;
	GVariantBuilder _arguments_builder;
	g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.gnome.SettingsDaemon.Color"));
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("DisabledUntilTomorrow"));
	g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
	g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (value));
	g_variant_builder_close (&_arguments_builder);
	_arguments = g_variant_builder_end (&_arguments_builder);
	_reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
	if (!_reply) {
		return;
	}
	g_variant_unref (_reply);
}

static gboolean
night_light_color_interface_dbus_proxy_get_night_light_active (NightLightColorInterface* self)
{
	GVariant *_inner_reply;
	gboolean _result;
	_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "NightLightActive");
	if (!_inner_reply) {
		GVariant *_arguments;
		GVariant *_reply;
		GVariantBuilder _arguments_builder;
		g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.gnome.SettingsDaemon.Color"));
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("NightLightActive"));
		_arguments = g_variant_builder_end (&_arguments_builder);
		_reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
		if (!_reply) {
			gboolean _tmp1_ = FALSE;
			return _tmp1_;
		}
		g_variant_get (_reply, "(v)", &_inner_reply);
		g_variant_unref (_reply);
	}
	_result = g_variant_get_boolean (_inner_reply);
	g_variant_unref (_inner_reply);
	return _result;
}

static void
night_light_color_interface_proxy_night_light_color_interface_interface_init (NightLightColorInterfaceIface* iface)
{
	iface->get_disabled_until_tomorrow = night_light_color_interface_dbus_proxy_get_disabled_until_tomorrow;
	iface->set_disabled_until_tomorrow = night_light_color_interface_dbus_proxy_set_disabled_until_tomorrow;
	iface->get_night_light_active = night_light_color_interface_dbus_proxy_get_night_light_active;
}

static void
night_light_color_interface_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)
{
	g_object_unref (invocation);
}

static GVariant*
_dbus_night_light_color_interface_get_disabled_until_tomorrow (NightLightColorInterface* self)
{
	gboolean result;
	GVariant* _reply;
	result = night_light_color_interface_get_disabled_until_tomorrow (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
_dbus_night_light_color_interface_get_night_light_active (NightLightColorInterface* self)
{
	gboolean result;
	GVariant* _reply;
	result = night_light_color_interface_get_night_light_active (self);
	_reply = g_variant_new_boolean (result);
	return _reply;
}

static GVariant*
night_light_color_interface_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];
	if (strcmp (property_name, "DisabledUntilTomorrow") == 0) {
		return _dbus_night_light_color_interface_get_disabled_until_tomorrow (object);
	} else if (strcmp (property_name, "NightLightActive") == 0) {
		return _dbus_night_light_color_interface_get_night_light_active (object);
	}
	return NULL;
}

static void
_dbus_night_light_color_interface_set_disabled_until_tomorrow (NightLightColorInterface* self,
                                                               GVariant* _value)
{
	gboolean value = FALSE;
	value = g_variant_get_boolean (_value);
	night_light_color_interface_set_disabled_until_tomorrow (self, value);
}

static gboolean
night_light_color_interface_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];
	if (strcmp (property_name, "DisabledUntilTomorrow") == 0) {
		_dbus_night_light_color_interface_set_disabled_until_tomorrow (object, value);
		return TRUE;
	}
	return FALSE;
}

guint
night_light_color_interface_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 *) (&_night_light_color_interface_dbus_interface_info), &_night_light_color_interface_dbus_interface_vtable, data, _night_light_color_interface_unregister_object, error);
	if (!result) {
		return 0;
	}
	return result;
}

static void
_night_light_color_interface_unregister_object (gpointer user_data)
{
	gpointer* data;
	data = user_data;
	g_object_unref (data[0]);
	g_object_unref (data[1]);
	g_free (data[2]);
	g_free (data);
}

static inline gpointer
night_light_manager_get_instance_private (NightLightManager* self)
{
	return G_STRUCT_MEMBER_P (self, NightLightManager_private_offset);
}

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

NightLightManager*
night_light_manager_get_instance (void)
{
	NightLightManager* _tmp0_;
	NightLightManager* _tmp2_;
	NightLightManager* _tmp3_;
	NightLightManager* result;
	_tmp0_ = night_light_manager_instance;
	if (_tmp0_ == NULL) {
		NightLightManager* _tmp1_;
		_tmp1_ = night_light_manager_new ();
		_g_object_unref0 (night_light_manager_instance);
		night_light_manager_instance = _tmp1_;
	}
	_tmp2_ = night_light_manager_instance;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

static NightLightManager*
night_light_manager_construct (GType object_type)
{
	NightLightManager * self = NULL;
	self = (NightLightManager*) g_object_new (object_type, NULL);
	return self;
}

static NightLightManager*
night_light_manager_new (void)
{
	return night_light_manager_construct (NIGHT_LIGHT_TYPE_MANAGER);
}

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

static void
night_light_manager_init_interface (NightLightManager* self,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	NightLightManagerInitInterfaceData* _data_;
	NightLightManager* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (NightLightManagerInitInterfaceData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, night_light_manager_init_interface_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	night_light_manager_init_interface_co (_data_);
}

static void
night_light_manager_init_interface_finish (NightLightManager* self,
                                           GAsyncResult* _res_)
{
	NightLightManagerInitInterfaceData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
night_light_manager_init_interface_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	NightLightManagerInitInterfaceData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	night_light_manager_init_interface_co (_data_);
}

static void
___lambda6_ (NightLightManager* self,
             GVariant* changed,
             gchar** invalid)
{
	GVariant* snooze = NULL;
	GVariantType* _tmp0_;
	GVariantType* _tmp1_;
	GVariant* _tmp2_;
	GVariant* _tmp3_;
	gboolean _tmp4_ = FALSE;
	GVariant* _tmp5_;
	GVariant* _active = NULL;
	GVariantType* _tmp8_;
	GVariantType* _tmp9_;
	GVariant* _tmp10_;
	GVariant* _tmp11_;
	GVariant* _tmp12_;
	g_return_if_fail (changed != NULL);
	_tmp0_ = g_variant_type_new ("b");
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_lookup_value (changed, "DisabledUntilTomorrow", _tmp1_);
	_tmp3_ = _tmp2_;
	_g_variant_type_free0 (_tmp1_);
	snooze = _tmp3_;
	_tmp5_ = snooze;
	if (_tmp5_ != NULL) {
		GVariant* _tmp6_;
		_tmp6_ = snooze;
		_tmp4_ = g_variant_get_boolean (_tmp6_) != self->priv->_snoozed;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		GVariant* _tmp7_;
		_tmp7_ = snooze;
		self->priv->_snoozed = g_variant_get_boolean (_tmp7_);
		g_object_notify ((GObject*) self, "snoozed");
	}
	_tmp8_ = g_variant_type_new ("b");
	_tmp9_ = _tmp8_;
	_tmp10_ = g_variant_lookup_value (changed, "NightLightActive", _tmp9_);
	_tmp11_ = _tmp10_;
	_g_variant_type_free0 (_tmp9_);
	_active = _tmp11_;
	_tmp12_ = _active;
	if (_tmp12_ != NULL) {
		g_object_notify ((GObject*) self, "active");
	}
	_g_variant_unref0 (_active);
	_g_variant_unref0 (snooze);
}

static void
____lambda6__g_dbus_proxy_g_properties_changed (GDBusProxy* _sender,
                                                GVariant* changed_properties,
                                                gchar** invalidated_properties,
                                                gpointer self)
{
	___lambda6_ ((NightLightManager*) self, changed_properties, invalidated_properties);
}

static gboolean
night_light_manager_init_interface_co (NightLightManagerInitInterfaceData* _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 (NIGHT_LIGHT_TYPE_COLOR_INTERFACE_PROXY, 0, NULL, night_light_manager_init_interface_ready, _data_, "g-flags", G_DBUS_PROXY_FLAGS_NONE, "g-name", "org.gnome.SettingsDaemon.Color", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/gnome/SettingsDaemon/Color", "g-interface-name", "org.gnome.SettingsDaemon.Color", NULL);
		return FALSE;
		_state_1:
		_data_->_tmp1_ = (NightLightColorInterface*) g_async_initable_new_finish ((GAsyncInitable *) _data_->_source_object_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp0_ = (NightLightColorInterface*) _data_->_tmp1_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp2_ = _data_->_tmp0_;
		_data_->_tmp0_ = NULL;
		_g_object_unref0 (_data_->self->priv->interface);
		_data_->self->priv->interface = _data_->_tmp2_;
		_data_->_tmp3_ = _data_->self->priv->interface;
		_data_->_tmp4_ = night_light_color_interface_get_disabled_until_tomorrow (_data_->_tmp3_);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->self->priv->_snoozed = _data_->_tmp5_;
		g_object_notify ((GObject*) _data_->self, "active");
		g_object_notify ((GObject*) _data_->self, "snoozed");
		_data_->_tmp6_ = _data_->self->priv->interface;
		g_signal_connect_object ((GDBusProxy*) _data_->_tmp6_, "g-properties-changed", (GCallback) ____lambda6__g_dbus_proxy_g_properties_changed, _data_->self, 0);
		_g_object_unref0 (_data_->_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp7_ = _data_->e;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		g_warning ("ColorInterface.vala:92: Could not connect to color settings: %s", _data_->_tmp8_);
		_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;
}

void
night_light_manager_toggle_snooze (NightLightManager* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = night_light_manager_get_snoozed (self);
	_tmp1_ = _tmp0_;
	night_light_manager_set_snoozed (self, !_tmp1_);
}

gboolean
night_light_manager_get_snoozed (NightLightManager* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_snoozed;
	return result;
}

void
night_light_manager_set_snoozed (NightLightManager* self,
                                 gboolean value)
{
	NightLightColorInterface* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->interface;
	if (_tmp0_ == NULL) {
		return;
	}
	if (value != self->priv->_snoozed) {
		NightLightColorInterface* _tmp1_;
		self->priv->_snoozed = value;
		_tmp1_ = self->priv->interface;
		night_light_color_interface_set_disabled_until_tomorrow (_tmp1_, value);
	}
	g_object_notify_by_pspec ((GObject *) self, night_light_manager_properties[NIGHT_LIGHT_MANAGER_SNOOZED_PROPERTY]);
}

gboolean
night_light_manager_get_active (NightLightManager* self)
{
	gboolean result;
	NightLightColorInterface* _tmp0_;
	NightLightColorInterface* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->interface;
	if (_tmp0_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp1_ = self->priv->interface;
	_tmp2_ = night_light_color_interface_get_night_light_active (_tmp1_);
	_tmp3_ = _tmp2_;
	result = _tmp3_;
	return result;
}

static GObject *
night_light_manager_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	NightLightManager * self;
	parent_class = G_OBJECT_CLASS (night_light_manager_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, NIGHT_LIGHT_TYPE_MANAGER, NightLightManager);
	night_light_manager_init_interface (self, NULL, NULL);
	return obj;
}

static void
night_light_manager_class_init (NightLightManagerClass * klass,
                                gpointer klass_data)
{
	night_light_manager_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &NightLightManager_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_night_light_manager_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_night_light_manager_set_property;
	G_OBJECT_CLASS (klass)->constructor = night_light_manager_constructor;
	G_OBJECT_CLASS (klass)->finalize = night_light_manager_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), NIGHT_LIGHT_MANAGER_SNOOZED_PROPERTY, night_light_manager_properties[NIGHT_LIGHT_MANAGER_SNOOZED_PROPERTY] = g_param_spec_boolean ("snoozed", "snoozed", "snoozed", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), NIGHT_LIGHT_MANAGER_ACTIVE_PROPERTY, night_light_manager_properties[NIGHT_LIGHT_MANAGER_ACTIVE_PROPERTY] = g_param_spec_boolean ("active", "active", "active", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
night_light_manager_instance_init (NightLightManager * self,
                                   gpointer klass)
{
	self->priv = night_light_manager_get_instance_private (self);
	self->priv->_snoozed = FALSE;
}

static void
night_light_manager_finalize (GObject * obj)
{
	NightLightManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, NIGHT_LIGHT_TYPE_MANAGER, NightLightManager);
	_g_object_unref0 (self->priv->interface);
	G_OBJECT_CLASS (night_light_manager_parent_class)->finalize (obj);
}

static GType
night_light_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (NightLightManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) night_light_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (NightLightManager), 0, (GInstanceInitFunc) night_light_manager_instance_init, NULL };
	GType night_light_manager_type_id;
	night_light_manager_type_id = g_type_register_static (G_TYPE_OBJECT, "NightLightManager", &g_define_type_info, 0);
	NightLightManager_private_offset = g_type_add_instance_private (night_light_manager_type_id, sizeof (NightLightManagerPrivate));
	return night_light_manager_type_id;
}

GType
night_light_manager_get_type (void)
{
	static volatile gsize night_light_manager_type_id__once = 0;
	if (g_once_init_enter (&night_light_manager_type_id__once)) {
		GType night_light_manager_type_id;
		night_light_manager_type_id = night_light_manager_get_type_once ();
		g_once_init_leave (&night_light_manager_type_id__once, night_light_manager_type_id);
	}
	return night_light_manager_type_id__once;
}

static void
_vala_night_light_manager_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	NightLightManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, NIGHT_LIGHT_TYPE_MANAGER, NightLightManager);
	switch (property_id) {
		case NIGHT_LIGHT_MANAGER_SNOOZED_PROPERTY:
		g_value_set_boolean (value, night_light_manager_get_snoozed (self));
		break;
		case NIGHT_LIGHT_MANAGER_ACTIVE_PROPERTY:
		g_value_set_boolean (value, night_light_manager_get_active (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_night_light_manager_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	NightLightManager * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, NIGHT_LIGHT_TYPE_MANAGER, NightLightManager);
	switch (property_id) {
		case NIGHT_LIGHT_MANAGER_SNOOZED_PROPERTY:
		night_light_manager_set_snoozed (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

