/* preferences-refresh-application-data-row.c generated by valac 0.56.19, the Vala compiler
 * generated from preferences-refresh-application-data-row.vala, do not modify */

#include "protonplus_core.h"
#include <gtk/gtk.h>
#include <adwaita.h>
#include <glib-object.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

enum  {
	PROTON_PLUS_WIDGETS_PREFERENCES_REFRESH_APPLICATION_DATA_ROW_0_PROPERTY,
	PROTON_PLUS_WIDGETS_PREFERENCES_REFRESH_APPLICATION_DATA_ROW_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_preferences_refresh_application_data_row_properties[PROTON_PLUS_WIDGETS_PREFERENCES_REFRESH_APPLICATION_DATA_ROW_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ProtonPlusWidgetsPreferencesRefreshApplicationDataRowPrivate {
	GtkButton* refresh_button;
	AdwSpinner* spinner;
};

static gint ProtonPlusWidgetsPreferencesRefreshApplicationDataRow_private_offset;
static gpointer proton_plus_widgets_preferences_refresh_application_data_row_parent_class = NULL;

static void proton_plus_widgets_preferences_refresh_application_data_row_refresh (ProtonPlusWidgetsPreferencesRefreshApplicationDataRow* self);
static GObject * proton_plus_widgets_preferences_refresh_application_data_row_constructor (GType type,
                                                                                    guint n_construct_properties,
                                                                                    GObjectConstructParam * construct_properties);
static void _proton_plus_widgets_preferences_refresh_application_data_row_refresh_gtk_button_clicked (GtkButton* _sender,
                                                                                               gpointer self);
static void proton_plus_widgets_preferences_refresh_application_data_row_finalize (GObject * obj);
static GType proton_plus_widgets_preferences_refresh_application_data_row_get_type_once (void);

static inline gpointer
proton_plus_widgets_preferences_refresh_application_data_row_get_instance_private (ProtonPlusWidgetsPreferencesRefreshApplicationDataRow* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusWidgetsPreferencesRefreshApplicationDataRow_private_offset);
}

ProtonPlusWidgetsPreferencesRefreshApplicationDataRow*
proton_plus_widgets_preferences_refresh_application_data_row_construct (GType object_type)
{
	ProtonPlusWidgetsPreferencesRefreshApplicationDataRow * self = NULL;
	self = (ProtonPlusWidgetsPreferencesRefreshApplicationDataRow*) g_object_new (object_type, NULL);
	return self;
}

ProtonPlusWidgetsPreferencesRefreshApplicationDataRow*
proton_plus_widgets_preferences_refresh_application_data_row_new (void)
{
	return proton_plus_widgets_preferences_refresh_application_data_row_construct (PROTON_PLUS_WIDGETS_PREFERENCES_TYPE_REFRESH_APPLICATION_DATA_ROW);
}

static void
proton_plus_widgets_preferences_refresh_application_data_row_refresh (ProtonPlusWidgetsPreferencesRefreshApplicationDataRow* self)
{
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	AdwSpinner* _tmp2_;
	AdwSpinner* _tmp3_ = NULL;
	AdwSpinner* _tmp4_;
	GtkButton* _tmp5_ = NULL;
	GtkButton* _tmp6_;
	GtkButton* _tmp7_ = NULL;
	GtkButton* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->refresh_button;
	gtk_widget_set_sensitive ((GtkWidget*) _tmp0_, FALSE);
	_tmp1_ = self->priv->refresh_button;
	_tmp2_ = self->priv->spinner;
	gtk_button_set_child (_tmp1_, (GtkWidget*) _tmp2_);
	gtk_widget_activate_action ((GtkWidget*) self, "app.reload", NULL, NULL);
	_tmp4_ = self->priv->spinner;
	_tmp3_ = _tmp4_;
	if (_tmp3_ != NULL) {
		gtk_widget_unparent ((GtkWidget*) _tmp3_);
	}
	_tmp6_ = self->priv->refresh_button;
	_tmp5_ = _tmp6_;
	if (_tmp5_ != NULL) {
		gtk_button_set_icon_name (_tmp5_, "arrows-rotate-symbolic");
	}
	_tmp8_ = self->priv->refresh_button;
	_tmp7_ = _tmp8_;
	if (_tmp7_ != NULL) {
		gtk_widget_set_sensitive ((GtkWidget*) _tmp7_, TRUE);
	}
}

static void
_proton_plus_widgets_preferences_refresh_application_data_row_refresh_gtk_button_clicked (GtkButton* _sender,
                                                                                          gpointer self)
{
	proton_plus_widgets_preferences_refresh_application_data_row_refresh ((ProtonPlusWidgetsPreferencesRefreshApplicationDataRow*) self);
}

static GObject *
proton_plus_widgets_preferences_refresh_application_data_row_constructor (GType type,
                                                                          guint n_construct_properties,
                                                                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ProtonPlusWidgetsPreferencesRefreshApplicationDataRow * self;
	GtkButton* _tmp0_;
	GtkButton* _tmp1_;
	GtkButton* _tmp2_;
	GtkButton* _tmp3_;
	AdwSpinner* _tmp4_;
	GtkButton* _tmp5_;
	parent_class = G_OBJECT_CLASS (proton_plus_widgets_preferences_refresh_application_data_row_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_PREFERENCES_TYPE_REFRESH_APPLICATION_DATA_ROW, ProtonPlusWidgetsPreferencesRefreshApplicationDataRow);
	_tmp0_ = (GtkButton*) gtk_button_new_from_icon_name ("arrows-rotate-symbolic");
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->refresh_button);
	self->priv->refresh_button = _tmp0_;
	_tmp1_ = self->priv->refresh_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp1_, "flat");
	_tmp2_ = self->priv->refresh_button;
	gtk_widget_set_valign ((GtkWidget*) _tmp2_, GTK_ALIGN_CENTER);
	_tmp3_ = self->priv->refresh_button;
	g_signal_connect_object (_tmp3_, "clicked", (GCallback) _proton_plus_widgets_preferences_refresh_application_data_row_refresh_gtk_button_clicked, self, 0);
	_tmp4_ = (AdwSpinner*) adw_spinner_new ();
	g_object_ref_sink (_tmp4_);
	_g_object_unref0 (self->priv->spinner);
	self->priv->spinner = _tmp4_;
	adw_preferences_row_set_title ((AdwPreferencesRow*) self, _ ("Refresh application data"));
	adw_action_row_set_subtitle ((AdwActionRow*) self, _ ("Refreshes the launchers, tools and games"));
	_tmp5_ = self->priv->refresh_button;
	adw_action_row_add_suffix ((AdwActionRow*) self, (GtkWidget*) _tmp5_);
	return obj;
}

