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

/*
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: 2026 elementary, Inc. (https://elementary.io)
 */

#include <granite-7.h>
#include <pantheon-wayland.h>
#include <glib-object.h>
#include <gcr/gcr.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <gdk/gdk.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 AG_TYPE_GCR_CONFIRM_DIALOG (ag_gcr_confirm_dialog_get_type ())
#define AG_GCR_CONFIRM_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AG_TYPE_GCR_CONFIRM_DIALOG, AgGcrConfirmDialog))
#define AG_GCR_CONFIRM_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AG_TYPE_GCR_CONFIRM_DIALOG, AgGcrConfirmDialogClass))
#define AG_IS_GCR_CONFIRM_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AG_TYPE_GCR_CONFIRM_DIALOG))
#define AG_IS_GCR_CONFIRM_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AG_TYPE_GCR_CONFIRM_DIALOG))
#define AG_GCR_CONFIRM_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AG_TYPE_GCR_CONFIRM_DIALOG, AgGcrConfirmDialogClass))

typedef struct _AgGcrConfirmDialog AgGcrConfirmDialog;
typedef struct _AgGcrConfirmDialogClass AgGcrConfirmDialogClass;
typedef struct _AgGcrConfirmDialogPrivate AgGcrConfirmDialogPrivate;
enum  {
	AG_GCR_CONFIRM_DIALOG_0_PROPERTY,
	AG_GCR_CONFIRM_DIALOG_PROMPT_PROPERTY,
	AG_GCR_CONFIRM_DIALOG_NUM_PROPERTIES
};
static GParamSpec* ag_gcr_confirm_dialog_properties[AG_GCR_CONFIRM_DIALOG_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))

struct _AgGcrConfirmDialog {
	GraniteMessageDialog parent_instance;
	AgGcrConfirmDialogPrivate * priv;
};

struct _AgGcrConfirmDialogClass {
	GraniteMessageDialogClass parent_class;
};

struct _AgGcrConfirmDialogPrivate {
	GcrPrompt* _prompt;
};

static gint AgGcrConfirmDialog_private_offset;
static gpointer ag_gcr_confirm_dialog_parent_class = NULL;
static PantheonWaylandExtendedBehaviorIface * ag_gcr_confirm_dialog_pantheon_wayland_extended_behavior_parent_iface = NULL;

VALA_EXTERN GType ag_gcr_confirm_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AgGcrConfirmDialog, g_object_unref)
VALA_EXTERN AgGcrConfirmDialog* ag_gcr_confirm_dialog_new (GcrPrompt* prompt);
VALA_EXTERN AgGcrConfirmDialog* ag_gcr_confirm_dialog_construct (GType object_type,
                                                     GcrPrompt* prompt);
static GcrPrompt* ag_gcr_confirm_dialog_get_prompt (AgGcrConfirmDialog* self);
static void ag_gcr_confirm_dialog_set_prompt (AgGcrConfirmDialog* self,
                                       GcrPrompt* value);
static GObject * ag_gcr_confirm_dialog_constructor (GType type,
                                             guint n_construct_properties,
                                             GObjectConstructParam * construct_properties);
static void _ag_gcr_confirm_dialog___lambda4_ (AgGcrConfirmDialog* self);
static void __ag_gcr_confirm_dialog___lambda4__gtk_widget_realize (GtkWidget* _sender,
                                                            gpointer self);
static void ag_gcr_confirm_dialog_finalize (GObject * obj);
static GType ag_gcr_confirm_dialog_get_type_once (void);
static void _vala_ag_gcr_confirm_dialog_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_ag_gcr_confirm_dialog_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);

static inline gpointer
ag_gcr_confirm_dialog_get_instance_private (AgGcrConfirmDialog* self)
{
	return G_STRUCT_MEMBER_P (self, AgGcrConfirmDialog_private_offset);
}

AgGcrConfirmDialog*
ag_gcr_confirm_dialog_construct (GType object_type,
                                 GcrPrompt* prompt)
{
	AgGcrConfirmDialog * self = NULL;
	g_return_val_if_fail (prompt != NULL, NULL);
	self = (AgGcrConfirmDialog*) g_object_new (object_type, "prompt", prompt, NULL);
	return self;
}

AgGcrConfirmDialog*
ag_gcr_confirm_dialog_new (GcrPrompt* prompt)
{
	return ag_gcr_confirm_dialog_construct (AG_TYPE_GCR_CONFIRM_DIALOG, prompt);
}

static GcrPrompt*
ag_gcr_confirm_dialog_get_prompt (AgGcrConfirmDialog* self)
{
	GcrPrompt* result;
	GcrPrompt* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_prompt;
	result = _tmp0_;
	return result;
}

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

