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

#include "protonplus_core.h"
#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <stdlib.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_BOX_0_PROPERTY,
	PROTON_PLUS_WIDGETS_MANGO_HUD_BOX_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_mango_hud_box_properties[PROTON_PLUS_WIDGETS_MANGO_HUD_BOX_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 _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	PROTON_PLUS_WIDGETS_MANGO_HUD_BOX_SAVED_SIGNAL,
	PROTON_PLUS_WIDGETS_MANGO_HUD_BOX_NUM_SIGNALS
};
static guint proton_plus_widgets_mango_hud_box_signals[PROTON_PLUS_WIDGETS_MANGO_HUD_BOX_NUM_SIGNALS] = {0};

struct _ProtonPlusWidgetsMangoHudBoxPrivate {
	ProtonPlusUtilsMangoHudManager* config;
	ProtonPlusWidgetsMangoHudPresetsPage* presets_page;
	ProtonPlusWidgetsMangoHudVisualPage* visual_page;
	ProtonPlusWidgetsMangoHudPerformancePage* performance_page;
	ProtonPlusWidgetsMangoHudMetricsPage* metrics_page;
	ProtonPlusWidgetsMangoHudExtrasPage* extras_page;
	AdwViewStack* stack;
};

static gint ProtonPlusWidgetsMangoHudBox_private_offset;
static gpointer proton_plus_widgets_mango_hud_box_parent_class = NULL;

static GtkScrolledWindow* proton_plus_widgets_mango_hud_box_create_scrolled_window (ProtonPlusWidgetsMangoHudBox* self,
                                                                             GtkWidget* child);
static void proton_plus_widgets_mango_hud_box_refresh_all (ProtonPlusWidgetsMangoHudBox* self);
static void _proton_plus_widgets_mango_hud_box_refresh_all_proton_plus_widgets_mango_hud_page_changed (ProtonPlusWidgetsMangoHudPage* _sender,
                                                                                                gpointer self);
static void __lambda343_ (ProtonPlusWidgetsMangoHudBox* self);
static void ___lambda343__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static void proton_plus_widgets_mango_hud_box_cube_button_clicked (ProtonPlusWidgetsMangoHudBox* self);
static void _proton_plus_widgets_mango_hud_box_cube_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                gpointer self);
static void proton_plus_widgets_mango_hud_box_finalize (GObject * obj);
static GType proton_plus_widgets_mango_hud_box_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_box_get_instance_private (ProtonPlusWidgetsMangoHudBox* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusWidgetsMangoHudBox_private_offset);
}

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

static void
_proton_plus_widgets_mango_hud_box_refresh_all_proton_plus_widgets_mango_hud_page_changed (ProtonPlusWidgetsMangoHudPage* _sender,
                                                                                           gpointer self)
{
	proton_plus_widgets_mango_hud_box_refresh_all ((ProtonPlusWidgetsMangoHudBox*) self);
}

static void
__lambda343_ (ProtonPlusWidgetsMangoHudBox* self)
{
	ProtonPlusUtilsMangoHudManager* _tmp0_;
	_tmp0_ = self->priv->config;
	proton_plus_utils_mango_hud_manager_save (_tmp0_);
	g_signal_emit (self, proton_plus_widgets_mango_hud_box_signals[PROTON_PLUS_WIDGETS_MANGO_HUD_BOX_SAVED_SIGNAL], 0);
}

static void
___lambda343__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda343_ ((ProtonPlusWidgetsMangoHudBox*) self);
}

static void
_proton_plus_widgets_mango_hud_box_cube_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                           gpointer self)
{
	proton_plus_widgets_mango_hud_box_cube_button_clicked ((ProtonPlusWidgetsMangoHudBox*) self);
}

