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

/*
 * BrightnessController
 * This file is part of budgie-extras
 *
 * Author: Serdar ŞEN github.com/serdarsen
 *
 * Copyright © 2018 Ubuntu Budgie Developers
 *
 * 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 3 of the License, or
 * (at your option) any later version.
 */

#include "brightnesscontroller.h"
#include <plugin.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <glib-object.h>
#include <gdk/gdk.h>
#include <locale.h>
#include <glib/gi18n-lib.h>
#include <config.h>
#include <libpeas.h>

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

enum  {
	BRIGHTNESS_CONTROLLER_APPLET_0_PROPERTY,
	BRIGHTNESS_CONTROLLER_APPLET_UUID_PROPERTY,
	BRIGHTNESS_CONTROLLER_APPLET_NUM_PROPERTIES
};
static GParamSpec* brightness_controller_applet_properties[BRIGHTNESS_CONTROLLER_APPLET_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _brightness_controller_helpers_config_helper_unref0(var) ((var == NULL) ? NULL : (var = (brightness_controller_helpers_config_helper_unref (var), NULL)))
enum  {
	BRIGHTNESS_CONTROLLER_PLUGIN_0_PROPERTY,
	BRIGHTNESS_CONTROLLER_PLUGIN_NUM_PROPERTIES
};
static GParamSpec* brightness_controller_plugin_properties[BRIGHTNESS_CONTROLLER_PLUGIN_NUM_PROPERTIES];

struct _BrightnessControllerAppletPrivate {
	BrightnessControllerWidgetsIndicatorButton* indicatorButton;
	BrightnessControllerWidgetsPopover* popover;
	BudgiePopoverManager* manager;
	GSettings* settings;
	gchar* _uuid;
	BrightnessControllerHelpersConfigHelper* gnomeSettingsDaemonsColorPluginConfigHelper;
};

static gint BrightnessControllerApplet_private_offset;
static gpointer brightness_controller_applet_parent_class = NULL;
static GType brightness_controller_applet_type_id = 0;
static gpointer brightness_controller_plugin_parent_class = NULL;
static BudgiePluginIface * brightness_controller_plugin_budgie_plugin_parent_iface = NULL;
static GType brightness_controller_plugin_type_id = 0;

static gboolean __lambda17_ (BrightnessControllerApplet* self,
                      GdkEventButton* e);
static gboolean ___lambda17__gtk_widget_button_press_event (GtkWidget* _sender,
                                                     GdkEventButton* event,
                                                     gpointer self);
static void brightness_controller_applet_real_update_popovers (BudgieApplet* base,
                                                        BudgiePopoverManager* manager);
static GtkWidget* brightness_controller_applet_real_get_settings_ui (BudgieApplet* base);
static void _brightness_controller_applet_OnGnomeSettingsDaemonsColorPluginCheckButtonToggled_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                                                                  gpointer self);
static gboolean brightness_controller_applet_real_supports_settings (BudgieApplet* base);
static void brightness_controller_applet_finalize (GObject * obj);
static void _vala_brightness_controller_applet_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec);
static void _vala_brightness_controller_applet_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec);
static BudgieApplet* brightness_controller_plugin_real_get_panel_widget (BudgiePlugin* base,
                                                                  const gchar* uuid);
GType brightness_controller_widgets_indicator_button_register_type (GTypeModule * module);
GType brightness_controller_widgets_custom_menu_button_register_type (GTypeModule * module);
GType brightness_controller_widgets_popover_register_type (GTypeModule * module);
GType brightness_controller_widgets_custom_scale_register_type (GTypeModule * module);
GType brightness_controller_helpers_dim_helper_register_type (GTypeModule * module);
GType brightness_controller_helpers_light_helper_register_type (GTypeModule * module);
GType brightness_controller_helpers_subprocess_helper_register_type (GTypeModule * module);
GType brightness_controller_helpers_config_helper_register_type (GTypeModule * module);
GType brightness_controller_helpers_color_settings_register_type (GTypeModule * module);
VALA_EXTERN void brightness_controller_helpers_color_settings_proxy_register_dynamic_type (GTypeModule* module);
GType brightness_controller_models_flame_register_type (GTypeModule * module);
GType brightness_controller_models_dim_register_type (GTypeModule * module);
GType brightness_controller_models_light_register_type (GTypeModule * module);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
brightness_controller_applet_get_instance_private (BrightnessControllerApplet* self)
{
	return G_STRUCT_MEMBER_P (self, BrightnessControllerApplet_private_offset);
}

