/* ErrorDialog.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from ErrorDialog.vala, do not modify */

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*-
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 * SPDX-FileCopyrightText: Michael Terry
 */

#include <adwaita.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.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 TYPE_ERROR_DIALOG (error_dialog_get_type ())
#define ERROR_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ERROR_DIALOG, ErrorDialog))
#define ERROR_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ERROR_DIALOG, ErrorDialogClass))
#define IS_ERROR_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ERROR_DIALOG))
#define IS_ERROR_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ERROR_DIALOG))
#define ERROR_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ERROR_DIALOG, ErrorDialogClass))

typedef struct _ErrorDialog ErrorDialog;
typedef struct _ErrorDialogClass ErrorDialogClass;
typedef struct _ErrorDialogPrivate ErrorDialogPrivate;
enum  {
	ERROR_DIALOG_0_PROPERTY,
	ERROR_DIALOG_HEADING_PROPERTY,
	ERROR_DIALOG_DETAILS_PROPERTY,
	ERROR_DIALOG_NUM_PROPERTIES
};
static GParamSpec* error_dialog_properties[ERROR_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 _ErrorDialog {
	AdwDialog parent_instance;
	ErrorDialogPrivate * priv;
};

struct _ErrorDialogClass {
	AdwDialogClass parent_class;
};

struct _ErrorDialogPrivate {
	gchar* _heading;
	gchar* _details;
	GtkLabel* heading_label;
	GtkScrolledWindow* body_scroll;
};

static gint ErrorDialog_private_offset;
static gpointer error_dialog_parent_class = NULL;

VALA_EXTERN GType error_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ErrorDialog, g_object_unref)
VALA_EXTERN void error_dialog_create (GtkWidget* parent,
                          const gchar* msg1,
                          const gchar* msg2);
VALA_EXTERN ErrorDialog* error_dialog_new (const gchar* heading,
                               const gchar* details);
VALA_EXTERN ErrorDialog* error_dialog_construct (GType object_type,
                                     const gchar* heading,
                                     const gchar* details);
static void error_dialog_on_close_clicked (ErrorDialog* self);
static void _error_dialog_on_close_clicked_gtk_button_clicked (GtkButton* _sender,
                                                        gpointer self);
VALA_EXTERN const gchar* error_dialog_get_heading (ErrorDialog* self);
static void error_dialog_set_heading (ErrorDialog* self,
                               const gchar* value);
VALA_EXTERN const gchar* error_dialog_get_details (ErrorDialog* self);
static void error_dialog_set_details (ErrorDialog* self,
                               const gchar* value);
static GObject * error_dialog_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties);
static void error_dialog_finalize (GObject * obj);
static GType error_dialog_get_type_once (void);
static void _vala_error_dialog_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec);
static void _vala_error_dialog_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec);

static inline gpointer
error_dialog_get_instance_private (ErrorDialog* self)
{
	return G_STRUCT_MEMBER_P (self, ErrorDialog_private_offset);
}

void
error_dialog_create (GtkWidget* parent,
                     const gchar* msg1,
                     const gchar* msg2)
{
	g_return_if_fail (parent != NULL);
	if (msg2 == NULL) {
		ErrorDialog* _tmp0_;
		ErrorDialog* _tmp1_;
		_tmp0_ = error_dialog_new (NULL, msg1);
		g_object_ref_sink (_tmp0_);
		_tmp1_ = _tmp0_;
		adw_dialog_present ((AdwDialog*) _tmp1_, parent);
		_g_object_unref0 (_tmp1_);
	} else {
		ErrorDialog* _tmp2_;
		ErrorDialog* _tmp3_;
		_tmp2_ = error_dialog_new (msg1, msg2);
		g_object_ref_sink (_tmp2_);
		_tmp3_ = _tmp2_;
		adw_dialog_present ((AdwDialog*) _tmp3_, parent);
		_g_object_unref0 (_tmp3_);
	}
}

ErrorDialog*
error_dialog_construct (GType object_type,
                        const gchar* heading,
                        const gchar* details)
{
	ErrorDialog * self = NULL;
	self = (ErrorDialog*) g_object_new (object_type, "heading", heading, "details", details, NULL);
	return self;
}

ErrorDialog*
error_dialog_new (const gchar* heading,
                  const gchar* details)
{
	return error_dialog_construct (TYPE_ERROR_DIALOG, heading, details);
}

static void
error_dialog_on_close_clicked (ErrorDialog* self)
{
	g_return_if_fail (self != NULL);
	adw_dialog_close ((AdwDialog*) self);
}

static void
_error_dialog_on_close_clicked_gtk_button_clicked (GtkButton* _sender,
                                                   gpointer self)
{
	error_dialog_on_close_clicked ((ErrorDialog*) self);
}

const gchar*
error_dialog_get_heading (ErrorDialog* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_heading;
	result = _tmp0_;
	return result;
}

