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

/*
* Copyright 2025 elementary, Inc. (https://elementary.io)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 3 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

#include <granite.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.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 SCRATCH_DIALOGS_TYPE_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG (scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_type ())
#define SCRATCH_DIALOGS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SCRATCH_DIALOGS_TYPE_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG, ScratchDialogsOverwriteUncommittedConfirmationDialog))
#define SCRATCH_DIALOGS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SCRATCH_DIALOGS_TYPE_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG, ScratchDialogsOverwriteUncommittedConfirmationDialogClass))
#define SCRATCH_DIALOGS_IS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCRATCH_DIALOGS_TYPE_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG))
#define SCRATCH_DIALOGS_IS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SCRATCH_DIALOGS_TYPE_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG))
#define SCRATCH_DIALOGS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SCRATCH_DIALOGS_TYPE_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG, ScratchDialogsOverwriteUncommittedConfirmationDialogClass))

typedef struct _ScratchDialogsOverwriteUncommittedConfirmationDialog ScratchDialogsOverwriteUncommittedConfirmationDialog;
typedef struct _ScratchDialogsOverwriteUncommittedConfirmationDialogClass ScratchDialogsOverwriteUncommittedConfirmationDialogClass;
typedef struct _ScratchDialogsOverwriteUncommittedConfirmationDialogPrivate ScratchDialogsOverwriteUncommittedConfirmationDialogPrivate;
enum  {
	SCRATCH_DIALOGS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG_0_PROPERTY,
	SCRATCH_DIALOGS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG_BRANCH_NAME_PROPERTY,
	SCRATCH_DIALOGS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG_NUM_PROPERTIES
};
static GParamSpec* scratch_dialogs_overwrite_uncommitted_confirmation_dialog_properties[SCRATCH_DIALOGS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _ScratchDialogsOverwriteUncommittedConfirmationDialog {
	GraniteMessageDialog parent_instance;
	ScratchDialogsOverwriteUncommittedConfirmationDialogPrivate * priv;
};

struct _ScratchDialogsOverwriteUncommittedConfirmationDialogClass {
	GraniteMessageDialogClass parent_class;
};

struct _ScratchDialogsOverwriteUncommittedConfirmationDialogPrivate {
	gchar* _branch_name;
};

static gint ScratchDialogsOverwriteUncommittedConfirmationDialog_private_offset;
static gpointer scratch_dialogs_overwrite_uncommitted_confirmation_dialog_parent_class = NULL;

VALA_EXTERN GType scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ScratchDialogsOverwriteUncommittedConfirmationDialog, g_object_unref)
VALA_EXTERN ScratchDialogsOverwriteUncommittedConfirmationDialog* scratch_dialogs_overwrite_uncommitted_confirmation_dialog_new (GtkWindow* parent,
                                                                                                                     const gchar* new_branch_name,
                                                                                                                     const gchar* details);
VALA_EXTERN ScratchDialogsOverwriteUncommittedConfirmationDialog* scratch_dialogs_overwrite_uncommitted_confirmation_dialog_construct (GType object_type,
                                                                                                                           GtkWindow* parent,
                                                                                                                           const gchar* new_branch_name,
                                                                                                                           const gchar* details);
VALA_EXTERN const gchar* scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_branch_name (ScratchDialogsOverwriteUncommittedConfirmationDialog* self);
static void scratch_dialogs_overwrite_uncommitted_confirmation_dialog_set_branch_name (ScratchDialogsOverwriteUncommittedConfirmationDialog* self,
                                                                                const gchar* value);
static GObject * scratch_dialogs_overwrite_uncommitted_confirmation_dialog_constructor (GType type,
                                                                                 guint n_construct_properties,
                                                                                 GObjectConstructParam * construct_properties);
static void scratch_dialogs_overwrite_uncommitted_confirmation_dialog_finalize (GObject * obj);
static GType scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_type_once (void);
static void _vala_scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_property (GObject * object,
                                                                                   guint property_id,
                                                                                   GValue * value,
                                                                                   GParamSpec * pspec);
static void _vala_scratch_dialogs_overwrite_uncommitted_confirmation_dialog_set_property (GObject * object,
                                                                                   guint property_id,
                                                                                   const GValue * value,
                                                                                   GParamSpec * pspec);

static inline gpointer
scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_instance_private (ScratchDialogsOverwriteUncommittedConfirmationDialog* self)
{
	return G_STRUCT_MEMBER_P (self, ScratchDialogsOverwriteUncommittedConfirmationDialog_private_offset);
}

ScratchDialogsOverwriteUncommittedConfirmationDialog*
scratch_dialogs_overwrite_uncommitted_confirmation_dialog_construct (GType object_type,
                                                                     GtkWindow* parent,
                                                                     const gchar* new_branch_name,
                                                                     const gchar* details)
{
	ScratchDialogsOverwriteUncommittedConfirmationDialog * self = NULL;
	g_return_val_if_fail (parent != NULL, NULL);
	g_return_val_if_fail (new_branch_name != NULL, NULL);
	g_return_val_if_fail (details != NULL, NULL);
	self = (ScratchDialogsOverwriteUncommittedConfirmationDialog*) g_object_new (object_type, "buttons", GTK_BUTTONS_NONE, "transient-for", parent, "branch-name", new_branch_name, NULL);
	granite_message_dialog_show_error_details ((GraniteMessageDialog*) self, details);
	return self;
}

ScratchDialogsOverwriteUncommittedConfirmationDialog*
scratch_dialogs_overwrite_uncommitted_confirmation_dialog_new (GtkWindow* parent,
                                                               const gchar* new_branch_name,
                                                               const gchar* details)
{
	return scratch_dialogs_overwrite_uncommitted_confirmation_dialog_construct (SCRATCH_DIALOGS_TYPE_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG, parent, new_branch_name, details);
}

const gchar*
scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_branch_name (ScratchDialogsOverwriteUncommittedConfirmationDialog* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_branch_name;
	result = _tmp0_;
	return result;
}

static void
scratch_dialogs_overwrite_uncommitted_confirmation_dialog_set_branch_name (ScratchDialogsOverwriteUncommittedConfirmationDialog* self,
                                                                           const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_branch_name (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_branch_name);
		self->priv->_branch_name = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, scratch_dialogs_overwrite_uncommitted_confirmation_dialog_properties[SCRATCH_DIALOGS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG_BRANCH_NAME_PROPERTY]);
	}
}

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

static GObject *
scratch_dialogs_overwrite_uncommitted_confirmation_dialog_constructor (GType type,
                                                                       guint n_construct_properties,
                                                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ScratchDialogsOverwriteUncommittedConfirmationDialog * self;
	GThemedIcon* _tmp0_;
	GThemedIcon* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GtkWidget* cancel_button = NULL;
	GtkWidget* _tmp5_;
	GtkWidget* _tmp6_;
	GtkButton* proceed_button = NULL;
	GtkWidget* _tmp7_;
	GtkButton* _tmp8_;
	GtkButton* _tmp9_;
	GtkStyleContext* _tmp10_;
	parent_class = G_OBJECT_CLASS (scratch_dialogs_overwrite_uncommitted_confirmation_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SCRATCH_DIALOGS_TYPE_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG, ScratchDialogsOverwriteUncommittedConfirmationDialog);
	gtk_window_set_modal ((GtkWindow*) self, TRUE);
	_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_primary_text ((GraniteMessageDialog*) self, _ ("There are uncommitted changes in the current branch"));
	_tmp2_ = self->priv->_branch_name;
	_tmp3_ = g_strdup_printf (_ ("Uncommitted changes will be permanently lost if <b>'%s'</b> is checked" \
" out now.\n" \
"\n" \
"<i>It is recommended that uncommitted changes are stashed, committed, " \
"or reverted before proceeding.</i>"), _tmp2_);
	_tmp4_ = _tmp3_;
	granite_message_dialog_set_secondary_text ((GraniteMessageDialog*) self, _tmp4_);
	_g_free0 (_tmp4_);
	_tmp5_ = gtk_dialog_add_button ((GtkDialog*) self, _ ("Do not Checkout"), (gint) GTK_RESPONSE_REJECT);
	_tmp6_ = _g_object_ref0 (_tmp5_);
	cancel_button = _tmp6_;
	_tmp7_ = gtk_dialog_add_button ((GtkDialog*) self, _ ("Checkout and Overwrite"), (gint) GTK_RESPONSE_ACCEPT);
	_tmp8_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, gtk_button_get_type (), GtkButton));
	proceed_button = _tmp8_;
	_tmp9_ = proceed_button;
	_tmp10_ = gtk_widget_get_style_context ((GtkWidget*) _tmp9_);
	gtk_style_context_add_class (_tmp10_, GTK_STYLE_CLASS_DESTRUCTIVE_ACTION);
	_g_object_unref0 (proceed_button);
	_g_object_unref0 (cancel_button);
	return obj;
}

static void
scratch_dialogs_overwrite_uncommitted_confirmation_dialog_class_init (ScratchDialogsOverwriteUncommittedConfirmationDialogClass * klass,
                                                                      gpointer klass_data)
{
	scratch_dialogs_overwrite_uncommitted_confirmation_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ScratchDialogsOverwriteUncommittedConfirmationDialog_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_scratch_dialogs_overwrite_uncommitted_confirmation_dialog_set_property;
	G_OBJECT_CLASS (klass)->constructor = scratch_dialogs_overwrite_uncommitted_confirmation_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = scratch_dialogs_overwrite_uncommitted_confirmation_dialog_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SCRATCH_DIALOGS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG_BRANCH_NAME_PROPERTY, scratch_dialogs_overwrite_uncommitted_confirmation_dialog_properties[SCRATCH_DIALOGS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG_BRANCH_NAME_PROPERTY] = g_param_spec_string ("branch-name", "branch-name", "branch-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
scratch_dialogs_overwrite_uncommitted_confirmation_dialog_instance_init (ScratchDialogsOverwriteUncommittedConfirmationDialog * self,
                                                                         gpointer klass)
{
	self->priv = scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_instance_private (self);
}

static void
scratch_dialogs_overwrite_uncommitted_confirmation_dialog_finalize (GObject * obj)
{
	ScratchDialogsOverwriteUncommittedConfirmationDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SCRATCH_DIALOGS_TYPE_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG, ScratchDialogsOverwriteUncommittedConfirmationDialog);
	_g_free0 (self->priv->_branch_name);
	G_OBJECT_CLASS (scratch_dialogs_overwrite_uncommitted_confirmation_dialog_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ScratchDialogsOverwriteUncommittedConfirmationDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) scratch_dialogs_overwrite_uncommitted_confirmation_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ScratchDialogsOverwriteUncommittedConfirmationDialog), 0, (GInstanceInitFunc) scratch_dialogs_overwrite_uncommitted_confirmation_dialog_instance_init, NULL };
	GType scratch_dialogs_overwrite_uncommitted_confirmation_dialog_type_id;
	scratch_dialogs_overwrite_uncommitted_confirmation_dialog_type_id = g_type_register_static (GRANITE_TYPE_MESSAGE_DIALOG, "ScratchDialogsOverwriteUncommittedConfirmationDialog", &g_define_type_info, G_TYPE_FLAG_NONE);
	ScratchDialogsOverwriteUncommittedConfirmationDialog_private_offset = g_type_add_instance_private (scratch_dialogs_overwrite_uncommitted_confirmation_dialog_type_id, sizeof (ScratchDialogsOverwriteUncommittedConfirmationDialogPrivate));
	return scratch_dialogs_overwrite_uncommitted_confirmation_dialog_type_id;
}

GType
scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_type (void)
{
	static gsize scratch_dialogs_overwrite_uncommitted_confirmation_dialog_type_id__once = 0;
	if (g_once_init_enter (&scratch_dialogs_overwrite_uncommitted_confirmation_dialog_type_id__once)) {
		GType scratch_dialogs_overwrite_uncommitted_confirmation_dialog_type_id;
		scratch_dialogs_overwrite_uncommitted_confirmation_dialog_type_id = scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_type_once ();
		g_once_init_leave (&scratch_dialogs_overwrite_uncommitted_confirmation_dialog_type_id__once, scratch_dialogs_overwrite_uncommitted_confirmation_dialog_type_id);
	}
	return scratch_dialogs_overwrite_uncommitted_confirmation_dialog_type_id__once;
}

static void
_vala_scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_property (GObject * object,
                                                                              guint property_id,
                                                                              GValue * value,
                                                                              GParamSpec * pspec)
{
	ScratchDialogsOverwriteUncommittedConfirmationDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SCRATCH_DIALOGS_TYPE_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG, ScratchDialogsOverwriteUncommittedConfirmationDialog);
	switch (property_id) {
		case SCRATCH_DIALOGS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG_BRANCH_NAME_PROPERTY:
		g_value_set_string (value, scratch_dialogs_overwrite_uncommitted_confirmation_dialog_get_branch_name (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_scratch_dialogs_overwrite_uncommitted_confirmation_dialog_set_property (GObject * object,
                                                                              guint property_id,
                                                                              const GValue * value,
                                                                              GParamSpec * pspec)
{
	ScratchDialogsOverwriteUncommittedConfirmationDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SCRATCH_DIALOGS_TYPE_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG, ScratchDialogsOverwriteUncommittedConfirmationDialog);
	switch (property_id) {
		case SCRATCH_DIALOGS_OVERWRITE_UNCOMMITTED_CONFIRMATION_DIALOG_BRANCH_NAME_PROPERTY:
		scratch_dialogs_overwrite_uncommitted_confirmation_dialog_set_branch_name (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

