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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <json-glib/json-glib.h>
#include <gio/gio.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 SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET (sway_notification_center_widgets_base_widget_get_type ())
#define SWAY_NOTIFICATION_CENTER_WIDGETS_BASE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidget))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_BASE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidgetClass))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_IS_BASE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_IS_BASE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_BASE_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidgetClass))

typedef struct _SwayNotificationCenterWidgetsBaseWidget SwayNotificationCenterWidgetsBaseWidget;
typedef struct _SwayNotificationCenterWidgetsBaseWidgetClass SwayNotificationCenterWidgetsBaseWidgetClass;
typedef struct _SwayNotificationCenterWidgetsBaseWidgetPrivate SwayNotificationCenterWidgetsBaseWidgetPrivate;

#define SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT (sway_notification_center_widgets_backlight_get_type ())
#define SWAY_NOTIFICATION_CENTER_WIDGETS_BACKLIGHT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT, SwayNotificationCenterWidgetsBacklight))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_BACKLIGHT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT, SwayNotificationCenterWidgetsBacklightClass))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_IS_BACKLIGHT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_IS_BACKLIGHT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_BACKLIGHT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT, SwayNotificationCenterWidgetsBacklightClass))

typedef struct _SwayNotificationCenterWidgetsBacklight SwayNotificationCenterWidgetsBacklight;
typedef struct _SwayNotificationCenterWidgetsBacklightClass SwayNotificationCenterWidgetsBacklightClass;
typedef struct _SwayNotificationCenterWidgetsBacklightPrivate SwayNotificationCenterWidgetsBacklightPrivate;

#define SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT_UTIL (sway_notification_center_widgets_backlight_util_get_type ())
#define SWAY_NOTIFICATION_CENTER_WIDGETS_BACKLIGHT_UTIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT_UTIL, SwayNotificationCenterWidgetsBacklightUtil))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_BACKLIGHT_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT_UTIL, SwayNotificationCenterWidgetsBacklightUtilClass))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_IS_BACKLIGHT_UTIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT_UTIL))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_IS_BACKLIGHT_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT_UTIL))
#define SWAY_NOTIFICATION_CENTER_WIDGETS_BACKLIGHT_UTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT_UTIL, SwayNotificationCenterWidgetsBacklightUtilClass))

typedef struct _SwayNotificationCenterWidgetsBacklightUtil SwayNotificationCenterWidgetsBacklightUtil;
typedef struct _SwayNotificationCenterWidgetsBacklightUtilClass SwayNotificationCenterWidgetsBacklightUtilClass;
enum  {
	SWAY_NOTIFICATION_CENTER_WIDGETS_BACKLIGHT_0_PROPERTY,
	SWAY_NOTIFICATION_CENTER_WIDGETS_BACKLIGHT_WIDGET_NAME_PROPERTY,
	SWAY_NOTIFICATION_CENTER_WIDGETS_BACKLIGHT_NUM_PROPERTIES
};
static GParamSpec* sway_notification_center_widgets_backlight_properties[SWAY_NOTIFICATION_CENTER_WIDGETS_BACKLIGHT_NUM_PROPERTIES];
#define _sway_notification_center_widgets_backlight_util_unref0(var) ((var == NULL) ? NULL : (var = (sway_notification_center_widgets_backlight_util_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))

struct _SwayNotificationCenterWidgetsBaseWidget {
	GtkBox parent_instance;
	SwayNotificationCenterWidgetsBaseWidgetPrivate * priv;
};

struct _SwayNotificationCenterWidgetsBaseWidgetClass {
	GtkBoxClass parent_class;
	void (*on_cc_visibility_change) (SwayNotificationCenterWidgetsBaseWidget* self, gboolean value);
	const gchar* (*get_widget_name) (SwayNotificationCenterWidgetsBaseWidget* self);
};

struct _SwayNotificationCenterWidgetsBacklight {
	SwayNotificationCenterWidgetsBaseWidget parent_instance;
	SwayNotificationCenterWidgetsBacklightPrivate * priv;
};

struct _SwayNotificationCenterWidgetsBacklightClass {
	SwayNotificationCenterWidgetsBaseWidgetClass parent_class;
};

struct _SwayNotificationCenterWidgetsBacklightPrivate {
	SwayNotificationCenterWidgetsBacklightUtil* client;
	GtkLabel* label_widget;
	GtkScale* slider;
};

