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

/*
 * SPDX-License-Identifier: LGPL-3.0-or-later
 * SPDX-FileCopyrightText: 2011-2025 elementary, Inc. (https://elementary.io)
 */

#include <granite-7.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <adwaita.h>
#include <gtk/gtk.h>
#include <gio/gio.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 TERMINAL_TYPE_UNSAFE_PASTE_DIALOG (terminal_unsafe_paste_dialog_get_type ())
#define TERMINAL_UNSAFE_PASTE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_UNSAFE_PASTE_DIALOG, TerminalUnsafePasteDialog))
#define TERMINAL_UNSAFE_PASTE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_UNSAFE_PASTE_DIALOG, TerminalUnsafePasteDialogClass))
#define TERMINAL_IS_UNSAFE_PASTE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_TYPE_UNSAFE_PASTE_DIALOG))
#define TERMINAL_IS_UNSAFE_PASTE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_UNSAFE_PASTE_DIALOG))
#define TERMINAL_UNSAFE_PASTE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_UNSAFE_PASTE_DIALOG, TerminalUnsafePasteDialogClass))

typedef struct _TerminalUnsafePasteDialog TerminalUnsafePasteDialog;
typedef struct _TerminalUnsafePasteDialogClass TerminalUnsafePasteDialogClass;
typedef struct _TerminalUnsafePasteDialogPrivate TerminalUnsafePasteDialogPrivate;
enum  {
	TERMINAL_UNSAFE_PASTE_DIALOG_0_PROPERTY,
	TERMINAL_UNSAFE_PASTE_DIALOG_TEXT_TO_PASTE_PROPERTY,
	TERMINAL_UNSAFE_PASTE_DIALOG_NUM_PROPERTIES
};
static GParamSpec* terminal_unsafe_paste_dialog_properties[TERMINAL_UNSAFE_PASTE_DIALOG_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

#define TERMINAL_TYPE_MAIN_WINDOW (terminal_main_window_get_type ())
#define TERMINAL_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_MAIN_WINDOW, TerminalMainWindow))
#define TERMINAL_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_MAIN_WINDOW, TerminalMainWindowClass))
#define TERMINAL_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_TYPE_MAIN_WINDOW))
#define TERMINAL_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_MAIN_WINDOW))
#define TERMINAL_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_MAIN_WINDOW, TerminalMainWindowClass))

typedef struct _TerminalMainWindow TerminalMainWindow;
typedef struct _TerminalMainWindowClass TerminalMainWindowClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _TerminalUnsafePasteDialog {
	GraniteMessageDialog parent_instance;
	TerminalUnsafePasteDialogPrivate * priv;
};

struct _TerminalUnsafePasteDialogClass {
	GraniteMessageDialogClass parent_class;
};

struct _TerminalUnsafePasteDialogPrivate {
	gchar* _text_to_paste;
};

static gint TerminalUnsafePasteDialog_private_offset;
static gpointer terminal_unsafe_paste_dialog_parent_class = NULL;
VALA_EXTERN GSettings* terminal_application_settings;

VALA_EXTERN GType terminal_unsafe_paste_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalUnsafePasteDialog, g_object_unref)
VALA_EXTERN GType terminal_main_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalMainWindow, g_object_unref)
VALA_EXTERN TerminalUnsafePasteDialog* terminal_unsafe_paste_dialog_new (TerminalMainWindow* parent,
                                                             const gchar* title_text,
                                                             const gchar* text_to_paste);
VALA_EXTERN TerminalUnsafePasteDialog* terminal_unsafe_paste_dialog_construct (GType object_type,
                                                                   TerminalMainWindow* parent,
                                                                   const gchar* title_text,
                                                                   const gchar* text_to_paste);
VALA_EXTERN const gchar* terminal_unsafe_paste_dialog_get_text_to_paste (TerminalUnsafePasteDialog* self);
static void terminal_unsafe_paste_dialog_set_text_to_paste (TerminalUnsafePasteDialog* self,
                                                     const gchar* value);
static GObject * terminal_unsafe_paste_dialog_constructor (GType type,
                                                    guint n_construct_properties,
                                                    GObjectConstructParam * construct_properties);
static void terminal_unsafe_paste_dialog_finalize (GObject * obj);
static GType terminal_unsafe_paste_dialog_get_type_once (void);
static void _vala_terminal_unsafe_paste_dialog_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec);
static void _vala_terminal_unsafe_paste_dialog_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec);