BrightnessControllerApplet*
brightness_controller_applet_construct (GType object_type,
                                        const gchar* uuid)
{
	BrightnessControllerApplet * self = NULL;
	BrightnessControllerHelpersConfigHelper* _tmp0_;
	GSettings* _tmp1_;
	BrightnessControllerWidgetsIndicatorButton* _tmp2_;
	BrightnessControllerWidgetsIndicatorButton* _tmp3_;
	BrightnessControllerWidgetsPopover* _tmp4_;
	BrightnessControllerWidgetsIndicatorButton* _tmp5_;
	g_return_val_if_fail (uuid != NULL, NULL);
	self = (BrightnessControllerApplet*) g_object_new (object_type, "uuid", uuid, NULL);
	brightness_controller_applet_initialiseLocaleLanguageSupport (self);
	_tmp0_ = brightness_controller_helpers_config_helper_new ("autostart", "org.gnome.SettingsDaemon.Color.desktop");
	_brightness_controller_helpers_config_helper_unref0 (self->priv->gnomeSettingsDaemonsColorPluginConfigHelper);
	self->priv->gnomeSettingsDaemonsColorPluginConfigHelper = _tmp0_;
	_tmp1_ = budgie_applet_get_applet_settings ((BudgieApplet*) self, uuid);
	_g_object_unref0 (self->priv->settings);
	self->priv->settings = _tmp1_;
	_tmp2_ = brightness_controller_widgets_indicator_button_new ();
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->indicatorButton);
	self->priv->indicatorButton = _tmp2_;
	_tmp3_ = self->priv->indicatorButton;
	_tmp4_ = brightness_controller_widgets_popover_new (_tmp3_, 140, 300);
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->popover);
	self->priv->popover = _tmp4_;
	brightness_controller_applet_AddPressEventToIndicatorButton (self);
	_tmp5_ = self->priv->indicatorButton;
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp5_);
	gtk_widget_show_all ((GtkWidget*) self);
	return self;
}

BrightnessControllerApplet*
brightness_controller_applet_new (const gchar* uuid)
{
	return brightness_controller_applet_construct (BRIGHTNESS_CONTROLLER_TYPE_APPLET, uuid);
}

static gboolean
__lambda17_ (BrightnessControllerApplet* self,
             GdkEventButton* e)
{
	BrightnessControllerWidgetsPopover* _tmp0_;
	gboolean result;
	g_return_val_if_fail (e != NULL, FALSE);
	if (e->button != ((guint) 1)) {
		result = GDK_EVENT_PROPAGATE;
		return result;
	}
	_tmp0_ = self->priv->popover;
	if (gtk_widget_get_visible ((GtkWidget*) _tmp0_)) {
		BrightnessControllerWidgetsPopover* _tmp1_;
		_tmp1_ = self->priv->popover;
		gtk_widget_hide ((GtkWidget*) _tmp1_);
	} else {
		BudgiePopoverManager* _tmp2_;
		BrightnessControllerWidgetsIndicatorButton* _tmp3_;
		BrightnessControllerWidgetsPopover* _tmp4_;
		_tmp2_ = self->priv->manager;
		_tmp3_ = self->priv->indicatorButton;
		budgie_popover_manager_show_popover (_tmp2_, (GtkWidget*) _tmp3_);
		_tmp4_ = self->priv->popover;
		brightness_controller_widgets_popover_OnShow (_tmp4_);
	}
	result = GDK_EVENT_STOP;
	return result;
}

static gboolean
___lambda17__gtk_widget_button_press_event (GtkWidget* _sender,
                                            GdkEventButton* event,
                                            gpointer self)
{
	gboolean result;
	result = __lambda17_ ((BrightnessControllerApplet*) self, event);
	return result;
}

