/* mangohud-presets-page.c generated by valac 0.56.19, the Vala compiler
 * generated from mangohud-presets-page.vala, do not modify */

#include "protonplus_core.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>
#include <string.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  {
	PROTON_PLUS_WIDGETS_MANGO_HUD_PRESETS_PAGE_0_PROPERTY,
	PROTON_PLUS_WIDGETS_MANGO_HUD_PRESETS_PAGE_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_mango_hud_presets_page_properties[PROTON_PLUS_WIDGETS_MANGO_HUD_PRESETS_PAGE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block36Data Block36Data;
typedef struct _Block37Data Block37Data;

struct _ProtonPlusWidgetsMangoHudPresetsPagePrivate {
	GtkToggleButton** preset_buttons;
	gint preset_buttons_length1;
	gint _preset_buttons_size_;
	GtkToggleButton* preset_custom_btn;
	GtkToggleButton* preset_full_btn;
	GtkToggleButton* preset_basic_btn;
	GtkToggleButton* preset_basic_horiz_btn;
	GtkToggleButton* preset_fps_only_btn;
	GtkToggleButton** theme_buttons;
	gint theme_buttons_length1;
	gint _theme_buttons_size_;
	GtkToggleButton* theme_stock_btn;
	GtkToggleButton* theme_white_btn;
	GtkToggleButton* theme_custom_btn;
};

struct _Block36Data {
	int _ref_count_;
	ProtonPlusWidgetsMangoHudPresetsPage* self;
	GtkToggleButton* button;
	ProtonPlusUtilsMangoHudPreset preset;
};

struct _Block37Data {
	int _ref_count_;
	ProtonPlusWidgetsMangoHudPresetsPage* self;
	GtkToggleButton* button;
	ProtonPlusUtilsMangoHudTheme theme;
};

static gint ProtonPlusWidgetsMangoHudPresetsPage_private_offset;
static gpointer proton_plus_widgets_mango_hud_presets_page_parent_class = NULL;

static void proton_plus_widgets_mango_hud_presets_page_connect_preset_button (ProtonPlusWidgetsMangoHudPresetsPage* self,
                                                                       GtkToggleButton* button,
                                                                       ProtonPlusUtilsMangoHudPreset preset);
static void proton_plus_widgets_mango_hud_presets_page_connect_theme_button (ProtonPlusWidgetsMangoHudPresetsPage* self,
                                                                      GtkToggleButton* button,
                                                                      ProtonPlusUtilsMangoHudTheme theme);
static Block36Data* block36_data_ref (Block36Data* _data36_);
static void block36_data_unref (void * _userdata_);
static void __lambda184_ (Block36Data* _data36_);
static void proton_plus_widgets_mango_hud_presets_page_apply_preset (ProtonPlusWidgetsMangoHudPresetsPage* self,
                                                              ProtonPlusUtilsMangoHudPreset preset);
static void ___lambda184__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                              gpointer self);
static Block37Data* block37_data_ref (Block37Data* _data37_);
static void block37_data_unref (void * _userdata_);
static void __lambda185_ (Block37Data* _data37_);
static void proton_plus_widgets_mango_hud_presets_page_apply_theme (ProtonPlusWidgetsMangoHudPresetsPage* self,
                                                             ProtonPlusUtilsMangoHudTheme theme);
static void ___lambda185__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                              gpointer self);
static void proton_plus_widgets_mango_hud_presets_page_real_refresh (ProtonPlusWidgetsMangoHudPage* base);
static void proton_plus_widgets_mango_hud_presets_page_finalize (GObject * obj);
static GType proton_plus_widgets_mango_hud_presets_page_get_type_once (void);
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 _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
proton_plus_widgets_mango_hud_presets_page_get_instance_private (ProtonPlusWidgetsMangoHudPresetsPage* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusWidgetsMangoHudPresetsPage_private_offset);
}

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