static void
ag_gcr_confirm_dialog_set_prompt (AgGcrConfirmDialog* self,
                                  GcrPrompt* value)
{
	GcrPrompt* old_value;
	g_return_if_fail (self != NULL);
	old_value = ag_gcr_confirm_dialog_get_prompt (self);
	if (old_value != value) {
		GcrPrompt* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_prompt);
		self->priv->_prompt = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, ag_gcr_confirm_dialog_properties[AG_GCR_CONFIRM_DIALOG_PROMPT_PROPERTY]);
	}
}

static void
_ag_gcr_confirm_dialog___lambda4_ (AgGcrConfirmDialog* self)
{
	GdkSurface* surface = NULL;
	GdkSurface* _tmp0_;
	GdkSurface* _tmp1_;
	pantheon_wayland_extended_behavior_connect_to_shell ((PantheonWaylandExtendedBehavior*) self);
	pantheon_wayland_extended_behavior_set_keep_above ((PantheonWaylandExtendedBehavior*) self);
	pantheon_wayland_extended_behavior_make_centered ((PantheonWaylandExtendedBehavior*) self);
	pantheon_wayland_extended_behavior_make_modal ((PantheonWaylandExtendedBehavior*) self, TRUE);
	_tmp0_ = gtk_native_get_surface ((GtkNative*) self);
	surface = _tmp0_;
	_tmp1_ = surface;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, gdk_toplevel_get_type ())) {
		GdkSurface* _tmp2_;
		_tmp2_ = surface;
		gdk_toplevel_inhibit_system_shortcuts (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gdk_toplevel_get_type (), GdkToplevel), NULL);
	}
}

static void
__ag_gcr_confirm_dialog___lambda4__gtk_widget_realize (GtkWidget* _sender,
                                                       gpointer self)
{
	_ag_gcr_confirm_dialog___lambda4_ ((AgGcrConfirmDialog*) self);
}

