/* steam-restart-dialog.c generated by valac 0.56.19, the Vala compiler
 * generated from steam-restart-dialog.vala, do not modify */

#include "protonplus_core.h"
#include <glib-object.h>
#include <gee.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <float.h>
#include <math.h>
#include <adwaita.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_MAIN_STEAM_RESTART_REVIEW_DIALOG_0_PROPERTY,
	PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_REVIEW_DIALOG_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_main_steam_restart_review_dialog_properties[PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_REVIEW_DIALOG_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block16Data Block16Data;
#define _g_free0(var) (var = (g_free (var), NULL))
enum  {
	PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_REVIEW_DIALOG_RESTART_REQUESTED_SIGNAL,
	PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_REVIEW_DIALOG_NUM_SIGNALS
};
static guint proton_plus_widgets_main_steam_restart_review_dialog_signals[PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_REVIEW_DIALOG_NUM_SIGNALS] = {0};

struct _Block16Data {
	int _ref_count_;
	ProtonPlusWidgetsMainSteamRestartReviewDialog* self;
	ProtonPlusWidgetsMainSteamRestartTargetSummary* summary;
};

static gpointer proton_plus_widgets_main_steam_restart_review_dialog_parent_class = NULL;

static Block16Data* block16_data_ref (Block16Data* _data16_);
static void block16_data_unref (void * _userdata_);
static void ____lambda354_ (Block16Data* _data16_);
static void _____lambda354__gtk_button_clicked (GtkButton* _sender,
                                         gpointer self);
static void __lambda355_ (ProtonPlusWidgetsMainSteamRestartReviewDialog* self);
static void ___lambda355__gtk_button_clicked (GtkButton* _sender,
                                       gpointer self);
static GType proton_plus_widgets_main_steam_restart_review_dialog_get_type_once (void);

static Block16Data*
block16_data_ref (Block16Data* _data16_)
{
	g_atomic_int_inc (&_data16_->_ref_count_);
	return _data16_;
}

static void
block16_data_unref (void * _userdata_)
{
	Block16Data* _data16_;
	_data16_ = (Block16Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data16_->_ref_count_)) {
		ProtonPlusWidgetsMainSteamRestartReviewDialog* self;
		self = _data16_->self;
		_g_object_unref0 (_data16_->summary);
		_g_object_unref0 (self);
		g_slice_free (Block16Data, _data16_);
	}
}

static void
____lambda354_ (Block16Data* _data16_)
{
	ProtonPlusWidgetsMainSteamRestartReviewDialog* self;
	ProtonPlusWidgetsMainSteamRestartTargetSummary* _tmp0_;
	ProtonPlusModelsSteamRestartTarget* _tmp1_;
	ProtonPlusModelsSteamRestartTarget* _tmp2_;
	self = _data16_->self;
	_tmp0_ = _data16_->summary;
	_tmp1_ = proton_plus_widgets_main_steam_restart_target_summary_get_target (_tmp0_);
	_tmp2_ = _tmp1_;
	g_signal_emit (self, proton_plus_widgets_main_steam_restart_review_dialog_signals[PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_REVIEW_DIALOG_RESTART_REQUESTED_SIGNAL], 0, _tmp2_);
}

static void
_____lambda354__gtk_button_clicked (GtkButton* _sender,
                                    gpointer self)
{
	____lambda354_ (self);
}

static void
__lambda355_ (ProtonPlusWidgetsMainSteamRestartReviewDialog* self)
{
	adw_dialog_close ((AdwDialog*) self);
}

static void
___lambda355__gtk_button_clicked (GtkButton* _sender,
                                  gpointer self)
{
	__lambda355_ ((ProtonPlusWidgetsMainSteamRestartReviewDialog*) self);
}