ProtonPlusWidgetsMangoHudPresetsPage*
proton_plus_widgets_mango_hud_presets_page_construct (GType object_type,
                                                      ProtonPlusUtilsMangoHudManager* config)
{
	ProtonPlusWidgetsMangoHudPresetsPage * self = NULL;
	GtkFlowBox* presets_flow_box = NULL;
	GtkFlowBox* _tmp0_;
	GtkToggleButton** _tmp1_;
	GtkToggleButton* preset_group_button = NULL;
	GtkToggleButton* _tmp2_;
	GtkToggleButton* _tmp3_;
	GtkToggleButton* _tmp4_;
	GtkToggleButton* _tmp5_;
	GtkToggleButton* _tmp6_;
	GtkToggleButton** _tmp7_;
	gint _tmp7__length1;
	GtkToggleButton* _tmp8_;
	GtkToggleButton* _tmp9_;
	GtkToggleButton** _tmp10_;
	gint _tmp10__length1;
	GtkToggleButton* _tmp11_;
	GtkToggleButton* _tmp12_;
	GtkToggleButton** _tmp13_;
	gint _tmp13__length1;
	GtkToggleButton* _tmp14_;
	GtkToggleButton* _tmp15_;
	GtkToggleButton** _tmp16_;
	gint _tmp16__length1;
	GtkToggleButton* _tmp17_;
	GtkToggleButton* _tmp18_;
	GtkToggleButton** _tmp19_;
	gint _tmp19__length1;
	GtkToggleButton* _tmp20_;
	GtkToggleButton* _tmp21_;
	GtkToggleButton* _tmp22_;
	GtkToggleButton* _tmp23_;
	GtkToggleButton* _tmp24_;
	GtkToggleButton* _tmp25_;
	GtkToggleButton* _tmp26_;
	GtkToggleButton* _tmp27_;
	GtkToggleButton* _tmp28_;
	GtkToggleButton* _tmp29_;
	GtkToggleButton* _tmp30_;
	GtkToggleButton* _tmp31_;
	GtkFlowBox* themes_flow_box = NULL;
	GtkFlowBox* _tmp32_;
	GtkToggleButton** _tmp33_;
	GtkToggleButton* theme_group_button = NULL;
	GtkToggleButton* _tmp34_;
	GtkToggleButton* _tmp35_;
	GtkToggleButton* _tmp36_;
	GtkToggleButton** _tmp37_;
	gint _tmp37__length1;
	GtkToggleButton* _tmp38_;
	GtkToggleButton* _tmp39_;
	GtkToggleButton** _tmp40_;
	gint _tmp40__length1;
	GtkToggleButton* _tmp41_;
	GtkToggleButton* _tmp42_;
	GtkToggleButton** _tmp43_;
	gint _tmp43__length1;
	GtkToggleButton* _tmp44_;
	GtkToggleButton* _tmp45_;
	GtkToggleButton* _tmp46_;
	GtkToggleButton* _tmp47_;
	GtkToggleButton* _tmp48_;
	GtkToggleButton* _tmp49_;
	GtkToggleButton* _tmp50_;
	GtkToggleButton* _tmp51_;
	g_return_val_if_fail (config != NULL, NULL);
	self = (ProtonPlusWidgetsMangoHudPresetsPage*) proton_plus_widgets_mango_hud_page_construct (object_type, config);
	_tmp0_ = proton_plus_widgets_mango_hud_page_create_flow_box ((ProtonPlusWidgetsMangoHudPage*) self);
	presets_flow_box = _tmp0_;
	_tmp1_ = g_new0 (GtkToggleButton*, 5 + 1);
	self->priv->preset_buttons = (_vala_array_free (self->priv->preset_buttons, self->priv->preset_buttons_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->preset_buttons = _tmp1_;
	self->priv->preset_buttons_length1 = 5;
	self->priv->_preset_buttons_size_ = self->priv->preset_buttons_length1;
	preset_group_button = NULL;
	_tmp2_ = proton_plus_widgets_mango_hud_page_create_preset_button ((ProtonPlusWidgetsMangoHudPage*) self, _ ("Full"), "chart-area-symbolic", &preset_group_button);
	_g_object_unref0 (self->priv->preset_full_btn);
	self->priv->preset_full_btn = _tmp2_;
	_tmp3_ = proton_plus_widgets_mango_hud_page_create_preset_button ((ProtonPlusWidgetsMangoHudPage*) self, _ ("Basic"), "square-poll-vertical-symbolic", &preset_group_button);
	_g_object_unref0 (self->priv->preset_basic_btn);
	self->priv->preset_basic_btn = _tmp3_;
	_tmp4_ = proton_plus_widgets_mango_hud_page_create_preset_button ((ProtonPlusWidgetsMangoHudPage*) self, _ ("Basic Horizontal"), "square-poll-horizontal-symbolic", &preset_group_button);
	_g_object_unref0 (self->priv->preset_basic_horiz_btn);
	self->priv->preset_basic_horiz_btn = _tmp4_;
	_tmp5_ = proton_plus_widgets_mango_hud_page_create_preset_button ((ProtonPlusWidgetsMangoHudPage*) self, _ ("FPS Only"), "gauge-high-symbolic", &preset_group_button);
	_g_object_unref0 (self->priv->preset_fps_only_btn);
	self->priv->preset_fps_only_btn = _tmp5_;
	_tmp6_ = proton_plus_widgets_mango_hud_page_create_preset_button ((ProtonPlusWidgetsMangoHudPage*) self, _ ("Custom"), "gear-symbolic", &preset_group_button);
	_g_object_unref0 (self->priv->preset_custom_btn);
	self->priv->preset_custom_btn = _tmp6_;
	_tmp7_ = self->priv->preset_buttons;
	_tmp7__length1 = self->priv->preset_buttons_length1;
	_tmp8_ = self->priv->preset_full_btn;
	_tmp9_ = _g_object_ref0 (_tmp8_);
	_g_object_unref0 (_tmp7_[PROTON_PLUS_UTILS_MANGO_HUD_PRESET_FULL]);
	_tmp7_[PROTON_PLUS_UTILS_MANGO_HUD_PRESET_FULL] = _tmp9_;
	_tmp10_ = self->priv->preset_buttons;
	_tmp10__length1 = self->priv->preset_buttons_length1;
	_tmp11_ = self->priv->preset_basic_btn;
	_tmp12_ = _g_object_ref0 (_tmp11_);
	_g_object_unref0 (_tmp10_[PROTON_PLUS_UTILS_MANGO_HUD_PRESET_BASIC]);
	_tmp10_[PROTON_PLUS_UTILS_MANGO_HUD_PRESET_BASIC] = _tmp12_;
	_tmp13_ = self->priv->preset_buttons;
	_tmp13__length1 = self->priv->preset_buttons_length1;
	_tmp14_ = self->priv->preset_basic_horiz_btn;
	_tmp15_ = _g_object_ref0 (_tmp14_);
	_g_object_unref0 (_tmp13_[PROTON_PLUS_UTILS_MANGO_HUD_PRESET_BASIC_HORIZONTAL]);
	_tmp13_[PROTON_PLUS_UTILS_MANGO_HUD_PRESET_BASIC_HORIZONTAL] = _tmp15_;
	_tmp16_ = self->priv->preset_buttons;
	_tmp16__length1 = self->priv->preset_buttons_length1;
	_tmp17_ = self->priv->preset_fps_only_btn;
	_tmp18_ = _g_object_ref0 (_tmp17_);
	_g_object_unref0 (_tmp16_[PROTON_PLUS_UTILS_MANGO_HUD_PRESET_FPS_ONLY]);
	_tmp16_[PROTON_PLUS_UTILS_MANGO_HUD_PRESET_FPS_ONLY] = _tmp18_;
	_tmp19_ = self->priv->preset_buttons;
	_tmp19__length1 = self->priv->preset_buttons_length1;
	_tmp20_ = self->priv->preset_custom_btn;
	_tmp21_ = _g_object_ref0 (_tmp20_);
	_g_object_unref0 (_tmp19_[PROTON_PLUS_UTILS_MANGO_HUD_PRESET_CUSTOM]);
	_tmp19_[PROTON_PLUS_UTILS_MANGO_HUD_PRESET_CUSTOM] = _tmp21_;
	_tmp22_ = self->priv->preset_full_btn;
	gtk_flow_box_append (presets_flow_box, (GtkWidget*) _tmp22_);
	_tmp23_ = self->priv->preset_basic_btn;
	gtk_flow_box_append (presets_flow_box, (GtkWidget*) _tmp23_);
	_tmp24_ = self->priv->preset_basic_horiz_btn;
	gtk_flow_box_append (presets_flow_box, (GtkWidget*) _tmp24_);
	_tmp25_ = self->priv->preset_fps_only_btn;
	gtk_flow_box_append (presets_flow_box, (GtkWidget*) _tmp25_);
	_tmp26_ = self->priv->preset_custom_btn;
	gtk_flow_box_append (presets_flow_box, (GtkWidget*) _tmp26_);
	_tmp27_ = self->priv->preset_custom_btn;
	proton_plus_widgets_mango_hud_presets_page_connect_preset_button (self, _tmp27_, PROTON_PLUS_UTILS_MANGO_HUD_PRESET_CUSTOM);
	_tmp28_ = self->priv->preset_full_btn;
	proton_plus_widgets_mango_hud_presets_page_connect_preset_button (self, _tmp28_, PROTON_PLUS_UTILS_MANGO_HUD_PRESET_FULL);
	_tmp29_ = self->priv->preset_basic_btn;
	proton_plus_widgets_mango_hud_presets_page_connect_preset_button (self, _tmp29_, PROTON_PLUS_UTILS_MANGO_HUD_PRESET_BASIC);
	_tmp30_ = self->priv->preset_basic_horiz_btn;
	proton_plus_widgets_mango_hud_presets_page_connect_preset_button (self, _tmp30_, PROTON_PLUS_UTILS_MANGO_HUD_PRESET_BASIC_HORIZONTAL);
	_tmp31_ = self->priv->preset_fps_only_btn;
	proton_plus_widgets_mango_hud_presets_page_connect_preset_button (self, _tmp31_, PROTON_PLUS_UTILS_MANGO_HUD_PRESET_FPS_ONLY);
	proton_plus_widgets_mango_hud_page_add_group_to_page ((ProtonPlusWidgetsMangoHudPage*) self, (GtkBox*) self, _ ("Layouts"), (GtkWidget*) presets_flow_box, "heading");
	_tmp32_ = proton_plus_widgets_mango_hud_page_create_flow_box ((ProtonPlusWidgetsMangoHudPage*) self);
	themes_flow_box = _tmp32_;
	_tmp33_ = g_new0 (GtkToggleButton*, 3 + 1);
	self->priv->theme_buttons = (_vala_array_free (self->priv->theme_buttons, self->priv->theme_buttons_length1, (GDestroyNotify) g_object_unref), NULL);
	self->priv->theme_buttons = _tmp33_;
	self->priv->theme_buttons_length1 = 3;
	self->priv->_theme_buttons_size_ = self->priv->theme_buttons_length1;
	theme_group_button = NULL;
	_tmp34_ = proton_plus_widgets_mango_hud_page_create_preset_button ((ProtonPlusWidgetsMangoHudPage*) self, _ ("Stock"), "palette-2-symbolic", &theme_group_button);
	_g_object_unref0 (self->priv->theme_stock_btn);
	self->priv->theme_stock_btn = _tmp34_;
	_tmp35_ = proton_plus_widgets_mango_hud_page_create_preset_button ((ProtonPlusWidgetsMangoHudPage*) self, _ ("White"), "palette-2-symbolic", &theme_group_button);
	_g_object_unref0 (self->priv->theme_white_btn);
	self->priv->theme_white_btn = _tmp35_;
	_tmp36_ = proton_plus_widgets_mango_hud_page_create_preset_button ((ProtonPlusWidgetsMangoHudPage*) self, _ ("Custom"), "gear-symbolic", &theme_group_button);
	_g_object_unref0 (self->priv->theme_custom_btn);
	self->priv->theme_custom_btn = _tmp36_;
	_tmp37_ = self->priv->theme_buttons;
	_tmp37__length1 = self->priv->theme_buttons_length1;
	_tmp38_ = self->priv->theme_stock_btn;
	_tmp39_ = _g_object_ref0 (_tmp38_);
	_g_object_unref0 (_tmp37_[PROTON_PLUS_UTILS_MANGO_HUD_THEME_STOCK]);
	_tmp37_[PROTON_PLUS_UTILS_MANGO_HUD_THEME_STOCK] = _tmp39_;
	_tmp40_ = self->priv->theme_buttons;
	_tmp40__length1 = self->priv->theme_buttons_length1;
	_tmp41_ = self->priv->theme_white_btn;
	_tmp42_ = _g_object_ref0 (_tmp41_);
	_g_object_unref0 (_tmp40_[PROTON_PLUS_UTILS_MANGO_HUD_THEME_SIMPLE_WHITE]);
	_tmp40_[PROTON_PLUS_UTILS_MANGO_HUD_THEME_SIMPLE_WHITE] = _tmp42_;
	_tmp43_ = self->priv->theme_buttons;
	_tmp43__length1 = self->priv->theme_buttons_length1;
	_tmp44_ = self->priv->theme_custom_btn;
	_tmp45_ = _g_object_ref0 (_tmp44_);
	_g_object_unref0 (_tmp43_[PROTON_PLUS_UTILS_MANGO_HUD_THEME_CUSTOM]);
	_tmp43_[PROTON_PLUS_UTILS_MANGO_HUD_THEME_CUSTOM] = _tmp45_;
	_tmp46_ = self->priv->theme_stock_btn;
	gtk_flow_box_append (themes_flow_box, (GtkWidget*) _tmp46_);
	_tmp47_ = self->priv->theme_white_btn;
	gtk_flow_box_append (themes_flow_box, (GtkWidget*) _tmp47_);
	_tmp48_ = self->priv->theme_custom_btn;
	gtk_flow_box_append (themes_flow_box, (GtkWidget*) _tmp48_);
	_tmp49_ = self->priv->theme_stock_btn;
	proton_plus_widgets_mango_hud_presets_page_connect_theme_button (self, _tmp49_, PROTON_PLUS_UTILS_MANGO_HUD_THEME_STOCK);
	_tmp50_ = self->priv->theme_white_btn;
	proton_plus_widgets_mango_hud_presets_page_connect_theme_button (self, _tmp50_, PROTON_PLUS_UTILS_MANGO_HUD_THEME_SIMPLE_WHITE);
	_tmp51_ = self->priv->theme_custom_btn;
	proton_plus_widgets_mango_hud_presets_page_connect_theme_button (self, _tmp51_, PROTON_PLUS_UTILS_MANGO_HUD_THEME_CUSTOM);
	proton_plus_widgets_mango_hud_page_add_group_to_page ((ProtonPlusWidgetsMangoHudPage*) self, (GtkBox*) self, _ ("Themes"), (GtkWidget*) themes_flow_box, "heading");
	proton_plus_widgets_mango_hud_page_refresh ((ProtonPlusWidgetsMangoHudPage*) self);
	_g_object_unref0 (theme_group_button);
	_g_object_unref0 (themes_flow_box);
	_g_object_unref0 (preset_group_button);
	_g_object_unref0 (presets_flow_box);
	return self;
}

ProtonPlusWidgetsMangoHudPresetsPage*
proton_plus_widgets_mango_hud_presets_page_new (ProtonPlusUtilsMangoHudManager* config)
{
	return proton_plus_widgets_mango_hud_presets_page_construct (PROTON_PLUS_WIDGETS_MANGO_HUD_TYPE_PRESETS_PAGE, config);
}

static Block36Data*
block36_data_ref (Block36Data* _data36_)
{
	g_atomic_int_inc (&_data36_->_ref_count_);
	return _data36_;
}

static void
block36_data_unref (void * _userdata_)
{
	Block36Data* _data36_;
	_data36_ = (Block36Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data36_->_ref_count_)) {
		ProtonPlusWidgetsMangoHudPresetsPage* self;
		self = _data36_->self;
		_g_object_unref0 (_data36_->button);
		_g_object_unref0 (self);
		g_slice_free (Block36Data, _data36_);
	}
}

static void
__lambda184_ (Block36Data* _data36_)
{
	ProtonPlusWidgetsMangoHudPresetsPage* self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data36_->self;
	_tmp1_ = proton_plus_widgets_mango_hud_page_get_is_updating ((ProtonPlusWidgetsMangoHudPage*) self);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp3_ = gtk_toggle_button_get_active (_data36_->button);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		proton_plus_widgets_mango_hud_presets_page_apply_preset (self, _data36_->preset);
	}
}

