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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <adwaita.h>
#include <glib.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
#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_UNSELECT_BUTTON (proton_plus_widgets_unselect_button_get_type ())
#define PROTON_PLUS_WIDGETS_UNSELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_WIDGETS_TYPE_UNSELECT_BUTTON, ProtonPlusWidgetsUnselectButton))
#define PROTON_PLUS_WIDGETS_UNSELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_WIDGETS_TYPE_UNSELECT_BUTTON, ProtonPlusWidgetsUnselectButtonClass))
#define PROTON_PLUS_WIDGETS_IS_UNSELECT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_WIDGETS_TYPE_UNSELECT_BUTTON))
#define PROTON_PLUS_WIDGETS_IS_UNSELECT_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_WIDGETS_TYPE_UNSELECT_BUTTON))
#define PROTON_PLUS_WIDGETS_UNSELECT_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_WIDGETS_TYPE_UNSELECT_BUTTON, ProtonPlusWidgetsUnselectButtonClass))

typedef struct _ProtonPlusWidgetsUnselectButton ProtonPlusWidgetsUnselectButton;
typedef struct _ProtonPlusWidgetsUnselectButtonClass ProtonPlusWidgetsUnselectButtonClass;
typedef struct _ProtonPlusWidgetsUnselectButtonPrivate ProtonPlusWidgetsUnselectButtonPrivate;
enum  {
	PROTON_PLUS_WIDGETS_UNSELECT_BUTTON_0_PROPERTY,
	PROTON_PLUS_WIDGETS_UNSELECT_BUTTON_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_unselect_button_properties[PROTON_PLUS_WIDGETS_UNSELECT_BUTTON_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define PROTON_PLUS_WIDGETS_TYPE_GAME_ROW (proton_plus_widgets_game_row_get_type ())
#define PROTON_PLUS_WIDGETS_GAME_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_WIDGETS_TYPE_GAME_ROW, ProtonPlusWidgetsGameRow))
#define PROTON_PLUS_WIDGETS_GAME_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_WIDGETS_TYPE_GAME_ROW, ProtonPlusWidgetsGameRowClass))
#define PROTON_PLUS_WIDGETS_IS_GAME_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_WIDGETS_TYPE_GAME_ROW))
#define PROTON_PLUS_WIDGETS_IS_GAME_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_WIDGETS_TYPE_GAME_ROW))
#define PROTON_PLUS_WIDGETS_GAME_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_WIDGETS_TYPE_GAME_ROW, ProtonPlusWidgetsGameRowClass))

typedef struct _ProtonPlusWidgetsGameRow ProtonPlusWidgetsGameRow;
typedef struct _ProtonPlusWidgetsGameRowClass ProtonPlusWidgetsGameRowClass;

struct _ProtonPlusWidgetsUnselectButton {
	GtkButton parent_instance;
	ProtonPlusWidgetsUnselectButtonPrivate * priv;
};

struct _ProtonPlusWidgetsUnselectButtonClass {
	GtkButtonClass parent_class;
};

struct _ProtonPlusWidgetsUnselectButtonPrivate {
	GtkListBox* _game_list_box;
	AdwButtonContent* _selection_button_content;
};

static gint ProtonPlusWidgetsUnselectButton_private_offset;
static gpointer proton_plus_widgets_unselect_button_parent_class = NULL;

VALA_EXTERN GType proton_plus_widgets_unselect_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusWidgetsUnselectButton, g_object_unref)
VALA_EXTERN ProtonPlusWidgetsUnselectButton* proton_plus_widgets_unselect_button_new (GtkListBox* game_list_box);
VALA_EXTERN ProtonPlusWidgetsUnselectButton* proton_plus_widgets_unselect_button_construct (GType object_type,
                                                                                GtkListBox* game_list_box);
static void proton_plus_widgets_unselect_button_set_game_list_box (ProtonPlusWidgetsUnselectButton* self,
                                                            GtkListBox* value);
static void proton_plus_widgets_unselect_button_unselect_button_clicked (ProtonPlusWidgetsUnselectButton* self);
static GtkListBox* proton_plus_widgets_unselect_button_get_game_list_box (ProtonPlusWidgetsUnselectButton* self);
VALA_EXTERN GType proton_plus_widgets_game_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusWidgetsGameRow, g_object_unref)
VALA_EXTERN void proton_plus_widgets_game_row_set_selected (ProtonPlusWidgetsGameRow* self,
                                                gboolean value);
static AdwButtonContent* proton_plus_widgets_unselect_button_get_selection_button_content (ProtonPlusWidgetsUnselectButton* self);
static void proton_plus_widgets_unselect_button_set_selection_button_content (ProtonPlusWidgetsUnselectButton* self,
                                                                       AdwButtonContent* value);