ProtonPlusWidgetsMangoHudBox*
proton_plus_widgets_mango_hud_box_construct (GType object_type)
{
	ProtonPlusWidgetsMangoHudBox * self = NULL;
	ProtonPlusUtilsMangoHudManager* _tmp0_;
	ProtonPlusUtilsMangoHudManager* _tmp1_;
	AdwViewStack* _tmp2_ = NULL;
	AdwViewSwitcher* switcher = NULL;
	AdwViewStack* _tmp3_;
	AdwViewStack* _tmp4_;
	AdwViewSwitcher* _tmp5_ = NULL;
	ProtonPlusUtilsMangoHudManager* _tmp6_;
	ProtonPlusWidgetsMangoHudPresetsPage* _tmp7_;
	ProtonPlusUtilsMangoHudManager* _tmp8_;
	ProtonPlusWidgetsMangoHudVisualPage* _tmp9_;
	ProtonPlusUtilsMangoHudManager* _tmp10_;
	ProtonPlusWidgetsMangoHudPerformancePage* _tmp11_;
	ProtonPlusUtilsMangoHudManager* _tmp12_;
	ProtonPlusWidgetsMangoHudMetricsPage* _tmp13_;
	ProtonPlusUtilsMangoHudManager* _tmp14_;
	ProtonPlusWidgetsMangoHudExtrasPage* _tmp15_;
	AdwViewStack* _tmp16_;
	ProtonPlusWidgetsMangoHudPresetsPage* _tmp17_;
	GtkScrolledWindow* _tmp18_;
	GtkScrolledWindow* _tmp19_;
	AdwViewStack* _tmp20_;
	ProtonPlusWidgetsMangoHudVisualPage* _tmp21_;
	GtkScrolledWindow* _tmp22_;
	GtkScrolledWindow* _tmp23_;
	AdwViewStack* _tmp24_;
	ProtonPlusWidgetsMangoHudPerformancePage* _tmp25_;
	GtkScrolledWindow* _tmp26_;
	GtkScrolledWindow* _tmp27_;
	AdwViewStack* _tmp28_;
	ProtonPlusWidgetsMangoHudMetricsPage* _tmp29_;
	GtkScrolledWindow* _tmp30_;
	GtkScrolledWindow* _tmp31_;
	AdwViewStack* _tmp32_;
	ProtonPlusWidgetsMangoHudExtrasPage* _tmp33_;
	GtkScrolledWindow* _tmp34_;
	GtkScrolledWindow* _tmp35_;
	ProtonPlusWidgetsMangoHudPresetsPage* _tmp36_;
	ProtonPlusWidgetsMangoHudVisualPage* _tmp37_;
	ProtonPlusWidgetsMangoHudPerformancePage* _tmp38_;
	ProtonPlusWidgetsMangoHudMetricsPage* _tmp39_;
	ProtonPlusWidgetsMangoHudExtrasPage* _tmp40_;
	AdwViewStack* _tmp41_;
	GtkActionBar* action_bar = NULL;
	GtkActionBar* _tmp42_;
	GtkButton* save_button = NULL;
	GtkButton* _tmp43_ = NULL;
	GtkSwitch* advanced_switch = NULL;
	GtkSwitch* _tmp44_ = NULL;
	GtkBox* advanced_box = NULL;
	GtkBox* _tmp45_ = NULL;
	GtkLabel* _tmp46_;
	GtkLabel* _tmp47_;
	AdwButtonContent* cube_button_content = NULL;
	AdwButtonContent* _tmp48_;
	GtkButton* cube_button = NULL;
	GtkWidget* _tmp49_;
	GtkButton* _tmp50_ = NULL;
	self = (ProtonPlusWidgetsMangoHudBox*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, "spacing", 0, NULL);
	gtk_widget_set_vexpand ((GtkWidget*) self, TRUE);
	_tmp0_ = proton_plus_utils_mango_hud_manager_new ();
	_g_object_unref0 (self->priv->config);
	self->priv->config = _tmp0_;
	_tmp1_ = self->priv->config;
	proton_plus_utils_mango_hud_manager_load (_tmp1_);
	_tmp2_ = (AdwViewStack*) adw_view_stack_new ();
	gtk_widget_set_vexpand ((GtkWidget*) _tmp2_, TRUE);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->stack);
	self->priv->stack = _tmp2_;
	_tmp3_ = self->priv->stack;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_tmp5_ = (AdwViewSwitcher*) adw_view_switcher_new ();
	adw_view_switcher_set_stack (_tmp5_, _tmp4_);
	_g_object_unref0 (_tmp4_);
	adw_view_switcher_set_policy (_tmp5_, ADW_VIEW_SWITCHER_POLICY_WIDE);
	g_object_ref_sink (_tmp5_);
	switcher = _tmp5_;
	_tmp6_ = self->priv->config;
	_tmp7_ = proton_plus_widgets_mango_hud_presets_page_new (_tmp6_);
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (self->priv->presets_page);
	self->priv->presets_page = _tmp7_;
	_tmp8_ = self->priv->config;
	_tmp9_ = proton_plus_widgets_mango_hud_visual_page_new (_tmp8_);
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->priv->visual_page);
	self->priv->visual_page = _tmp9_;
	_tmp10_ = self->priv->config;
	_tmp11_ = proton_plus_widgets_mango_hud_performance_page_new (_tmp10_);
	g_object_ref_sink (_tmp11_);
	_g_object_unref0 (self->priv->performance_page);
	self->priv->performance_page = _tmp11_;
	_tmp12_ = self->priv->config;
	_tmp13_ = proton_plus_widgets_mango_hud_metrics_page_new (_tmp12_);
	g_object_ref_sink (_tmp13_);
	_g_object_unref0 (self->priv->metrics_page);
	self->priv->metrics_page = _tmp13_;
	_tmp14_ = self->priv->config;
	_tmp15_ = proton_plus_widgets_mango_hud_extras_page_new (_tmp14_);
	g_object_ref_sink (_tmp15_);
	_g_object_unref0 (self->priv->extras_page);
	self->priv->extras_page = _tmp15_;
	_tmp16_ = self->priv->stack;
	_tmp17_ = self->priv->presets_page;
	_tmp18_ = proton_plus_widgets_mango_hud_box_create_scrolled_window (self, (GtkWidget*) _tmp17_);
	_tmp19_ = _tmp18_;
	adw_view_stack_add_titled_with_icon (_tmp16_, (GtkWidget*) _tmp19_, "presets", _ ("Presets"), "list-symbolic");
	_g_object_unref0 (_tmp19_);
	_tmp20_ = self->priv->stack;
	_tmp21_ = self->priv->visual_page;
	_tmp22_ = proton_plus_widgets_mango_hud_box_create_scrolled_window (self, (GtkWidget*) _tmp21_);
	_tmp23_ = _tmp22_;
	adw_view_stack_add_titled_with_icon (_tmp20_, (GtkWidget*) _tmp23_, "visual", _ ("Visual"), "eye-symbolic");
	_g_object_unref0 (_tmp23_);
	_tmp24_ = self->priv->stack;
	_tmp25_ = self->priv->performance_page;
	_tmp26_ = proton_plus_widgets_mango_hud_box_create_scrolled_window (self, (GtkWidget*) _tmp25_);
	_tmp27_ = _tmp26_;
	adw_view_stack_add_titled_with_icon (_tmp24_, (GtkWidget*) _tmp27_, "performance", _ ("Performance"), "gauge-high-symbolic");
	_g_object_unref0 (_tmp27_);
	_tmp28_ = self->priv->stack;
	_tmp29_ = self->priv->metrics_page;
	_tmp30_ = proton_plus_widgets_mango_hud_box_create_scrolled_window (self, (GtkWidget*) _tmp29_);
	_tmp31_ = _tmp30_;
	adw_view_stack_add_titled_with_icon (_tmp28_, (GtkWidget*) _tmp31_, "metrics", _ ("Metrics"), "chart-area-symbolic");
	_g_object_unref0 (_tmp31_);
	_tmp32_ = self->priv->stack;
	_tmp33_ = self->priv->extras_page;
	_tmp34_ = proton_plus_widgets_mango_hud_box_create_scrolled_window (self, (GtkWidget*) _tmp33_);
	_tmp35_ = _tmp34_;
	adw_view_stack_add_titled_with_icon (_tmp32_, (GtkWidget*) _tmp35_, "extras", _ ("Extras"), "plus-symbolic");
	_g_object_unref0 (_tmp35_);
	_tmp36_ = self->priv->presets_page;
	g_signal_connect_object ((ProtonPlusWidgetsMangoHudPage*) _tmp36_, "changed", (GCallback) _proton_plus_widgets_mango_hud_box_refresh_all_proton_plus_widgets_mango_hud_page_changed, self, 0);
	_tmp37_ = self->priv->visual_page;
	g_signal_connect_object ((ProtonPlusWidgetsMangoHudPage*) _tmp37_, "changed", (GCallback) _proton_plus_widgets_mango_hud_box_refresh_all_proton_plus_widgets_mango_hud_page_changed, self, 0);
	_tmp38_ = self->priv->performance_page;
	g_signal_connect_object ((ProtonPlusWidgetsMangoHudPage*) _tmp38_, "changed", (GCallback) _proton_plus_widgets_mango_hud_box_refresh_all_proton_plus_widgets_mango_hud_page_changed, self, 0);
	_tmp39_ = self->priv->metrics_page;
	g_signal_connect_object ((ProtonPlusWidgetsMangoHudPage*) _tmp39_, "changed", (GCallback) _proton_plus_widgets_mango_hud_box_refresh_all_proton_plus_widgets_mango_hud_page_changed, self, 0);
	_tmp40_ = self->priv->extras_page;
	g_signal_connect_object ((ProtonPlusWidgetsMangoHudPage*) _tmp40_, "changed", (GCallback) _proton_plus_widgets_mango_hud_box_refresh_all_proton_plus_widgets_mango_hud_page_changed, self, 0);
	_tmp41_ = self->priv->stack;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp41_);
	_tmp42_ = (GtkActionBar*) gtk_action_bar_new ();
	g_object_ref_sink (_tmp42_);
	action_bar = _tmp42_;
	gtk_action_bar_set_center_widget (action_bar, (GtkWidget*) switcher);
	_tmp43_ = (GtkButton*) gtk_button_new_from_icon_name ("document-save-symbolic");
	gtk_widget_set_valign ((GtkWidget*) _tmp43_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp43_);
	save_button = _tmp43_;
	gtk_widget_add_css_class ((GtkWidget*) save_button, "suggested-action");
	gtk_widget_set_tooltip_text ((GtkWidget*) save_button, _ ("Save the current configuration"));
	gtk_accessible_update_property ((GtkAccessible*) save_button, GTK_ACCESSIBLE_PROPERTY_LABEL, _ ("Save the current configuration"), -1, -1);
	g_signal_connect_object (save_button, "clicked", (GCallback) ___lambda343__gtk_button_clicked, self, 0);
	gtk_action_bar_pack_end (action_bar, (GtkWidget*) save_button);
	_tmp44_ = (GtkSwitch*) gtk_switch_new ();
	gtk_widget_set_valign ((GtkWidget*) _tmp44_, GTK_ALIGN_CENTER);
	gtk_switch_set_active (_tmp44_, FALSE);
	g_object_ref_sink (_tmp44_);
	advanced_switch = _tmp44_;
	_tmp45_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
	gtk_widget_set_valign ((GtkWidget*) _tmp45_, GTK_ALIGN_CENTER);
	g_object_ref_sink (_tmp45_);
	advanced_box = _tmp45_;
	_tmp46_ = (GtkLabel*) gtk_label_new (_ ("Advanced"));
	g_object_ref_sink (_tmp46_);
	_tmp47_ = _tmp46_;
	gtk_box_append (advanced_box, (GtkWidget*) _tmp47_);
	_g_object_unref0 (_tmp47_);
	gtk_box_append (advanced_box, (GtkWidget*) advanced_switch);
	g_object_bind_property_with_closures ((GObject*) advanced_switch, "active", (GObject*) switcher, "visible", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	gtk_action_bar_pack_end (action_bar, (GtkWidget*) advanced_box);
	_tmp48_ = (AdwButtonContent*) adw_button_content_new ();
	g_object_ref_sink (_tmp48_);
	cube_button_content = _tmp48_;
	adw_button_content_set_label (cube_button_content, _ ("Preview"));
	adw_button_content_set_icon_name (cube_button_content, "cube-symbolic");
	_tmp49_ = _g_object_ref0 ((GtkWidget*) cube_button_content);
	_tmp50_ = (GtkButton*) gtk_button_new ();
	gtk_widget_set_valign ((GtkWidget*) _tmp50_, GTK_ALIGN_CENTER);
	gtk_button_set_child (_tmp50_, _tmp49_);
	_g_object_unref0 (_tmp49_);
	g_object_ref_sink (_tmp50_);
	cube_button = _tmp50_;
	gtk_widget_set_tooltip_text ((GtkWidget*) cube_button, _ ("Show vkcube"));
	g_signal_connect_object (cube_button, "clicked", (GCallback) _proton_plus_widgets_mango_hud_box_cube_button_clicked_gtk_button_clicked, self, 0);
	gtk_action_bar_pack_start (action_bar, (GtkWidget*) cube_button);
	gtk_box_append ((GtkBox*) self, (GtkWidget*) action_bar);
	_g_object_unref0 (cube_button);
	_g_object_unref0 (cube_button_content);
	_g_object_unref0 (advanced_box);
	_g_object_unref0 (advanced_switch);
	_g_object_unref0 (save_button);
	_g_object_unref0 (action_bar);
	_g_object_unref0 (switcher);
	return self;
}

