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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_BUTTON (proton_plus_widgets_launchers_popover_button_get_type ())
#define PROTON_PLUS_WIDGETS_LAUNCHERS_POPOVER_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_BUTTON, ProtonPlusWidgetsLaunchersPopoverButton))
#define PROTON_PLUS_WIDGETS_LAUNCHERS_POPOVER_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_BUTTON, ProtonPlusWidgetsLaunchersPopoverButtonClass))
#define PROTON_PLUS_WIDGETS_IS_LAUNCHERS_POPOVER_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_BUTTON))
#define PROTON_PLUS_WIDGETS_IS_LAUNCHERS_POPOVER_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_BUTTON))
#define PROTON_PLUS_WIDGETS_LAUNCHERS_POPOVER_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_BUTTON, ProtonPlusWidgetsLaunchersPopoverButtonClass))

typedef struct _ProtonPlusWidgetsLaunchersPopoverButton ProtonPlusWidgetsLaunchersPopoverButton;
typedef struct _ProtonPlusWidgetsLaunchersPopoverButtonClass ProtonPlusWidgetsLaunchersPopoverButtonClass;
typedef struct _ProtonPlusWidgetsLaunchersPopoverButtonPrivate ProtonPlusWidgetsLaunchersPopoverButtonPrivate;

#define PROTON_PLUS_MODELS_TYPE_LAUNCHER (proton_plus_models_launcher_get_type ())
#define PROTON_PLUS_MODELS_LAUNCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_TYPE_LAUNCHER, ProtonPlusModelsLauncher))
#define PROTON_PLUS_MODELS_LAUNCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_TYPE_LAUNCHER, ProtonPlusModelsLauncherClass))
#define PROTON_PLUS_MODELS_IS_LAUNCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_TYPE_LAUNCHER))
#define PROTON_PLUS_MODELS_IS_LAUNCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_TYPE_LAUNCHER))
#define PROTON_PLUS_MODELS_LAUNCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_TYPE_LAUNCHER, ProtonPlusModelsLauncherClass))

