/* games-extra-button.c generated by valac 0.56.19, the Vala compiler
 * generated from games-extra-button.vala, do not modify */

#include "protonplus_core.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.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_GAMES_EXTRA_BUTTON_0_PROPERTY,
	PROTON_PLUS_WIDGETS_GAMES_EXTRA_BUTTON_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_games_extra_button_properties[PROTON_PLUS_WIDGETS_GAMES_EXTRA_BUTTON_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))

struct _ProtonPlusWidgetsGamesExtraButtonPrivate {
	ProtonPlusModelsGame* game;
	GtkButton* open_protontricks_button;
	GtkButton* anticheat_button;
	GtkButton* protondb_button;
	GtkBox* content_box;
	GtkPopover* popover;
	gulong awacy_status_handler;
};

static gint ProtonPlusWidgetsGamesExtraButton_private_offset;
static gpointer proton_plus_widgets_games_extra_button_parent_class = NULL;

static void proton_plus_widgets_games_extra_button_refresh_anticheat_button (ProtonPlusWidgetsGamesExtraButton* self);
static void _proton_plus_widgets_games_extra_button_refresh_anticheat_button_g_object_notify (GObject* _sender,
                                                                                       GParamSpec* pspec,
                                                                                       gpointer self);
static void proton_plus_widgets_games_extra_button_refresh_sensitivity (ProtonPlusWidgetsGamesExtraButton* self);
static void proton_plus_widgets_games_extra_button_real_dispose (GObject* base);
static void proton_plus_widgets_games_extra_button_extra_button_clicked (ProtonPlusWidgetsGamesExtraButton* self);
static void proton_plus_widgets_games_extra_button_open_protontricks_button_clicked (ProtonPlusWidgetsGamesExtraButton* self);
static void proton_plus_widgets_games_extra_button_anticheat_button_clicked (ProtonPlusWidgetsGamesExtraButton* self);
static void proton_plus_widgets_games_extra_button_protondb_button_clicked (ProtonPlusWidgetsGamesExtraButton* self);
static GObject * proton_plus_widgets_games_extra_button_constructor (GType type,
                                                              guint n_construct_properties,
                                                              GObjectConstructParam * construct_properties);
static void _proton_plus_widgets_games_extra_button_open_protontricks_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                                  gpointer self);
static void _proton_plus_widgets_games_extra_button_protondb_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                         gpointer self);
static void _proton_plus_widgets_games_extra_button_anticheat_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                          gpointer self);
static void _proton_plus_widgets_games_extra_button_extra_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                      gpointer self);
static void proton_plus_widgets_games_extra_button_finalize (GObject * obj);
static GType proton_plus_widgets_games_extra_button_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
proton_plus_widgets_games_extra_button_get_instance_private (ProtonPlusWidgetsGamesExtraButton* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusWidgetsGamesExtraButton_private_offset);
}

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

static void
_proton_plus_widgets_games_extra_button_refresh_anticheat_button_g_object_notify (GObject* _sender,
                                                                                  GParamSpec* pspec,
                                                                                  gpointer self)
{
	proton_plus_widgets_games_extra_button_refresh_anticheat_button ((ProtonPlusWidgetsGamesExtraButton*) self);
}