void
brightness_controller_applet_AddPressEventToIndicatorButton (BrightnessControllerApplet* self)
{
	BrightnessControllerWidgetsIndicatorButton* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->indicatorButton;
	g_signal_connect_object ((GtkWidget*) _tmp0_, "button-press-event", (GCallback) ___lambda17__gtk_widget_button_press_event, self, 0);
}

static void
brightness_controller_applet_real_update_popovers (BudgieApplet* base,
                                                   BudgiePopoverManager* manager)
{
	BrightnessControllerApplet * self;
	BrightnessControllerWidgetsIndicatorButton* _tmp0_;
	BrightnessControllerWidgetsPopover* _tmp1_;
	self = (BrightnessControllerApplet*) base;
	self->priv->manager = manager;
	_tmp0_ = self->priv->indicatorButton;
	_tmp1_ = self->priv->popover;
	budgie_popover_manager_register_popover (manager, (GtkWidget*) _tmp0_, (GtkPopover*) _tmp1_);
}

void
brightness_controller_applet_initialiseLocaleLanguageSupport (BrightnessControllerApplet* self)
{
	g_return_if_fail (self != NULL);
	setlocale (LC_ALL, "");
	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
}

static void
_brightness_controller_applet_OnGnomeSettingsDaemonsColorPluginCheckButtonToggled_gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                                                                                             gpointer self)
{
	brightness_controller_applet_OnGnomeSettingsDaemonsColorPluginCheckButtonToggled ((BrightnessControllerApplet*) self);
}

static GtkWidget*
brightness_controller_applet_real_get_settings_ui (BudgieApplet* base)
{
	BrightnessControllerApplet * self;
	GtkBox* settingsLayout = NULL;
	GtkBox* _tmp0_;
	GtkLabel* gnomeSettingsDaemonsColorPluginCheckButtonLabel = NULL;
	GtkLabel* _tmp1_;
	GtkLabel* _tmp2_;
	GtkCheckButton* gnomeSettingsDaemonsColorPluginCheckButton = NULL;
	GtkCheckButton* _tmp3_;
	BrightnessControllerHelpersConfigHelper* _tmp4_;
	GtkCheckButton* _tmp7_;
	GtkBox* _tmp8_;
	GtkCheckButton* _tmp9_;
	GtkBox* _tmp10_;
	GtkLabel* _tmp11_;
	GtkBox* _tmp12_;
	GtkWidget* result;
	self = (BrightnessControllerApplet*) base;
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
	g_object_ref_sink (_tmp0_);
	settingsLayout = _tmp0_;
	_tmp1_ = (GtkLabel*) gtk_label_new (_ ("Remove Gnome Settings Daemon's color plugin from autostart"));
	g_object_ref_sink (_tmp1_);
	gnomeSettingsDaemonsColorPluginCheckButtonLabel = _tmp1_;
	_tmp2_ = gnomeSettingsDaemonsColorPluginCheckButtonLabel;
	gtk_label_set_line_wrap (_tmp2_, TRUE);
	_tmp3_ = (GtkCheckButton*) gtk_check_button_new ();
	g_object_ref_sink (_tmp3_);
	gnomeSettingsDaemonsColorPluginCheckButton = _tmp3_;
	_tmp4_ = self->priv->gnomeSettingsDaemonsColorPluginConfigHelper;
	if (brightness_controller_helpers_config_helper_IsFileExist (_tmp4_)) {
		GtkCheckButton* _tmp5_;
		_tmp5_ = gnomeSettingsDaemonsColorPluginCheckButton;
		gtk_toggle_button_set_active ((GtkToggleButton*) _tmp5_, TRUE);
	} else {
		GtkCheckButton* _tmp6_;
		_tmp6_ = gnomeSettingsDaemonsColorPluginCheckButton;
		gtk_toggle_button_set_active ((GtkToggleButton*) _tmp6_, FALSE);
	}
	_tmp7_ = gnomeSettingsDaemonsColorPluginCheckButton;
	g_signal_connect_object ((GtkToggleButton*) _tmp7_, "toggled", (GCallback) _brightness_controller_applet_OnGnomeSettingsDaemonsColorPluginCheckButtonToggled_gtk_toggle_button_toggled, self, 0);
	_tmp8_ = settingsLayout;
	_tmp9_ = gnomeSettingsDaemonsColorPluginCheckButton;
	gtk_box_pack_start (_tmp8_, (GtkWidget*) _tmp9_, FALSE, FALSE, (guint) 1);
	_tmp10_ = settingsLayout;
	_tmp11_ = gnomeSettingsDaemonsColorPluginCheckButtonLabel;
	gtk_box_pack_start (_tmp10_, (GtkWidget*) _tmp11_, FALSE, FALSE, (guint) 2);
	_tmp12_ = settingsLayout;
	gtk_widget_show ((GtkWidget*) _tmp12_);
	result = (GtkWidget*) settingsLayout;
	_g_object_unref0 (gnomeSettingsDaemonsColorPluginCheckButton);
	_g_object_unref0 (gnomeSettingsDaemonsColorPluginCheckButtonLabel);
	return result;
}