typedef struct _ProtonPlusModelsLauncher ProtonPlusModelsLauncher;
typedef struct _ProtonPlusModelsLauncherClass ProtonPlusModelsLauncherClass;
enum  {
	PROTON_PLUS_WIDGETS_LAUNCHERS_POPOVER_BUTTON_0_PROPERTY,
	PROTON_PLUS_WIDGETS_LAUNCHERS_POPOVER_BUTTON_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_launchers_popover_button_properties[PROTON_PLUS_WIDGETS_LAUNCHERS_POPOVER_BUTTON_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_LIST_ROW (proton_plus_widgets_launchers_popover_list_row_get_type ())
#define PROTON_PLUS_WIDGETS_LAUNCHERS_POPOVER_LIST_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_LIST_ROW, ProtonPlusWidgetsLaunchersPopoverListRow))
#define PROTON_PLUS_WIDGETS_LAUNCHERS_POPOVER_LIST_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_LIST_ROW, ProtonPlusWidgetsLaunchersPopoverListRowClass))
#define PROTON_PLUS_WIDGETS_IS_LAUNCHERS_POPOVER_LIST_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_LIST_ROW))
#define PROTON_PLUS_WIDGETS_IS_LAUNCHERS_POPOVER_LIST_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_LIST_ROW))
#define PROTON_PLUS_WIDGETS_LAUNCHERS_POPOVER_LIST_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_LIST_ROW, ProtonPlusWidgetsLaunchersPopoverListRowClass))

typedef struct _ProtonPlusWidgetsLaunchersPopoverListRow ProtonPlusWidgetsLaunchersPopoverListRow;
typedef struct _ProtonPlusWidgetsLaunchersPopoverListRowClass ProtonPlusWidgetsLaunchersPopoverListRowClass;
typedef struct _ProtonPlusWidgetsLaunchersPopoverListRowPrivate ProtonPlusWidgetsLaunchersPopoverListRowPrivate;
typedef struct _ProtonPlusModelsLauncherPrivate ProtonPlusModelsLauncherPrivate;

#define PROTON_PLUS_MODELS_TYPE_GAME (proton_plus_models_game_get_type ())
#define PROTON_PLUS_MODELS_GAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_TYPE_GAME, ProtonPlusModelsGame))
#define PROTON_PLUS_MODELS_GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_TYPE_GAME, ProtonPlusModelsGameClass))
#define PROTON_PLUS_MODELS_IS_GAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_TYPE_GAME))
#define PROTON_PLUS_MODELS_IS_GAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_TYPE_GAME))
#define PROTON_PLUS_MODELS_GAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_TYPE_GAME, ProtonPlusModelsGameClass))

typedef struct _ProtonPlusModelsGame ProtonPlusModelsGame;
typedef struct _ProtonPlusModelsGameClass ProtonPlusModelsGameClass;

#define PROTON_PLUS_MODELS_TYPE_SIMPLE_RUNNER (proton_plus_models_simple_runner_get_type ())
#define PROTON_PLUS_MODELS_SIMPLE_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_TYPE_SIMPLE_RUNNER, ProtonPlusModelsSimpleRunner))
#define PROTON_PLUS_MODELS_SIMPLE_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_TYPE_SIMPLE_RUNNER, ProtonPlusModelsSimpleRunnerClass))
#define PROTON_PLUS_MODELS_IS_SIMPLE_RUNNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_TYPE_SIMPLE_RUNNER))
#define PROTON_PLUS_MODELS_IS_SIMPLE_RUNNER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_TYPE_SIMPLE_RUNNER))
#define PROTON_PLUS_MODELS_SIMPLE_RUNNER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_TYPE_SIMPLE_RUNNER, ProtonPlusModelsSimpleRunnerClass))

typedef struct _ProtonPlusModelsSimpleRunner ProtonPlusModelsSimpleRunner;
typedef struct _ProtonPlusModelsSimpleRunnerClass ProtonPlusModelsSimpleRunnerClass;

#define PROTON_PLUS_MODELS_TYPE_GROUP (proton_plus_models_group_get_type ())
#define PROTON_PLUS_MODELS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_MODELS_TYPE_GROUP, ProtonPlusModelsGroup))
#define PROTON_PLUS_MODELS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_MODELS_TYPE_GROUP, ProtonPlusModelsGroupClass))
#define PROTON_PLUS_MODELS_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_MODELS_TYPE_GROUP))
#define PROTON_PLUS_MODELS_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_MODELS_TYPE_GROUP))
#define PROTON_PLUS_MODELS_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_MODELS_TYPE_GROUP, ProtonPlusModelsGroupClass))

typedef struct _ProtonPlusModelsGroup ProtonPlusModelsGroup;
typedef struct _ProtonPlusModelsGroupClass ProtonPlusModelsGroupClass;
typedef enum  {
	PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_SYSTEM,
	PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_FLATPAK,
	PROTON_PLUS_MODELS_LAUNCHER_INSTALLATION_TYPES_SNAP
} ProtonPlusModelsLauncherInstallationTypes;

#define PROTON_PLUS_MODELS_LAUNCHER_TYPE_INSTALLATION_TYPES (proton_plus_models_launcher_installation_types_get_type ())
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

struct _ProtonPlusWidgetsLaunchersPopoverButton {
	GtkButton parent_instance;
	ProtonPlusWidgetsLaunchersPopoverButtonPrivate * priv;
};

struct _ProtonPlusWidgetsLaunchersPopoverButtonClass {
	GtkButtonClass parent_class;
};

struct _ProtonPlusWidgetsLaunchersPopoverButtonPrivate {
	ProtonPlusModelsLauncher* selected_launcher;
	GtkPopover* popover;
	GtkImage* button_image;
	GtkLabel* button_label;
	GtkBox* button_content;
	GtkListBox* list_box;
};

struct _ProtonPlusWidgetsLaunchersPopoverListRow {
	GtkListBoxRow parent_instance;
	ProtonPlusWidgetsLaunchersPopoverListRowPrivate * priv;
	ProtonPlusModelsLauncher* launcher;
};

struct _ProtonPlusWidgetsLaunchersPopoverListRowClass {
	GtkListBoxRowClass parent_class;
};

struct _ProtonPlusModelsLauncher {
	GObject parent_instance;
	ProtonPlusModelsLauncherPrivate * priv;
	gchar* title;
	gchar* icon_path;
	gchar* directory;
	gboolean installed;
	gboolean has_library_support;
	GList* games;
	GeeArrayList* compatibility_tools;
	ProtonPlusModelsGroup** groups;
	gint groups_length1;
	ProtonPlusModelsLauncherInstallationTypes installation_type;
};

struct _ProtonPlusModelsLauncherClass {
	GObjectClass parent_class;
	void (*load_game_library) (ProtonPlusModelsLauncher* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	gboolean (*load_game_library_finish) (ProtonPlusModelsLauncher* self, GAsyncResult* _res_);
	gint (*get_compatibility_tool_usage_count) (ProtonPlusModelsLauncher* self, const gchar* compatibility_tool_name);
};

static gint ProtonPlusWidgetsLaunchersPopoverButton_private_offset;
static gpointer proton_plus_widgets_launchers_popover_button_parent_class = NULL;

VALA_EXTERN GType proton_plus_widgets_launchers_popover_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusWidgetsLaunchersPopoverButton, g_object_unref)
VALA_EXTERN GType proton_plus_models_launcher_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsLauncher, g_object_unref)
VALA_EXTERN ProtonPlusWidgetsLaunchersPopoverButton* proton_plus_widgets_launchers_popover_button_new (void);
VALA_EXTERN ProtonPlusWidgetsLaunchersPopoverButton* proton_plus_widgets_launchers_popover_button_construct (GType object_type);
static void proton_plus_widgets_launchers_popover_button_list_box_row_activated (ProtonPlusWidgetsLaunchersPopoverButton* self,
                                                                          GtkListBoxRow* row);
static void _proton_plus_widgets_launchers_popover_button_list_box_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                                                      GtkListBoxRow* row,
                                                                                                      gpointer self);
