/* RestoreTargetDialog.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from RestoreTargetDialog.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>
#include "deja.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 TYPE_ACTION_DIALOG (action_dialog_get_type ())
#define ACTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ACTION_DIALOG, ActionDialog))
#define ACTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ACTION_DIALOG, ActionDialogClass))
#define IS_ACTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ACTION_DIALOG))
#define IS_ACTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ACTION_DIALOG))
#define ACTION_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ACTION_DIALOG, ActionDialogClass))

typedef struct _ActionDialog ActionDialog;
typedef struct _ActionDialogClass ActionDialogClass;
typedef struct _ActionDialogPrivate ActionDialogPrivate;

#define TYPE_RESTORE_TARGET_DIALOG (restore_target_dialog_get_type ())
#define RESTORE_TARGET_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTORE_TARGET_DIALOG, RestoreTargetDialog))
#define RESTORE_TARGET_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTORE_TARGET_DIALOG, RestoreTargetDialogClass))
#define IS_RESTORE_TARGET_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTORE_TARGET_DIALOG))
#define IS_RESTORE_TARGET_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTORE_TARGET_DIALOG))
#define RESTORE_TARGET_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTORE_TARGET_DIALOG, RestoreTargetDialogClass))

typedef struct _RestoreTargetDialog RestoreTargetDialog;
typedef struct _RestoreTargetDialogClass RestoreTargetDialogClass;
typedef struct _RestoreTargetDialogPrivate RestoreTargetDialogPrivate;

#define TYPE_FOLDER_CHOOSER_BUTTON (folder_chooser_button_get_type ())
#define FOLDER_CHOOSER_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOLDER_CHOOSER_BUTTON, FolderChooserButton))
#define FOLDER_CHOOSER_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOLDER_CHOOSER_BUTTON, FolderChooserButtonClass))
#define IS_FOLDER_CHOOSER_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOLDER_CHOOSER_BUTTON))
#define IS_FOLDER_CHOOSER_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOLDER_CHOOSER_BUTTON))
#define FOLDER_CHOOSER_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOLDER_CHOOSER_BUTTON, FolderChooserButtonClass))

typedef struct _FolderChooserButton FolderChooserButton;
typedef struct _FolderChooserButtonClass FolderChooserButtonClass;

#define TYPE_HELP_BUTTON (help_button_get_type ())
#define HELP_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HELP_BUTTON, HelpButton))
#define HELP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HELP_BUTTON, HelpButtonClass))
#define IS_HELP_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HELP_BUTTON))
#define IS_HELP_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HELP_BUTTON))
#define HELP_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HELP_BUTTON, HelpButtonClass))

typedef struct _HelpButton HelpButton;
typedef struct _HelpButtonClass HelpButtonClass;

#define TYPE_RESTORE_TARGET_WARNING_BUTTON (restore_target_warning_button_get_type ())
#define RESTORE_TARGET_WARNING_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTORE_TARGET_WARNING_BUTTON, RestoreTargetWarningButton))
#define RESTORE_TARGET_WARNING_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTORE_TARGET_WARNING_BUTTON, RestoreTargetWarningButtonClass))
#define IS_RESTORE_TARGET_WARNING_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTORE_TARGET_WARNING_BUTTON))
#define IS_RESTORE_TARGET_WARNING_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTORE_TARGET_WARNING_BUTTON))
#define RESTORE_TARGET_WARNING_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTORE_TARGET_WARNING_BUTTON, RestoreTargetWarningButtonClass))

typedef struct _RestoreTargetWarningButton RestoreTargetWarningButton;
typedef struct _RestoreTargetWarningButtonClass RestoreTargetWarningButtonClass;
enum  {
	RESTORE_TARGET_DIALOG_0_PROPERTY,
	RESTORE_TARGET_DIALOG_RESTORE_LOCATION_PROPERTY,
	RESTORE_TARGET_DIALOG_NUM_PROPERTIES
};
static GParamSpec* restore_target_dialog_properties[RESTORE_TARGET_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)))
typedef struct _Block11Data Block11Data;

struct _ActionDialog {
	AdwDialog parent_instance;
	ActionDialogPrivate * priv;
};

struct _ActionDialogClass {
	AdwDialogClass parent_class;
	void (*accept) (ActionDialog* self);
};

struct _RestoreTargetDialog {
	ActionDialog parent_instance;
	RestoreTargetDialogPrivate * priv;
};

struct _RestoreTargetDialogClass {
	ActionDialogClass parent_class;
};

struct _RestoreTargetDialogPrivate {
	gchar* _restore_location;
	AdwActionRow* orig_row;
	AdwActionRow* folder_row;
	GtkCheckButton* folder_radio;
	AdwEntryRow* folder_entry;
	FolderChooserButton* open_button;
	RestoreTargetWarningButton* orig_warning;
	RestoreTargetWarningButton* folder_warning;
	DejaDupFileTree* tree;
	GList* restore_files;
};

struct _Block11Data {
	int _ref_count_;
	RestoreTargetDialog* self;
	gchar* label;
};

static gint RestoreTargetDialog_private_offset;
static gpointer restore_target_dialog_parent_class = NULL;

VALA_EXTERN GType action_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ActionDialog, g_object_unref)
VALA_EXTERN GType restore_target_dialog_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RestoreTargetDialog, g_object_unref)
VALA_EXTERN GType folder_chooser_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FolderChooserButton, g_object_unref)
VALA_EXTERN GType help_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (HelpButton, g_object_unref)
VALA_EXTERN GType restore_target_warning_button_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (RestoreTargetWarningButton, g_object_unref)
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
VALA_EXTERN RestoreTargetDialog* restore_target_dialog_new (DejaDupFileTree* tree,
                                                GList* restore_files);
VALA_EXTERN RestoreTargetDialog* restore_target_dialog_construct (GType object_type,
                                                      DejaDupFileTree* tree,
                                                      GList* restore_files);
static void restore_target_dialog_update_responses (RestoreTargetDialog* self);
static void restore_target_dialog_handle_file_selected (RestoreTargetDialog* self);
VALA_EXTERN const gchar* folder_chooser_button_get_path (FolderChooserButton* self);
static void _restore_target_dialog_handle_file_selected_folder_chooser_button_file_selected (FolderChooserButton* _sender,
                                                                                      gpointer self);
static Block11Data* block11_data_ref (Block11Data* _data11_);
static void block11_data_unref (void * _userdata_);
VALA_EXTERN void action_dialog_set_accept_enabled (ActionDialog* self,
                                       gboolean value);
static void restore_target_dialog_set_restore_location (RestoreTargetDialog* self,
                                                 const gchar* value);
VALA_EXTERN GList* restore_file_tester_get_bad_paths (const gchar* prefix,
                                          DejaDupFileTree* tree,
                                          gboolean* all_bad,
                                          GList* files);
VALA_EXTERN const gchar* restore_target_dialog_get_restore_location (RestoreTargetDialog* self);
static void ___lambda19_ (Block11Data* _data11_,
                   const gchar* file);
static void ____lambda19__gfunc (gconstpointer data,
                          gpointer self);
VALA_EXTERN void restore_target_warning_button_set_label (RestoreTargetWarningButton* self,
                                              const gchar* value);
static void _g_free0_ (gpointer var);
static inline void _g_list_free__g_free0_ (GList* self);
static void _restore_target_dialog_update_responses_gtk_editable_changed (GtkEditable* _sender,
                                                                   gpointer self);
static void restore_target_dialog_finalize (GObject * obj);
static GType restore_target_dialog_get_type_once (void);
static void _vala_restore_target_dialog_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_restore_target_dialog_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);

static inline gpointer
restore_target_dialog_get_instance_private (RestoreTargetDialog* self)
{
	return G_STRUCT_MEMBER_P (self, RestoreTargetDialog_private_offset);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

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

RestoreTargetDialog*
restore_target_dialog_construct (GType object_type,
                                 DejaDupFileTree* tree,
                                 GList* restore_files)
{
	RestoreTargetDialog * self = NULL;
	DejaDupFileTree* _tmp0_;
	GList* _tmp1_;
	g_return_val_if_fail (tree != NULL, NULL);
	self = (RestoreTargetDialog*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (tree);
	_g_object_unref0 (self->priv->tree);
	self->priv->tree = _tmp0_;
	_tmp1_ = g_list_copy_deep (restore_files, (GCopyFunc) g_object_ref, NULL);
	(self->priv->restore_files == NULL) ? NULL : (self->priv->restore_files = (_g_list_free__g_object_unref0_ (self->priv->restore_files), NULL));
	self->priv->restore_files = _tmp1_;
	restore_target_dialog_update_responses (self);
	return self;
}

RestoreTargetDialog*
restore_target_dialog_new (DejaDupFileTree* tree,
                           GList* restore_files)
{
	return restore_target_dialog_construct (TYPE_RESTORE_TARGET_DIALOG, tree, restore_files);
}

static void
restore_target_dialog_handle_file_selected (RestoreTargetDialog* self)
{
	AdwEntryRow* _tmp0_;
	FolderChooserButton* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->folder_entry;
	_tmp1_ = self->priv->open_button;
	_tmp2_ = folder_chooser_button_get_path (_tmp1_);
	_tmp3_ = _tmp2_;
	gtk_editable_set_text ((GtkEditable*) _tmp0_, _tmp3_);
}

static void
_restore_target_dialog_handle_file_selected_folder_chooser_button_file_selected (FolderChooserButton* _sender,
                                                                                 gpointer self)
{
	restore_target_dialog_handle_file_selected ((RestoreTargetDialog*) self);
}

static Block11Data*
block11_data_ref (Block11Data* _data11_)
{
	g_atomic_int_inc (&_data11_->_ref_count_);
	return _data11_;
}

static void
block11_data_unref (void * _userdata_)
{
	Block11Data* _data11_;
	_data11_ = (Block11Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data11_->_ref_count_)) {
		RestoreTargetDialog* self;
		self = _data11_->self;
		_g_free0 (_data11_->label);
		_g_object_unref0 (self);
		g_slice_free (Block11Data, _data11_);
	}
}

static void
___lambda19_ (Block11Data* _data11_,
              const gchar* file)
{
	RestoreTargetDialog* self;
	const gchar* _tmp0_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	self = _data11_->self;
	g_return_if_fail (file != NULL);
	_tmp0_ = _data11_->label;
	if (g_strcmp0 (_tmp0_, "") != 0) {
		const gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = _data11_->label;
		_tmp2_ = g_strconcat (_tmp1_, "\n", NULL);
		_g_free0 (_data11_->label);
		_data11_->label = _tmp2_;
	}
	_tmp3_ = _data11_->label;
	_tmp4_ = g_strconcat (_tmp3_, file, NULL);
	_g_free0 (_data11_->label);
	_data11_->label = _tmp4_;
}

static void
____lambda19__gfunc (gconstpointer data,
                     gpointer self)
{
	___lambda19_ (self, (const gchar*) data);
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static inline void
_g_list_free__g_free0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_free0_);
}

static void
restore_target_dialog_update_responses (RestoreTargetDialog* self)
{
	Block11Data* _data11_;
	RestoreTargetWarningButton* _tmp0_;
	AdwActionRow* _tmp1_;
	RestoreTargetWarningButton* _tmp2_;
	AdwActionRow* _tmp3_;
	AdwEntryRow* _tmp4_;
	gboolean _tmp5_ = FALSE;
	GtkCheckButton* _tmp6_;
	gboolean _tmp7_;
	gboolean _tmp8_;
	GtkCheckButton* _tmp12_;
	gboolean _tmp13_;
	gboolean _tmp14_;
	gchar* _tmp20_;
	GList* bad_files = NULL;
	const gchar* _tmp21_;
	DejaDupFileTree* _tmp22_;
	GList* _tmp23_;
	GList* _tmp24_;
	GList* _tmp25_;
	GList* _tmp40_;
	g_return_if_fail (self != NULL);
	_data11_ = g_slice_new0 (Block11Data);
	_data11_->_ref_count_ = 1;
	_data11_->self = g_object_ref (self);
	_tmp0_ = self->priv->orig_warning;
	gtk_widget_set_visible ((GtkWidget*) _tmp0_, FALSE);
	_tmp1_ = self->priv->orig_row;
	gtk_widget_remove_css_class ((GtkWidget*) _tmp1_, "error");
	_tmp2_ = self->priv->folder_warning;
	gtk_widget_set_visible ((GtkWidget*) _tmp2_, FALSE);
	_tmp3_ = self->priv->folder_row;
	gtk_widget_remove_css_class ((GtkWidget*) _tmp3_, "error");
	_tmp4_ = self->priv->folder_entry;
	gtk_widget_remove_css_class ((GtkWidget*) _tmp4_, "error");
	_tmp6_ = self->priv->folder_radio;
	_tmp7_ = gtk_check_button_get_active (_tmp6_);
	_tmp8_ = _tmp7_;
	if (_tmp8_) {
		AdwEntryRow* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp9_ = self->priv->folder_entry;
		_tmp10_ = gtk_editable_get_text ((GtkEditable*) _tmp9_);
		_tmp11_ = _tmp10_;
		_tmp5_ = g_strcmp0 (_tmp11_, "") == 0;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		action_dialog_set_accept_enabled ((ActionDialog*) self, FALSE);
		block11_data_unref (_data11_);
		_data11_ = NULL;
		return;
	}
	restore_target_dialog_set_restore_location (self, "/");
	_tmp12_ = self->priv->folder_radio;
	_tmp13_ = gtk_check_button_get_active (_tmp12_);
	_tmp14_ = _tmp13_;
	if (_tmp14_) {
		AdwEntryRow* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		gchar* _tmp18_;
		gchar* _tmp19_;
		_tmp15_ = self->priv->folder_entry;
		_tmp16_ = gtk_editable_get_text ((GtkEditable*) _tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = deja_dup_resolve_user_dir (_tmp17_);
		_tmp19_ = _tmp18_;
		restore_target_dialog_set_restore_location (self, _tmp19_);
		_g_free0 (_tmp19_);
	}
	_tmp20_ = g_strdup ("");
	_data11_->label = _tmp20_;
	_tmp21_ = self->priv->_restore_location;
	_tmp22_ = self->priv->tree;
	_tmp23_ = self->priv->restore_files;
	_tmp24_ = restore_file_tester_get_bad_paths (_tmp21_, _tmp22_, NULL, _tmp23_);
	bad_files = _tmp24_;
	_tmp25_ = bad_files;
	if (g_list_length (_tmp25_) > ((guint) 0)) {
		GCompareFunc _tmp26_;
		GList* _tmp27_;
		GtkCheckButton* _tmp28_;
		gboolean _tmp29_;
		gboolean _tmp30_;
		_tmp26_ = ((GCompareFunc) g_strcmp0);
		bad_files = g_list_sort (bad_files, _tmp26_);
		_tmp27_ = bad_files;
		g_list_foreach (_tmp27_, ____lambda19__gfunc, _data11_);
		_tmp28_ = self->priv->folder_radio;
		_tmp29_ = gtk_check_button_get_active (_tmp28_);
		_tmp30_ = _tmp29_;
		if (_tmp30_) {
			RestoreTargetWarningButton* _tmp31_;
			const gchar* _tmp32_;
			RestoreTargetWarningButton* _tmp33_;
			AdwActionRow* _tmp34_;
			AdwEntryRow* _tmp35_;
			_tmp31_ = self->priv->folder_warning;
			_tmp32_ = _data11_->label;
			restore_target_warning_button_set_label (_tmp31_, _tmp32_);
			_tmp33_ = self->priv->folder_warning;
			gtk_widget_set_visible ((GtkWidget*) _tmp33_, TRUE);
			_tmp34_ = self->priv->folder_row;
			gtk_widget_add_css_class ((GtkWidget*) _tmp34_, "error");
			_tmp35_ = self->priv->folder_entry;
			gtk_widget_add_css_class ((GtkWidget*) _tmp35_, "error");
		} else {
			RestoreTargetWarningButton* _tmp36_;
			const gchar* _tmp37_;
			RestoreTargetWarningButton* _tmp38_;
			AdwActionRow* _tmp39_;
			_tmp36_ = self->priv->orig_warning;
			_tmp37_ = _data11_->label;
			restore_target_warning_button_set_label (_tmp36_, _tmp37_);
			_tmp38_ = self->priv->orig_warning;
			gtk_widget_set_visible ((GtkWidget*) _tmp38_, TRUE);
			_tmp39_ = self->priv->orig_row;
			gtk_widget_add_css_class ((GtkWidget*) _tmp39_, "error");
		}
	}
	_tmp40_ = bad_files;
	action_dialog_set_accept_enabled ((ActionDialog*) self, g_list_length (_tmp40_) == ((guint) 0));
	(bad_files == NULL) ? NULL : (bad_files = (_g_list_free__g_free0_ (bad_files), NULL));
	block11_data_unref (_data11_);
	_data11_ = NULL;
}

static void
_restore_target_dialog_update_responses_gtk_editable_changed (GtkEditable* _sender,
                                                              gpointer self)
{
	restore_target_dialog_update_responses ((RestoreTargetDialog*) self);
}

const gchar*
restore_target_dialog_get_restore_location (RestoreTargetDialog* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_restore_location;
	result = _tmp0_;
	return result;
}

static void
restore_target_dialog_set_restore_location (RestoreTargetDialog* self,
                                            const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = restore_target_dialog_get_restore_location (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_restore_location);
		self->priv->_restore_location = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, restore_target_dialog_properties[RESTORE_TARGET_DIALOG_RESTORE_LOCATION_PROPERTY]);
	}
}

static void
restore_target_dialog_class_init (RestoreTargetDialogClass * klass,
                                  gpointer klass_data)
{
	restore_target_dialog_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &RestoreTargetDialog_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_restore_target_dialog_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_restore_target_dialog_set_property;
	G_OBJECT_CLASS (klass)->finalize = restore_target_dialog_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), RESTORE_TARGET_DIALOG_RESTORE_LOCATION_PROPERTY, restore_target_dialog_properties[RESTORE_TARGET_DIALOG_RESTORE_LOCATION_PROPERTY] = g_param_spec_string ("restore-location", "restore-location", "restore-location", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/DejaDup/RestoreTargetDialog.ui");
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "orig_row", FALSE, RestoreTargetDialog_private_offset + G_STRUCT_OFFSET (RestoreTargetDialogPrivate, orig_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "folder_row", FALSE, RestoreTargetDialog_private_offset + G_STRUCT_OFFSET (RestoreTargetDialogPrivate, folder_row));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "folder_radio", FALSE, RestoreTargetDialog_private_offset + G_STRUCT_OFFSET (RestoreTargetDialogPrivate, folder_radio));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "folder_entry", FALSE, RestoreTargetDialog_private_offset + G_STRUCT_OFFSET (RestoreTargetDialogPrivate, folder_entry));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "open_button", FALSE, RestoreTargetDialog_private_offset + G_STRUCT_OFFSET (RestoreTargetDialogPrivate, open_button));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "orig_warning", FALSE, RestoreTargetDialog_private_offset + G_STRUCT_OFFSET (RestoreTargetDialogPrivate, orig_warning));
	gtk_widget_class_bind_template_child_full (GTK_WIDGET_CLASS (klass), "folder_warning", FALSE, RestoreTargetDialog_private_offset + G_STRUCT_OFFSET (RestoreTargetDialogPrivate, folder_warning));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "handle_file_selected", G_CALLBACK(_restore_target_dialog_handle_file_selected_folder_chooser_button_file_selected));
	gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (klass), "update_responses", G_CALLBACK(_restore_target_dialog_update_responses_gtk_editable_changed));
}

static void
restore_target_dialog_instance_init (RestoreTargetDialog * self,
                                     gpointer klass)
{
	self->priv = restore_target_dialog_get_instance_private (self);
	g_type_ensure (TYPE_FOLDER_CHOOSER_BUTTON);
	g_type_ensure (TYPE_RESTORE_TARGET_WARNING_BUTTON);
	g_type_ensure (TYPE_RESTORE_TARGET_WARNING_BUTTON);
	gtk_widget_init_template (GTK_WIDGET (self));
}

static void
restore_target_dialog_finalize (GObject * obj)
{
	RestoreTargetDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_RESTORE_TARGET_DIALOG, RestoreTargetDialog);
	_g_free0 (self->priv->_restore_location);
	_g_object_unref0 (self->priv->tree);
	(self->priv->restore_files == NULL) ? NULL : (self->priv->restore_files = (_g_list_free__g_object_unref0_ (self->priv->restore_files), NULL));
	G_OBJECT_CLASS (restore_target_dialog_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
restore_target_dialog_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (RestoreTargetDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restore_target_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RestoreTargetDialog), 0, (GInstanceInitFunc) restore_target_dialog_instance_init, NULL };
	GType restore_target_dialog_type_id;
	restore_target_dialog_type_id = g_type_register_static (TYPE_ACTION_DIALOG, "RestoreTargetDialog", &g_define_type_info, 0);
	RestoreTargetDialog_private_offset = g_type_add_instance_private (restore_target_dialog_type_id, sizeof (RestoreTargetDialogPrivate));
	return restore_target_dialog_type_id;
}

GType
restore_target_dialog_get_type (void)
{
	static gsize restore_target_dialog_type_id__once = 0;
	if (g_once_init_enter (&restore_target_dialog_type_id__once)) {
		GType restore_target_dialog_type_id;
		restore_target_dialog_type_id = restore_target_dialog_get_type_once ();
		g_once_init_leave (&restore_target_dialog_type_id__once, restore_target_dialog_type_id);
	}
	return restore_target_dialog_type_id__once;
}

static void
_vala_restore_target_dialog_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	RestoreTargetDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_RESTORE_TARGET_DIALOG, RestoreTargetDialog);
	switch (property_id) {
		case RESTORE_TARGET_DIALOG_RESTORE_LOCATION_PROPERTY:
		g_value_set_string (value, restore_target_dialog_get_restore_location (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_restore_target_dialog_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	RestoreTargetDialog * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_RESTORE_TARGET_DIALOG, RestoreTargetDialog);
	switch (property_id) {
		case RESTORE_TARGET_DIALOG_RESTORE_LOCATION_PROPERTY:
		restore_target_dialog_set_restore_location (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

