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

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

#include "nightlight.h"
#include <granite-7.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <float.h>
#include <math.h>
#include <wingpanel-9.h>

#define NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_TEMP_CHANGE_DELAY_MS 300
#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  {
	NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_0_PROPERTY,
	NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_AUTOMATIC_SCHEDULE_PROPERTY,
	NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_SNOOZED_PROPERTY,
	NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_TEMPERATURE_PROPERTY,
	NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_NUM_PROPERTIES
};
static GParamSpec* nightlight_widgets_popover_widget_properties[NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block2Data Block2Data;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _NightlightWidgetsPopoverWidgetPrivate {
	GraniteSwitchModelButton* toggle_switch;
	GtkBox* scale_box;
	GtkImage* image;
	GtkScale* temp_scale;
	GSettings* settings;
	guint temp_change_timeout_id;
};

struct _Block2Data {
	int _ref_count_;
	NightlightWidgetsPopoverWidget* self;
	GtkUriLauncher* uri_launcher;
};

static gint NightlightWidgetsPopoverWidget_private_offset;
static gpointer nightlight_widgets_popover_widget_parent_class = NULL;

static void nightlight_widgets_popover_widget_schedule_temp_change (NightlightWidgetsPopoverWidget* self);
static gboolean __lambda4_ (NightlightWidgetsPopoverWidget* self);
static gboolean ___lambda4__gsource_func (gpointer self);
static void nightlight_widgets_popover_widget_show_settings (NightlightWidgetsPopoverWidget* self);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static void __lambda5_ (Block2Data* _data2_,
                 GObject* obj,
                 GAsyncResult* res);
static void ___lambda5__gasync_ready_callback (GObject* source_object,
                                        GAsyncResult* res,
                                        gpointer self);
static GObject * nightlight_widgets_popover_widget_constructor (GType type,
                                                         guint n_construct_properties,
                                                         GObjectConstructParam * construct_properties);
static void _nightlight_widgets_popover_widget_show_settings_gtk_button_clicked (GtkButton* _sender,
                                                                          gpointer self);
static void _nightlight_widgets_popover_widget___lambda7_ (NightlightWidgetsPopoverWidget* self);
static void __nightlight_widgets_popover_widget___lambda7__gtk_range_value_changed (GtkRange* _sender,
                                                                             gpointer self);
static void nightlight_widgets_popover_widget_finalize (GObject * obj);
static GType nightlight_widgets_popover_widget_get_type_once (void);
static void _vala_nightlight_widgets_popover_widget_set_property (GObject * object,
                                                           guint property_id,
                                                           const GValue * value,
                                                           GParamSpec * pspec);

static inline gpointer
nightlight_widgets_popover_widget_get_instance_private (NightlightWidgetsPopoverWidget* self)
{
	return G_STRUCT_MEMBER_P (self, NightlightWidgetsPopoverWidget_private_offset);
}

static gboolean
__lambda4_ (NightlightWidgetsPopoverWidget* self)
{
	GSettings* _tmp0_;
	GtkScale* _tmp1_;
	gboolean result;
	_tmp0_ = self->priv->settings;
	_tmp1_ = self->priv->temp_scale;
	g_settings_set_uint (_tmp0_, "night-light-temperature", (guint) gtk_range_get_value ((GtkRange*) _tmp1_));
	self->priv->temp_change_timeout_id = (guint) 0;
	result = FALSE;
	return result;
}

static gboolean
___lambda4__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda4_ ((NightlightWidgetsPopoverWidget*) self);
	return result;
}

static void
nightlight_widgets_popover_widget_schedule_temp_change (NightlightWidgetsPopoverWidget* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->temp_change_timeout_id != ((guint) 0)) {
		return;
	}
	self->priv->temp_change_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_TEMP_CHANGE_DELAY_MS, ___lambda4__gsource_func, g_object_ref (self), g_object_unref);
}

static Block2Data*
block2_data_ref (Block2Data* _data2_)
{
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}