static GObject * proton_plus_widgets_unselect_button_constructor (GType type,
                                                           guint n_construct_properties,
                                                           GObjectConstructParam * construct_properties);
static void _proton_plus_widgets_unselect_button_unselect_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                      gpointer self);
static void proton_plus_widgets_unselect_button_finalize (GObject * obj);
static GType proton_plus_widgets_unselect_button_get_type_once (void);
static void _vala_proton_plus_widgets_unselect_button_get_property (GObject * object,
                                                             guint property_id,
                                                             GValue * value,
                                                             GParamSpec * pspec);
static void _vala_proton_plus_widgets_unselect_button_set_property (GObject * object,
                                                             guint property_id,
                                                             const GValue * value,
                                                             GParamSpec * pspec);

static inline gpointer
proton_plus_widgets_unselect_button_get_instance_private (ProtonPlusWidgetsUnselectButton* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusWidgetsUnselectButton_private_offset);
}

ProtonPlusWidgetsUnselectButton*
proton_plus_widgets_unselect_button_construct (GType object_type,
                                               GtkListBox* game_list_box)
{
	ProtonPlusWidgetsUnselectButton * self = NULL;
	g_return_val_if_fail (game_list_box != NULL, NULL);
	self = (ProtonPlusWidgetsUnselectButton*) g_object_new (object_type, NULL);
	proton_plus_widgets_unselect_button_set_game_list_box (self, game_list_box);
	return self;
}

ProtonPlusWidgetsUnselectButton*
proton_plus_widgets_unselect_button_new (GtkListBox* game_list_box)
{
	return proton_plus_widgets_unselect_button_construct (PROTON_PLUS_WIDGETS_TYPE_UNSELECT_BUTTON, game_list_box);
}

static void
proton_plus_widgets_unselect_button_unselect_button_clicked (ProtonPlusWidgetsUnselectButton* self)
{
	GtkListBox* _tmp0_;
	GList* _tmp1_;
	GtkListBox* _tmp4_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_game_list_box;
	_tmp1_ = gtk_list_box_get_selected_rows (_tmp0_);
	{
		GList* row_collection = NULL;
		GList* row_it = NULL;
		row_collection = _tmp1_;
		for (row_it = row_collection; row_it != NULL; row_it = row_it->next) {
			GtkListBoxRow* row = NULL;
			row = (GtkListBoxRow*) row_it->data;
			{
				GtkListBoxRow* _tmp2_;
				_tmp2_ = row;
				if (PROTON_PLUS_WIDGETS_IS_GAME_ROW (_tmp2_)) {
					GtkListBoxRow* _tmp3_;
					_tmp3_ = row;
					proton_plus_widgets_game_row_set_selected (G_TYPE_CHECK_INSTANCE_CAST (_tmp3_, PROTON_PLUS_WIDGETS_TYPE_GAME_ROW, ProtonPlusWidgetsGameRow), FALSE);
				}
			}
		}
		(row_collection == NULL) ? NULL : (row_collection = (g_list_free (row_collection), NULL));
	}
	_tmp4_ = self->priv->_game_list_box;
	gtk_list_box_unselect_all (_tmp4_);
}

static GtkListBox*
proton_plus_widgets_unselect_button_get_game_list_box (ProtonPlusWidgetsUnselectButton* self)
{
	GtkListBox* result;
	GtkListBox* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_game_list_box;
	result = _tmp0_;
	return result;
}

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

static void
proton_plus_widgets_unselect_button_set_game_list_box (ProtonPlusWidgetsUnselectButton* self,
                                                       GtkListBox* value)
{
	GtkListBox* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_game_list_box);
	self->priv->_game_list_box = _tmp0_;
}

static AdwButtonContent*
proton_plus_widgets_unselect_button_get_selection_button_content (ProtonPlusWidgetsUnselectButton* self)
{
	AdwButtonContent* result;
	AdwButtonContent* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_selection_button_content;
	result = _tmp0_;
	return result;
}

static void
proton_plus_widgets_unselect_button_set_selection_button_content (ProtonPlusWidgetsUnselectButton* self,
                                                                  AdwButtonContent* value)
{
	AdwButtonContent* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_selection_button_content);
	self->priv->_selection_button_content = _tmp0_;
}

static void
_proton_plus_widgets_unselect_button_unselect_button_clicked_gtk_button_clicked (GtkButton* _sender,
                                                                                 gpointer self)
{
	proton_plus_widgets_unselect_button_unselect_button_clicked ((ProtonPlusWidgetsUnselectButton*) self);
}