static gint SwayNotificationCenterWidgetsBacklight_private_offset;
static gpointer sway_notification_center_widgets_backlight_parent_class = NULL;

VALA_EXTERN GType sway_notification_center_widgets_base_widget_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SwayNotificationCenterWidgetsBaseWidget, g_object_unref)
VALA_EXTERN GType sway_notification_center_widgets_backlight_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SwayNotificationCenterWidgetsBacklight, g_object_unref)
VALA_EXTERN gpointer sway_notification_center_widgets_backlight_util_ref (gpointer instance);
VALA_EXTERN void sway_notification_center_widgets_backlight_util_unref (gpointer instance);
VALA_EXTERN GParamSpec* sway_notification_center_widgets_param_spec_backlight_util (const gchar* name,
                                                                        const gchar* nick,
                                                                        const gchar* blurb,
                                                                        GType object_type,
                                                                        GParamFlags flags);
VALA_EXTERN void sway_notification_center_widgets_value_set_backlight_util (GValue* value,
                                                                gpointer v_object);
VALA_EXTERN void sway_notification_center_widgets_value_take_backlight_util (GValue* value,
                                                                 gpointer v_object);
VALA_EXTERN gpointer sway_notification_center_widgets_value_get_backlight_util (const GValue* value);
VALA_EXTERN GType sway_notification_center_widgets_backlight_util_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SwayNotificationCenterWidgetsBacklightUtil, sway_notification_center_widgets_backlight_util_unref)
VALA_EXTERN void sway_notification_center_widgets_base_widget_on_cc_visibility_change (SwayNotificationCenterWidgetsBaseWidget* self,
                                                                           gboolean value);
VALA_EXTERN const gchar* sway_notification_center_widgets_base_widget_get_widget_name (SwayNotificationCenterWidgetsBaseWidget* self);
VALA_EXTERN SwayNotificationCenterWidgetsBacklight* sway_notification_center_widgets_backlight_new (const gchar* suffix);
VALA_EXTERN SwayNotificationCenterWidgetsBacklight* sway_notification_center_widgets_backlight_construct (GType object_type,
                                                                                              const gchar* suffix);
VALA_EXTERN SwayNotificationCenterWidgetsBaseWidget* sway_notification_center_widgets_base_widget_construct (GType object_type,
                                                                                                 const gchar* suffix);
VALA_EXTERN JsonObject* sway_notification_center_widgets_base_widget_get_config (SwayNotificationCenterWidgetsBaseWidget* self,
                                                                     GtkWidget* widget);
VALA_EXTERN gpointer sway_notification_center_widgets_base_widget_get_prop (SwayNotificationCenterWidgetsBaseWidget* self,
                                                                GType t_type,
                                                                GBoxedCopyFunc t_dup_func,
                                                                GDestroyNotify t_destroy_func,
                                                                JsonObject* config,
                                                                const gchar* value_key,
                                                                gboolean* found);
VALA_EXTERN SwayNotificationCenterWidgetsBacklightUtil* sway_notification_center_widgets_backlight_util_new (const gchar* s,
                                                                                                 const gchar* d);
VALA_EXTERN SwayNotificationCenterWidgetsBacklightUtil* sway_notification_center_widgets_backlight_util_construct (GType object_type,
                                                                                                       const gchar* s,
                                                                                                       const gchar* d);
VALA_EXTERN gint sway_notification_center_widgets_backlight_util_get_max_value (SwayNotificationCenterWidgetsBacklightUtil* self);
static void __lambda86_ (SwayNotificationCenterWidgetsBacklight* self,
                  gint percent);
static void ___lambda86__sway_notification_center_widgets_backlight_util_brightness_change (SwayNotificationCenterWidgetsBacklightUtil* _sender,
                                                                                     gint percent,
                                                                                     gpointer self);
static void __lambda87_ (SwayNotificationCenterWidgetsBacklight* self);
VALA_EXTERN void sway_notification_center_widgets_backlight_util_set_brightness (SwayNotificationCenterWidgetsBacklightUtil* self,
                                                                     gfloat percent,
                                                                     GAsyncReadyCallback _callback_,
                                                                     gpointer _user_data_);
VALA_EXTERN void sway_notification_center_widgets_backlight_util_set_brightness_finish (SwayNotificationCenterWidgetsBacklightUtil* self,
                                                                            GAsyncResult* _res_);
