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

/*
 * SPDX-License-Identifier: LGPL-3.0-or-later
 * SPDX-FileCopyrightText: 2011-2017 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 <glib/gi18n-lib.h>
#include <gio/gio.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_FOREGROUND_PROCESS_DIALOG (terminal_foreground_process_dialog_get_type ())
#define TERMINAL_FOREGROUND_PROCESS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG, TerminalForegroundProcessDialog))
#define TERMINAL_FOREGROUND_PROCESS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG, TerminalForegroundProcessDialogClass))
#define TERMINAL_IS_FOREGROUND_PROCESS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG))
#define TERMINAL_IS_FOREGROUND_PROCESS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG))
#define TERMINAL_FOREGROUND_PROCESS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG, TerminalForegroundProcessDialogClass))

typedef struct _TerminalForegroundProcessDialog TerminalForegroundProcessDialog;
typedef struct _TerminalForegroundProcessDialogClass TerminalForegroundProcessDialogClass;
typedef struct _TerminalForegroundProcessDialogPrivate TerminalForegroundProcessDialogPrivate;
enum  {
	TERMINAL_FOREGROUND_PROCESS_DIALOG_0_PROPERTY,
	TERMINAL_FOREGROUND_PROCESS_DIALOG_BUTTON_LABEL_PROPERTY,
	TERMINAL_FOREGROUND_PROCESS_DIALOG_NUM_PROPERTIES
};
static GParamSpec* terminal_foreground_process_dialog_properties[TERMINAL_FOREGROUND_PROCESS_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 _TerminalForegroundProcessDialog {
	GraniteMessageDialog parent_instance;
	TerminalForegroundProcessDialogPrivate * priv;
};

struct _TerminalForegroundProcessDialogClass {
	GraniteMessageDialogClass parent_class;
};

struct _TerminalForegroundProcessDialogPrivate {
	gchar* _button_label;
};

static gint TerminalForegroundProcessDialog_private_offset;
static gpointer terminal_foreground_process_dialog_parent_class = NULL;

VALA_EXTERN GType terminal_foreground_process_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TerminalForegroundProcessDialog, 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 TerminalForegroundProcessDialog* terminal_foreground_process_dialog_new (TerminalMainWindow* parent,
                                                                         const gchar* primary_text,
                                                                         const gchar* button_label);
VALA_EXTERN TerminalForegroundProcessDialog* terminal_foreground_process_dialog_construct (GType object_type,
                                                                               TerminalMainWindow* parent,
                                                                               const gchar* primary_text,
                                                                               const gchar* button_label);
VALA_EXTERN const gchar* terminal_foreground_process_dialog_get_button_label (TerminalForegroundProcessDialog* self);
static void terminal_foreground_process_dialog_set_button_label (TerminalForegroundProcessDialog* self,
                                                          const gchar* value);
static GObject * terminal_foreground_process_dialog_constructor (GType type,
                                                          guint n_construct_properties,
                                                          GObjectConstructParam * construct_properties);
static void terminal_foreground_process_dialog_finalize (GObject * obj);
static GType terminal_foreground_process_dialog_get_type_once (void);
static void _vala_terminal_foreground_process_dialog_get_property (GObject * object,
                                                            guint property_id,
                                                            GValue * value,
                                                            GParamSpec * pspec);
static void _vala_terminal_foreground_process_dialog_set_property (GObject * object,
                                                            guint property_id,
                                                            const GValue * value,
                                                            GParamSpec * pspec);

static inline gpointer
terminal_foreground_process_dialog_get_instance_private (TerminalForegroundProcessDialog* self)
{
	return G_STRUCT_MEMBER_P (self, TerminalForegroundProcessDialog_private_offset);
}

TerminalForegroundProcessDialog*
terminal_foreground_process_dialog_construct (GType object_type,
                                              TerminalMainWindow* parent,
                                              const gchar* primary_text,
                                              const gchar* button_label)
{
	TerminalForegroundProcessDialog * self = NULL;
	g_return_val_if_fail (parent != NULL, NULL);
	g_return_val_if_fail (primary_text != NULL, NULL);
	g_return_val_if_fail (button_label != NULL, NULL);
	self = (TerminalForegroundProcessDialog*) g_object_new (object_type, "transient-for", parent, "primary-text", primary_text, "button-label", button_label, "buttons", GTK_BUTTONS_CANCEL, NULL);
	return self;
}

TerminalForegroundProcessDialog*
terminal_foreground_process_dialog_new (TerminalMainWindow* parent,
                                        const gchar* primary_text,
                                        const gchar* button_label)
{
	return terminal_foreground_process_dialog_construct (TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG, parent, primary_text, button_label);
}

const gchar*
terminal_foreground_process_dialog_get_button_label (TerminalForegroundProcessDialog* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_button_label;
	result = _tmp0_;
	return result;
}

static void
terminal_foreground_process_dialog_set_button_label (TerminalForegroundProcessDialog* self,
                                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = terminal_foreground_process_dialog_get_button_label (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_button_label);
		self->priv->_button_label = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, terminal_foreground_process_dialog_properties[TERMINAL_FOREGROUND_PROCESS_DIALOG_BUTTON_LABEL_PROPERTY]);
	}
}

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

static GObject *
terminal_foreground_process_dialog_constructor (GType type,
                                                guint n_construct_properties,
                                                GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TerminalForegroundProcessDialog * self;
	GThemedIcon* _tmp0_;
	GThemedIcon* _tmp1_;
	GtkWidget* close_button = NULL;
	const gchar* _tmp2_;
	GtkWidget* _tmp3_;
	GtkWidget* _tmp4_;
	GtkWidget* _tmp5_;
	parent_class = G_OBJECT_CLASS (terminal_foreground_process_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG, TerminalForegroundProcessDialog);
	gtk_window_set_modal ((GtkWindow*) self, TRUE);
	granite_message_dialog_set_secondary_text ((GraniteMessageDialog*) self, _ ("There is an active process on this tab. If you continue, the process w" \
"ill end."));
	_tmp0_ = (GThemedIcon*) g_themed_icon_new ("dialog-warning");
	_tmp1_ = _tmp0_;
	granite_message_dialog_set_image_icon ((GraniteMessageDialog*) self, (GIcon*) _tmp1_);
	_g_object_unref0 (_tmp1_);
	_tmp2_ = self->priv->_button_label;
	_tmp3_ = granite_dialog_add_button ((GraniteDialog*) self, _tmp2_, (gint) GTK_RESPONSE_ACCEPT);
	_tmp4_ = _g_object_ref0 (_tmp3_);
	close_button = _tmp4_;
	_tmp5_ = close_button;
	gtk_widget_add_css_class (_tmp5_, GRANITE_CSS_CLASS_DESTRUCTIVE);
	_g_object_unref0 (close_button);
	return obj;
}

static void
terminal_foreground_process_dialog_class_init (TerminalForegroundProcessDialogClass * klass,
                                               gpointer klass_data)
{
	terminal_foreground_process_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TerminalForegroundProcessDialog_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_terminal_foreground_process_dialog_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_terminal_foreground_process_dialog_set_property;
	G_OBJECT_CLASS (klass)->constructor = terminal_foreground_process_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = terminal_foreground_process_dialog_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TERMINAL_FOREGROUND_PROCESS_DIALOG_BUTTON_LABEL_PROPERTY, terminal_foreground_process_dialog_properties[TERMINAL_FOREGROUND_PROCESS_DIALOG_BUTTON_LABEL_PROPERTY] = g_param_spec_string ("button-label", "button-label", "button-label", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
terminal_foreground_process_dialog_instance_init (TerminalForegroundProcessDialog * self,
                                                  gpointer klass)
{
	self->priv = terminal_foreground_process_dialog_get_instance_private (self);
}

static void
terminal_foreground_process_dialog_finalize (GObject * obj)
{
	TerminalForegroundProcessDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG, TerminalForegroundProcessDialog);
	_g_free0 (self->priv->_button_label);
	G_OBJECT_CLASS (terminal_foreground_process_dialog_parent_class)->finalize (obj);
}

static GType
terminal_foreground_process_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TerminalForegroundProcessDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) terminal_foreground_process_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TerminalForegroundProcessDialog), 0, (GInstanceInitFunc) terminal_foreground_process_dialog_instance_init, NULL };
	GType terminal_foreground_process_dialog_type_id;
	terminal_foreground_process_dialog_type_id = g_type_register_static (GRANITE_TYPE_MESSAGE_DIALOG, "TerminalForegroundProcessDialog", &g_define_type_info, 0);
	TerminalForegroundProcessDialog_private_offset = g_type_add_instance_private (terminal_foreground_process_dialog_type_id, sizeof (TerminalForegroundProcessDialogPrivate));
	return terminal_foreground_process_dialog_type_id;
}

GType
terminal_foreground_process_dialog_get_type (void)
{
	static volatile gsize terminal_foreground_process_dialog_type_id__once = 0;
	if (g_once_init_enter (&terminal_foreground_process_dialog_type_id__once)) {
		GType terminal_foreground_process_dialog_type_id;
		terminal_foreground_process_dialog_type_id = terminal_foreground_process_dialog_get_type_once ();
		g_once_init_leave (&terminal_foreground_process_dialog_type_id__once, terminal_foreground_process_dialog_type_id);
	}
	return terminal_foreground_process_dialog_type_id__once;
}

static void
_vala_terminal_foreground_process_dialog_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec)
{
	TerminalForegroundProcessDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG, TerminalForegroundProcessDialog);
	switch (property_id) {
		case TERMINAL_FOREGROUND_PROCESS_DIALOG_BUTTON_LABEL_PROPERTY:
		g_value_set_string (value, terminal_foreground_process_dialog_get_button_label (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_terminal_foreground_process_dialog_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec)
{
	TerminalForegroundProcessDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TERMINAL_TYPE_FOREGROUND_PROCESS_DIALOG, TerminalForegroundProcessDialog);
	switch (property_id) {
		case TERMINAL_FOREGROUND_PROCESS_DIALOG_BUTTON_LABEL_PROPERTY:
		terminal_foreground_process_dialog_set_button_label (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