static void proton_plus_widgets_launchers_popover_button_popover_button_clicked (ProtonPlusWidgetsLaunchersPopoverButton* self);
static void _proton_plus_widgets_launchers_popover_button_popover_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                              gpointer self);
VALA_EXTERN GType proton_plus_widgets_launchers_popover_list_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusWidgetsLaunchersPopoverListRow, g_object_unref)
VALA_EXTERN GType proton_plus_models_game_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsGame, g_object_unref)
VALA_EXTERN GType proton_plus_models_simple_runner_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsSimpleRunner, g_object_unref)
VALA_EXTERN GType proton_plus_models_group_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusModelsGroup, g_object_unref)
VALA_EXTERN GType proton_plus_models_launcher_installation_types_get_type (void) G_GNUC_CONST ;
static GVariant* _variant_new2 (gint value);
VALA_EXTERN void proton_plus_widgets_launchers_popover_button_initialize (ProtonPlusWidgetsLaunchersPopoverButton* self,
                                                              GList* launchers);
VALA_EXTERN ProtonPlusWidgetsLaunchersPopoverListRow* proton_plus_widgets_launchers_popover_list_row_new (ProtonPlusModelsLauncher* launcher);
VALA_EXTERN ProtonPlusWidgetsLaunchersPopoverListRow* proton_plus_widgets_launchers_popover_list_row_construct (GType object_type,
                                                                                                    ProtonPlusModelsLauncher* launcher);
static void proton_plus_widgets_launchers_popover_button_finalize (GObject * obj);
static GType proton_plus_widgets_launchers_popover_button_get_type_once (void);

static inline gpointer
proton_plus_widgets_launchers_popover_button_get_instance_private (ProtonPlusWidgetsLaunchersPopoverButton* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusWidgetsLaunchersPopoverButton_private_offset);
}

static void
_proton_plus_widgets_launchers_popover_button_list_box_row_activated_gtk_list_box_row_activated (GtkListBox* _sender,
                                                                                                 GtkListBoxRow* row,
                                                                                                 gpointer self)
{
	proton_plus_widgets_launchers_popover_button_list_box_row_activated ((ProtonPlusWidgetsLaunchersPopoverButton*) self, row);
}

static void
_proton_plus_widgets_launchers_popover_button_popover_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                         gpointer self)
{
	proton_plus_widgets_launchers_popover_button_popover_button_clicked ((ProtonPlusWidgetsLaunchersPopoverButton*) self);
}