ProtonPlusWidgetsMangoHudBox*
proton_plus_widgets_mango_hud_box_new (void)
{
	return proton_plus_widgets_mango_hud_box_construct (PROTON_PLUS_WIDGETS_MANGO_HUD_TYPE_BOX);
}

static void
proton_plus_widgets_mango_hud_box_refresh_all (ProtonPlusWidgetsMangoHudBox* self)
{
	ProtonPlusWidgetsMangoHudPresetsPage* _tmp0_;
	ProtonPlusWidgetsMangoHudVisualPage* _tmp1_;
	ProtonPlusWidgetsMangoHudPerformancePage* _tmp2_;
	ProtonPlusWidgetsMangoHudMetricsPage* _tmp3_;
	ProtonPlusWidgetsMangoHudExtrasPage* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->presets_page;
	proton_plus_widgets_mango_hud_page_refresh ((ProtonPlusWidgetsMangoHudPage*) _tmp0_);
	_tmp1_ = self->priv->visual_page;
	proton_plus_widgets_mango_hud_page_refresh ((ProtonPlusWidgetsMangoHudPage*) _tmp1_);
	_tmp2_ = self->priv->performance_page;
	proton_plus_widgets_mango_hud_page_refresh ((ProtonPlusWidgetsMangoHudPage*) _tmp2_);
	_tmp3_ = self->priv->metrics_page;
	proton_plus_widgets_mango_hud_page_refresh ((ProtonPlusWidgetsMangoHudPage*) _tmp3_);
	_tmp4_ = self->priv->extras_page;
	proton_plus_widgets_mango_hud_page_refresh ((ProtonPlusWidgetsMangoHudPage*) _tmp4_);
}