ProtonPlusWidgetsGamesExtraButton*
proton_plus_widgets_games_extra_button_construct (GType object_type,
                                                  ProtonPlusModelsGame* game)
{
	ProtonPlusWidgetsGamesExtraButton * self = NULL;
	ProtonPlusModelsGame* _tmp0_;
	g_return_val_if_fail (game != NULL, NULL);
	self = (ProtonPlusWidgetsGamesExtraButton*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (game);
	_g_object_unref0 (self->priv->game);
	self->priv->game = _tmp0_;
	if (PROTON_PLUS_MODELS_GAMES_IS_STEAM (game)) {
		gboolean _tmp1_ = FALSE;
		ProtonPlusModelsGamesSteam* steam_game = NULL;
		ProtonPlusModelsGamesSteam* _tmp4_;
		GtkButton* _tmp5_;
		ProtonPlusModelsGamesSteam* _tmp6_;
		gboolean _tmp7_;
		gboolean _tmp8_;
		GtkBox* _tmp9_;
		GtkButton* _tmp10_;
		GtkBox* _tmp11_;
		GtkButton* _tmp12_;
		ProtonPlusModelsGamesSteam* _tmp13_;
		gulong _tmp14_;
		GtkButton* _tmp15_;
		ProtonPlusModelsGamesSteam* _tmp16_;
		gboolean _tmp17_;
		gboolean _tmp18_;
		if (proton_plus_globals_PROTONTRICKS_INSTALLED) {
			_tmp1_ = TRUE;
		} else {
			_tmp1_ = proton_plus_globals_PROTONTRICKS_FLATPAK_INSTALLED;
		}
		if (_tmp1_) {
			GtkBox* _tmp2_;
			GtkButton* _tmp3_;
			_tmp2_ = self->priv->content_box;
			_tmp3_ = self->priv->open_protontricks_button;
			gtk_box_append (_tmp2_, (GtkWidget*) _tmp3_);
		}
		_tmp4_ = _g_object_ref0 (PROTON_PLUS_MODELS_GAMES_IS_STEAM (game) ? ((ProtonPlusModelsGamesSteam*) game) : NULL);
		steam_game = _tmp4_;
		_tmp5_ = self->priv->open_protontricks_button;
		_tmp6_ = steam_game;
		_tmp7_ = proton_plus_models_games_steam_get_is_non_steam (_tmp6_);
		_tmp8_ = _tmp7_;
		gtk_widget_set_visible ((GtkWidget*) _tmp5_, !_tmp8_);
		_tmp9_ = self->priv->content_box;
		_tmp10_ = self->priv->protondb_button;
		gtk_box_append (_tmp9_, (GtkWidget*) _tmp10_);
		_tmp11_ = self->priv->content_box;
		_tmp12_ = self->priv->anticheat_button;
		gtk_box_append (_tmp11_, (GtkWidget*) _tmp12_);
		_tmp13_ = steam_game;
		_tmp14_ = g_signal_connect_object ((GObject*) _tmp13_, "notify::awacy-status", (GCallback) _proton_plus_widgets_games_extra_button_refresh_anticheat_button_g_object_notify, self, 0);
		self->priv->awacy_status_handler = _tmp14_;
		proton_plus_widgets_games_extra_button_refresh_anticheat_button (self);
		_tmp15_ = self->priv->protondb_button;
		_tmp16_ = steam_game;
		_tmp17_ = proton_plus_models_games_steam_get_is_non_steam (_tmp16_);
		_tmp18_ = _tmp17_;
		gtk_widget_set_visible ((GtkWidget*) _tmp15_, !_tmp18_);
		_g_object_unref0 (steam_game);
	}
	proton_plus_widgets_games_extra_button_refresh_sensitivity (self);
	return self;
}

ProtonPlusWidgetsGamesExtraButton*
proton_plus_widgets_games_extra_button_new (ProtonPlusModelsGame* game)
{
	return proton_plus_widgets_games_extra_button_construct (PROTON_PLUS_WIDGETS_GAMES_TYPE_EXTRA_BUTTON, game);
}

static void
proton_plus_widgets_games_extra_button_refresh_anticheat_button (ProtonPlusWidgetsGamesExtraButton* self)
{
	ProtonPlusModelsGamesSteam* steam_game = NULL;
	ProtonPlusModelsGame* _tmp0_;
	ProtonPlusModelsGamesSteam* _tmp1_;
	ProtonPlusModelsGamesSteam* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar** _tmp8_;
	GtkButton* _tmp12_;
	ProtonPlusModelsGamesSteam* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	GtkButton* _tmp16_;
	ProtonPlusModelsGamesSteam* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	GQuark _tmp22_ = 0U;
	static GQuark _tmp21_label0 = 0;
	static GQuark _tmp21_label1 = 0;
	static GQuark _tmp21_label2 = 0;
	static GQuark _tmp21_label3 = 0;
	static GQuark _tmp21_label4 = 0;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->game;
	_tmp1_ = _g_object_ref0 (PROTON_PLUS_MODELS_GAMES_IS_STEAM (_tmp0_) ? ((ProtonPlusModelsGamesSteam*) _tmp0_) : NULL);
	steam_game = _tmp1_;
	_tmp2_ = steam_game;
	if (_tmp2_ == NULL) {
		_g_object_unref0 (steam_game);
		return;
	}
	_tmp3_ = g_strdup ("green");
	_tmp4_ = g_strdup ("blue");
	_tmp5_ = g_strdup ("purple");
	_tmp6_ = g_strdup ("orange");
	_tmp7_ = g_strdup ("red");
	_tmp8_ = g_new0 (gchar*, 5 + 1);
	_tmp8_[0] = _tmp3_;
	_tmp8_[1] = _tmp4_;
	_tmp8_[2] = _tmp5_;
	_tmp8_[3] = _tmp6_;
	_tmp8_[4] = _tmp7_;
	{
		gchar** css_class_collection = NULL;
		gint css_class_collection_length1 = 0;
		gint _css_class_collection_size_ = 0;
		gint css_class_it = 0;
		css_class_collection = _tmp8_;
		css_class_collection_length1 = 5;
		for (css_class_it = 0; css_class_it < css_class_collection_length1; css_class_it = css_class_it + 1) {
			gchar* _tmp9_;
			gchar* css_class = NULL;
			_tmp9_ = g_strdup (css_class_collection[css_class_it]);
			css_class = _tmp9_;
			{
				GtkButton* _tmp10_;
				const gchar* _tmp11_;
				_tmp10_ = self->priv->anticheat_button;
				_tmp11_ = css_class;
				gtk_widget_remove_css_class ((GtkWidget*) _tmp10_, _tmp11_);
				_g_free0 (css_class);
			}
		}
		css_class_collection = (_vala_array_free (css_class_collection, css_class_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp12_ = self->priv->anticheat_button;
	_tmp13_ = steam_game;
	_tmp14_ = proton_plus_models_games_steam_get_awacy_status (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, PROTON_PLUS_MODELS_GAMES_TYPE_STEAM, ProtonPlusModelsGamesSteam));
	_tmp15_ = _tmp14_;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp12_, _tmp15_);
	_tmp16_ = self->priv->anticheat_button;
	gtk_widget_set_visible ((GtkWidget*) _tmp16_, TRUE);
	_tmp17_ = steam_game;
	_tmp18_ = proton_plus_models_games_steam_get_awacy_status (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, PROTON_PLUS_MODELS_GAMES_TYPE_STEAM, ProtonPlusModelsGamesSteam));
	_tmp19_ = _tmp18_;
	_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 ("Supported")))) {
		switch (0) {
			default:
			{
				GtkButton* _tmp23_;
				_tmp23_ = self->priv->anticheat_button;
				gtk_widget_add_css_class ((GtkWidget*) _tmp23_, "green");
				break;
			}
		}
	} else if (_tmp22_ == ((0 != _tmp21_label1) ? _tmp21_label1 : (_tmp21_label1 = g_quark_from_static_string ("Running")))) {
		switch (0) {
			default:
			{
				GtkButton* _tmp24_;
				_tmp24_ = self->priv->anticheat_button;
				gtk_widget_add_css_class ((GtkWidget*) _tmp24_, "blue");
				break;
			}
		}
	} else if (_tmp22_ == ((0 != _tmp21_label2) ? _tmp21_label2 : (_tmp21_label2 = g_quark_from_static_string ("Planned")))) {
		switch (0) {
			default:
			{
				GtkButton* _tmp25_;
				_tmp25_ = self->priv->anticheat_button;
				gtk_widget_add_css_class ((GtkWidget*) _tmp25_, "purple");
				break;
			}
		}
	} else if (_tmp22_ == ((0 != _tmp21_label3) ? _tmp21_label3 : (_tmp21_label3 = g_quark_from_static_string ("Broken")))) {
		switch (0) {
			default:
			{
				GtkButton* _tmp26_;
				_tmp26_ = self->priv->anticheat_button;
				gtk_widget_add_css_class ((GtkWidget*) _tmp26_, "orange");
				break;
			}
		}
	} else if (_tmp22_ == ((0 != _tmp21_label4) ? _tmp21_label4 : (_tmp21_label4 = g_quark_from_static_string ("Denied")))) {
		switch (0) {
			default:
			{
				GtkButton* _tmp27_;
				_tmp27_ = self->priv->anticheat_button;
				gtk_widget_add_css_class ((GtkWidget*) _tmp27_, "red");
				break;
			}
		}
	} else {
		switch (0) {
			default:
			{
				GtkButton* _tmp28_;
				GtkButton* _tmp29_;
				_tmp28_ = self->priv->anticheat_button;
				gtk_widget_set_tooltip_text ((GtkWidget*) _tmp28_, _ ("Unknown"));
				_tmp29_ = self->priv->anticheat_button;
				gtk_widget_set_visible ((GtkWidget*) _tmp29_, FALSE);
				break;
			}
		}
	}
	proton_plus_widgets_games_extra_button_refresh_sensitivity (self);
	_g_object_unref0 (steam_game);
}