static void
___lambda184__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                         gpointer self)
{
	__lambda184_ (self);
}

static void
proton_plus_widgets_mango_hud_presets_page_connect_preset_button (ProtonPlusWidgetsMangoHudPresetsPage* self,
                                                                  GtkToggleButton* button,
                                                                  ProtonPlusUtilsMangoHudPreset preset)
{
	Block36Data* _data36_;
	GtkToggleButton* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_data36_ = g_slice_new0 (Block36Data);
	_data36_->_ref_count_ = 1;
	_data36_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (button);
	_g_object_unref0 (_data36_->button);
	_data36_->button = _tmp0_;
	_data36_->preset = preset;
	g_signal_connect_data (_data36_->button, "toggled", (GCallback) ___lambda184__gtk_toggle_button_toggled, block36_data_ref (_data36_), (GClosureNotify) block36_data_unref, 0);
	block36_data_unref (_data36_);
	_data36_ = NULL;
}

static Block37Data*
block37_data_ref (Block37Data* _data37_)
{
	g_atomic_int_inc (&_data37_->_ref_count_);
	return _data37_;
}

static void
block37_data_unref (void * _userdata_)
{
	Block37Data* _data37_;
	_data37_ = (Block37Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data37_->_ref_count_)) {
		ProtonPlusWidgetsMangoHudPresetsPage* self;
		self = _data37_->self;
		_g_object_unref0 (_data37_->button);
		_g_object_unref0 (self);
		g_slice_free (Block37Data, _data37_);
	}
}