ProtonPlusWidgetsLaunchersPopoverButton*
proton_plus_widgets_launchers_popover_button_construct (GType object_type)
{
	ProtonPlusWidgetsLaunchersPopoverButton * self = NULL;
	GtkImage* _tmp0_;
	GtkLabel* _tmp1_;
	GtkBox* _tmp2_;
	GtkBox* _tmp3_;
	GtkImage* _tmp4_;
	GtkBox* _tmp5_;
	GtkLabel* _tmp6_;
	GtkListBox* _tmp7_;
	GtkListBox* _tmp8_;
	GtkListBox* _tmp9_;
	GtkListBox* _tmp10_;
	GtkListBox* _tmp11_;
	GtkListBox* _tmp12_;
	GtkListBox* _tmp13_;
	GtkListBox* _tmp14_;
	GtkPopover* _tmp15_;
	GtkPopover* _tmp16_;
	GtkListBox* _tmp17_;
	GtkPopover* _tmp18_;
	GtkBox* _tmp19_;
	self = (ProtonPlusWidgetsLaunchersPopoverButton*) g_object_new (object_type, NULL);
	_tmp0_ = (GtkImage*) gtk_image_new ();
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->button_image);
	self->priv->button_image = _tmp0_;
	_tmp1_ = (GtkLabel*) gtk_label_new (NULL);
	g_object_ref_sink (_tmp1_);
	_g_object_unref0 (self->priv->button_label);
	self->priv->button_label = _tmp1_;
	_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
	g_object_ref_sink (_tmp2_);
	_g_object_unref0 (self->priv->button_content);
	self->priv->button_content = _tmp2_;
	_tmp3_ = self->priv->button_content;
	_tmp4_ = self->priv->button_image;
	gtk_box_append (_tmp3_, (GtkWidget*) _tmp4_);
	_tmp5_ = self->priv->button_content;
	_tmp6_ = self->priv->button_label;
	gtk_box_append (_tmp5_, (GtkWidget*) _tmp6_);
	_tmp7_ = (GtkListBox*) gtk_list_box_new ();
	g_object_ref_sink (_tmp7_);
	_g_object_unref0 (self->priv->list_box);
	self->priv->list_box = _tmp7_;
	_tmp8_ = self->priv->list_box;
	gtk_list_box_set_activate_on_single_click (_tmp8_, TRUE);
	_tmp9_ = self->priv->list_box;
	gtk_list_box_set_selection_mode (_tmp9_, GTK_SELECTION_SINGLE);
	_tmp10_ = self->priv->list_box;
	gtk_widget_add_css_class ((GtkWidget*) _tmp10_, "navigation-sidebar");
	_tmp11_ = self->priv->list_box;
	gtk_widget_set_hexpand ((GtkWidget*) _tmp11_, TRUE);
	_tmp12_ = self->priv->list_box;
	gtk_widget_set_vexpand ((GtkWidget*) _tmp12_, TRUE);
	_tmp13_ = self->priv->list_box;
	gtk_widget_add_css_class ((GtkWidget*) _tmp13_, "launchers-popover-list");
	_tmp14_ = self->priv->list_box;
	g_signal_connect_object (_tmp14_, "row-activated", (GCallback) _proton_plus_widgets_launchers_popover_button_list_box_row_activated_gtk_list_box_row_activated, self, 0);
	_tmp15_ = (GtkPopover*) gtk_popover_new ();
	g_object_ref_sink (_tmp15_);
	_g_object_unref0 (self->priv->popover);
	self->priv->popover = _tmp15_;
	_tmp16_ = self->priv->popover;
	_tmp17_ = self->priv->list_box;
	gtk_popover_set_child (_tmp16_, (GtkWidget*) _tmp17_);
	_tmp18_ = self->priv->popover;
	gtk_widget_set_parent ((GtkWidget*) _tmp18_, (GtkWidget*) self);
	g_signal_connect_object ((GtkButton*) self, "clicked", (GCallback) _proton_plus_widgets_launchers_popover_button_popover_button_clicked_gtk_button_clicked, self, 0);
	gtk_widget_add_css_class ((GtkWidget*) self, "flat");
	_tmp19_ = self->priv->button_content;
	gtk_button_set_child ((GtkButton*) self, (GtkWidget*) _tmp19_);
	return self;
}