static void
proton_plus_widgets_games_extra_button_refresh_sensitivity (ProtonPlusWidgetsGamesExtraButton* self)
{
	gboolean any_visible = FALSE;
	GtkWidget* child = NULL;
	GtkBox* _tmp0_;
	GtkWidget* _tmp1_;
	GtkWidget* _tmp2_;
	g_return_if_fail (self != NULL);
	any_visible = FALSE;
	_tmp0_ = self->priv->content_box;
	_tmp1_ = gtk_widget_get_first_child ((GtkWidget*) _tmp0_);
	_tmp2_ = _g_object_ref0 (_tmp1_);
	child = _tmp2_;
	while (TRUE) {
		GtkWidget* _tmp3_;
		GtkWidget* _tmp4_;
		GtkWidget* _tmp5_;
		GtkWidget* _tmp6_;
		GtkWidget* _tmp7_;
		_tmp3_ = child;
		if (!(_tmp3_ != NULL)) {
			break;
		}
		_tmp4_ = child;
		if (gtk_widget_get_visible (_tmp4_)) {
			any_visible = TRUE;
			break;
		}
		_tmp5_ = child;
		_tmp6_ = gtk_widget_get_next_sibling (_tmp5_);
		_tmp7_ = _g_object_ref0 (_tmp6_);
		_g_object_unref0 (child);
		child = _tmp7_;
	}
	gtk_widget_set_sensitive ((GtkWidget*) self, any_visible);
	_g_object_unref0 (child);
}