static void
error_dialog_set_heading (ErrorDialog* self,
                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = error_dialog_get_heading (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_heading);
		self->priv->_heading = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, error_dialog_properties[ERROR_DIALOG_HEADING_PROPERTY]);
	}
}

const gchar*
error_dialog_get_details (ErrorDialog* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_details;
	result = _tmp0_;
	return result;
}

static void
error_dialog_set_details (ErrorDialog* self,
                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = error_dialog_get_details (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_details);
		self->priv->_details = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, error_dialog_properties[ERROR_DIALOG_DETAILS_PROPERTY]);
	}
}

static GObject *
error_dialog_constructor (GType type,
                          guint n_construct_properties,
                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ErrorDialog * self;
	GtkLabel* _tmp0_;
	const gchar* _tmp1_;
	GtkScrolledWindow* _tmp2_;
	const gchar* _tmp3_;
	parent_class = G_OBJECT_CLASS (error_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ERROR_DIALOG, ErrorDialog);
	_tmp0_ = self->priv->heading_label;
	_tmp1_ = self->priv->_heading;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, _tmp1_ != NULL);
	_tmp2_ = self->priv->body_scroll;
	_tmp3_ = self->priv->_details;
	gtk_widget_set_visible ((GtkWidget*) _tmp2_, _tmp3_ != NULL);
	return obj;
}

static void
error_dialog_class_init (ErrorDialogClass * klass,
                         gpointer klass_data)
{
	error_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ErrorDialog_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_error_dialog_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_error_dialog_set_property;
	G_OBJECT_CLASS (klass)->constructor = error_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = error_dialog_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), ERROR_DIALOG_HEADING_PROPERTY, error_dialog_properties[ERROR_DIALOG_HEADING_PROPERTY] = g_param_spec_string ("heading", "heading", "heading", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), ERROR_DIALOG_DETAILS_PROPERTY, error_dialog_properties[ERROR_DIALOG_DETAILS_PROPERTY] = g_param_spec_string ("details", "details", "details", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/DejaDup/ErrorDialog.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "heading_label", FALSE, ErrorDialog_private_offset + G_STRUCT_OFFSET (ErrorDialogPrivate, heading_label));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "body_scroll", FALSE, ErrorDialog_private_offset + G_STRUCT_OFFSET (ErrorDialogPrivate, body_scroll));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_close_clicked", G_CALLBACK(_error_dialog_on_close_clicked_gtk_button_clicked));
}

static void
error_dialog_instance_init (ErrorDialog * self,
                            gpointer klass)
{
	self->priv = error_dialog_get_instance_private (self);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
error_dialog_finalize (GObject * obj)
{
	ErrorDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ERROR_DIALOG, ErrorDialog);
	g_debug ("ErrorDialog.vala:40: Finalizing ErrorDialog\n");
	_g_free0 (self->priv->_heading);
	_g_free0 (self->priv->_details);
	G_OBJECT_CLASS (error_dialog_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
error_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ErrorDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) error_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ErrorDialog), 0, (GInstanceInitFunc) error_dialog_instance_init, NULL };
	GType error_dialog_type_id;
	error_dialog_type_id = g_type_register_static (adw_dialog_get_type (), "ErrorDialog", &g_define_type_info, 0);
	ErrorDialog_private_offset = g_type_add_instance_private (error_dialog_type_id, sizeof (ErrorDialogPrivate));
	return error_dialog_type_id;
}

GType
error_dialog_get_type (void)
{
	static gsize error_dialog_type_id__once = 0;
	if (g_once_init_enter (&error_dialog_type_id__once)) {
		GType error_dialog_type_id;
		error_dialog_type_id = error_dialog_get_type_once ();
		g_once_init_leave (&error_dialog_type_id__once, error_dialog_type_id);
	}
	return error_dialog_type_id__once;
}

static void
_vala_error_dialog_get_property (GObject * object,
                                 guint property_id,
                                 GValue * value,
                                 GParamSpec * pspec)
{
	ErrorDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_ERROR_DIALOG, ErrorDialog);
	switch (property_id) {
		case ERROR_DIALOG_HEADING_PROPERTY:
		g_value_set_string (value, error_dialog_get_heading (self));
		break;
		case ERROR_DIALOG_DETAILS_PROPERTY:
		g_value_set_string (value, error_dialog_get_details (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_error_dialog_set_property (GObject * object,
                                 guint property_id,
                                 const GValue * value,
                                 GParamSpec * pspec)
{
	ErrorDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_ERROR_DIALOG, ErrorDialog);
	switch (property_id) {
		case ERROR_DIALOG_HEADING_PROPERTY:
		error_dialog_set_heading (self, g_value_get_string (value));
		break;
		case ERROR_DIALOG_DETAILS_PROPERTY:
		error_dialog_set_details (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