void
brightness_controller_applet_OnGnomeSettingsDaemonsColorPluginCheckButtonToggled (BrightnessControllerApplet* self)
{
	BrightnessControllerHelpersConfigHelper* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->gnomeSettingsDaemonsColorPluginConfigHelper;
	if (brightness_controller_helpers_config_helper_IsFileExist (_tmp0_)) {
		BrightnessControllerHelpersConfigHelper* _tmp1_;
		_tmp1_ = self->priv->gnomeSettingsDaemonsColorPluginConfigHelper;
		brightness_controller_helpers_config_helper_Delete (_tmp1_);
	} else {
		gchar* path = NULL;
		gchar* _tmp2_;
		gchar* _tmp3_;
		BrightnessControllerHelpersConfigHelper* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		const gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		gchar** _tmp19_;
		gchar** _tmp20_;
		gint _tmp20__length1;
		_tmp2_ = g_strdup (PACKAGE_LIBDIR "/gnome-settings-daemon");
		path = _tmp2_;
		_tmp3_ = g_strdup (PACKAGE_LIBEXECDIR);
		_g_free0 (path);
		path = _tmp3_;
		_tmp4_ = self->priv->gnomeSettingsDaemonsColorPluginConfigHelper;
		_tmp5_ = g_strdup ("[Desktop Entry]");
		_tmp6_ = g_strdup ("Type=Application");
		_tmp7_ = g_strdup ("Name=GNOME Settings Daemon's color plugin");
		_tmp8_ = path;
		_tmp9_ = g_strconcat ("Exec=", _tmp8_, NULL);
		_tmp10_ = _tmp9_;
		_tmp11_ = g_strconcat (_tmp10_, "/gsd-color", NULL);
		_tmp12_ = g_strdup ("OnlyShowIn=GNOME;");
		_tmp13_ = g_strdup ("NoDisplay=false");
		_tmp14_ = g_strdup ("X-GNOME-Autostart-Phase=Initialization");
		_tmp15_ = g_strdup ("X-GNOME-Autostart-Notify=true");
		_tmp16_ = g_strdup ("X-GNOME-AutoRestart=true");
		_tmp17_ = g_strdup ("X-Ubuntu-Gettext-Domain=gnome-settings-daemon");
		_tmp18_ = g_strdup ("X-GNOME-Autostart-enabled=false");
		_tmp19_ = g_new0 (gchar*, 11 + 1);
		_tmp19_[0] = _tmp5_;
		_tmp19_[1] = _tmp6_;
		_tmp19_[2] = _tmp7_;
		_tmp19_[3] = _tmp11_;
		_tmp19_[4] = _tmp12_;
		_tmp19_[5] = _tmp13_;
		_tmp19_[6] = _tmp14_;
		_tmp19_[7] = _tmp15_;
		_tmp19_[8] = _tmp16_;
		_tmp19_[9] = _tmp17_;
		_tmp19_[10] = _tmp18_;
		_tmp20_ = _tmp19_;
		_tmp20__length1 = 11;
		brightness_controller_helpers_config_helper_Write (_tmp4_, _tmp20_, (gint) 11);
		_tmp20_ = (_vala_array_free (_tmp20_, _tmp20__length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (_tmp10_);
		_g_free0 (path);
	}
}

static gboolean
brightness_controller_applet_real_supports_settings (BudgieApplet* base)
{
	BrightnessControllerApplet * self;
	gboolean result;
	self = (BrightnessControllerApplet*) base;
	result = TRUE;
	return result;
}

const gchar*
brightness_controller_applet_get_uuid (BrightnessControllerApplet* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_uuid;
	result = _tmp0_;
	return result;
}

void
brightness_controller_applet_set_uuid (BrightnessControllerApplet* self,
                                       const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = brightness_controller_applet_get_uuid (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_uuid);
		self->priv->_uuid = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, brightness_controller_applet_properties[BRIGHTNESS_CONTROLLER_APPLET_UUID_PROPERTY]);
	}
}