static GObject *
ag_gcr_confirm_dialog_constructor (GType type,
                                   guint n_construct_properties,
                                   GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	AgGcrConfirmDialog * self;
	GcrPrompt* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GcrPrompt* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GcrPrompt* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	GThemedIcon* _tmp12_;
	GThemedIcon* _tmp13_;
	GcrPrompt* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	GtkButton* authenticate_button = NULL;
	GcrPrompt* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	GtkWidget* _tmp22_;
	GtkButton* _tmp23_;
	GtkButton* _tmp24_;
	GtkButton* _tmp25_;
	GtkButton* _tmp26_;
	GtkWidget* _tmp27_;
	GtkWidget* _tmp28_;
	parent_class = G_OBJECT_CLASS (ag_gcr_confirm_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, AG_TYPE_GCR_CONFIRM_DIALOG, AgGcrConfirmDialog);
	_tmp0_ = self->priv->_prompt;
	_tmp1_ = gcr_prompt_get_title (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	gtk_window_set_title ((GtkWindow*) self, _tmp3_);
	_g_free0 (_tmp3_);
	_tmp4_ = self->priv->_prompt;
	_tmp5_ = gcr_prompt_get_description (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = _tmp6_;
	granite_message_dialog_set_primary_text ((GraniteMessageDialog*) self, _tmp7_);
	_g_free0 (_tmp7_);
	_tmp8_ = self->priv->_prompt;
	_tmp9_ = gcr_prompt_get_message (_tmp8_);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp10_;
	granite_message_dialog_set_secondary_text ((GraniteMessageDialog*) self, _tmp11_);
	_g_free0 (_tmp11_);
	_tmp12_ = (GThemedIcon*) g_themed_icon_new ("dialog-question");
	_tmp13_ = _tmp12_;
	granite_message_dialog_set_image_icon ((GraniteMessageDialog*) self, (GIcon*) _tmp13_);
	_g_object_unref0 (_tmp13_);
	_tmp14_ = self->priv->_prompt;
	_tmp15_ = gcr_prompt_get_cancel_label (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = _tmp16_;
	granite_dialog_add_button ((GraniteDialog*) self, _tmp17_, (gint) GTK_RESPONSE_CANCEL);
	_g_free0 (_tmp17_);
	_tmp18_ = self->priv->_prompt;
	_tmp19_ = gcr_prompt_get_continue_label (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = _tmp20_;
	_tmp22_ = granite_dialog_add_button ((GraniteDialog*) self, _tmp21_, (gint) GTK_RESPONSE_APPLY);
	_tmp23_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, gtk_button_get_type (), GtkButton);
	_g_free0 (_tmp21_);
	authenticate_button = _tmp23_;
	_tmp24_ = authenticate_button;
	gtk_widget_set_receives_default ((GtkWidget*) _tmp24_, TRUE);
	_tmp25_ = authenticate_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp25_, GRANITE_CSS_CLASS_SUGGESTED);
	_tmp26_ = authenticate_button;
	gtk_window_set_default_widget ((GtkWindow*) self, (GtkWidget*) _tmp26_);
	_tmp27_ = gtk_window_get_child ((GtkWindow*) self);
	_tmp28_ = _tmp27_;
	g_signal_connect_object (_tmp28_, "realize", (GCallback) __ag_gcr_confirm_dialog___lambda4__gtk_widget_realize, self, 0);
	return obj;
}

static void
ag_gcr_confirm_dialog_class_init (AgGcrConfirmDialogClass * klass,
                                  gpointer klass_data)
{
	ag_gcr_confirm_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &AgGcrConfirmDialog_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_ag_gcr_confirm_dialog_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_ag_gcr_confirm_dialog_set_property;
	G_OBJECT_CLASS (klass)->constructor = ag_gcr_confirm_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = ag_gcr_confirm_dialog_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), AG_GCR_CONFIRM_DIALOG_PROMPT_PROPERTY, ag_gcr_confirm_dialog_properties[AG_GCR_CONFIRM_DIALOG_PROMPT_PROPERTY] = g_param_spec_object ("prompt", "prompt", "prompt", gcr_prompt_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
ag_gcr_confirm_dialog_pantheon_wayland_extended_behavior_interface_init (PantheonWaylandExtendedBehaviorIface * iface,
                                                                         gpointer iface_data)
{
	ag_gcr_confirm_dialog_pantheon_wayland_extended_behavior_parent_iface = g_type_interface_peek_parent (iface);
}

static void
ag_gcr_confirm_dialog_instance_init (AgGcrConfirmDialog * self,
                                     gpointer klass)
{
	self->priv = ag_gcr_confirm_dialog_get_instance_private (self);
}

static void
ag_gcr_confirm_dialog_finalize (GObject * obj)
{
	AgGcrConfirmDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, AG_TYPE_GCR_CONFIRM_DIALOG, AgGcrConfirmDialog);
	_g_object_unref0 (self->priv->_prompt);
	G_OBJECT_CLASS (ag_gcr_confirm_dialog_parent_class)->finalize (obj);
}

/**
 * Class used by GcrAgent to ask for confirmation.
 * To get status, connect to `response` signal.
 * Gtk.ResponseType.APPLY means that continue button was pressed.
 * Everything else should be treated as cancel.
 */
static GType
ag_gcr_confirm_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (AgGcrConfirmDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ag_gcr_confirm_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AgGcrConfirmDialog), 0, (GInstanceInitFunc) ag_gcr_confirm_dialog_instance_init, NULL };
	static const GInterfaceInfo pantheon_wayland_extended_behavior_info = { (GInterfaceInitFunc) ag_gcr_confirm_dialog_pantheon_wayland_extended_behavior_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType ag_gcr_confirm_dialog_type_id;
	ag_gcr_confirm_dialog_type_id = g_type_register_static (GRANITE_TYPE_MESSAGE_DIALOG, "AgGcrConfirmDialog", &g_define_type_info, 0);
	g_type_add_interface_static (ag_gcr_confirm_dialog_type_id, PANTHEON_WAYLAND_TYPE_EXTENDED_BEHAVIOR, &pantheon_wayland_extended_behavior_info);
	AgGcrConfirmDialog_private_offset = g_type_add_instance_private (ag_gcr_confirm_dialog_type_id, sizeof (AgGcrConfirmDialogPrivate));
	return ag_gcr_confirm_dialog_type_id;
}

GType
ag_gcr_confirm_dialog_get_type (void)
{
	static volatile gsize ag_gcr_confirm_dialog_type_id__once = 0;
	if (g_once_init_enter (&ag_gcr_confirm_dialog_type_id__once)) {
		GType ag_gcr_confirm_dialog_type_id;
		ag_gcr_confirm_dialog_type_id = ag_gcr_confirm_dialog_get_type_once ();
		g_once_init_leave (&ag_gcr_confirm_dialog_type_id__once, ag_gcr_confirm_dialog_type_id);
	}
	return ag_gcr_confirm_dialog_type_id__once;
}

static void
_vala_ag_gcr_confirm_dialog_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	AgGcrConfirmDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, AG_TYPE_GCR_CONFIRM_DIALOG, AgGcrConfirmDialog);
	switch (property_id) {
		case AG_GCR_CONFIRM_DIALOG_PROMPT_PROPERTY:
		g_value_set_object (value, ag_gcr_confirm_dialog_get_prompt (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_ag_gcr_confirm_dialog_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	AgGcrConfirmDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, AG_TYPE_GCR_CONFIRM_DIALOG, AgGcrConfirmDialog);
	switch (property_id) {
		case AG_GCR_CONFIRM_DIALOG_PROMPT_PROPERTY:
		ag_gcr_confirm_dialog_set_prompt (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