static void
__lambda185_ (Block37Data* _data37_)
{
	ProtonPlusWidgetsMangoHudPresetsPage* self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_;
	gboolean _tmp2_;
	self = _data37_->self;
	_tmp1_ = proton_plus_widgets_mango_hud_page_get_is_updating ((ProtonPlusWidgetsMangoHudPage*) self);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp3_ = gtk_toggle_button_get_active (_data37_->button);
		_tmp4_ = _tmp3_;
		_tmp0_ = _tmp4_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		proton_plus_widgets_mango_hud_presets_page_apply_theme (self, _data37_->theme);
	}
}

static void
___lambda185__gtk_toggle_button_toggled (GtkToggleButton* _sender,
                                         gpointer self)
{
	__lambda185_ (self);
}

static void
proton_plus_widgets_mango_hud_presets_page_connect_theme_button (ProtonPlusWidgetsMangoHudPresetsPage* self,
                                                                 GtkToggleButton* button,
                                                                 ProtonPlusUtilsMangoHudTheme theme)
{
	Block37Data* _data37_;
	GtkToggleButton* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (button != NULL);
	_data37_ = g_slice_new0 (Block37Data);
	_data37_->_ref_count_ = 1;
	_data37_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (button);
	_g_object_unref0 (_data37_->button);
	_data37_->button = _tmp0_;
	_data37_->theme = theme;
	g_signal_connect_data (_data37_->button, "toggled", (GCallback) ___lambda185__gtk_toggle_button_toggled, block37_data_ref (_data37_), (GClosureNotify) block37_data_unref, 0);
	block37_data_unref (_data37_);
	_data37_ = NULL;
}