ProtonPlusWidgetsLaunchersPopoverButton*
proton_plus_widgets_launchers_popover_button_new (void)
{
	return proton_plus_widgets_launchers_popover_button_construct (PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_BUTTON);
}

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

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

static GVariant*
_variant_new2 (gint value)
{
	return g_variant_ref_sink (g_variant_new_int32 (value));
}

static void
proton_plus_widgets_launchers_popover_button_list_box_row_activated (ProtonPlusWidgetsLaunchersPopoverButton* self,
                                                                     GtkListBoxRow* row)
{
	gboolean _tmp0_ = FALSE;
	ProtonPlusWidgetsLaunchersPopoverListRow* launchers_popover_list_row = NULL;
	ProtonPlusWidgetsLaunchersPopoverListRow* _tmp1_;
	ProtonPlusModelsLauncher* _tmp2_;
	ProtonPlusWidgetsLaunchersPopoverListRow* _tmp3_;
	ProtonPlusModelsLauncher* _tmp4_;
	ProtonPlusWidgetsLaunchersPopoverListRow* _tmp5_;
	ProtonPlusModelsLauncher* _tmp6_;
	ProtonPlusModelsLauncher* _tmp7_;
	GtkImage* _tmp8_;
	ProtonPlusModelsLauncher* _tmp9_;
	const gchar* _tmp10_;
	GtkLabel* _tmp11_;
	ProtonPlusModelsLauncher* _tmp12_;
	const gchar* _tmp13_;
	GVariant* _tmp14_;
	GtkPopover* _tmp15_;
	g_return_if_fail (self != NULL);
	if (row == NULL) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = G_TYPE_FROM_INSTANCE ((GObject*) row) != PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_LIST_ROW;
	}
	if (_tmp0_) {
		return;
	}
	_tmp1_ = _g_object_ref0 (PROTON_PLUS_WIDGETS_IS_LAUNCHERS_POPOVER_LIST_ROW (row) ? ((ProtonPlusWidgetsLaunchersPopoverListRow*) row) : NULL);
	launchers_popover_list_row = _tmp1_;
	_tmp2_ = self->priv->selected_launcher;
	_tmp3_ = launchers_popover_list_row;
	_tmp4_ = _tmp3_->launcher;
	if (_tmp2_ == _tmp4_) {
		_g_object_unref0 (launchers_popover_list_row);
		return;
	}
	_tmp5_ = launchers_popover_list_row;
	_tmp6_ = _tmp5_->launcher;
	_tmp7_ = _g_object_ref0 (_tmp6_);
	_g_object_unref0 (self->priv->selected_launcher);
	self->priv->selected_launcher = _tmp7_;
	_tmp8_ = self->priv->button_image;
	_tmp9_ = self->priv->selected_launcher;
	_tmp10_ = _tmp9_->icon_path;
	gtk_image_set_from_resource (_tmp8_, _tmp10_);
	_tmp11_ = self->priv->button_label;
	_tmp12_ = self->priv->selected_launcher;
	_tmp13_ = _tmp12_->title;
	gtk_label_set_label (_tmp11_, _tmp13_);
	_tmp14_ = _variant_new2 (gtk_list_box_row_get_index (row));
	gtk_widget_activate_action_variant ((GtkWidget*) self, "win.set-selected-launcher", _tmp14_);
	_g_variant_unref0 (_tmp14_);
	_tmp15_ = self->priv->popover;
	gtk_popover_popdown (_tmp15_);
	_g_object_unref0 (launchers_popover_list_row);
}