static void
proton_plus_widgets_preferences_refresh_application_data_row_class_init (ProtonPlusWidgetsPreferencesRefreshApplicationDataRowClass * klass,
                                                                         gpointer klass_data)
{
	proton_plus_widgets_preferences_refresh_application_data_row_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusWidgetsPreferencesRefreshApplicationDataRow_private_offset);
	G_OBJECT_CLASS (klass)->constructor = proton_plus_widgets_preferences_refresh_application_data_row_constructor;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_widgets_preferences_refresh_application_data_row_finalize;
}

static void
proton_plus_widgets_preferences_refresh_application_data_row_instance_init (ProtonPlusWidgetsPreferencesRefreshApplicationDataRow * self,
                                                                            gpointer klass)
{
	self->priv = proton_plus_widgets_preferences_refresh_application_data_row_get_instance_private (self);
}

static void
proton_plus_widgets_preferences_refresh_application_data_row_finalize (GObject * obj)
{
	ProtonPlusWidgetsPreferencesRefreshApplicationDataRow * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_PREFERENCES_TYPE_REFRESH_APPLICATION_DATA_ROW, ProtonPlusWidgetsPreferencesRefreshApplicationDataRow);
	_g_object_unref0 (self->priv->refresh_button);
	_g_object_unref0 (self->priv->spinner);
	G_OBJECT_CLASS (proton_plus_widgets_preferences_refresh_application_data_row_parent_class)->finalize (obj);
}

static GType
proton_plus_widgets_preferences_refresh_application_data_row_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsPreferencesRefreshApplicationDataRowClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_preferences_refresh_application_data_row_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsPreferencesRefreshApplicationDataRow), 0, (GInstanceInitFunc) proton_plus_widgets_preferences_refresh_application_data_row_instance_init, NULL };
	GType proton_plus_widgets_preferences_refresh_application_data_row_type_id;
	proton_plus_widgets_preferences_refresh_application_data_row_type_id = g_type_register_static (adw_action_row_get_type (), "ProtonPlusWidgetsPreferencesRefreshApplicationDataRow", &g_define_type_info, 0);
	ProtonPlusWidgetsPreferencesRefreshApplicationDataRow_private_offset = g_type_add_instance_private (proton_plus_widgets_preferences_refresh_application_data_row_type_id, sizeof (ProtonPlusWidgetsPreferencesRefreshApplicationDataRowPrivate));
	return proton_plus_widgets_preferences_refresh_application_data_row_type_id;
}

GType
proton_plus_widgets_preferences_refresh_application_data_row_get_type (void)
{
	static volatile gsize proton_plus_widgets_preferences_refresh_application_data_row_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_preferences_refresh_application_data_row_type_id__once)) {
		GType proton_plus_widgets_preferences_refresh_application_data_row_type_id;
		proton_plus_widgets_preferences_refresh_application_data_row_type_id = proton_plus_widgets_preferences_refresh_application_data_row_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_preferences_refresh_application_data_row_type_id__once, proton_plus_widgets_preferences_refresh_application_data_row_type_id);
	}
	return proton_plus_widgets_preferences_refresh_application_data_row_type_id__once;
}

