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

#include "protonplus_core.h"
#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <glib/gi18n-lib.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_BANNER_0_PROPERTY,
	PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_BANNER_NUM_PROPERTIES
};
static GParamSpec* proton_plus_widgets_main_steam_restart_banner_properties[PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_BANNER_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))
enum  {
	PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_BANNER_RESTART_REQUESTED_SIGNAL,
	PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_BANNER_NUM_SIGNALS
};
static guint proton_plus_widgets_main_steam_restart_banner_signals[PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_BANNER_NUM_SIGNALS] = {0};

struct _ProtonPlusWidgetsMainSteamRestartBannerPrivate {
	AdwBanner* banner;
};

static gint ProtonPlusWidgetsMainSteamRestartBanner_private_offset;
static gpointer proton_plus_widgets_main_steam_restart_banner_parent_class = NULL;

static void __lambda347_ (ProtonPlusWidgetsMainSteamRestartBanner* self);
static void ___lambda347__adw_banner_button_clicked (AdwBanner* _sender,
                                              gpointer self);
static void proton_plus_widgets_main_steam_restart_banner_finalize (GObject * obj);
static GType proton_plus_widgets_main_steam_restart_banner_get_type_once (void);

static inline gpointer
proton_plus_widgets_main_steam_restart_banner_get_instance_private (ProtonPlusWidgetsMainSteamRestartBanner* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusWidgetsMainSteamRestartBanner_private_offset);
}

static void
__lambda347_ (ProtonPlusWidgetsMainSteamRestartBanner* self)
{
	g_signal_emit (self, proton_plus_widgets_main_steam_restart_banner_signals[PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_BANNER_RESTART_REQUESTED_SIGNAL], 0);
}

static void
___lambda347__adw_banner_button_clicked (AdwBanner* _sender,
                                         gpointer self)
{
	__lambda347_ ((ProtonPlusWidgetsMainSteamRestartBanner*) self);
}

ProtonPlusWidgetsMainSteamRestartBanner*
proton_plus_widgets_main_steam_restart_banner_construct (GType object_type)
{
	ProtonPlusWidgetsMainSteamRestartBanner * self = NULL;
	AdwBanner* _tmp0_;
	AdwBanner* _tmp1_;
	AdwBanner* _tmp2_;
	AdwBanner* _tmp3_;
	self = (ProtonPlusWidgetsMainSteamRestartBanner*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, NULL);
	_tmp0_ = (AdwBanner*) adw_banner_new (_ ("Restart Steam to apply changes"));
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->banner);
	self->priv->banner = _tmp0_;
	_tmp1_ = self->priv->banner;
	adw_banner_set_button_label (_tmp1_, _ ("Restart Steam"));
	_tmp2_ = self->priv->banner;
	g_signal_connect_object (_tmp2_, "button-clicked", (GCallback) ___lambda347__adw_banner_button_clicked, self, 0);
	_tmp3_ = self->priv->banner;
	gtk_box_append ((GtkBox*) self, (GtkWidget*) _tmp3_);
	gtk_widget_set_visible ((GtkWidget*) self, FALSE);
	return self;
}

ProtonPlusWidgetsMainSteamRestartBanner*
proton_plus_widgets_main_steam_restart_banner_new (void)
{
	return proton_plus_widgets_main_steam_restart_banner_construct (PROTON_PLUS_WIDGETS_MAIN_TYPE_STEAM_RESTART_BANNER);
}

void
proton_plus_widgets_main_steam_restart_banner_show_pending (ProtonPlusWidgetsMainSteamRestartBanner* self,
                                                            ProtonPlusWidgetsMainSteamRestartBannerState* state)
{
	AdwBanner* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	AdwBanner* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	AdwBanner* _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (state != NULL);
	_tmp0_ = self->priv->banner;
	_tmp1_ = proton_plus_widgets_main_steam_restart_banner_state_get_title (state);
	_tmp2_ = _tmp1_;
	adw_banner_set_title (_tmp0_, _tmp2_);
	_tmp3_ = self->priv->banner;
	adw_banner_set_button_label (_tmp3_, _ ("Restart Steam"));
	_tmp4_ = proton_plus_widgets_main_steam_restart_banner_state_get_visible (state);
	_tmp5_ = _tmp4_;
	gtk_widget_set_visible ((GtkWidget*) self, _tmp5_);
	_tmp6_ = self->priv->banner;
	_tmp7_ = proton_plus_widgets_main_steam_restart_banner_state_get_visible (state);
	_tmp8_ = _tmp7_;
	adw_banner_set_revealed (_tmp6_, _tmp8_);
}