void
proton_plus_widgets_launchers_popover_button_initialize (ProtonPlusWidgetsLaunchersPopoverButton* self,
                                                         GList* launchers)
{
	GtkListBox* _tmp0_;
	GtkListBox* _tmp6_;
	GtkListBox* _tmp7_;
	GtkListBoxRow* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->list_box;
	gtk_list_box_remove_all (_tmp0_);
	{
		GList* launcher_collection = NULL;
		GList* launcher_it = NULL;
		launcher_collection = launchers;
		for (launcher_it = launcher_collection; launcher_it != NULL; launcher_it = launcher_it->next) {
			ProtonPlusModelsLauncher* _tmp1_;
			ProtonPlusModelsLauncher* launcher = NULL;
			_tmp1_ = _g_object_ref0 ((ProtonPlusModelsLauncher*) launcher_it->data);
			launcher = _tmp1_;
			{
				ProtonPlusWidgetsLaunchersPopoverListRow* launchers_popover_list_row = NULL;
				ProtonPlusModelsLauncher* _tmp2_;
				ProtonPlusWidgetsLaunchersPopoverListRow* _tmp3_;
				GtkListBox* _tmp4_;
				ProtonPlusWidgetsLaunchersPopoverListRow* _tmp5_;
				_tmp2_ = launcher;
				_tmp3_ = proton_plus_widgets_launchers_popover_list_row_new (_tmp2_);
				g_object_ref_sink (_tmp3_);
				launchers_popover_list_row = _tmp3_;
				_tmp4_ = self->priv->list_box;
				_tmp5_ = launchers_popover_list_row;
				gtk_list_box_append (_tmp4_, (GtkWidget*) _tmp5_);
				_g_object_unref0 (launchers_popover_list_row);
				_g_object_unref0 (launcher);
			}
		}
	}
	_tmp6_ = self->priv->list_box;
	_tmp7_ = self->priv->list_box;
	_tmp8_ = gtk_list_box_get_row_at_index (_tmp7_, 0);
	g_signal_emit_by_name (_tmp6_, "row-activated", _tmp8_);
}

static void
proton_plus_widgets_launchers_popover_button_class_init (ProtonPlusWidgetsLaunchersPopoverButtonClass * klass,
                                                         gpointer klass_data)
{
	proton_plus_widgets_launchers_popover_button_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusWidgetsLaunchersPopoverButton_private_offset);
	G_OBJECT_CLASS (klass)->finalize = proton_plus_widgets_launchers_popover_button_finalize;
}

static void
proton_plus_widgets_launchers_popover_button_instance_init (ProtonPlusWidgetsLaunchersPopoverButton * self,
                                                            gpointer klass)
{
	self->priv = proton_plus_widgets_launchers_popover_button_get_instance_private (self);
}

static void
proton_plus_widgets_launchers_popover_button_finalize (GObject * obj)
{
	ProtonPlusWidgetsLaunchersPopoverButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_TYPE_LAUNCHERS_POPOVER_BUTTON, ProtonPlusWidgetsLaunchersPopoverButton);
	_g_object_unref0 (self->priv->selected_launcher);
	_g_object_unref0 (self->priv->popover);
	_g_object_unref0 (self->priv->button_image);
	_g_object_unref0 (self->priv->button_label);
	_g_object_unref0 (self->priv->button_content);
	_g_object_unref0 (self->priv->list_box);
	G_OBJECT_CLASS (proton_plus_widgets_launchers_popover_button_parent_class)->finalize (obj);
}

static GType
proton_plus_widgets_launchers_popover_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsLaunchersPopoverButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_launchers_popover_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsLaunchersPopoverButton), 0, (GInstanceInitFunc) proton_plus_widgets_launchers_popover_button_instance_init, NULL };
	GType proton_plus_widgets_launchers_popover_button_type_id;
	proton_plus_widgets_launchers_popover_button_type_id = g_type_register_static (gtk_button_get_type (), "ProtonPlusWidgetsLaunchersPopoverButton", &g_define_type_info, 0);
	ProtonPlusWidgetsLaunchersPopoverButton_private_offset = g_type_add_instance_private (proton_plus_widgets_launchers_popover_button_type_id, sizeof (ProtonPlusWidgetsLaunchersPopoverButtonPrivate));
	return proton_plus_widgets_launchers_popover_button_type_id;
}

GType
proton_plus_widgets_launchers_popover_button_get_type (void)
{
	static volatile gsize proton_plus_widgets_launchers_popover_button_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_launchers_popover_button_type_id__once)) {
		GType proton_plus_widgets_launchers_popover_button_type_id;
		proton_plus_widgets_launchers_popover_button_type_id = proton_plus_widgets_launchers_popover_button_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_launchers_popover_button_type_id__once, proton_plus_widgets_launchers_popover_button_type_id);
	}
	return proton_plus_widgets_launchers_popover_button_type_id__once;
}