static void
proton_plus_widgets_mango_hud_presets_page_apply_preset (ProtonPlusWidgetsMangoHudPresetsPage* self,
                                                         ProtonPlusUtilsMangoHudPreset preset)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_;
	gboolean _tmp3_;
	ProtonPlusUtilsMangoHudManager* _tmp6_;
	ProtonPlusUtilsMangoHudManager* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp2_ = proton_plus_widgets_mango_hud_page_get_is_updating ((ProtonPlusWidgetsMangoHudPage*) self);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		_tmp1_ = TRUE;
	} else {
		ProtonPlusUtilsMangoHudManager* _tmp4_;
		ProtonPlusUtilsMangoHudManager* _tmp5_;
		_tmp4_ = proton_plus_widgets_mango_hud_page_get_config ((ProtonPlusWidgetsMangoHudPage*) self);
		_tmp5_ = _tmp4_;
		_tmp1_ = _tmp5_ == NULL;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = preset == PROTON_PLUS_UTILS_MANGO_HUD_PRESET_CUSTOM;
	}
	if (_tmp0_) {
		return;
	}
	proton_plus_widgets_mango_hud_page_set_is_updating ((ProtonPlusWidgetsMangoHudPage*) self, TRUE);
	_tmp6_ = proton_plus_widgets_mango_hud_page_get_config ((ProtonPlusWidgetsMangoHudPage*) self);
	_tmp7_ = _tmp6_;
	proton_plus_utils_mango_hud_manager_set_preset (_tmp7_, preset);
	proton_plus_widgets_mango_hud_page_set_is_updating ((ProtonPlusWidgetsMangoHudPage*) self, FALSE);
	g_signal_emit_by_name ((ProtonPlusWidgetsMangoHudPage*) self, "changed");
}