static GObject *
proton_plus_widgets_unselect_button_constructor (GType type,
                                                 guint n_construct_properties,
                                                 GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ProtonPlusWidgetsUnselectButton * self;
	AdwButtonContent* _tmp0_;
	AdwButtonContent* _tmp1_;
	AdwButtonContent* _tmp2_;
	AdwButtonContent* _tmp3_;
	AdwButtonContent* _tmp4_;
	parent_class = G_OBJECT_CLASS (proton_plus_widgets_unselect_button_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_TYPE_UNSELECT_BUTTON, ProtonPlusWidgetsUnselectButton);
	_tmp0_ = (AdwButtonContent*) adw_button_content_new ();
	g_object_ref_sink (_tmp0_);
	_tmp1_ = _tmp0_;
	proton_plus_widgets_unselect_button_set_selection_button_content (self, _tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = self->priv->_selection_button_content;
	adw_button_content_set_label (_tmp2_, _ ("Unselect all"));
	_tmp3_ = self->priv->_selection_button_content;
	adw_button_content_set_icon_name (_tmp3_, "square-uncheck-symbolic");
	gtk_widget_set_tooltip_text ((GtkWidget*) self, _ ("Unselect all the games"));
	gtk_widget_add_css_class ((GtkWidget*) self, "flat");
	_tmp4_ = self->priv->_selection_button_content;
	gtk_button_set_child ((GtkButton*) self, (GtkWidget*) _tmp4_);
	g_signal_connect_object ((GtkButton*) self, "clicked", (GCallback) _proton_plus_widgets_unselect_button_unselect_button_clicked_gtk_button_clicked, self, 0);
	return obj;
}

static void
proton_plus_widgets_unselect_button_class_init (ProtonPlusWidgetsUnselectButtonClass * klass,
                                                gpointer klass_data)
{
	proton_plus_widgets_unselect_button_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusWidgetsUnselectButton_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_widgets_unselect_button_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_widgets_unselect_button_set_property;
	G_OBJECT_CLASS (klass)->constructor = proton_plus_widgets_unselect_button_constructor;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_widgets_unselect_button_finalize;
}

static void
proton_plus_widgets_unselect_button_instance_init (ProtonPlusWidgetsUnselectButton * self,
                                                   gpointer klass)
{
	self->priv = proton_plus_widgets_unselect_button_get_instance_private (self);
}

static void
proton_plus_widgets_unselect_button_finalize (GObject * obj)
{
	ProtonPlusWidgetsUnselectButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_TYPE_UNSELECT_BUTTON, ProtonPlusWidgetsUnselectButton);
	_g_object_unref0 (self->priv->_game_list_box);
	_g_object_unref0 (self->priv->_selection_button_content);
	G_OBJECT_CLASS (proton_plus_widgets_unselect_button_parent_class)->finalize (obj);
}

static GType
proton_plus_widgets_unselect_button_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsUnselectButtonClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_unselect_button_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsUnselectButton), 0, (GInstanceInitFunc) proton_plus_widgets_unselect_button_instance_init, NULL };
	GType proton_plus_widgets_unselect_button_type_id;
	proton_plus_widgets_unselect_button_type_id = g_type_register_static (gtk_button_get_type (), "ProtonPlusWidgetsUnselectButton", &g_define_type_info, 0);
	ProtonPlusWidgetsUnselectButton_private_offset = g_type_add_instance_private (proton_plus_widgets_unselect_button_type_id, sizeof (ProtonPlusWidgetsUnselectButtonPrivate));
	return proton_plus_widgets_unselect_button_type_id;
}

GType
proton_plus_widgets_unselect_button_get_type (void)
{
	static volatile gsize proton_plus_widgets_unselect_button_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_unselect_button_type_id__once)) {
		GType proton_plus_widgets_unselect_button_type_id;
		proton_plus_widgets_unselect_button_type_id = proton_plus_widgets_unselect_button_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_unselect_button_type_id__once, proton_plus_widgets_unselect_button_type_id);
	}
	return proton_plus_widgets_unselect_button_type_id__once;
}

static void
_vala_proton_plus_widgets_unselect_button_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec)
{
	ProtonPlusWidgetsUnselectButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_WIDGETS_TYPE_UNSELECT_BUTTON, ProtonPlusWidgetsUnselectButton);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_widgets_unselect_button_set_property (GObject * object,
                                                        guint property_id,
                                                        const GValue * value,
                                                        GParamSpec * pspec)
{
	ProtonPlusWidgetsUnselectButton * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_WIDGETS_TYPE_UNSELECT_BUTTON, ProtonPlusWidgetsUnselectButton);
	switch (property_id) {
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