static void ___lambda87__gtk_range_value_changed (GtkRange* _sender,
                                           gpointer self);
static void sway_notification_center_widgets_backlight_real_on_cc_visibility_change (SwayNotificationCenterWidgetsBaseWidget* base,
                                                                              gboolean val);
VALA_EXTERN void sway_notification_center_widgets_backlight_util_start (SwayNotificationCenterWidgetsBacklightUtil* self);
VALA_EXTERN void sway_notification_center_widgets_backlight_util_close (SwayNotificationCenterWidgetsBacklightUtil* self);
static void sway_notification_center_widgets_backlight_finalize (GObject * obj);
static GType sway_notification_center_widgets_backlight_get_type_once (void);
static void _vala_sway_notification_center_widgets_backlight_get_property (GObject * object,
                                                                    guint property_id,
                                                                    GValue * value,
                                                                    GParamSpec * pspec);

static inline gpointer
sway_notification_center_widgets_backlight_get_instance_private (SwayNotificationCenterWidgetsBacklight* self)
{
	return G_STRUCT_MEMBER_P (self, SwayNotificationCenterWidgetsBacklight_private_offset);
}

static void
__lambda86_ (SwayNotificationCenterWidgetsBacklight* self,
             gint percent)
{
	if (percent < 0) {
		gtk_widget_hide (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
	} else {
		GtkScale* _tmp0_;
		_tmp0_ = self->priv->slider;
		gtk_range_set_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gtk_range_get_type (), GtkRange), (gdouble) percent);
	}
}

static void
___lambda86__sway_notification_center_widgets_backlight_util_brightness_change (SwayNotificationCenterWidgetsBacklightUtil* _sender,
                                                                                gint percent,
                                                                                gpointer self)
{
	__lambda86_ ((SwayNotificationCenterWidgetsBacklight*) self, percent);
}

static void
__lambda87_ (SwayNotificationCenterWidgetsBacklight* self)
{
	SwayNotificationCenterWidgetsBacklightUtil* _tmp0_;
	GtkScale* _tmp1_;
	GtkScale* _tmp2_;
	GtkScale* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	_tmp0_ = self->priv->client;
	_tmp1_ = self->priv->slider;
	sway_notification_center_widgets_backlight_util_set_brightness (_tmp0_, (gfloat) gtk_range_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, gtk_range_get_type (), GtkRange)), NULL, NULL);
	_tmp2_ = self->priv->slider;
	_tmp3_ = self->priv->slider;
	_tmp4_ = g_strdup_printf ("%i", (gint) gtk_range_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, gtk_range_get_type (), GtkRange)));
	_tmp5_ = _tmp4_;
	gtk_widget_set_tooltip_text (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gtk_widget_get_type (), GtkWidget), _tmp5_);
	_g_free0 (_tmp5_);
}

static void
___lambda87__gtk_range_value_changed (GtkRange* _sender,
                                      gpointer self)
{
	__lambda87_ ((SwayNotificationCenterWidgetsBacklight*) self);
}