static void
proton_plus_widgets_mango_hud_presets_page_apply_theme (ProtonPlusWidgetsMangoHudPresetsPage* self,
                                                        ProtonPlusUtilsMangoHudTheme theme)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_;
	gboolean _tmp3_;
	ProtonPlusUtilsMangoHudManager* _tmp6_;
	ProtonPlusUtilsMangoHudManager* _tmp7_;
	g_return_if_fail (self != NULL);
	_tmp2_ = proton_plus_widgets_mango_hud_page_get_is_updating ((ProtonPlusWidgetsMangoHudPage*) self);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		_tmp1_ = TRUE;
	} else {
		ProtonPlusUtilsMangoHudManager* _tmp4_;
		ProtonPlusUtilsMangoHudManager* _tmp5_;
		_tmp4_ = proton_plus_widgets_mango_hud_page_get_config ((ProtonPlusWidgetsMangoHudPage*) self);
		_tmp5_ = _tmp4_;
		_tmp1_ = _tmp5_ == NULL;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = theme == PROTON_PLUS_UTILS_MANGO_HUD_THEME_CUSTOM;
	}
	if (_tmp0_) {
		return;
	}
	proton_plus_widgets_mango_hud_page_set_is_updating ((ProtonPlusWidgetsMangoHudPage*) self, TRUE);
	_tmp6_ = proton_plus_widgets_mango_hud_page_get_config ((ProtonPlusWidgetsMangoHudPage*) self);
	_tmp7_ = _tmp6_;
	proton_plus_utils_mango_hud_manager_set_theme (_tmp7_, theme);
	proton_plus_widgets_mango_hud_page_set_is_updating ((ProtonPlusWidgetsMangoHudPage*) self, FALSE);
	g_signal_emit_by_name ((ProtonPlusWidgetsMangoHudPage*) self, "changed");
}