static inline gpointer
terminal_unsafe_paste_dialog_get_instance_private (TerminalUnsafePasteDialog* self)
{
	return G_STRUCT_MEMBER_P (self, TerminalUnsafePasteDialog_private_offset);
}

TerminalUnsafePasteDialog*
terminal_unsafe_paste_dialog_construct (GType object_type,
                                        TerminalMainWindow* parent,
                                        const gchar* title_text,
                                        const gchar* text_to_paste)
{
	TerminalUnsafePasteDialog * self = NULL;
	g_return_val_if_fail (parent != NULL, NULL);
	g_return_val_if_fail (title_text != NULL, NULL);
	g_return_val_if_fail (text_to_paste != NULL, NULL);
	self = (TerminalUnsafePasteDialog*) g_object_new (object_type, "transient-for", parent, "primary-text", title_text, "text-to-paste", text_to_paste, "buttons", GTK_BUTTONS_NONE, NULL);
	return self;
}

TerminalUnsafePasteDialog*
terminal_unsafe_paste_dialog_new (TerminalMainWindow* parent,
                                  const gchar* title_text,
                                  const gchar* text_to_paste)
{
	return terminal_unsafe_paste_dialog_construct (TERMINAL_TYPE_UNSAFE_PASTE_DIALOG, parent, title_text, text_to_paste);
}

const gchar*
terminal_unsafe_paste_dialog_get_text_to_paste (TerminalUnsafePasteDialog* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_text_to_paste;
	result = _tmp0_;
	return result;
}

static void
terminal_unsafe_paste_dialog_set_text_to_paste (TerminalUnsafePasteDialog* self,
                                                const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = terminal_unsafe_paste_dialog_get_text_to_paste (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_text_to_paste);
		self->priv->_text_to_paste = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, terminal_unsafe_paste_dialog_properties[TERMINAL_UNSAFE_PASTE_DIALOG_TEXT_TO_PASTE_PROPERTY]);
	}
}

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

static GObject *
terminal_unsafe_paste_dialog_constructor (GType type,
                                          guint n_construct_properties,
                                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TerminalUnsafePasteDialog * self;
	GThemedIcon* _tmp0_;
	GThemedIcon* _tmp1_;
	const gchar* _tmp2_;
	GtkCheckButton* show_protection_warnings = NULL;
	GtkCheckButton* _tmp3_;
	GtkBox* _tmp4_;
	GtkBox* _tmp5_;
	GtkCheckButton* _tmp6_;
	GtkButton* ignore_button = NULL;
	GtkWidget* _tmp7_;
	GtkButton* _tmp8_;
	GtkButton* _tmp9_;
	GSettings* _tmp10_;
	GtkCheckButton* _tmp11_;
	parent_class = G_OBJECT_CLASS (terminal_unsafe_paste_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_TYPE_UNSAFE_PASTE_DIALOG, TerminalUnsafePasteDialog);
	_tmp0_ = (GThemedIcon*) g_themed_icon_new ("dialog-warning");
	_tmp1_ = _tmp0_;
	granite_message_dialog_set_image_icon ((GraniteMessageDialog*) self, (GIcon*) _tmp1_);
	_g_object_unref0 (_tmp1_);
	granite_message_dialog_set_secondary_text ((GraniteMessageDialog*) self, _ ("Copying commands into Terminal can be dangerous. Be sure you understan" \
"d what each part of the pasted text does before continuing."));
	_tmp2_ = self->priv->_text_to_paste;
	granite_message_dialog_show_error_details ((GraniteMessageDialog*) self, _tmp2_);
	_tmp3_ = (GtkCheckButton*) gtk_check_button_new_with_label (_ ("Show paste protection warnings"));
	g_object_ref_sink (_tmp3_);
	show_protection_warnings = _tmp3_;
	_tmp4_ = granite_message_dialog_get_custom_bin ((GraniteMessageDialog*) self);
	_tmp5_ = _tmp4_;
	_tmp6_ = show_protection_warnings;
	gtk_box_append (_tmp5_, (GtkWidget*) _tmp6_);
	granite_dialog_add_button ((GraniteDialog*) self, _ ("Don't Paste"), (gint) GTK_RESPONSE_CANCEL);
	_tmp7_ = granite_dialog_add_button ((GraniteDialog*) self, _ ("Paste Anyway"), (gint) GTK_RESPONSE_ACCEPT);
	_tmp8_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, gtk_button_get_type (), GtkButton));
	ignore_button = _tmp8_;
	_tmp9_ = ignore_button;
	gtk_widget_add_css_class ((GtkWidget*) _tmp9_, GRANITE_CSS_CLASS_DESTRUCTIVE);
	gtk_dialog_set_default_response ((GtkDialog*) self, (gint) GTK_RESPONSE_CANCEL);
	_tmp10_ = terminal_application_settings;
	_tmp11_ = show_protection_warnings;
	g_settings_bind (_tmp10_, "unsafe-paste-alert", (GObject*) _tmp11_, "active", G_SETTINGS_BIND_DEFAULT);
	_g_object_unref0 (ignore_button);
	_g_object_unref0 (show_protection_warnings);
	return obj;
}