static void
block2_data_unref (void * _userdata_)
{
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		NightlightWidgetsPopoverWidget* self;
		self = _data2_->self;
		_g_object_unref0 (_data2_->uri_launcher);
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}

static void
__lambda5_ (Block2Data* _data2_,
            GObject* obj,
            GAsyncResult* res)
{
	NightlightWidgetsPopoverWidget* self;
	GError* _inner_error0_ = NULL;
	self = _data2_->self;
	g_return_if_fail (res != NULL);
	{
		gtk_uri_launcher_launch_finish (_data2_->uri_launcher, res, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp0_;
		const gchar* _tmp1_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp0_ = e;
		_tmp1_ = _tmp0_->message;
		g_warning ("PopoverWidget.vala:120: Failed to open display settings: %s", _tmp1_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
___lambda5__gasync_ready_callback (GObject* source_object,
                                   GAsyncResult* res,
                                   gpointer self)
{
	__lambda5_ (self, source_object, res);
	block2_data_unref (self);
}

static void
nightlight_widgets_popover_widget_show_settings (NightlightWidgetsPopoverWidget* self)
{
	Block2Data* _data2_;
	GtkUriLauncher* _tmp0_;
	GtkRoot* _tmp1_;
	g_return_if_fail (self != NULL);
	_data2_ = g_slice_new0 (Block2Data);
	_data2_->_ref_count_ = 1;
	_data2_->self = g_object_ref (self);
	_tmp0_ = gtk_uri_launcher_new ("settings://display/night-light");
	_data2_->uri_launcher = _tmp0_;
	_tmp1_ = gtk_widget_get_root ((GtkWidget*) self);
	gtk_uri_launcher_launch (_data2_->uri_launcher, G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_window_get_type (), GtkWindow), NULL, ___lambda5__gasync_ready_callback, block2_data_ref (_data2_));
	block2_data_unref (_data2_);
	_data2_ = NULL;
}

NightlightWidgetsPopoverWidget*
nightlight_widgets_popover_widget_construct (GType object_type)
{
	NightlightWidgetsPopoverWidget * self = NULL;
	self = (NightlightWidgetsPopoverWidget*) g_object_new (object_type, NULL);
	return self;
}

NightlightWidgetsPopoverWidget*
nightlight_widgets_popover_widget_new (void)
{
	return nightlight_widgets_popover_widget_construct (NIGHTLIGHT_WIDGETS_TYPE_POPOVER_WIDGET);
}

void
nightlight_widgets_popover_widget_set_automatic_schedule (NightlightWidgetsPopoverWidget* self,
                                                          gboolean value)
{
	g_return_if_fail (self != NULL);
	if (value) {
		GraniteSwitchModelButton* _tmp0_;
		_tmp0_ = self->priv->toggle_switch;
		granite_switch_model_button_set_description (_tmp0_, _ ("Disabled until sunrise"));
	} else {
		GraniteSwitchModelButton* _tmp1_;
		_tmp1_ = self->priv->toggle_switch;
		granite_switch_model_button_set_description (_tmp1_, _ ("Disabled until tomorrow"));
	}
	g_object_notify_by_pspec ((GObject *) self, nightlight_widgets_popover_widget_properties[NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_AUTOMATIC_SCHEDULE_PROPERTY]);
}

void
nightlight_widgets_popover_widget_set_snoozed (NightlightWidgetsPopoverWidget* self,
                                               gboolean value)
{
	GtkBox* _tmp0_;
	GraniteSwitchModelButton* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->scale_box;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, !value);
	_tmp1_ = self->priv->toggle_switch;
	gtk_toggle_button_set_active ((GtkToggleButton*) _tmp1_, value);
	if (value) {
		GtkImage* _tmp2_;
		_tmp2_ = self->priv->image;
		g_object_set (_tmp2_, "icon-name", "indicator-night-light-disabled-symbolic", NULL);
	} else {
		GtkImage* _tmp3_;
		_tmp3_ = self->priv->image;
		g_object_set (_tmp3_, "icon-name", "indicator-night-light-symbolic", NULL);
	}
	g_object_notify_by_pspec ((GObject *) self, nightlight_widgets_popover_widget_properties[NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_SNOOZED_PROPERTY]);
}

void
nightlight_widgets_popover_widget_set_temperature (NightlightWidgetsPopoverWidget* self,
                                                   gint value)
{
	GtkScale* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->temp_scale;
	gtk_range_set_value ((GtkRange*) _tmp0_, (gdouble) value);
	g_object_notify_by_pspec ((GObject *) self, nightlight_widgets_popover_widget_properties[NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_TEMPERATURE_PROPERTY]);
}

static void
_nightlight_widgets_popover_widget_show_settings_gtk_button_clicked (GtkButton* _sender,
                                                                     gpointer self)
{
	nightlight_widgets_popover_widget_show_settings ((NightlightWidgetsPopoverWidget*) self);
}

static void
_nightlight_widgets_popover_widget___lambda7_ (NightlightWidgetsPopoverWidget* self)
{
	nightlight_widgets_popover_widget_schedule_temp_change (self);
}

static void
__nightlight_widgets_popover_widget___lambda7__gtk_range_value_changed (GtkRange* _sender,
                                                                        gpointer self)
{
	_nightlight_widgets_popover_widget___lambda7_ ((NightlightWidgetsPopoverWidget*) self);
}

static GObject *
nightlight_widgets_popover_widget_constructor (GType type,
                                               guint n_construct_properties,
                                               GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	NightlightWidgetsPopoverWidget * self;
	GraniteSwitchModelButton* _tmp0_;
	GtkSeparator* toggle_sep = NULL;
	GtkSeparator* _tmp1_ = NULL;
	GtkImage* _tmp2_ = NULL;
	GtkScale* _tmp3_ = NULL;
	GtkScale* _tmp4_;
	GtkBox* _tmp5_ = NULL;
	GtkBox* _tmp6_;
	GtkImage* _tmp7_;
	GtkBox* _tmp8_;
	GtkScale* _tmp9_;
	GtkSeparator* scale_sep = NULL;
	GtkSeparator* _tmp10_ = NULL;
	WingpanelPopoverMenuItem* settings_button = NULL;
	gchar* _tmp11_;
	WingpanelPopoverMenuItem* _tmp12_ = NULL;
	WingpanelPopoverMenuItem* _tmp13_;
	GraniteSwitchModelButton* _tmp14_;
	GtkSeparator* _tmp15_;
	GtkBox* _tmp16_;
	GtkSeparator* _tmp17_;
	WingpanelPopoverMenuItem* _tmp18_;
	NightLightManager* _tmp19_;
	NightLightManager* _tmp20_;
	gboolean _tmp21_;
	gboolean _tmp22_;
	GraniteSwitchModelButton* _tmp23_;
	NightLightManager* _tmp24_;
	NightLightManager* _tmp25_;
	GSettings* _tmp26_;
	GSettings* _tmp27_;
	GSettings* _tmp28_;
	GtkScale* _tmp29_;
	parent_class = G_OBJECT_CLASS (nightlight_widgets_popover_widget_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, NIGHTLIGHT_WIDGETS_TYPE_POPOVER_WIDGET, NightlightWidgetsPopoverWidget);
	_tmp0_ = granite_switch_model_button_new (_ ("Snooze Night Light"));
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->toggle_switch);
	self->priv->toggle_switch = _tmp0_;
	_tmp1_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp1_, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp1_, 3);
	g_object_ref_sink (_tmp1_);
	toggle_sep = _tmp1_;
	_tmp2_ = (GtkImage*) gtk_image_new ();
	gtk_image_set_pixel_size (_tmp2_, 48);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->image);
	self->priv->image = _tmp2_;
	_tmp3_ = (GtkScale*) gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, (gdouble) 1500, (gdouble) 6000, (gdouble) 10);
	gtk_scale_set_draw_value (_tmp3_, FALSE);
	gtk_scale_set_has_origin (_tmp3_, FALSE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp3_, TRUE);
	gtk_range_set_inverted ((GtkRange*) _tmp3_, TRUE);
	g_object_set ((GtkWidget*) _tmp3_, "width-request", 200, NULL);
	g_object_ref_sink (_tmp3_);
	_g_object_unref0 (self->priv->temp_scale);
	self->priv->temp_scale = _tmp3_;
	_tmp4_ = self->priv->temp_scale;
	gtk_widget_add_css_class ((GtkWidget*) _tmp4_, "warmth");
	_tmp5_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp5_, 6);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp5_, 12);
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->scale_box);
	self->priv->scale_box = _tmp5_;
	_tmp6_ = self->priv->scale_box;
	_tmp7_ = self->priv->image;
	gtk_box_append (_tmp6_, (GtkWidget*) _tmp7_);
	_tmp8_ = self->priv->scale_box;
	_tmp9_ = self->priv->temp_scale;
	gtk_box_append (_tmp8_, (GtkWidget*) _tmp9_);
	_tmp10_ = (GtkSeparator*) gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp10_, 3);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp10_, 3);
	g_object_ref_sink (_tmp10_);
	scale_sep = _tmp10_;
	_tmp11_ = g_strdup (_ ("Night Light Settings…"));
	_tmp12_ = wingpanel_popover_menu_item_new ();
	wingpanel_popover_menu_item_set_text (_tmp12_, _tmp11_);
	_g_free0 (_tmp11_);
	g_object_ref_sink (_tmp12_);
	settings_button = _tmp12_;
	_tmp13_ = settings_button;
	g_signal_connect_object ((GtkButton*) _tmp13_, "clicked", (GCallback) _nightlight_widgets_popover_widget_show_settings_gtk_button_clicked, self, 0);
	gtk_orientable_set_orientation ((GtkOrientable*) self, GTK_ORIENTATION_VERTICAL);
	_tmp14_ = self->priv->toggle_switch;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp14_);
	_tmp15_ = toggle_sep;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp15_);
	_tmp16_ = self->priv->scale_box;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp16_);
	_tmp17_ = scale_sep;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp17_);
	_tmp18_ = settings_button;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp18_);
	_tmp19_ = night_light_manager_get_instance ();
	_tmp20_ = _tmp19_;
	_tmp21_ = night_light_manager_get_snoozed (_tmp20_);
	_tmp22_ = _tmp21_;
	nightlight_widgets_popover_widget_set_snoozed (self, _tmp22_);
	_g_object_unref0 (_tmp20_);
	_tmp23_ = self->priv->toggle_switch;
	_tmp24_ = night_light_manager_get_instance ();
	_tmp25_ = _tmp24_;
	g_object_bind_property_with_closures ((GObject*) _tmp23_, "active", (GObject*) _tmp25_, "snoozed", G_BINDING_DEFAULT, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_g_object_unref0 (_tmp25_);
	_tmp26_ = g_settings_new ("org.gnome.settings-daemon.plugins.color");
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp26_;
	_tmp27_ = self->priv->settings;
	g_settings_bind (_tmp27_, "night-light-temperature", (GObject*) self, "temperature", G_SETTINGS_BIND_GET);
	_tmp28_ = self->priv->settings;
	g_settings_bind (_tmp28_, "night-light-schedule-automatic", (GObject*) self, "automatic_schedule", G_SETTINGS_BIND_GET);
	_tmp29_ = self->priv->temp_scale;
	g_signal_connect_object ((GtkRange*) _tmp29_, "value-changed", (GCallback) __nightlight_widgets_popover_widget___lambda7__gtk_range_value_changed, self, 0);
	_g_object_unref0 (settings_button);
	_g_object_unref0 (scale_sep);
	_g_object_unref0 (toggle_sep);
	return obj;
}