static void
proton_plus_widgets_games_extra_button_real_dispose (GObject* base)
{
	ProtonPlusWidgetsGamesExtraButton * self;
	gboolean _tmp0_ = FALSE;
	GtkPopover* _tmp3_;
	self = (ProtonPlusWidgetsGamesExtraButton*) base;
	if (self->priv->awacy_status_handler != ((gulong) 0)) {
		ProtonPlusModelsGame* _tmp1_;
		_tmp1_ = self->priv->game;
		_tmp0_ = PROTON_PLUS_MODELS_GAMES_IS_STEAM (_tmp1_);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		ProtonPlusModelsGame* _tmp2_;
		_tmp2_ = self->priv->game;
		g_signal_handler_disconnect ((GObject*) _tmp2_, self->priv->awacy_status_handler);
		self->priv->awacy_status_handler = (gulong) 0;
	}
	_tmp3_ = self->priv->popover;
	gtk_widget_unparent ((GtkWidget*) _tmp3_);
	G_OBJECT_CLASS (proton_plus_widgets_games_extra_button_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, gtk_button_get_type (), GtkButton));
}

static void
proton_plus_widgets_games_extra_button_extra_button_clicked (ProtonPlusWidgetsGamesExtraButton* self)
{
	GtkPopover* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->popover;
	gtk_popover_popup (_tmp0_);
}