static void
brightness_controller_applet_class_init (BrightnessControllerAppletClass * klass,
                                         gpointer klass_data)
{
	brightness_controller_applet_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BrightnessControllerApplet_private_offset);
	((BudgieAppletClass *) klass)->update_popovers = (void (*) (BudgieApplet*, BudgiePopoverManager*)) brightness_controller_applet_real_update_popovers;
	((BudgieAppletClass *) klass)->get_settings_ui = (GtkWidget* (*) (BudgieApplet*)) brightness_controller_applet_real_get_settings_ui;
	((BudgieAppletClass *) klass)->supports_settings = (gboolean (*) (BudgieApplet*)) brightness_controller_applet_real_supports_settings;
	G_OBJECT_CLASS (klass)->get_property = _vala_brightness_controller_applet_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_brightness_controller_applet_set_property;
	G_OBJECT_CLASS (klass)->finalize = brightness_controller_applet_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BRIGHTNESS_CONTROLLER_APPLET_UUID_PROPERTY, brightness_controller_applet_properties[BRIGHTNESS_CONTROLLER_APPLET_UUID_PROPERTY] = g_param_spec_string ("uuid", "uuid", "uuid", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
brightness_controller_applet_instance_init (BrightnessControllerApplet * self,
                                            gpointer klass)
{
	self->priv = brightness_controller_applet_get_instance_private (self);
	self->priv->manager = NULL;
	self->priv->settings = NULL;
}

static void
brightness_controller_applet_finalize (GObject * obj)
{
	BrightnessControllerApplet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BRIGHTNESS_CONTROLLER_TYPE_APPLET, BrightnessControllerApplet);
	_g_object_unref0 (self->priv->indicatorButton);
	_g_object_unref0 (self->priv->popover);
	_g_object_unref0 (self->priv->settings);
	_g_free0 (self->priv->_uuid);
	_brightness_controller_helpers_config_helper_unref0 (self->priv->gnomeSettingsDaemonsColorPluginConfigHelper);
	G_OBJECT_CLASS (brightness_controller_applet_parent_class)->finalize (obj);
}

GType
brightness_controller_applet_get_type (void)
{
	return brightness_controller_applet_type_id;
}

GType
brightness_controller_applet_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (BrightnessControllerAppletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) brightness_controller_applet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BrightnessControllerApplet), 0, (GInstanceInitFunc) brightness_controller_applet_instance_init, NULL };
	brightness_controller_applet_type_id = g_type_module_register_type (module, budgie_applet_get_type (), "BrightnessControllerApplet", &g_define_type_info, 0);
	BrightnessControllerApplet_private_offset = sizeof (BrightnessControllerAppletPrivate);
	return brightness_controller_applet_type_id;
}