ProtonPlusWidgetsMainSteamRestartReviewDialog*
proton_plus_widgets_main_steam_restart_review_dialog_construct (GType object_type,
                                                                GeeList* targets)
{
	ProtonPlusWidgetsMainSteamRestartReviewDialog * self = NULL;
	GtkBox* content = NULL;
	GtkBox* _tmp0_ = NULL;
	GtkBox* _tmp1_;
	GtkLabel* _tmp2_ = NULL;
	GtkLabel* _tmp3_;
	AdwPreferencesGroup* group = NULL;
	AdwPreferencesGroup* _tmp4_;
	GtkBox* _tmp33_;
	AdwPreferencesGroup* _tmp34_;
	GtkButton* later = NULL;
	GtkButton* _tmp35_ = NULL;
	GtkBox* _tmp36_;
	GtkBox* _tmp37_;
	g_return_val_if_fail (targets != NULL, NULL);
	self = (ProtonPlusWidgetsMainSteamRestartReviewDialog*) g_object_new (object_type, "title", _ ("Restart Steam?"), NULL);
	_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
	gtk_widget_set_margin_top ((GtkWidget*) _tmp0_, 24);
	gtk_widget_set_margin_bottom ((GtkWidget*) _tmp0_, 24);
	gtk_widget_set_margin_start ((GtkWidget*) _tmp0_, 24);
	gtk_widget_set_margin_end ((GtkWidget*) _tmp0_, 24);
	g_object_ref_sink (_tmp0_);
	content = _tmp0_;
	_tmp1_ = content;
	_tmp2_ = (GtkLabel*) gtk_label_new (_ ("Each Steam installation must be restarted separately. Save your progre" \
"ss and close any running games before continuing. In SteamOS Gaming Mo" \
"de, Steam, running games, and ProtonPlus will close while Steam restar" \
"ts."));
	gtk_label_set_wrap (_tmp2_, TRUE);
	gtk_label_set_xalign (_tmp2_, (gfloat) 0);
	g_object_ref_sink (_tmp2_);
	_tmp3_ = _tmp2_;
	gtk_box_append (_tmp1_, (GtkWidget*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = (AdwPreferencesGroup*) adw_preferences_group_new ();
	g_object_ref_sink (_tmp4_);
	group = _tmp4_;
	{
		GeeList* _summary_list = NULL;
		gint _summary_size = 0;
		GeeList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _summary_index = 0;
		_summary_list = targets;
		_tmp5_ = _summary_list;
		_tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_summary_size = _tmp7_;
		_summary_index = -1;
		while (TRUE) {
			Block16Data* _data16_;
			gint _tmp8_;
			gint _tmp9_;
			GeeList* _tmp10_;
			gpointer _tmp11_;
			AdwActionRow* row = NULL;
			ProtonPlusWidgetsMainSteamRestartTargetSummary* _tmp12_;
			ProtonPlusModelsSteamRestartTarget* _tmp13_;
			ProtonPlusModelsSteamRestartTarget* _tmp14_;
			const gchar* _tmp15_;
			const gchar* _tmp16_;
			gchar* _tmp17_;
			ProtonPlusWidgetsMainSteamRestartTargetSummary* _tmp18_;
			guint _tmp19_;
			guint _tmp20_;
			ProtonPlusWidgetsMainSteamRestartTargetSummary* _tmp21_;
			guint _tmp22_;
			guint _tmp23_;
			gchar* _tmp24_;
			AdwActionRow* _tmp25_ = NULL;
			GtkButton* button = NULL;
			GtkButton* _tmp26_;
			GtkButton* _tmp27_;
			GtkButton* _tmp28_;
			AdwActionRow* _tmp29_;
			GtkButton* _tmp30_;
			AdwPreferencesGroup* _tmp31_;
			AdwActionRow* _tmp32_;
			_data16_ = g_slice_new0 (Block16Data);
			_data16_->_ref_count_ = 1;
			_data16_->self = g_object_ref (self);
			_summary_index = _summary_index + 1;
			_tmp8_ = _summary_index;
			_tmp9_ = _summary_size;
			if (!(_tmp8_ < _tmp9_)) {
				block16_data_unref (_data16_);
				_data16_ = NULL;
				break;
			}
			_tmp10_ = _summary_list;
			_tmp11_ = gee_list_get (_tmp10_, _summary_index);
			_data16_->summary = (ProtonPlusWidgetsMainSteamRestartTargetSummary*) _tmp11_;
			_tmp12_ = _data16_->summary;
			_tmp13_ = proton_plus_widgets_main_steam_restart_target_summary_get_target (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = proton_plus_models_steam_restart_target_get_display_name (_tmp14_);
			_tmp16_ = _tmp15_;
			_tmp17_ = g_strdup (_tmp16_);
			_tmp18_ = _data16_->summary;
			_tmp19_ = proton_plus_widgets_main_steam_restart_target_summary_get_pending_count (_tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = _data16_->summary;
			_tmp22_ = proton_plus_widgets_main_steam_restart_target_summary_get_pending_count (_tmp21_);
			_tmp23_ = _tmp22_;
			_tmp24_ = g_strdup_printf (ngettext ("%u pending change", "%u pending changes", (gulong) _tmp20_), _tmp23_);
			_tmp25_ = (AdwActionRow*) adw_action_row_new ();
			adw_preferences_row_set_title ((AdwPreferencesRow*) _tmp25_, _tmp17_);
			_g_free0 (_tmp17_);
			adw_action_row_set_subtitle (_tmp25_, _tmp24_);
			_g_free0 (_tmp24_);
			g_object_ref_sink (_tmp25_);
			row = _tmp25_;
			_tmp26_ = (GtkButton*) gtk_button_new_with_label (_ ("Restart"));
			g_object_ref_sink (_tmp26_);
			button = _tmp26_;
			_tmp27_ = button;
			gtk_widget_add_css_class ((GtkWidget*) _tmp27_, "suggested-action");
			_tmp28_ = button;
			g_signal_connect_data (_tmp28_, "clicked", (GCallback) _____lambda354__gtk_button_clicked, block16_data_ref (_data16_), (GClosureNotify) block16_data_unref, 0);
			_tmp29_ = row;
			_tmp30_ = button;
			adw_action_row_add_suffix (_tmp29_, (GtkWidget*) _tmp30_);
			_tmp31_ = group;
			_tmp32_ = row;
			adw_preferences_group_add (_tmp31_, (GtkWidget*) _tmp32_);
			_g_object_unref0 (button);
			_g_object_unref0 (row);
			block16_data_unref (_data16_);
			_data16_ = NULL;
		}
	}
	_tmp33_ = content;
	_tmp34_ = group;
	gtk_box_append (_tmp33_, (GtkWidget*) _tmp34_);
	_tmp35_ = (GtkButton*) gtk_button_new_with_label (_ ("Later"));
	gtk_widget_set_halign ((GtkWidget*) _tmp35_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp35_);
	later = _tmp35_;
	g_signal_connect_object (later, "clicked", (GCallback) ___lambda355__gtk_button_clicked, self, 0);
	_tmp36_ = content;
	gtk_box_append (_tmp36_, (GtkWidget*) later);
	adw_dialog_set_default_widget ((AdwDialog*) self, (GtkWidget*) later);
	_tmp37_ = content;
	adw_dialog_set_child ((AdwDialog*) self, (GtkWidget*) _tmp37_);
	_g_object_unref0 (later);
	_g_object_unref0 (group);
	_g_object_unref0 (content);
	return self;
}

ProtonPlusWidgetsMainSteamRestartReviewDialog*
proton_plus_widgets_main_steam_restart_review_dialog_new (GeeList* targets)
{
	return proton_plus_widgets_main_steam_restart_review_dialog_construct (PROTON_PLUS_WIDGETS_MAIN_TYPE_STEAM_RESTART_REVIEW_DIALOG, targets);
}

static void
proton_plus_widgets_main_steam_restart_review_dialog_class_init (ProtonPlusWidgetsMainSteamRestartReviewDialogClass * klass,
                                                                 gpointer klass_data)
{
	proton_plus_widgets_main_steam_restart_review_dialog_parent_class = g_type_class_peek_parent (klass);
	proton_plus_widgets_main_steam_restart_review_dialog_signals[PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_REVIEW_DIALOG_RESTART_REQUESTED_SIGNAL] = g_signal_new ("restart-requested", PROTON_PLUS_WIDGETS_MAIN_TYPE_STEAM_RESTART_REVIEW_DIALOG, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, PROTON_PLUS_MODELS_TYPE_STEAM_RESTART_TARGET);
}

static void
proton_plus_widgets_main_steam_restart_review_dialog_instance_init (ProtonPlusWidgetsMainSteamRestartReviewDialog * self,
                                                                    gpointer klass)
{
}

static GType
proton_plus_widgets_main_steam_restart_review_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsMainSteamRestartReviewDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_main_steam_restart_review_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsMainSteamRestartReviewDialog), 0, (GInstanceInitFunc) proton_plus_widgets_main_steam_restart_review_dialog_instance_init, NULL };
	GType proton_plus_widgets_main_steam_restart_review_dialog_type_id;
	proton_plus_widgets_main_steam_restart_review_dialog_type_id = g_type_register_static (adw_dialog_get_type (), "ProtonPlusWidgetsMainSteamRestartReviewDialog", &g_define_type_info, 0);
	return proton_plus_widgets_main_steam_restart_review_dialog_type_id;
}

GType
proton_plus_widgets_main_steam_restart_review_dialog_get_type (void)
{
	static volatile gsize proton_plus_widgets_main_steam_restart_review_dialog_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_main_steam_restart_review_dialog_type_id__once)) {
		GType proton_plus_widgets_main_steam_restart_review_dialog_type_id;
		proton_plus_widgets_main_steam_restart_review_dialog_type_id = proton_plus_widgets_main_steam_restart_review_dialog_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_main_steam_restart_review_dialog_type_id__once, proton_plus_widgets_main_steam_restart_review_dialog_type_id);
	}
	return proton_plus_widgets_main_steam_restart_review_dialog_type_id__once;
}