SwayNotificationCenterWidgetsBacklight*
sway_notification_center_widgets_backlight_construct (GType object_type,
                                                      const gchar* suffix)
{
	SwayNotificationCenterWidgetsBacklight * self = NULL;
	JsonObject* config = NULL;
	JsonObject* _tmp0_;
	JsonObject* _tmp1_;
	SwayNotificationCenterWidgetsBacklightUtil* _tmp33_;
	GtkScale* _tmp34_;
	GtkScale* _tmp35_;
	GtkScale* _tmp36_;
	GtkScale* _tmp37_;
	GtkLabel* _tmp38_;
	GtkScale* _tmp39_;
	g_return_val_if_fail (suffix != NULL, NULL);
	self = (SwayNotificationCenterWidgetsBacklight*) sway_notification_center_widgets_base_widget_construct (object_type, suffix);
	_tmp0_ = sway_notification_center_widgets_base_widget_get_config (G_TYPE_CHECK_INSTANCE_CAST (self, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidget), G_TYPE_CHECK_INSTANCE_CAST (self, gtk_widget_get_type (), GtkWidget));
	config = _tmp0_;
	_tmp1_ = config;
	if (_tmp1_ != NULL) {
		gchar* label = NULL;
		JsonObject* _tmp2_;
		gpointer _tmp3_;
		const gchar* _tmp4_ = NULL;
		const gchar* _tmp5_;
		GtkLabel* _tmp6_;
		gchar* _tmp7_ = NULL;
		JsonObject* _tmp8_;
		gpointer _tmp9_;
		gchar* device = NULL;
		gchar* _tmp11_;
		gchar* _tmp12_ = NULL;
		JsonObject* _tmp13_;
		gpointer _tmp14_;
		gchar* subsystem = NULL;
		gchar* _tmp16_;
		gint min = 0;
		JsonObject* _tmp17_;
		gpointer _tmp18_;
		const gchar* _tmp19_;
		const gchar* _tmp20_;
		GQuark _tmp22_ = 0U;
		static GQuark _tmp21_label0 = 0;
		_tmp2_ = config;
		_tmp3_ = sway_notification_center_widgets_base_widget_get_prop (G_TYPE_CHECK_INSTANCE_CAST (self, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidget), G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp2_, "label", NULL);
		label = (gchar*) _tmp3_;
		_tmp5_ = label;
		_tmp4_ = _tmp5_;
		if (_tmp4_ == NULL) {
			_tmp4_ = "Brightness";
		}
		_tmp6_ = self->priv->label_widget;
		gtk_label_set_label (_tmp6_, _tmp4_);
		_tmp8_ = config;
		_tmp9_ = sway_notification_center_widgets_base_widget_get_prop (G_TYPE_CHECK_INSTANCE_CAST (self, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidget), G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp8_, "device", NULL);
		_tmp7_ = (gchar*) _tmp9_;
		if (_tmp7_ == NULL) {
			gchar* _tmp10_;
			_tmp10_ = g_strdup ("intel_backlight");
			_g_free0 (_tmp7_);
			_tmp7_ = _tmp10_;
		}
		_tmp11_ = _tmp7_;
		_tmp7_ = NULL;
		device = _tmp11_;
		_tmp13_ = config;
		_tmp14_ = sway_notification_center_widgets_base_widget_get_prop (G_TYPE_CHECK_INSTANCE_CAST (self, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidget), G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp13_, "subsystem", NULL);
		_tmp12_ = (gchar*) _tmp14_;
		if (_tmp12_ == NULL) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("backlight");
			_g_free0 (_tmp12_);
			_tmp12_ = _tmp15_;
		}
		_tmp16_ = _tmp12_;
		_tmp12_ = NULL;
		subsystem = _tmp16_;
		_tmp17_ = config;
		_tmp18_ = sway_notification_center_widgets_base_widget_get_prop (G_TYPE_CHECK_INSTANCE_CAST (self, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidget), G_TYPE_INT, NULL, NULL, _tmp17_, "min", NULL);
		min = MAX (0, (gint) ((gintptr) _tmp18_));
		_tmp19_ = subsystem;
		_tmp20_ = _tmp19_;
		_tmp22_ = (NULL == _tmp20_) ? 0 : g_quark_from_string (_tmp20_);
		if (_tmp22_ == ((0 != _tmp21_label0) ? _tmp21_label0 : (_tmp21_label0 = g_quark_from_static_string ("leds")))) {
			switch (0) {
				default:
				{
					const gchar* _tmp23_;
					SwayNotificationCenterWidgetsBacklightUtil* _tmp24_;
					GtkScale* _tmp25_;
					SwayNotificationCenterWidgetsBacklightUtil* _tmp26_;
					_tmp23_ = device;
					_tmp24_ = sway_notification_center_widgets_backlight_util_new ("leds", _tmp23_);
					_sway_notification_center_widgets_backlight_util_unref0 (self->priv->client);
					self->priv->client = _tmp24_;
					_tmp25_ = self->priv->slider;
					_tmp26_ = self->priv->client;
					gtk_range_set_range (G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, gtk_range_get_type (), GtkRange), (gdouble) min, (gdouble) sway_notification_center_widgets_backlight_util_get_max_value (_tmp26_));
					break;
				}
			}
		} else {
			switch (0) {
				default:
				{
					const gchar* _tmp27_;
					const gchar* _tmp30_;
					SwayNotificationCenterWidgetsBacklightUtil* _tmp31_;
					GtkScale* _tmp32_;
					_tmp27_ = subsystem;
					if (g_strcmp0 (_tmp27_, "backlight") != 0) {
						const gchar* _tmp28_;
						const gchar* _tmp29_;
						_tmp28_ = subsystem;
						_tmp29_ = device;
						g_info ("Invalid subsystem %s for device %s. " "Use 'backlight' or 'leds'. Using default: 'backlight'", _tmp28_, _tmp29_);
					}
					_tmp30_ = device;
					_tmp31_ = sway_notification_center_widgets_backlight_util_new ("backlight", _tmp30_);
					_sway_notification_center_widgets_backlight_util_unref0 (self->priv->client);
					self->priv->client = _tmp31_;
					_tmp32_ = self->priv->slider;
					gtk_range_set_range (G_TYPE_CHECK_INSTANCE_CAST (_tmp32_, gtk_range_get_type (), GtkRange), (gdouble) min, (gdouble) 100);
					break;
				}
			}
		}
		_g_free0 (subsystem);
		_g_free0 (_tmp12_);
		_g_free0 (device);
		_g_free0 (_tmp7_);
		_g_free0 (label);
	}
	_tmp33_ = self->priv->client;
	g_signal_connect_object (_tmp33_, "brightness-change", (GCallback) ___lambda86__sway_notification_center_widgets_backlight_util_brightness_change, self, 0);
	_tmp34_ = self->priv->slider;
	gtk_scale_set_draw_value (_tmp34_, FALSE);
	_tmp35_ = self->priv->slider;
	gtk_range_set_round_digits (G_TYPE_CHECK_INSTANCE_CAST (_tmp35_, gtk_range_get_type (), GtkRange), 0);
	_tmp36_ = self->priv->slider;
	gtk_widget_set_hexpand (G_TYPE_CHECK_INSTANCE_CAST (_tmp36_, gtk_widget_get_type (), GtkWidget), TRUE);
	_tmp37_ = self->priv->slider;
	g_signal_connect_object (G_TYPE_CHECK_INSTANCE_CAST (_tmp37_, gtk_range_get_type (), GtkRange), "value-changed", (GCallback) ___lambda87__gtk_range_value_changed, self, 0);
	_tmp38_ = self->priv->label_widget;
	gtk_box_append (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_box_get_type (), GtkBox), G_TYPE_CHECK_INSTANCE_CAST (_tmp38_, gtk_widget_get_type (), GtkWidget));
	_tmp39_ = self->priv->slider;
	gtk_box_append (G_TYPE_CHECK_INSTANCE_CAST (self, gtk_box_get_type (), GtkBox), G_TYPE_CHECK_INSTANCE_CAST (_tmp39_, gtk_widget_get_type (), GtkWidget));
	_json_object_unref0 (config);
	return self;
}

