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

/* PasswordDialog.vala
 *
 * Copyright 2024 Diego Iván <diegoivan.mae@gmail.com>
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <glib.h>
#include <glib-object.h>
#include <adwaita.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.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 PAPER_CLIP_TYPE_PASSWORD_DIALOG_ERROR (paper_clip_password_dialog_error_get_type ())

#define PAPER_CLIP_TYPE_PASSWORD_DIALOG (paper_clip_password_dialog_get_type ())
#define PAPER_CLIP_PASSWORD_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PAPER_CLIP_TYPE_PASSWORD_DIALOG, PaperClipPasswordDialog))
#define PAPER_CLIP_PASSWORD_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PAPER_CLIP_TYPE_PASSWORD_DIALOG, PaperClipPasswordDialogClass))
#define PAPER_CLIP_IS_PASSWORD_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PAPER_CLIP_TYPE_PASSWORD_DIALOG))
#define PAPER_CLIP_IS_PASSWORD_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PAPER_CLIP_TYPE_PASSWORD_DIALOG))
#define PAPER_CLIP_PASSWORD_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAPER_CLIP_TYPE_PASSWORD_DIALOG, PaperClipPasswordDialogClass))

typedef struct _PaperClipPasswordDialog PaperClipPasswordDialog;
typedef struct _PaperClipPasswordDialogClass PaperClipPasswordDialogClass;
typedef struct _PaperClipPasswordDialogPrivate PaperClipPasswordDialogPrivate;
typedef struct _PaperClipAsyncTask PaperClipAsyncTask;
enum  {
	PAPER_CLIP_PASSWORD_DIALOG_0_PROPERTY,
	PAPER_CLIP_PASSWORD_DIALOG_NUM_PROPERTIES
};
static GParamSpec* paper_clip_password_dialog_properties[PAPER_CLIP_PASSWORD_DIALOG_NUM_PROPERTIES];
#define _paper_clip_async_task_free0(var) ((var == NULL) ? NULL : (var = (paper_clip_async_task_free (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define PAPER_CLIP_TYPE_DOCUMENT (paper_clip_document_get_type ())
#define PAPER_CLIP_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PAPER_CLIP_TYPE_DOCUMENT, PaperClipDocument))
#define PAPER_CLIP_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PAPER_CLIP_TYPE_DOCUMENT, PaperClipDocumentClass))
#define PAPER_CLIP_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PAPER_CLIP_TYPE_DOCUMENT))
#define PAPER_CLIP_IS_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PAPER_CLIP_TYPE_DOCUMENT))
#define PAPER_CLIP_DOCUMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PAPER_CLIP_TYPE_DOCUMENT, PaperClipDocumentClass))

typedef struct _PaperClipDocument PaperClipDocument;
typedef struct _PaperClipDocumentClass PaperClipDocumentClass;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef enum  {
	PAPER_CLIP_TASK_STATUS_CANCELLED,
	PAPER_CLIP_TASK_STATUS_SUCCEEDED,
	PAPER_CLIP_TASK_STATUS_RUNNING
} PaperClipTaskStatus;

#define PAPER_CLIP_TYPE_TASK_STATUS (paper_clip_task_status_get_type ())
typedef struct _PaperClipPasswordDialogDecryptData PaperClipPasswordDialogDecryptData;
typedef void (*GSimpleActionActivateCallback) (GSimpleAction* action, GVariant* parameter, gpointer user_data);
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

typedef enum  {
	PAPER_CLIP_PASSWORD_DIALOG_ERROR_CANCELLED
} PaperClipPasswordDialogError;
#define PAPER_CLIP_PASSWORD_DIALOG_ERROR paper_clip_password_dialog_error_quark ()

struct _PaperClipPasswordDialog {
	AdwDialog parent_instance;
	PaperClipPasswordDialogPrivate * priv;
};

struct _PaperClipPasswordDialogClass {
	AdwDialogClass parent_class;
};

struct _PaperClipPasswordDialogPrivate {
	AdwPasswordEntryRow* password_entry;
	AdwStatusPage* status_page;
	PaperClipAsyncTask* task;
};

struct _PaperClipAsyncTask {
	PaperClipTaskStatus status;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
};

struct _PaperClipPasswordDialogDecryptData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	PaperClipPasswordDialog* self;
	GFile* file;
	GtkWindow* parent;
	GCancellable* cancellable;
	PaperClipDocument* result;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	AdwStatusPage* _tmp3_;
	PaperClipAsyncTask* _tmp4_;
	PaperClipAsyncTask* _tmp5_;
	GError* _tmp6_;
	PaperClipDocument* _tmp7_;
	AdwPasswordEntryRow* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	PaperClipDocument* _tmp11_;
	PaperClipDocument* _tmp12_;
	GError* _inner_error0_;
};

static gint PaperClipPasswordDialog_private_offset;
static gpointer paper_clip_password_dialog_parent_class = NULL;

VALA_EXTERN GQuark paper_clip_password_dialog_error_quark (void);
VALA_EXTERN GType paper_clip_password_dialog_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType paper_clip_password_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PaperClipPasswordDialog, g_object_unref)
VALA_EXTERN void paper_clip_async_task_free (PaperClipAsyncTask * self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PaperClipAsyncTask, paper_clip_async_task_free)
static void paper_clip_password_dialog_decrypt_data_free (gpointer _data);
VALA_EXTERN GType paper_clip_document_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PaperClipDocument, g_object_unref)
VALA_EXTERN void paper_clip_password_dialog_decrypt (PaperClipPasswordDialog* self,
                                         GFile* file,
                                         GtkWindow* parent,
                                         GCancellable* cancellable,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
VALA_EXTERN PaperClipDocument* paper_clip_password_dialog_decrypt_finish (PaperClipPasswordDialog* self,
                                                              GAsyncResult* _res_,
                                                              GError** error);
static gboolean paper_clip_password_dialog_decrypt_co (PaperClipPasswordDialogDecryptData* _data_);
static gboolean _paper_clip_password_dialog_decrypt_co_gsource_func (gpointer self);
VALA_EXTERN PaperClipAsyncTask* paper_clip_async_task_new (GSourceFunc callback,
                                               gpointer callback_target,
                                               GDestroyNotify callback_target_destroy_notify);
static void paper_clip_password_dialog_cancel_task (PaperClipPasswordDialog* self);
static void _paper_clip_password_dialog_cancel_task_g_cancellable_cancelled (GCancellable* _sender,
                                                                      gpointer self);
VALA_EXTERN GType paper_clip_task_status_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void paper_clip_document_new (GFile* original_file,
                              const gchar* password,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_);
VALA_EXTERN PaperClipDocument* paper_clip_document_new_finish (GAsyncResult* _res_,
                                                   GError** error);
VALA_EXTERN void paper_clip_document_construct (GType object_type,
                                    GFile* original_file,
                                    const gchar* password,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN PaperClipDocument* paper_clip_document_construct_finish (GAsyncResult* _res_,
                                                         GError** error);
static void paper_clip_password_dialog_decrypt_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void paper_clip_password_dialog_on_closed (PaperClipPasswordDialog* self);
static void _paper_clip_password_dialog_on_closed_adw_dialog_closed (AdwDialog* _sender,
                                                              gpointer self);
static void paper_clip_password_dialog_success_task (PaperClipPasswordDialog* self);
static void _paper_clip_password_dialog_success_task_gtk_button_clicked (GtkButton* _sender,
                                                                  gpointer self);
VALA_EXTERN PaperClipPasswordDialog* paper_clip_password_dialog_new (void);
VALA_EXTERN PaperClipPasswordDialog* paper_clip_password_dialog_construct (GType object_type);
static GObject * paper_clip_password_dialog_constructor (GType type,
                                                  guint n_construct_properties,
                                                  GObjectConstructParam * construct_properties);
static void _paper_clip_password_dialog_success_task_gsimple_action_activate_callback (GSimpleAction* action,
                                                                                GVariant* parameter,
                                                                                gpointer self);
static void _paper_clip_password_dialog_cancel_task_gsimple_action_activate_callback (GSimpleAction* action,
                                                                               GVariant* parameter,
                                                                               gpointer self);
static void paper_clip_password_dialog_finalize (GObject * obj);
static GType paper_clip_password_dialog_get_type_once (void);

GQuark
paper_clip_password_dialog_error_quark (void)
{
	return g_quark_from_static_string ("paper-clip-password-dialog-error-quark");
}

static GType
paper_clip_password_dialog_error_get_type_once (void)
{
	static const GEnumValue values[] = {{PAPER_CLIP_PASSWORD_DIALOG_ERROR_CANCELLED, "PAPER_CLIP_PASSWORD_DIALOG_ERROR_CANCELLED", "cancelled"}, {0, NULL, NULL}};
	GType paper_clip_password_dialog_error_type_id;
	paper_clip_password_dialog_error_type_id = g_enum_register_static ("PaperClipPasswordDialogError", values);
	return paper_clip_password_dialog_error_type_id;
}

GType
paper_clip_password_dialog_error_get_type (void)
{
	static volatile gsize paper_clip_password_dialog_error_type_id__once = 0;
	if (g_once_init_enter (&paper_clip_password_dialog_error_type_id__once)) {
		GType paper_clip_password_dialog_error_type_id;
		paper_clip_password_dialog_error_type_id = paper_clip_password_dialog_error_get_type_once ();
		g_once_init_leave (&paper_clip_password_dialog_error_type_id__once, paper_clip_password_dialog_error_type_id);
	}
	return paper_clip_password_dialog_error_type_id__once;
}

static inline gpointer
paper_clip_password_dialog_get_instance_private (PaperClipPasswordDialog* self)
{
	return G_STRUCT_MEMBER_P (self, PaperClipPasswordDialog_private_offset);
}

static void
paper_clip_password_dialog_decrypt_data_free (gpointer _data)
{
	PaperClipPasswordDialogDecryptData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file);
	_g_object_unref0 (_data_->parent);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (PaperClipPasswordDialogDecryptData, _data_);
}

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

void
paper_clip_password_dialog_decrypt (PaperClipPasswordDialog* self,
                                    GFile* file,
                                    GtkWindow* parent,
                                    GCancellable* cancellable,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	PaperClipPasswordDialogDecryptData* _data_;
	PaperClipPasswordDialog* _tmp0_;
	GFile* _tmp1_;
	GtkWindow* _tmp2_;
	GCancellable* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file != NULL);
	_data_ = g_slice_new0 (PaperClipPasswordDialogDecryptData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, paper_clip_password_dialog_decrypt_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (file);
	_g_object_unref0 (_data_->file);
	_data_->file = _tmp1_;
	_tmp2_ = _g_object_ref0 (parent);
	_g_object_unref0 (_data_->parent);
	_data_->parent = _tmp2_;
	_tmp3_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp3_;
	paper_clip_password_dialog_decrypt_co (_data_);
}

PaperClipDocument*
paper_clip_password_dialog_decrypt_finish (PaperClipPasswordDialog* self,
                                           GAsyncResult* _res_,
                                           GError** error)
{
	PaperClipDocument* result;
	PaperClipPasswordDialogDecryptData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static gboolean
_paper_clip_password_dialog_decrypt_co_gsource_func (gpointer self)
{
	gboolean result;
	result = paper_clip_password_dialog_decrypt_co (self);
	return result;
}

static void
_paper_clip_password_dialog_cancel_task_g_cancellable_cancelled (GCancellable* _sender,
                                                                 gpointer self)
{
	paper_clip_password_dialog_cancel_task ((PaperClipPasswordDialog*) self);
}

static void
paper_clip_password_dialog_decrypt_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	PaperClipPasswordDialogDecryptData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	paper_clip_password_dialog_decrypt_co (_data_);
}

static gboolean
paper_clip_password_dialog_decrypt_co (PaperClipPasswordDialogDecryptData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = g_file_get_basename (_data_->file);
	_data_->_tmp0_ = _data_->_tmp1_;
	if (_data_->_tmp0_ == NULL) {
		_data_->_tmp2_ = g_strdup ("");
		_g_free0 (_data_->_tmp0_);
		_data_->_tmp0_ = _data_->_tmp2_;
	}
	_data_->_tmp3_ = _data_->self->priv->status_page;
	adw_status_page_set_description (_data_->_tmp3_, _data_->_tmp0_);
	_data_->_tmp4_ = paper_clip_async_task_new (_paper_clip_password_dialog_decrypt_co_gsource_func, _data_, NULL);
	_paper_clip_async_task_free0 (_data_->self->priv->task);
	_data_->self->priv->task = _data_->_tmp4_;
	if (_data_->cancellable != NULL) {
		g_signal_connect_object (_data_->cancellable, "cancelled", (GCallback) _paper_clip_password_dialog_cancel_task_g_cancellable_cancelled, _data_->self, 0);
	}
	adw_dialog_present ((AdwDialog*) _data_->self, (GtkWidget*) _data_->parent);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	adw_dialog_close ((AdwDialog*) _data_->self);
	_data_->_tmp5_ = _data_->self->priv->task;
	if (_data_->_tmp5_->status == PAPER_CLIP_TASK_STATUS_CANCELLED) {
		_data_->_tmp6_ = g_error_new_literal (PAPER_CLIP_PASSWORD_DIALOG_ERROR, PAPER_CLIP_PASSWORD_DIALOG_ERROR_CANCELLED, "Use cancelled the operation");
		_data_->_inner_error0_ = _data_->_tmp6_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->_tmp0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp8_ = _data_->self->priv->password_entry;
	_data_->_tmp9_ = gtk_editable_get_text ((GtkEditable*) _data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_state_ = 2;
	paper_clip_document_new (_data_->file, _data_->_tmp10_, paper_clip_password_dialog_decrypt_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp11_ = paper_clip_document_new_finish (_data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp7_ = _data_->_tmp11_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_free0 (_data_->_tmp0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp12_ = _data_->_tmp7_;
	_data_->_tmp7_ = NULL;
	_data_->result = _data_->_tmp12_;
	_g_object_unref0 (_data_->_tmp7_);
	_g_free0 (_data_->_tmp0_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
paper_clip_password_dialog_on_closed (PaperClipPasswordDialog* self)
{
	PaperClipAsyncTask* _tmp0_;
	PaperClipAsyncTask* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->task;
	_vala_return_if_fail (_tmp0_ != NULL, "task != null");
	_tmp1_ = self->priv->task;
	_vala_return_if_fail (_tmp1_->status == PAPER_CLIP_TASK_STATUS_RUNNING, "task.status == RUNNING");
	paper_clip_password_dialog_cancel_task (self);
}

static void
_paper_clip_password_dialog_on_closed_adw_dialog_closed (AdwDialog* _sender,
                                                         gpointer self)
{
	paper_clip_password_dialog_on_closed ((PaperClipPasswordDialog*) self);
}

static void
paper_clip_password_dialog_success_task (PaperClipPasswordDialog* self)
{
	PaperClipAsyncTask* _tmp0_;
	PaperClipAsyncTask* _tmp1_;
	PaperClipAsyncTask* _tmp2_;
	PaperClipAsyncTask* _tmp3_;
	GSourceFunc _tmp4_;
	gpointer _tmp4__target;
	GDestroyNotify _tmp4__target_destroy_notify;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->task;
	_vala_return_if_fail (_tmp0_ != NULL, "task != null");
	_tmp1_ = self->priv->task;
	_vala_return_if_fail (_tmp1_->status == PAPER_CLIP_TASK_STATUS_RUNNING, "task.status == RUNNING");
	_tmp2_ = self->priv->task;
	_tmp2_->status = PAPER_CLIP_TASK_STATUS_SUCCEEDED;
	_tmp3_ = self->priv->task;
	_tmp4_ = _tmp3_->callback;
	_tmp4__target = _tmp3_->callback_target;
	_tmp4__target_destroy_notify = _tmp3_->callback_target_destroy_notify;
	_tmp3_->callback = NULL;
	_tmp3_->callback_target = NULL;
	_tmp3_->callback_target_destroy_notify = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp4_, _tmp4__target, _tmp4__target_destroy_notify);
}

static void
_paper_clip_password_dialog_success_task_gtk_button_clicked (GtkButton* _sender,
                                                             gpointer self)
{
	paper_clip_password_dialog_success_task ((PaperClipPasswordDialog*) self);
}

static void
paper_clip_password_dialog_cancel_task (PaperClipPasswordDialog* self)
{
	PaperClipAsyncTask* _tmp0_;
	PaperClipAsyncTask* _tmp1_;
	PaperClipAsyncTask* _tmp2_;
	PaperClipAsyncTask* _tmp3_;
	GSourceFunc _tmp4_;
	gpointer _tmp4__target;
	GDestroyNotify _tmp4__target_destroy_notify;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->task;
	_vala_return_if_fail (_tmp0_ != NULL, "task != null");
	_tmp1_ = self->priv->task;
	_vala_return_if_fail (_tmp1_->status == PAPER_CLIP_TASK_STATUS_RUNNING, "task.status == RUNNING");
	_tmp2_ = self->priv->task;
	_tmp2_->status = PAPER_CLIP_TASK_STATUS_CANCELLED;
	_tmp3_ = self->priv->task;
	_tmp4_ = _tmp3_->callback;
	_tmp4__target = _tmp3_->callback_target;
	_tmp4__target_destroy_notify = _tmp3_->callback_target_destroy_notify;
	_tmp3_->callback = NULL;
	_tmp3_->callback_target = NULL;
	_tmp3_->callback_target_destroy_notify = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tmp4_, _tmp4__target, _tmp4__target_destroy_notify);
}

PaperClipPasswordDialog*
paper_clip_password_dialog_construct (GType object_type)
{
	PaperClipPasswordDialog * self = NULL;
	self = (PaperClipPasswordDialog*) g_object_new (object_type, NULL);
	return self;
}

PaperClipPasswordDialog*
paper_clip_password_dialog_new (void)
{
	return paper_clip_password_dialog_construct (PAPER_CLIP_TYPE_PASSWORD_DIALOG);
}

static void
_paper_clip_password_dialog_success_task_gsimple_action_activate_callback (GSimpleAction* action,
                                                                           GVariant* parameter,
                                                                           gpointer self)
{
	paper_clip_password_dialog_success_task ((PaperClipPasswordDialog*) self);
}

static void
_paper_clip_password_dialog_cancel_task_gsimple_action_activate_callback (GSimpleAction* action,
                                                                          GVariant* parameter,
                                                                          gpointer self)
{
	paper_clip_password_dialog_cancel_task ((PaperClipPasswordDialog*) self);
}

static GObject *
paper_clip_password_dialog_constructor (GType type,
                                        guint n_construct_properties,
                                        GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	PaperClipPasswordDialog * self;
	GActionEntry* action_entries = NULL;
	GActionEntry _tmp0_ = {0};
	GActionEntry _tmp1_ = {0};
	GActionEntry* _tmp2_;
	gint action_entries_length1;
	gint _action_entries_size_;
	GSimpleActionGroup* action_group = NULL;
	GSimpleActionGroup* _tmp3_;
	GSimpleActionGroup* _tmp4_;
	GActionEntry* _tmp5_;
	gint _tmp5__length1;
	GSimpleActionGroup* _tmp6_;
	parent_class = G_OBJECT_CLASS (paper_clip_password_dialog_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PAPER_CLIP_TYPE_PASSWORD_DIALOG, PaperClipPasswordDialog);
	memset (&_tmp0_, 0, sizeof (GActionEntry));
	_tmp0_.name = "success";
	_tmp0_.activate = _paper_clip_password_dialog_success_task_gsimple_action_activate_callback;
	memset (&_tmp1_, 0, sizeof (GActionEntry));
	_tmp1_.name = "cancel";
	_tmp1_.activate = _paper_clip_password_dialog_cancel_task_gsimple_action_activate_callback;
	_tmp2_ = g_new0 (GActionEntry, 2);
	_tmp2_[0] = _tmp0_;
	_tmp2_[1] = _tmp1_;
	action_entries = _tmp2_;
	action_entries_length1 = 2;
	_action_entries_size_ = action_entries_length1;
	_tmp3_ = g_simple_action_group_new ();
	action_group = _tmp3_;
	_tmp4_ = action_group;
	_tmp5_ = action_entries;
	_tmp5__length1 = action_entries_length1;
	g_action_map_add_action_entries ((GActionMap*) _tmp4_, _tmp5_, (gint) _tmp5__length1, self);
	_tmp6_ = action_group;
	gtk_widget_insert_action_group ((GtkWidget*) self, "dialog", (GActionGroup*) _tmp6_);
	_g_object_unref0 (action_group);
	action_entries = (g_free (action_entries), NULL);
	return obj;
}

static void
paper_clip_password_dialog_class_init (PaperClipPasswordDialogClass * klass,
                                       gpointer klass_data)
{
	paper_clip_password_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &PaperClipPasswordDialog_private_offset);
	G_OBJECT_CLASS (klass)->constructor = paper_clip_password_dialog_constructor;
	G_OBJECT_CLASS (klass)->finalize = paper_clip_password_dialog_finalize;
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/io/github/diegoivan/pdf_metadata_editor/gtk/password-dialog.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "password_entry", FALSE, PaperClipPasswordDialog_private_offset + G_STRUCT_OFFSET (PaperClipPasswordDialogPrivate, password_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "status_page", FALSE, PaperClipPasswordDialog_private_offset + G_STRUCT_OFFSET (PaperClipPasswordDialogPrivate, status_page));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "on_closed", G_CALLBACK(_paper_clip_password_dialog_on_closed_adw_dialog_closed));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "success_task", G_CALLBACK(_paper_clip_password_dialog_success_task_gtk_button_clicked));
}

static void
paper_clip_password_dialog_instance_init (PaperClipPasswordDialog * self,
                                          gpointer klass)
{
	self->priv = paper_clip_password_dialog_get_instance_private (self);
	self->priv->task = NULL;
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
paper_clip_password_dialog_finalize (GObject * obj)
{
	PaperClipPasswordDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PAPER_CLIP_TYPE_PASSWORD_DIALOG, PaperClipPasswordDialog);
	_paper_clip_async_task_free0 (self->priv->task);
	G_OBJECT_CLASS (paper_clip_password_dialog_parent_class)->finalize (obj);
}

static GType
paper_clip_password_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PaperClipPasswordDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) paper_clip_password_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PaperClipPasswordDialog), 0, (GInstanceInitFunc) paper_clip_password_dialog_instance_init, NULL };
	GType paper_clip_password_dialog_type_id;
	paper_clip_password_dialog_type_id = g_type_register_static (adw_dialog_get_type (), "PaperClipPasswordDialog", &g_define_type_info, 0);
	PaperClipPasswordDialog_private_offset = g_type_add_instance_private (paper_clip_password_dialog_type_id, sizeof (PaperClipPasswordDialogPrivate));
	return paper_clip_password_dialog_type_id;
}

GType
paper_clip_password_dialog_get_type (void)
{
	static volatile gsize paper_clip_password_dialog_type_id__once = 0;
	if (g_once_init_enter (&paper_clip_password_dialog_type_id__once)) {
		GType paper_clip_password_dialog_type_id;
		paper_clip_password_dialog_type_id = paper_clip_password_dialog_get_type_once ();
		g_once_init_leave (&paper_clip_password_dialog_type_id__once, paper_clip_password_dialog_type_id);
	}
	return paper_clip_password_dialog_type_id__once;
}