void
proton_plus_widgets_main_steam_restart_banner_show_progress (ProtonPlusWidgetsMainSteamRestartBanner* self,
                                                             ProtonPlusModelsSteamRestartOperationState state)
{
	gchar* title = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	AdwBanner* _tmp2_;
	const gchar* _tmp3_;
	AdwBanner* _tmp4_;
	AdwBanner* _tmp5_;
	g_return_if_fail (self != NULL);
	_tmp0_ = proton_plus_widgets_main_steam_restart_presentation_progress_title (state);
	title = _tmp0_;
	_tmp1_ = title;
	if (g_strcmp0 (_tmp1_, "") == 0) {
		_g_free0 (title);
		return;
	}
	_tmp2_ = self->priv->banner;
	_tmp3_ = title;
	adw_banner_set_title (_tmp2_, _tmp3_);
	_tmp4_ = self->priv->banner;
	adw_banner_set_button_label (_tmp4_, NULL);
	gtk_widget_set_visible ((GtkWidget*) self, TRUE);
	_tmp5_ = self->priv->banner;
	adw_banner_set_revealed (_tmp5_, TRUE);
	_g_free0 (title);
}

static void
proton_plus_widgets_main_steam_restart_banner_class_init (ProtonPlusWidgetsMainSteamRestartBannerClass * klass,
                                                          gpointer klass_data)
{
	proton_plus_widgets_main_steam_restart_banner_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusWidgetsMainSteamRestartBanner_private_offset);
	G_OBJECT_CLASS (klass)->finalize = proton_plus_widgets_main_steam_restart_banner_finalize;
	proton_plus_widgets_main_steam_restart_banner_signals[PROTON_PLUS_WIDGETS_MAIN_STEAM_RESTART_BANNER_RESTART_REQUESTED_SIGNAL] = g_signal_new ("restart-requested", PROTON_PLUS_WIDGETS_MAIN_TYPE_STEAM_RESTART_BANNER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
proton_plus_widgets_main_steam_restart_banner_instance_init (ProtonPlusWidgetsMainSteamRestartBanner * self,
                                                             gpointer klass)
{
	self->priv = proton_plus_widgets_main_steam_restart_banner_get_instance_private (self);
}

static void
proton_plus_widgets_main_steam_restart_banner_finalize (GObject * obj)
{
	ProtonPlusWidgetsMainSteamRestartBanner * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_WIDGETS_MAIN_TYPE_STEAM_RESTART_BANNER, ProtonPlusWidgetsMainSteamRestartBanner);
	_g_object_unref0 (self->priv->banner);
	G_OBJECT_CLASS (proton_plus_widgets_main_steam_restart_banner_parent_class)->finalize (obj);
}

static GType
proton_plus_widgets_main_steam_restart_banner_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusWidgetsMainSteamRestartBannerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_widgets_main_steam_restart_banner_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusWidgetsMainSteamRestartBanner), 0, (GInstanceInitFunc) proton_plus_widgets_main_steam_restart_banner_instance_init, NULL };
	GType proton_plus_widgets_main_steam_restart_banner_type_id;
	proton_plus_widgets_main_steam_restart_banner_type_id = g_type_register_static (gtk_box_get_type (), "ProtonPlusWidgetsMainSteamRestartBanner", &g_define_type_info, 0);
	ProtonPlusWidgetsMainSteamRestartBanner_private_offset = g_type_add_instance_private (proton_plus_widgets_main_steam_restart_banner_type_id, sizeof (ProtonPlusWidgetsMainSteamRestartBannerPrivate));
	return proton_plus_widgets_main_steam_restart_banner_type_id;
}

GType
proton_plus_widgets_main_steam_restart_banner_get_type (void)
{
	static volatile gsize proton_plus_widgets_main_steam_restart_banner_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_widgets_main_steam_restart_banner_type_id__once)) {
		GType proton_plus_widgets_main_steam_restart_banner_type_id;
		proton_plus_widgets_main_steam_restart_banner_type_id = proton_plus_widgets_main_steam_restart_banner_get_type_once ();
		g_once_init_leave (&proton_plus_widgets_main_steam_restart_banner_type_id__once, proton_plus_widgets_main_steam_restart_banner_type_id);
	}
	return proton_plus_widgets_main_steam_restart_banner_type_id__once;
}