SwayNotificationCenterWidgetsBacklight*
sway_notification_center_widgets_backlight_new (const gchar* suffix)
{
	return sway_notification_center_widgets_backlight_construct (SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT, suffix);
}

static void
sway_notification_center_widgets_backlight_real_on_cc_visibility_change (SwayNotificationCenterWidgetsBaseWidget* base,
                                                                         gboolean val)
{
	SwayNotificationCenterWidgetsBacklight * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT, SwayNotificationCenterWidgetsBacklight);
	if (val) {
		SwayNotificationCenterWidgetsBacklightUtil* _tmp0_;
		_tmp0_ = self->priv->client;
		sway_notification_center_widgets_backlight_util_start (_tmp0_);
	} else {
		SwayNotificationCenterWidgetsBacklightUtil* _tmp1_;
		_tmp1_ = self->priv->client;
		sway_notification_center_widgets_backlight_util_close (_tmp1_);
	}
}

static const gchar*
sway_notification_center_widgets_backlight_real_get_widget_name (SwayNotificationCenterWidgetsBaseWidget* base)
{
	const gchar* result;
	SwayNotificationCenterWidgetsBacklight* self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT, SwayNotificationCenterWidgetsBacklight);
	result = "backlight";
	return result;
}

static void
sway_notification_center_widgets_backlight_class_init (SwayNotificationCenterWidgetsBacklightClass * klass,
                                                       gpointer klass_data)
{
	sway_notification_center_widgets_backlight_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SwayNotificationCenterWidgetsBacklight_private_offset);
	((SwayNotificationCenterWidgetsBaseWidgetClass *) klass)->on_cc_visibility_change = (void (*) (SwayNotificationCenterWidgetsBaseWidget*, gboolean)) sway_notification_center_widgets_backlight_real_on_cc_visibility_change;
	SWAY_NOTIFICATION_CENTER_WIDGETS_BASE_WIDGET_CLASS (klass)->get_widget_name = (const gchar* (*) (SwayNotificationCenterWidgetsBaseWidget*)) sway_notification_center_widgets_backlight_real_get_widget_name;
	G_OBJECT_CLASS (klass)->get_property = _vala_sway_notification_center_widgets_backlight_get_property;
	G_OBJECT_CLASS (klass)->finalize = sway_notification_center_widgets_backlight_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SWAY_NOTIFICATION_CENTER_WIDGETS_BACKLIGHT_WIDGET_NAME_PROPERTY, sway_notification_center_widgets_backlight_properties[SWAY_NOTIFICATION_CENTER_WIDGETS_BACKLIGHT_WIDGET_NAME_PROPERTY] = g_param_spec_string ("widget-name", "widget-name", "widget-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
sway_notification_center_widgets_backlight_instance_init (SwayNotificationCenterWidgetsBacklight * self,
                                                          gpointer klass)
{
	GtkLabel* _tmp0_;
	GtkScale* _tmp1_;
	self->priv = sway_notification_center_widgets_backlight_get_instance_private (self);
	_tmp0_ = (GtkLabel*) gtk_label_new (NULL);
	if (_tmp0_) {
		g_object_set_data ((GObject *) _tmp0_, "vala-creation-function", "");
	}
	g_object_ref_sink (_tmp0_);
	self->priv->label_widget = _tmp0_;
	_tmp1_ = (GtkScale*) gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, (gdouble) 0, (gdouble) 100, (gdouble) 1);
	if (_tmp1_) {
		g_object_set_data ((GObject *) _tmp1_, "vala-creation-function", "");
	}
	g_object_ref_sink (_tmp1_);
	self->priv->slider = _tmp1_;
}