static void
proton_plus_widgets_games_extra_button_open_protontricks_button_clicked (ProtonPlusWidgetsGamesExtraButton* self)
{
	ProtonPlusModelsGamesSteam* steam_game = NULL;
	ProtonPlusModelsGame* _tmp0_;
	ProtonPlusModelsGamesSteam* _tmp1_;
	GtkPopover* _tmp12_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->game;
	_tmp1_ = _g_object_ref0 (PROTON_PLUS_MODELS_GAMES_IS_STEAM (_tmp0_) ? ((ProtonPlusModelsGamesSteam*) _tmp0_) : NULL);
	steam_game = _tmp1_;
	if (proton_plus_globals_PROTONTRICKS_INSTALLED) {
		ProtonPlusModelsGamesSteam* _tmp2_;
		guint _tmp3_;
		guint _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp2_ = steam_game;
		_tmp3_ = proton_plus_models_games_steam_get_appid (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strdup_printf ("%s %u --gui", "protontricks", _tmp4_);
		_tmp6_ = _tmp5_;
		proton_plus_utils_system_run_command (_tmp6_, NULL, NULL);
		_g_free0 (_tmp6_);
	} else {
		if (proton_plus_globals_PROTONTRICKS_FLATPAK_INSTALLED) {
			ProtonPlusModelsGamesSteam* _tmp7_;
			guint _tmp8_;
			guint _tmp9_;
			gchar* _tmp10_;
			gchar* _tmp11_;
			_tmp7_ = steam_game;
			_tmp8_ = proton_plus_models_games_steam_get_appid (_tmp7_);
			_tmp9_ = _tmp8_;
			_tmp10_ = g_strdup_printf ("flatpak run %s %u --gui", "com.github.Matoking.protontricks", _tmp9_);
			_tmp11_ = _tmp10_;
			proton_plus_utils_system_run_command (_tmp11_, NULL, NULL);
			_g_free0 (_tmp11_);
		}
	}
	_tmp12_ = self->priv->popover;
	gtk_popover_popdown (_tmp12_);
	_g_object_unref0 (steam_game);
}

static void
proton_plus_widgets_games_extra_button_anticheat_button_clicked (ProtonPlusWidgetsGamesExtraButton* self)
{
	ProtonPlusModelsGamesSteam* steam_game = NULL;
	ProtonPlusModelsGame* _tmp0_;
	ProtonPlusModelsGamesSteam* _tmp1_;
	ProtonPlusModelsGamesSteam* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	GtkPopover* _tmp10_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->game;
	_tmp1_ = _g_object_ref0 (PROTON_PLUS_MODELS_GAMES_IS_STEAM (_tmp0_) ? ((ProtonPlusModelsGamesSteam*) _tmp0_) : NULL);
	steam_game = _tmp1_;
	_tmp2_ = steam_game;
	_tmp3_ = proton_plus_models_games_steam_get_awacy_name (_tmp2_);
	_tmp4_ = _tmp3_;
	if (_tmp4_ != NULL) {
		ProtonPlusModelsGamesSteam* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp5_ = steam_game;
		_tmp6_ = proton_plus_models_games_steam_get_awacy_name (_tmp5_);
		_tmp7_ = _tmp6_;
		_tmp8_ = g_strdup_printf ("https://areweanticheatyet.com/game/%s", _tmp7_);
		_tmp9_ = _tmp8_;
		proton_plus_utils_system_open_uri (_tmp9_);
		_g_free0 (_tmp9_);
	}
	_tmp10_ = self->priv->popover;
	gtk_popover_popdown (_tmp10_);
	_g_object_unref0 (steam_game);
}

static void
proton_plus_widgets_games_extra_button_protondb_button_clicked (ProtonPlusWidgetsGamesExtraButton* self)
{
	ProtonPlusModelsGamesSteam* steam_game = NULL;
	ProtonPlusModelsGame* _tmp0_;
	ProtonPlusModelsGamesSteam* _tmp1_;
	guint _tmp2_;
	guint _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GtkPopover* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->game;
	_tmp1_ = _g_object_ref0 (PROTON_PLUS_MODELS_GAMES_IS_STEAM (_tmp0_) ? ((ProtonPlusModelsGamesSteam*) _tmp0_) : NULL);
	steam_game = _tmp1_;
	_tmp2_ = proton_plus_models_games_steam_get_appid (steam_game);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strdup_printf ("https://www.protondb.com/app/%u", _tmp3_);
	_tmp5_ = _tmp4_;
	proton_plus_utils_system_open_uri (_tmp5_);
	_g_free0 (_tmp5_);
	_tmp6_ = self->priv->popover;
	gtk_popover_popdown (_tmp6_);
	_g_object_unref0 (steam_game);
}

static void
_proton_plus_widgets_games_extra_button_open_protontricks_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                             gpointer self)
{
	proton_plus_widgets_games_extra_button_open_protontricks_button_clicked ((ProtonPlusWidgetsGamesExtraButton*) self);
}