static void
nightlight_widgets_popover_widget_class_init (NightlightWidgetsPopoverWidgetClass * klass,
                                              gpointer klass_data)
{
	nightlight_widgets_popover_widget_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &NightlightWidgetsPopoverWidget_private_offset);
	G_OBJECT_CLASS (klass)->set_property = _vala_nightlight_widgets_popover_widget_set_property;
	G_OBJECT_CLASS (klass)->constructor = nightlight_widgets_popover_widget_constructor;
	G_OBJECT_CLASS (klass)->finalize = nightlight_widgets_popover_widget_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_AUTOMATIC_SCHEDULE_PROPERTY, nightlight_widgets_popover_widget_properties[NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_AUTOMATIC_SCHEDULE_PROPERTY] = g_param_spec_boolean ("automatic-schedule", "automatic-schedule", "automatic-schedule", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_SNOOZED_PROPERTY, nightlight_widgets_popover_widget_properties[NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_SNOOZED_PROPERTY] = g_param_spec_boolean ("snoozed", "snoozed", "snoozed", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_TEMPERATURE_PROPERTY, nightlight_widgets_popover_widget_properties[NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_TEMPERATURE_PROPERTY] = g_param_spec_int ("temperature", "temperature", "temperature", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE));
}

static void
nightlight_widgets_popover_widget_instance_init (NightlightWidgetsPopoverWidget * self,
                                                 gpointer klass)
{
	self->priv = nightlight_widgets_popover_widget_get_instance_private (self);
	self->priv->temp_change_timeout_id = (guint) 0;
}