static void
proton_plus_widgets_mango_hud_presets_page_real_refresh (ProtonPlusWidgetsMangoHudPage* base)
{
	ProtonPlusWidgetsMangoHudPresetsPage * self;
	ProtonPlusUtilsMangoHudManager* _tmp0_;
	ProtonPlusUtilsMangoHudManager* _tmp1_;
	gint selected_preset = 0;
	ProtonPlusUtilsMangoHudManager* _tmp2_;
	ProtonPlusUtilsMangoHudManager* _tmp3_;
	gint selected_theme = 0;
	ProtonPlusUtilsMangoHudManager* _tmp4_;
	ProtonPlusUtilsMangoHudManager* _tmp5_;
	GtkToggleButton** _tmp6_;
	gint _tmp6__length1;
	GtkToggleButton* _tmp7_;
	GtkToggleButton** _tmp8_;
	gint _tmp8__length1;
	GtkToggleButton* _tmp9_;
	self = (ProtonPlusWidgetsMangoHudPresetsPage*) base;
	_tmp0_ = proton_plus_widgets_mango_hud_page_get_config ((ProtonPlusWidgetsMangoHudPage*) self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ == NULL) {
		return;
	}
	_tmp2_ = proton_plus_widgets_mango_hud_page_get_config ((ProtonPlusWidgetsMangoHudPage*) self);
	_tmp3_ = _tmp2_;
	selected_preset = (gint) proton_plus_utils_mango_hud_manager_get_preset (_tmp3_);
	_tmp4_ = proton_plus_widgets_mango_hud_page_get_config ((ProtonPlusWidgetsMangoHudPage*) self);
	_tmp5_ = _tmp4_;
	selected_theme = (gint) proton_plus_utils_mango_hud_manager_get_theme (_tmp5_);
	proton_plus_widgets_mango_hud_page_set_is_updating ((ProtonPlusWidgetsMangoHudPage*) self, TRUE);
	_tmp6_ = self->priv->preset_buttons;
	_tmp6__length1 = self->priv->preset_buttons_length1;
	_tmp7_ = _tmp6_[selected_preset];
	gtk_toggle_button_set_active (_tmp7_, TRUE);
	_tmp8_ = self->priv->theme_buttons;
	_tmp8__length1 = self->priv->theme_buttons_length1;
	_tmp9_ = _tmp8_[selected_theme];
	gtk_toggle_button_set_active (_tmp9_, TRUE);
	proton_plus_widgets_mango_hud_page_set_is_updating ((ProtonPlusWidgetsMangoHudPage*) self, FALSE);
}