static void
_proton_plus_widgets_games_extra_button_protondb_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                    gpointer self)
{
	proton_plus_widgets_games_extra_button_protondb_button_clicked ((ProtonPlusWidgetsGamesExtraButton*) self);
}

static void
_proton_plus_widgets_games_extra_button_anticheat_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                     gpointer self)
{
	proton_plus_widgets_games_extra_button_anticheat_button_clicked ((ProtonPlusWidgetsGamesExtraButton*) self);
}

static void
_proton_plus_widgets_games_extra_button_extra_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                 gpointer self)
{
	proton_plus_widgets_games_extra_button_extra_button_clicked ((ProtonPlusWidgetsGamesExtraButton*) self);
}

static GObject *
proton_plus_widgets_games_extra_button_constructor (GType type,
                                                    guint n_construct_properties,
                                                    GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ProtonPlusWidgetsGamesExtraButton * self;
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	GtkButton* _tmp2_;
	GtkButton* _tmp3_;
	GtkButton* _tmp4_;
	GtkButton* _tmp5_;
	GtkButton* _tmp6_;
	GtkButton* _tmp7_;
	GtkBox* _tmp8_;
	GtkPopover* _tmp9_;
	GtkPopover* _tmp10_;
	GtkPopover* _tmp11_;
	GtkPopover* _tmp12_;
	GtkBox* _tmp13_;
	GtkPopover* _tmp14_;
	GtkButton* _tmp15_;
	parent_class = G_OBJECT_CLASS (proton_plus_widgets_games_extra_button_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_GAMES_TYPE_EXTRA_BUTTON, ProtonPlusWidgetsGamesExtraButton);
	_tmp0_ = (GtkButton*) gtk_button_new_with_label (_ ("Open in protontricks"));
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->open_protontricks_button);
	self->priv->open_protontricks_button = _tmp0_;
	_tmp1_ = self->priv->open_protontricks_button;
	g_signal_connect_object (_tmp1_, "clicked", (GCallback) _proton_plus_widgets_games_extra_button_open_protontricks_button_clicked_gtk_button_clicked, self, 0);
	_tmp2_ = (GtkButton*) gtk_button_new_with_label ("ProtonDB");
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->protondb_button);
	self->priv->protondb_button = _tmp2_;
	_tmp3_ = self->priv->protondb_button;
	gtk_widget_set_tooltip_text ((GtkWidget*) _tmp3_, _ ("Open ProtonDB page"));
	_tmp4_ = self->priv->protondb_button;
	g_signal_connect_object (_tmp4_, "clicked", (GCallback) _proton_plus_widgets_games_extra_button_protondb_button_clicked_gtk_button_clicked, self, 0);
	_tmp5_ = (GtkButton*) gtk_button_new_with_label ("AreWeAntiCheatYet");
	g_object_ref_sink (_tmp5_);
	_g_object_unref0 (self->priv->anticheat_button);
	self->priv->anticheat_button = _tmp5_;
	_tmp6_ = self->priv->anticheat_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp6_, "anticheat-button");
	_tmp7_ = self->priv->anticheat_button;
	g_signal_connect_object (_tmp7_, "clicked", (GCallback) _proton_plus_widgets_games_extra_button_anticheat_button_clicked_gtk_button_clicked, self, 0);
	_tmp8_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
	g_object_ref_sink (_tmp8_);
	_g_object_unref0 (self->priv->content_box);
	self->priv->content_box = _tmp8_;
	_tmp9_ = (GtkPopover*) gtk_popover_new ();
	g_object_ref_sink (_tmp9_);
	_g_object_unref0 (self->priv->popover);
	self->priv->popover = _tmp9_;
	_tmp10_ = self->priv->popover;
	gtk_popover_set_autohide (_tmp10_, TRUE);
	_tmp11_ = self->priv->popover;
	gtk_widget_set_parent ((GtkWidget*) _tmp11_, (GtkWidget*) self);
	_tmp12_ = self->priv->popover;
	_tmp13_ = self->priv->content_box;
	gtk_popover_set_child (_tmp12_, (GtkWidget*) _tmp13_);
	_tmp14_ = self->priv->popover;
	_tmp15_ = self->priv->open_protontricks_button;
	proton_plus_widgets_window_register_popover_for_controller (_tmp14_, (GtkWidget*) self, (GtkWidget*) _tmp15_);
	g_signal_connect_object ((GtkButton*) self, "clicked", (GCallback) _proton_plus_widgets_games_extra_button_extra_button_clicked_gtk_button_clicked, self, 0);
	gtk_button_set_icon_name ((GtkButton*) self, "dots-symbolic");
	gtk_widget_set_tooltip_text ((GtkWidget*) self, _ ("Extra"));
	gtk_widget_add_css_class ((GtkWidget*) self, "flat");
	return obj;
}