static void
nightlight_widgets_popover_widget_finalize (GObject * obj)
{
	NightlightWidgetsPopoverWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, NIGHTLIGHT_WIDGETS_TYPE_POPOVER_WIDGET, NightlightWidgetsPopoverWidget);
	_g_object_unref0 (self->priv->toggle_switch);
	_g_object_unref0 (self->priv->scale_box);
	_g_object_unref0 (self->priv->image);
	_g_object_unref0 (self->priv->temp_scale);
	_g_object_unref0 (self->priv->settings);
	G_OBJECT_CLASS (nightlight_widgets_popover_widget_parent_class)->finalize (obj);
}

static GType
nightlight_widgets_popover_widget_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (NightlightWidgetsPopoverWidgetClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) nightlight_widgets_popover_widget_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (NightlightWidgetsPopoverWidget), 0, (GInstanceInitFunc) nightlight_widgets_popover_widget_instance_init, NULL };
	GType nightlight_widgets_popover_widget_type_id;
	nightlight_widgets_popover_widget_type_id = g_type_register_static (gtk_box_get_type (), "NightlightWidgetsPopoverWidget", &g_define_type_info, 0);
	NightlightWidgetsPopoverWidget_private_offset = g_type_add_instance_private (nightlight_widgets_popover_widget_type_id, sizeof (NightlightWidgetsPopoverWidgetPrivate));
	return nightlight_widgets_popover_widget_type_id;
}