static GtkScrolledWindow*
proton_plus_widgets_mango_hud_box_create_scrolled_window (ProtonPlusWidgetsMangoHudBox* self,
                                                          GtkWidget* child)
{
	GtkScrolledWindow* scrolled = NULL;
	GtkWidget* _tmp0_;
	AdwClamp* _tmp1_ = NULL;
	GtkScrolledWindow* _tmp2_ = NULL;
	GtkScrolledWindow* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (child != NULL, NULL);
	_tmp0_ = _g_object_ref0 (child);
	_tmp1_ = (AdwClamp*) adw_clamp_new ();
	adw_clamp_set_child (_tmp1_, _tmp0_);
	_g_object_unref0 (_tmp0_);
	adw_clamp_set_maximum_size (_tmp1_, 975);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp1_, 0);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp1_, 12);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp1_, 0);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp1_, 0);
	g_object_ref_sink (_tmp1_);
	_tmp2_ = (GtkScrolledWindow*) gtk_scrolled_window_new ();
	gtk_scrolled_window_set_child (_tmp2_, (GtkWidget*) _tmp1_);
	_g_object_unref0 (_tmp1_);
	g_object_set (_tmp2_, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp2_, TRUE);
	g_object_ref_sink (_tmp2_);
	scrolled = _tmp2_;
	result = scrolled;
	return result;
}