static void
proton_plus_widgets_games_extra_button_class_init (ProtonPlusWidgetsGamesExtraButtonClass * klass,
                                                   gpointer klass_data)
{
	proton_plus_widgets_games_extra_button_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusWidgetsGamesExtraButton_private_offset);
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) proton_plus_widgets_games_extra_button_real_dispose;
	G_OBJECT_CLASS (klass)->constructor = proton_plus_widgets_games_extra_button_constructor;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_widgets_games_extra_button_finalize;
}

static void
proton_plus_widgets_games_extra_button_instance_init (ProtonPlusWidgetsGamesExtraButton * self,
                                                      gpointer klass)
{
	self->priv = proton_plus_widgets_games_extra_button_get_instance_private (self);
}

static void
proton_plus_widgets_games_extra_button_finalize (GObject * obj)
{
	ProtonPlusWidgetsGamesExtraButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_GAMES_TYPE_EXTRA_BUTTON, ProtonPlusWidgetsGamesExtraButton);
	_g_object_unref0 (self->priv->game);
	_g_object_unref0 (self->priv->open_protontricks_button);
	_g_object_unref0 (self->priv->anticheat_button);
	_g_object_unref0 (self->priv->protondb_button);
	_g_object_unref0 (self->priv->content_box);
	_g_object_unref0 (self->priv->popover);
	G_OBJECT_CLASS (proton_plus_widgets_games_extra_button_parent_class)->finalize (obj);
}

static GType
proton_plus_widgets_games_extra_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsGamesExtraButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_games_extra_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsGamesExtraButton), 0, (GInstanceInitFunc) proton_plus_widgets_games_extra_button_instance_init, NULL };
	GType proton_plus_widgets_games_extra_button_type_id;
	proton_plus_widgets_games_extra_button_type_id = g_type_register_static (gtk_button_get_type (), "ProtonPlusWidgetsGamesExtraButton", &g_define_type_info, 0);
	ProtonPlusWidgetsGamesExtraButton_private_offset = g_type_add_instance_private (proton_plus_widgets_games_extra_button_type_id, sizeof (ProtonPlusWidgetsGamesExtraButtonPrivate));
	return proton_plus_widgets_games_extra_button_type_id;
}

GType
proton_plus_widgets_games_extra_button_get_type (void)
{
	static volatile gsize proton_plus_widgets_games_extra_button_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_games_extra_button_type_id__once)) {
		GType proton_plus_widgets_games_extra_button_type_id;
		proton_plus_widgets_games_extra_button_type_id = proton_plus_widgets_games_extra_button_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_games_extra_button_type_id__once, proton_plus_widgets_games_extra_button_type_id);
	}
	return proton_plus_widgets_games_extra_button_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);
}