static void
_vala_brightness_controller_applet_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec)
{
	BrightnessControllerApplet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BRIGHTNESS_CONTROLLER_TYPE_APPLET, BrightnessControllerApplet);
	switch (property_id) {
		case BRIGHTNESS_CONTROLLER_APPLET_UUID_PROPERTY:
		g_value_set_string (value, brightness_controller_applet_get_uuid (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_brightness_controller_applet_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec)
{
	BrightnessControllerApplet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BRIGHTNESS_CONTROLLER_TYPE_APPLET, BrightnessControllerApplet);
	switch (property_id) {
		case BRIGHTNESS_CONTROLLER_APPLET_UUID_PROPERTY:
		brightness_controller_applet_set_uuid (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static BudgieApplet*
brightness_controller_plugin_real_get_panel_widget (BudgiePlugin* base,
                                                    const gchar* uuid)
{
	BrightnessControllerPlugin * self;
	BrightnessControllerApplet* _tmp0_;
	BudgieApplet* result;
	self = (BrightnessControllerPlugin*) base;
	g_return_val_if_fail (uuid != NULL, NULL);
	_tmp0_ = brightness_controller_applet_new (uuid);
	g_object_ref_sink (_tmp0_);
	result = (BudgieApplet*) _tmp0_;
	return result;
}

BrightnessControllerPlugin*
brightness_controller_plugin_construct (GType object_type)
{
	BrightnessControllerPlugin * self = NULL;
	self = (BrightnessControllerPlugin*) g_object_new (object_type, NULL);
	return self;
}

BrightnessControllerPlugin*
brightness_controller_plugin_new (void)
{
	return brightness_controller_plugin_construct (BRIGHTNESS_CONTROLLER_TYPE_PLUGIN);
}

static void
brightness_controller_plugin_class_init (BrightnessControllerPluginClass * klass,
                                         gpointer klass_data)
{
	brightness_controller_plugin_parent_class = g_type_class_peek_parent (klass);
}

static void
brightness_controller_plugin_budgie_plugin_interface_init (BudgiePluginIface * iface,
                                                           gpointer iface_data)
{
	brightness_controller_plugin_budgie_plugin_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_panel_widget = (BudgieApplet* (*) (BudgiePlugin*, const gchar*)) brightness_controller_plugin_real_get_panel_widget;
}

static void
brightness_controller_plugin_instance_init (BrightnessControllerPlugin * self,
                                            gpointer klass)
{
}

GType
brightness_controller_plugin_get_type (void)
{
	return brightness_controller_plugin_type_id;
}

GType
brightness_controller_plugin_register_type (GTypeModule * module)
{
	static const GTypeInfo g_define_type_info = { sizeof (BrightnessControllerPluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) brightness_controller_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BrightnessControllerPlugin), 0, (GInstanceInitFunc) brightness_controller_plugin_instance_init, NULL };
	static const GInterfaceInfo budgie_plugin_info = { (GInterfaceInitFunc) brightness_controller_plugin_budgie_plugin_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	brightness_controller_plugin_type_id = g_type_module_register_type (module, peas_extension_base_get_type (), "BrightnessControllerPlugin", &g_define_type_info, 0);
	g_type_module_add_interface (module, brightness_controller_plugin_type_id, budgie_plugin_get_type (), &budgie_plugin_info);
	return brightness_controller_plugin_type_id;
}

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

void
peas_register_types (GTypeModule* module)
{
	PeasObjectModule* objmodule = NULL;
	PeasObjectModule* _tmp0_;
	g_return_if_fail (module != NULL);
	brightness_controller_widgets_indicator_button_register_type (module);
	brightness_controller_widgets_custom_menu_button_register_type (module);
	brightness_controller_widgets_popover_register_type (module);
	brightness_controller_widgets_custom_scale_register_type (module);
	brightness_controller_helpers_dim_helper_register_type (module);
	brightness_controller_helpers_light_helper_register_type (module);
	brightness_controller_helpers_subprocess_helper_register_type (module);
	brightness_controller_helpers_config_helper_register_type (module);
	brightness_controller_helpers_color_settings_register_type (module);
	brightness_controller_helpers_color_settings_proxy_register_dynamic_type (module);
	brightness_controller_models_flame_register_type (module);
	brightness_controller_models_dim_register_type (module);
	brightness_controller_models_light_register_type (module);
	brightness_controller_applet_register_type (module);
	brightness_controller_plugin_register_type (module);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (module, peas_object_module_get_type ()) ? ((PeasObjectModule*) module) : NULL);
	objmodule = _tmp0_;
	peas_object_module_register_extension_type (objmodule, budgie_plugin_get_type (), BRIGHTNESS_CONTROLLER_TYPE_PLUGIN);
	_g_object_unref0 (objmodule);
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