static void
proton_plus_widgets_mango_hud_box_cube_button_clicked (ProtonPlusWidgetsMangoHudBox* self)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		gchar* command = NULL;
		gchar* _tmp0_;
		gchar** argv = NULL;
		gint argv_length1 = 0;
		gint _argv_size_ = 0;
		const gchar* _tmp3_;
		gchar** _tmp4_ = NULL;
		gint _tmp5_ = 0;
		gchar** _tmp6_;
		gint _tmp6__length1;
		_tmp0_ = g_strdup ("env MANGOHUD=1 vkcube");
		command = _tmp0_;
		if (proton_plus_globals_IS_FLATPAK) {
			const gchar* _tmp1_;
			gchar* _tmp2_;
			_tmp1_ = command;
			_tmp2_ = g_strconcat ("flatpak-spawn --host ", _tmp1_, NULL);
			_g_free0 (command);
			command = _tmp2_;
		}
		_tmp3_ = command;
		g_shell_parse_argv (_tmp3_, &_tmp5_, &_tmp4_, &_inner_error0_);
		argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
		argv = _tmp4_;
		argv_length1 = _tmp5_;
		_argv_size_ = argv_length1;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (command);
			goto __catch0_g_error;
		}
		_tmp6_ = argv;
		_tmp6__length1 = argv_length1;
		g_spawn_async (NULL, _tmp6_, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (command);
			goto __catch0_g_error;
		}
		argv = (_vala_array_free (argv, argv_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (command);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp7_;
		const gchar* _tmp8_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp7_ = e;
		_tmp8_ = _tmp7_->message;
		g_warning ("mangohud-box.vala:119: %s", _tmp8_);
		_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;
	}
}