GType
nightlight_widgets_popover_widget_get_type (void)
{
	static volatile gsize nightlight_widgets_popover_widget_type_id__once = 0;
	if (g_once_init_enter (&nightlight_widgets_popover_widget_type_id__once)) {
		GType nightlight_widgets_popover_widget_type_id;
		nightlight_widgets_popover_widget_type_id = nightlight_widgets_popover_widget_get_type_once ();
		g_once_init_leave (&nightlight_widgets_popover_widget_type_id__once, nightlight_widgets_popover_widget_type_id);
	}
	return nightlight_widgets_popover_widget_type_id__once;
}

static void
_vala_nightlight_widgets_popover_widget_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec)
{
	NightlightWidgetsPopoverWidget * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, NIGHTLIGHT_WIDGETS_TYPE_POPOVER_WIDGET, NightlightWidgetsPopoverWidget);
	switch (property_id) {
		case NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_AUTOMATIC_SCHEDULE_PROPERTY:
		nightlight_widgets_popover_widget_set_automatic_schedule (self, g_value_get_boolean (value));
		break;
		case NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_SNOOZED_PROPERTY:
		nightlight_widgets_popover_widget_set_snoozed (self, g_value_get_boolean (value));
		break;
		case NIGHTLIGHT_WIDGETS_POPOVER_WIDGET_TEMPERATURE_PROPERTY:
		nightlight_widgets_popover_widget_set_temperature (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