static void
proton_plus_widgets_mango_hud_presets_page_class_init (ProtonPlusWidgetsMangoHudPresetsPageClass * klass,
                                                       gpointer klass_data)
{
	proton_plus_widgets_mango_hud_presets_page_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusWidgetsMangoHudPresetsPage_private_offset);
	((ProtonPlusWidgetsMangoHudPageClass *) klass)->refresh = (void (*) (ProtonPlusWidgetsMangoHudPage*)) proton_plus_widgets_mango_hud_presets_page_real_refresh;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_widgets_mango_hud_presets_page_finalize;
}

static void
proton_plus_widgets_mango_hud_presets_page_instance_init (ProtonPlusWidgetsMangoHudPresetsPage * self,
                                                          gpointer klass)
{
	self->priv = proton_plus_widgets_mango_hud_presets_page_get_instance_private (self);
}

static void
proton_plus_widgets_mango_hud_presets_page_finalize (GObject * obj)
{
	ProtonPlusWidgetsMangoHudPresetsPage * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_MANGO_HUD_TYPE_PRESETS_PAGE, ProtonPlusWidgetsMangoHudPresetsPage);
	self->priv->preset_buttons = (_vala_array_free (self->priv->preset_buttons, self->priv->preset_buttons_length1, (GDestroyNotify) g_object_unref), NULL);
	_g_object_unref0 (self->priv->preset_custom_btn);
	_g_object_unref0 (self->priv->preset_full_btn);
	_g_object_unref0 (self->priv->preset_basic_btn);
	_g_object_unref0 (self->priv->preset_basic_horiz_btn);
	_g_object_unref0 (self->priv->preset_fps_only_btn);
	self->priv->theme_buttons = (_vala_array_free (self->priv->theme_buttons, self->priv->theme_buttons_length1, (GDestroyNotify) g_object_unref), NULL);
	_g_object_unref0 (self->priv->theme_stock_btn);
	_g_object_unref0 (self->priv->theme_white_btn);
	_g_object_unref0 (self->priv->theme_custom_btn);
	G_OBJECT_CLASS (proton_plus_widgets_mango_hud_presets_page_parent_class)->finalize (obj);
}

static GType
proton_plus_widgets_mango_hud_presets_page_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsMangoHudPresetsPageClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_mango_hud_presets_page_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsMangoHudPresetsPage), 0, (GInstanceInitFunc) proton_plus_widgets_mango_hud_presets_page_instance_init, NULL };
	GType proton_plus_widgets_mango_hud_presets_page_type_id;
	proton_plus_widgets_mango_hud_presets_page_type_id = g_type_register_static (PROTON_PLUS_WIDGETS_MANGO_HUD_TYPE_PAGE, "ProtonPlusWidgetsMangoHudPresetsPage", &g_define_type_info, 0);
	ProtonPlusWidgetsMangoHudPresetsPage_private_offset = g_type_add_instance_private (proton_plus_widgets_mango_hud_presets_page_type_id, sizeof (ProtonPlusWidgetsMangoHudPresetsPagePrivate));
	return proton_plus_widgets_mango_hud_presets_page_type_id;
}

GType
proton_plus_widgets_mango_hud_presets_page_get_type (void)
{
	static volatile gsize proton_plus_widgets_mango_hud_presets_page_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_mango_hud_presets_page_type_id__once)) {
		GType proton_plus_widgets_mango_hud_presets_page_type_id;
		proton_plus_widgets_mango_hud_presets_page_type_id = proton_plus_widgets_mango_hud_presets_page_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_mango_hud_presets_page_type_id__once, proton_plus_widgets_mango_hud_presets_page_type_id);
	}
	return proton_plus_widgets_mango_hud_presets_page_type_id__once;
}

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);
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