static void
terminal_unsafe_paste_dialog_class_init (TerminalUnsafePasteDialogClass * klass,
                                         gpointer klass_data)
{
	terminal_unsafe_paste_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TerminalUnsafePasteDialog_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_terminal_unsafe_paste_dialog_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_terminal_unsafe_paste_dialog_set_property;
	G_OBJECT_CLASS (klass)->constructor = terminal_unsafe_paste_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = terminal_unsafe_paste_dialog_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_UNSAFE_PASTE_DIALOG_TEXT_TO_PASTE_PROPERTY, terminal_unsafe_paste_dialog_properties[TERMINAL_UNSAFE_PASTE_DIALOG_TEXT_TO_PASTE_PROPERTY] = g_param_spec_string ("text-to-paste", "text-to-paste", "text-to-paste", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
terminal_unsafe_paste_dialog_instance_init (TerminalUnsafePasteDialog * self,
                                            gpointer klass)
{
	self->priv = terminal_unsafe_paste_dialog_get_instance_private (self);
}

static void
terminal_unsafe_paste_dialog_finalize (GObject * obj)
{
	TerminalUnsafePasteDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_TYPE_UNSAFE_PASTE_DIALOG, TerminalUnsafePasteDialog);
	_g_free0 (self->priv->_text_to_paste);
	G_OBJECT_CLASS (terminal_unsafe_paste_dialog_parent_class)->finalize (obj);
}

static GType
terminal_unsafe_paste_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TerminalUnsafePasteDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) terminal_unsafe_paste_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TerminalUnsafePasteDialog), 0, (GInstanceInitFunc) terminal_unsafe_paste_dialog_instance_init, NULL };
	GType terminal_unsafe_paste_dialog_type_id;
	terminal_unsafe_paste_dialog_type_id = g_type_register_static (GRANITE_TYPE_MESSAGE_DIALOG, "TerminalUnsafePasteDialog", &g_define_type_info, 0);
	TerminalUnsafePasteDialog_private_offset = g_type_add_instance_private (terminal_unsafe_paste_dialog_type_id, sizeof (TerminalUnsafePasteDialogPrivate));
	return terminal_unsafe_paste_dialog_type_id;
}

GType
terminal_unsafe_paste_dialog_get_type (void)
{
	static volatile gsize terminal_unsafe_paste_dialog_type_id__once = 0;
	if (g_once_init_enter (&terminal_unsafe_paste_dialog_type_id__once)) {
		GType terminal_unsafe_paste_dialog_type_id;
		terminal_unsafe_paste_dialog_type_id = terminal_unsafe_paste_dialog_get_type_once ();
		g_once_init_leave (&terminal_unsafe_paste_dialog_type_id__once, terminal_unsafe_paste_dialog_type_id);
	}
	return terminal_unsafe_paste_dialog_type_id__once;
}

static void
_vala_terminal_unsafe_paste_dialog_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec)
{
	TerminalUnsafePasteDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TERMINAL_TYPE_UNSAFE_PASTE_DIALOG, TerminalUnsafePasteDialog);
	switch (property_id) {
		case TERMINAL_UNSAFE_PASTE_DIALOG_TEXT_TO_PASTE_PROPERTY:
		g_value_set_string (value, terminal_unsafe_paste_dialog_get_text_to_paste (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_terminal_unsafe_paste_dialog_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec)
{
	TerminalUnsafePasteDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TERMINAL_TYPE_UNSAFE_PASTE_DIALOG, TerminalUnsafePasteDialog);
	switch (property_id) {
		case TERMINAL_UNSAFE_PASTE_DIALOG_TEXT_TO_PASTE_PROPERTY:
		terminal_unsafe_paste_dialog_set_text_to_paste (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