void
proton_plus_widgets_mango_hud_box_show_presets_page (ProtonPlusWidgetsMangoHudBox* self)
{
	AdwViewStack* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->stack;
	adw_view_stack_set_visible_child_name (_tmp0_, "presets");
}

static void
proton_plus_widgets_mango_hud_box_class_init (ProtonPlusWidgetsMangoHudBoxClass * klass,
                                              gpointer klass_data)
{
	proton_plus_widgets_mango_hud_box_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusWidgetsMangoHudBox_private_offset);
	G_OBJECT_CLASS (klass)->finalize = proton_plus_widgets_mango_hud_box_finalize;
	proton_plus_widgets_mango_hud_box_signals[PROTON_PLUS_WIDGETS_MANGO_HUD_BOX_SAVED_SIGNAL] = g_signal_new ("saved", PROTON_PLUS_WIDGETS_MANGO_HUD_TYPE_BOX, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
proton_plus_widgets_mango_hud_box_instance_init (ProtonPlusWidgetsMangoHudBox * self,
                                                 gpointer klass)
{
	self->priv = proton_plus_widgets_mango_hud_box_get_instance_private (self);
}

static void
proton_plus_widgets_mango_hud_box_finalize (GObject * obj)
{
	ProtonPlusWidgetsMangoHudBox * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_MANGO_HUD_TYPE_BOX, ProtonPlusWidgetsMangoHudBox);
	_g_object_unref0 (self->priv->config);
	_g_object_unref0 (self->priv->presets_page);
	_g_object_unref0 (self->priv->visual_page);
	_g_object_unref0 (self->priv->performance_page);
	_g_object_unref0 (self->priv->metrics_page);
	_g_object_unref0 (self->priv->extras_page);
	_g_object_unref0 (self->priv->stack);
	G_OBJECT_CLASS (proton_plus_widgets_mango_hud_box_parent_class)->finalize (obj);
}

static GType
proton_plus_widgets_mango_hud_box_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsMangoHudBoxClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_mango_hud_box_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsMangoHudBox), 0, (GInstanceInitFunc) proton_plus_widgets_mango_hud_box_instance_init, NULL };
	GType proton_plus_widgets_mango_hud_box_type_id;
	proton_plus_widgets_mango_hud_box_type_id = g_type_register_static (gtk_box_get_type (), "ProtonPlusWidgetsMangoHudBox", &g_define_type_info, 0);
	ProtonPlusWidgetsMangoHudBox_private_offset = g_type_add_instance_private (proton_plus_widgets_mango_hud_box_type_id, sizeof (ProtonPlusWidgetsMangoHudBoxPrivate));
	return proton_plus_widgets_mango_hud_box_type_id;
}

GType
proton_plus_widgets_mango_hud_box_get_type (void)
{
	static volatile gsize proton_plus_widgets_mango_hud_box_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_mango_hud_box_type_id__once)) {
		GType proton_plus_widgets_mango_hud_box_type_id;
		proton_plus_widgets_mango_hud_box_type_id = proton_plus_widgets_mango_hud_box_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_mango_hud_box_type_id__once, proton_plus_widgets_mango_hud_box_type_id);
	}
	return proton_plus_widgets_mango_hud_box_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;
}