static void
sway_notification_center_widgets_backlight_finalize (GObject * obj)
{
	SwayNotificationCenterWidgetsBacklight * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT, SwayNotificationCenterWidgetsBacklight);
	_sway_notification_center_widgets_backlight_util_unref0 (self->priv->client);
	_g_object_unref0 (self->priv->label_widget);
	_g_object_unref0 (self->priv->slider);
	G_OBJECT_CLASS (sway_notification_center_widgets_backlight_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
sway_notification_center_widgets_backlight_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SwayNotificationCenterWidgetsBacklightClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sway_notification_center_widgets_backlight_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SwayNotificationCenterWidgetsBacklight), 0, (GInstanceInitFunc) sway_notification_center_widgets_backlight_instance_init, NULL };
	GType sway_notification_center_widgets_backlight_type_id;
	sway_notification_center_widgets_backlight_type_id = g_type_register_static (SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, "SwayNotificationCenterWidgetsBacklight", &g_define_type_info, 0);
	SwayNotificationCenterWidgetsBacklight_private_offset = g_type_add_instance_private (sway_notification_center_widgets_backlight_type_id, sizeof (SwayNotificationCenterWidgetsBacklightPrivate));
	return sway_notification_center_widgets_backlight_type_id;
}

GType
sway_notification_center_widgets_backlight_get_type (void)
{
	static gsize sway_notification_center_widgets_backlight_type_id__once = 0;
	if (g_once_init_enter (&sway_notification_center_widgets_backlight_type_id__once)) {
		GType sway_notification_center_widgets_backlight_type_id;
		sway_notification_center_widgets_backlight_type_id = sway_notification_center_widgets_backlight_get_type_once ();
		g_once_init_leave (&sway_notification_center_widgets_backlight_type_id__once, sway_notification_center_widgets_backlight_type_id);
	}
	return sway_notification_center_widgets_backlight_type_id__once;
}

static void
_vala_sway_notification_center_widgets_backlight_get_property (GObject * object,
                                                               guint property_id,
                                                               GValue * value,
                                                               GParamSpec * pspec)
{
	SwayNotificationCenterWidgetsBacklight * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BACKLIGHT, SwayNotificationCenterWidgetsBacklight);
	switch (property_id) {
		case SWAY_NOTIFICATION_CENTER_WIDGETS_BACKLIGHT_WIDGET_NAME_PROPERTY:
		g_value_set_string (value, sway_notification_center_widgets_base_widget_get_widget_name (G_TYPE_CHECK_INSTANCE_CAST (self, SWAY_NOTIFICATION_CENTER_WIDGETS_TYPE_BASE_WIDGET, SwayNotificationCenterWidgetsBaseWidget)));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

