/* ResticJob.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from ResticJob.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 "deja.h"
#include <glib-object.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <json-glib/json-glib.h>
#include <glib/gi18n-lib.h>
#include <float.h>
#include <math.h>

#define RESTIC_INSTANCE_ERROR_NO_REPOSITORY 10
#define RESTIC_INSTANCE_ERROR_BAD_PASSWORD 12
#define RESTIC_INSTANCE_ERROR_OUT_OF_SPACE -1
#define RESTIC_INSTANCE_ERROR_ALREADY_LOCKED 11
#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

#define DEJA_DUP_TYPE_TOOL_JOBLET (deja_dup_tool_joblet_get_type ())
#define DEJA_DUP_TOOL_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_TOOL_JOBLET, DejaDupToolJoblet))
#define DEJA_DUP_TOOL_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_TOOL_JOBLET, DejaDupToolJobletClass))
#define DEJA_DUP_IS_TOOL_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_TOOL_JOBLET))
#define DEJA_DUP_IS_TOOL_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_TOOL_JOBLET))
#define DEJA_DUP_TOOL_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_TOOL_JOBLET, DejaDupToolJobletClass))

typedef struct _DejaDupToolJoblet DejaDupToolJoblet;
typedef struct _DejaDupToolJobletClass DejaDupToolJobletClass;
typedef struct _DejaDupToolJobletPrivate DejaDupToolJobletPrivate;

#define TYPE_TOOL_INSTANCE (tool_instance_get_type ())
#define TOOL_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TOOL_INSTANCE, ToolInstance))
#define TOOL_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TOOL_INSTANCE, ToolInstanceClass))
#define IS_TOOL_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TOOL_INSTANCE))
#define IS_TOOL_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TOOL_INSTANCE))
#define TOOL_INSTANCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TOOL_INSTANCE, ToolInstanceClass))

typedef struct _ToolInstance ToolInstance;
typedef struct _ToolInstanceClass ToolInstanceClass;

#define TYPE_RESTIC_JOBLET (restic_joblet_get_type ())
#define RESTIC_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_JOBLET, ResticJoblet))
#define RESTIC_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_JOBLET, ResticJobletClass))
#define IS_RESTIC_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_JOBLET))
#define IS_RESTIC_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_JOBLET))
#define RESTIC_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_JOBLET, ResticJobletClass))

typedef struct _ResticJoblet ResticJoblet;
typedef struct _ResticJobletClass ResticJobletClass;
typedef struct _ResticJobletPrivate ResticJobletPrivate;
enum  {
	RESTIC_JOBLET_0_PROPERTY,
	RESTIC_JOBLET_NUM_PROPERTIES
};
static GParamSpec* restic_joblet_properties[RESTIC_JOBLET_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_RESTIC_INSTANCE (restic_instance_get_type ())
#define RESTIC_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_INSTANCE, ResticInstance))
#define RESTIC_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_INSTANCE, ResticInstanceClass))
#define IS_RESTIC_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_INSTANCE))
#define IS_RESTIC_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_INSTANCE))
#define RESTIC_INSTANCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_INSTANCE, ResticInstanceClass))

typedef struct _ResticInstance ResticInstance;
typedef struct _ResticInstanceClass ResticInstanceClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ResticJobletPrepareData ResticJobletPrepareData;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

#define DEJA_DUP_TYPE_TOOL_JOB_CHAIN (deja_dup_tool_job_chain_get_type ())
#define DEJA_DUP_TOOL_JOB_CHAIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_TOOL_JOB_CHAIN, DejaDupToolJobChain))
#define DEJA_DUP_TOOL_JOB_CHAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_TOOL_JOB_CHAIN, DejaDupToolJobChainClass))
#define DEJA_DUP_IS_TOOL_JOB_CHAIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_TOOL_JOB_CHAIN))
#define DEJA_DUP_IS_TOOL_JOB_CHAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_TOOL_JOB_CHAIN))
#define DEJA_DUP_TOOL_JOB_CHAIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_TOOL_JOB_CHAIN, DejaDupToolJobChainClass))

typedef struct _DejaDupToolJobChain DejaDupToolJobChain;
typedef struct _DejaDupToolJobChainClass DejaDupToolJobChainClass;

#define TYPE_RESTIC_INIT_JOBLET (restic_init_joblet_get_type ())
#define RESTIC_INIT_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_INIT_JOBLET, ResticInitJoblet))
#define RESTIC_INIT_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_INIT_JOBLET, ResticInitJobletClass))
#define IS_RESTIC_INIT_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_INIT_JOBLET))
#define IS_RESTIC_INIT_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_INIT_JOBLET))
#define RESTIC_INIT_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_INIT_JOBLET, ResticInitJobletClass))

typedef struct _ResticInitJoblet ResticInitJoblet;
typedef struct _ResticInitJobletClass ResticInitJobletClass;
typedef struct _ResticInitJobletPrivate ResticInitJobletPrivate;
enum  {
	RESTIC_INIT_JOBLET_0_PROPERTY,
	RESTIC_INIT_JOBLET_NUM_PROPERTIES
};
static GParamSpec* restic_init_joblet_properties[RESTIC_INIT_JOBLET_NUM_PROPERTIES];

#define TYPE_RESTIC_UNLOCK_JOBLET (restic_unlock_joblet_get_type ())
#define RESTIC_UNLOCK_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_UNLOCK_JOBLET, ResticUnlockJoblet))
#define RESTIC_UNLOCK_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_UNLOCK_JOBLET, ResticUnlockJobletClass))
#define IS_RESTIC_UNLOCK_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_UNLOCK_JOBLET))
#define IS_RESTIC_UNLOCK_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_UNLOCK_JOBLET))
#define RESTIC_UNLOCK_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_UNLOCK_JOBLET, ResticUnlockJobletClass))

typedef struct _ResticUnlockJoblet ResticUnlockJoblet;
typedef struct _ResticUnlockJobletClass ResticUnlockJobletClass;
typedef struct _ResticUnlockJobletPrivate ResticUnlockJobletPrivate;
enum  {
	RESTIC_UNLOCK_JOBLET_0_PROPERTY,
	RESTIC_UNLOCK_JOBLET_NUM_PROPERTIES
};
static GParamSpec* restic_unlock_joblet_properties[RESTIC_UNLOCK_JOBLET_NUM_PROPERTIES];

#define TYPE_RESTIC_BACKUP_JOBLET (restic_backup_joblet_get_type ())
#define RESTIC_BACKUP_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_BACKUP_JOBLET, ResticBackupJoblet))
#define RESTIC_BACKUP_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_BACKUP_JOBLET, ResticBackupJobletClass))
#define IS_RESTIC_BACKUP_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_BACKUP_JOBLET))
#define IS_RESTIC_BACKUP_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_BACKUP_JOBLET))
#define RESTIC_BACKUP_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_BACKUP_JOBLET, ResticBackupJobletClass))

typedef struct _ResticBackupJoblet ResticBackupJoblet;
typedef struct _ResticBackupJobletClass ResticBackupJobletClass;
typedef struct _ResticBackupJobletPrivate ResticBackupJobletPrivate;
enum  {
	RESTIC_BACKUP_JOBLET_0_PROPERTY,
	RESTIC_BACKUP_JOBLET_NUM_PROPERTIES
};
static GParamSpec* restic_backup_joblet_properties[RESTIC_BACKUP_JOBLET_NUM_PROPERTIES];

#define TYPE_RESTIC_DELETE_JOBLET_BASE (restic_delete_joblet_base_get_type ())
#define RESTIC_DELETE_JOBLET_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_DELETE_JOBLET_BASE, ResticDeleteJobletBase))
#define RESTIC_DELETE_JOBLET_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_DELETE_JOBLET_BASE, ResticDeleteJobletBaseClass))
#define IS_RESTIC_DELETE_JOBLET_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_DELETE_JOBLET_BASE))
#define IS_RESTIC_DELETE_JOBLET_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_DELETE_JOBLET_BASE))
#define RESTIC_DELETE_JOBLET_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_DELETE_JOBLET_BASE, ResticDeleteJobletBaseClass))

typedef struct _ResticDeleteJobletBase ResticDeleteJobletBase;
typedef struct _ResticDeleteJobletBaseClass ResticDeleteJobletBaseClass;

#define TYPE_RESTIC_DELETE_OLDEST_BACKUP_JOBLET (restic_delete_oldest_backup_joblet_get_type ())
#define RESTIC_DELETE_OLDEST_BACKUP_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_DELETE_OLDEST_BACKUP_JOBLET, ResticDeleteOldestBackupJoblet))
#define RESTIC_DELETE_OLDEST_BACKUP_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_DELETE_OLDEST_BACKUP_JOBLET, ResticDeleteOldestBackupJobletClass))
#define IS_RESTIC_DELETE_OLDEST_BACKUP_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_DELETE_OLDEST_BACKUP_JOBLET))
#define IS_RESTIC_DELETE_OLDEST_BACKUP_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_DELETE_OLDEST_BACKUP_JOBLET))
#define RESTIC_DELETE_OLDEST_BACKUP_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_DELETE_OLDEST_BACKUP_JOBLET, ResticDeleteOldestBackupJobletClass))

typedef struct _ResticDeleteOldestBackupJoblet ResticDeleteOldestBackupJoblet;
typedef struct _ResticDeleteOldestBackupJobletClass ResticDeleteOldestBackupJobletClass;
typedef struct _ResticBackupJobletPrepareData ResticBackupJobletPrepareData;
typedef struct _ResticDeleteJobletBasePrivate ResticDeleteJobletBasePrivate;
enum  {
	RESTIC_DELETE_JOBLET_BASE_0_PROPERTY,
	RESTIC_DELETE_JOBLET_BASE_NUM_PROPERTIES
};
static GParamSpec* restic_delete_joblet_base_properties[RESTIC_DELETE_JOBLET_BASE_NUM_PROPERTIES];
typedef struct _ResticDeleteJobletBasePrepareData ResticDeleteJobletBasePrepareData;

#define TYPE_RESTIC_DELETE_OLD_BACKUPS_JOBLET (restic_delete_old_backups_joblet_get_type ())
#define RESTIC_DELETE_OLD_BACKUPS_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_DELETE_OLD_BACKUPS_JOBLET, ResticDeleteOldBackupsJoblet))
#define RESTIC_DELETE_OLD_BACKUPS_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_DELETE_OLD_BACKUPS_JOBLET, ResticDeleteOldBackupsJobletClass))
#define IS_RESTIC_DELETE_OLD_BACKUPS_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_DELETE_OLD_BACKUPS_JOBLET))
#define IS_RESTIC_DELETE_OLD_BACKUPS_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_DELETE_OLD_BACKUPS_JOBLET))
#define RESTIC_DELETE_OLD_BACKUPS_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_DELETE_OLD_BACKUPS_JOBLET, ResticDeleteOldBackupsJobletClass))

typedef struct _ResticDeleteOldBackupsJoblet ResticDeleteOldBackupsJoblet;
typedef struct _ResticDeleteOldBackupsJobletClass ResticDeleteOldBackupsJobletClass;
typedef struct _ResticDeleteOldBackupsJobletPrivate ResticDeleteOldBackupsJobletPrivate;
enum  {
	RESTIC_DELETE_OLD_BACKUPS_JOBLET_0_PROPERTY,
	RESTIC_DELETE_OLD_BACKUPS_JOBLET_DELETE_AFTER_PROPERTY,
	RESTIC_DELETE_OLD_BACKUPS_JOBLET_NUM_PROPERTIES
};
static GParamSpec* restic_delete_old_backups_joblet_properties[RESTIC_DELETE_OLD_BACKUPS_JOBLET_NUM_PROPERTIES];
typedef struct _ResticDeleteOldestBackupJobletPrivate ResticDeleteOldestBackupJobletPrivate;
enum  {
	RESTIC_DELETE_OLDEST_BACKUP_JOBLET_0_PROPERTY,
	RESTIC_DELETE_OLDEST_BACKUP_JOBLET_NUM_PROPERTIES
};
static GParamSpec* restic_delete_oldest_backup_joblet_properties[RESTIC_DELETE_OLDEST_BACKUP_JOBLET_NUM_PROPERTIES];

#define TYPE_RESTIC_SNAPSHOTS_JOBLET (restic_snapshots_joblet_get_type ())
#define RESTIC_SNAPSHOTS_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_SNAPSHOTS_JOBLET, ResticSnapshotsJoblet))
#define RESTIC_SNAPSHOTS_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_SNAPSHOTS_JOBLET, ResticSnapshotsJobletClass))
#define IS_RESTIC_SNAPSHOTS_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_SNAPSHOTS_JOBLET))
#define IS_RESTIC_SNAPSHOTS_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_SNAPSHOTS_JOBLET))
#define RESTIC_SNAPSHOTS_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_SNAPSHOTS_JOBLET, ResticSnapshotsJobletClass))

typedef struct _ResticSnapshotsJoblet ResticSnapshotsJoblet;
typedef struct _ResticSnapshotsJobletClass ResticSnapshotsJobletClass;
typedef struct _ResticSnapshotsJobletPrivate ResticSnapshotsJobletPrivate;
enum  {
	RESTIC_SNAPSHOTS_JOBLET_0_PROPERTY,
	RESTIC_SNAPSHOTS_JOBLET_NUM_PROPERTIES
};
static GParamSpec* restic_snapshots_joblet_properties[RESTIC_SNAPSHOTS_JOBLET_NUM_PROPERTIES];
#define _g_time_zone_unref0(var) ((var == NULL) ? NULL : (var = (g_time_zone_unref (var), NULL)))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))

#define TYPE_RESTIC_MOUNT_JOBLET (restic_mount_joblet_get_type ())
#define RESTIC_MOUNT_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_MOUNT_JOBLET, ResticMountJoblet))
#define RESTIC_MOUNT_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_MOUNT_JOBLET, ResticMountJobletClass))
#define IS_RESTIC_MOUNT_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_MOUNT_JOBLET))
#define IS_RESTIC_MOUNT_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_MOUNT_JOBLET))
#define RESTIC_MOUNT_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_MOUNT_JOBLET, ResticMountJobletClass))

typedef struct _ResticMountJoblet ResticMountJoblet;
typedef struct _ResticMountJobletClass ResticMountJobletClass;
typedef struct _ResticMountJobletPrivate ResticMountJobletPrivate;
enum  {
	RESTIC_MOUNT_JOBLET_0_PROPERTY,
	RESTIC_MOUNT_JOBLET_NUM_PROPERTIES
};
static GParamSpec* restic_mount_joblet_properties[RESTIC_MOUNT_JOBLET_NUM_PROPERTIES];

#define TYPE_RESTIC_LIST_JOBLET (restic_list_joblet_get_type ())
#define RESTIC_LIST_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_LIST_JOBLET, ResticListJoblet))
#define RESTIC_LIST_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_LIST_JOBLET, ResticListJobletClass))
#define IS_RESTIC_LIST_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_LIST_JOBLET))
#define IS_RESTIC_LIST_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_LIST_JOBLET))
#define RESTIC_LIST_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_LIST_JOBLET, ResticListJobletClass))

typedef struct _ResticListJoblet ResticListJoblet;
typedef struct _ResticListJobletClass ResticListJobletClass;
typedef struct _ResticListJobletPrivate ResticListJobletPrivate;
enum  {
	RESTIC_LIST_JOBLET_0_PROPERTY,
	RESTIC_LIST_JOBLET_NUM_PROPERTIES
};
static GParamSpec* restic_list_joblet_properties[RESTIC_LIST_JOBLET_NUM_PROPERTIES];

#define TYPE_RESTIC_RESTORE_JOBLET (restic_restore_joblet_get_type ())
#define RESTIC_RESTORE_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_RESTORE_JOBLET, ResticRestoreJoblet))
#define RESTIC_RESTORE_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_RESTORE_JOBLET, ResticRestoreJobletClass))
#define IS_RESTIC_RESTORE_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_RESTORE_JOBLET))
#define IS_RESTIC_RESTORE_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_RESTORE_JOBLET))
#define RESTIC_RESTORE_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_RESTORE_JOBLET, ResticRestoreJobletClass))

typedef struct _ResticRestoreJoblet ResticRestoreJoblet;
typedef struct _ResticRestoreJobletClass ResticRestoreJobletClass;
typedef struct _ResticRestoreJobletPrivate ResticRestoreJobletPrivate;
enum  {
	RESTIC_RESTORE_JOBLET_0_PROPERTY,
	RESTIC_RESTORE_JOBLET_RESTORE_FILE_PROPERTY,
	RESTIC_RESTORE_JOBLET_PERCENTAGE_PROPERTY,
	RESTIC_RESTORE_JOBLET_NUM_PROPERTIES
};
static GParamSpec* restic_restore_joblet_properties[RESTIC_RESTORE_JOBLET_NUM_PROPERTIES];

#define TYPE_RESTIC_CHECK_JOBLET (restic_check_joblet_get_type ())
#define RESTIC_CHECK_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_CHECK_JOBLET, ResticCheckJoblet))
#define RESTIC_CHECK_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_CHECK_JOBLET, ResticCheckJobletClass))
#define IS_RESTIC_CHECK_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_CHECK_JOBLET))
#define IS_RESTIC_CHECK_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_CHECK_JOBLET))
#define RESTIC_CHECK_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_CHECK_JOBLET, ResticCheckJobletClass))

typedef struct _ResticCheckJoblet ResticCheckJoblet;
typedef struct _ResticCheckJobletClass ResticCheckJobletClass;
typedef struct _ResticCheckJobletPrivate ResticCheckJobletPrivate;
enum  {
	RESTIC_CHECK_JOBLET_0_PROPERTY,
	RESTIC_CHECK_JOBLET_READ_DATA_PROPERTY,
	RESTIC_CHECK_JOBLET_NUM_PROPERTIES
};
static GParamSpec* restic_check_joblet_properties[RESTIC_CHECK_JOBLET_NUM_PROPERTIES];
typedef struct _DejaDupToolJobChainPrivate DejaDupToolJobChainPrivate;

#define TYPE_RESTIC_JOB (restic_job_get_type ())
#define RESTIC_JOB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RESTIC_JOB, ResticJob))
#define RESTIC_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RESTIC_JOB, ResticJobClass))
#define IS_RESTIC_JOB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RESTIC_JOB))
#define IS_RESTIC_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_RESTIC_JOB))
#define RESTIC_JOB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_RESTIC_JOB, ResticJobClass))

typedef struct _ResticJob ResticJob;
typedef struct _ResticJobClass ResticJobClass;
typedef struct _ResticJobPrivate ResticJobPrivate;
enum  {
	RESTIC_JOB_0_PROPERTY,
	RESTIC_JOB_NUM_PROPERTIES
};
static GParamSpec* restic_job_properties[RESTIC_JOB_NUM_PROPERTIES];
typedef struct _ResticJobStartData ResticJobStartData;

struct _DejaDupToolJoblet {
	DejaDupToolJob parent_instance;
	DejaDupToolJobletPrivate * priv;
};

struct _DejaDupToolJobletClass {
	DejaDupToolJobClass parent_class;
	ToolInstance* (*make_instance) (DejaDupToolJoblet* self);
	void (*prepare_args) (DejaDupToolJoblet* self, GList** argv, GList** envp, GError** error);
	void (*prepare) (DejaDupToolJoblet* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*prepare_finish) (DejaDupToolJoblet* self, GAsyncResult* _res_, GError** error);
	void (*handle_done) (DejaDupToolJoblet* self, gboolean success, gboolean cancelled);
};

struct _ResticJoblet {
	DejaDupToolJoblet parent_instance;
	ResticJobletPrivate * priv;
	gboolean ignore_errors;
	gboolean fatal_error_issued;
};

struct _ResticJobletClass {
	DejaDupToolJobletClass parent_class;
	gboolean (*process_message) (ResticJoblet* self, const gchar* msgid, JsonReader* reader);
	void (*handle_no_repository) (ResticJoblet* self);
	gboolean (*handle_out_of_space) (ResticJoblet* self);
	void (*handle_fatal_error) (ResticJoblet* self, gint code, const gchar* msg);
};

struct _ResticJobletPrivate {
	gchar* rclone_remote;
	gchar* tmpdir;
	gchar* last_error_message;
};

struct _ResticJobletPrepareData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ResticJoblet* self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	GError* _inner_error0_;
};

struct _ResticInitJoblet {
	ResticJoblet parent_instance;
	ResticInitJobletPrivate * priv;
};

struct _ResticInitJobletClass {
	ResticJobletClass parent_class;
};

struct _ResticUnlockJoblet {
	ResticJoblet parent_instance;
	ResticUnlockJobletPrivate * priv;
};

struct _ResticUnlockJobletClass {
	ResticJobletClass parent_class;
};

struct _ResticBackupJoblet {
	ResticJoblet parent_instance;
	ResticBackupJobletPrivate * priv;
};

struct _ResticBackupJobletClass {
	ResticJobletClass parent_class;
};

struct _ResticBackupJobletPrivate {
	gboolean snapshot_made;
	gint64 seconds_elapsed;
	guint64 free_space;
	guint64 total_space;
};

struct _ResticBackupJobletPrepareData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ResticBackupJoblet* self;
	DejaDupBackend* _tmp0_;
	DejaDupBackend* _tmp1_;
	guint64 _tmp2_;
	guint64 _tmp3_;
	GError* _inner_error0_;
};

struct _ResticDeleteJobletBase {
	ResticJoblet parent_instance;
	ResticDeleteJobletBasePrivate * priv;
};

struct _ResticDeleteJobletBaseClass {
	ResticJobletClass parent_class;
};

struct _ResticDeleteJobletBasePrepareData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ResticDeleteJobletBase* self;
	DejaDupMountManager* manager;
	DejaDupMountManager* _tmp0_;
	gchar* dir;
	DejaDupMountManager* _tmp1_;
	DejaDupToolPlugin* _tmp2_;
	DejaDupToolPlugin* _tmp3_;
	DejaDupBackend* _tmp4_;
	DejaDupBackend* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	DejaDupMountManager* _tmp8_;
	const gchar* _tmp9_;
	GError* _inner_error0_;
};

struct _ResticDeleteOldBackupsJoblet {
	ResticDeleteJobletBase parent_instance;
	ResticDeleteOldBackupsJobletPrivate * priv;
};

struct _ResticDeleteOldBackupsJobletClass {
	ResticDeleteJobletBaseClass parent_class;
};

struct _ResticDeleteOldBackupsJobletPrivate {
	gint _delete_after;
};

struct _ResticDeleteOldestBackupJoblet {
	ResticDeleteJobletBase parent_instance;
	ResticDeleteOldestBackupJobletPrivate * priv;
};

struct _ResticDeleteOldestBackupJobletClass {
	ResticDeleteJobletBaseClass parent_class;
};

struct _ResticSnapshotsJoblet {
	ResticJoblet parent_instance;
	ResticSnapshotsJobletPrivate * priv;
};

struct _ResticSnapshotsJobletClass {
	ResticJobletClass parent_class;
};

struct _ResticMountJoblet {
	ResticJoblet parent_instance;
	ResticMountJobletPrivate * priv;
};

struct _ResticMountJobletClass {
	ResticJobletClass parent_class;
};

struct _ResticListJoblet {
	ResticJoblet parent_instance;
	ResticListJobletPrivate * priv;
};

struct _ResticListJobletClass {
	ResticJobletClass parent_class;
};

struct _ResticRestoreJoblet {
	ResticJoblet parent_instance;
	ResticRestoreJobletPrivate * priv;
};

struct _ResticRestoreJobletClass {
	ResticJobletClass parent_class;
};

struct _ResticRestoreJobletPrivate {
	GFile* _restore_file;
	gdouble _percentage;
};

struct _ResticCheckJoblet {
	ResticJoblet parent_instance;
	ResticCheckJobletPrivate * priv;
};

struct _ResticCheckJobletClass {
	ResticJobletClass parent_class;
};

struct _ResticCheckJobletPrivate {
	gboolean _read_data;
};

struct _DejaDupToolJobChain {
	DejaDupToolJob parent_instance;
	DejaDupToolJobChainPrivate * priv;
};

struct _DejaDupToolJobChainClass {
	DejaDupToolJobClass parent_class;
};

struct _ResticJob {
	DejaDupToolJobChain parent_instance;
	ResticJobPrivate * priv;
};

struct _ResticJobClass {
	DejaDupToolJobChainClass parent_class;
};

struct _ResticJobStartData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	ResticJob* self;
	DejaDupToolJobMode _tmp0_;
	DejaDupToolJobMode _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	DejaDupToolJobMode _tmp4_;
	DejaDupToolJobMode _tmp5_;
	DejaDupFilteredSettings* settings;
	DejaDupFilteredSettings* _tmp6_;
	gint delete_after;
	DejaDupFilteredSettings* _tmp7_;
	ResticUnlockJoblet* _tmp8_;
	ResticUnlockJoblet* _tmp9_;
	ResticSnapshotsJoblet* _tmp10_;
	ResticSnapshotsJoblet* _tmp11_;
	ResticBackupJoblet* _tmp12_;
	ResticBackupJoblet* _tmp13_;
	ResticDeleteOldBackupsJoblet* _tmp14_;
	ResticDeleteOldBackupsJoblet* _tmp15_;
	ResticUnlockJoblet* _tmp16_;
	ResticUnlockJoblet* _tmp17_;
	GList* _tmp18_;
	GList* _tmp19_;
	ResticRestoreJoblet* _tmp20_;
	ResticRestoreJoblet* _tmp21_;
	gdouble i;
	GList* _tmp22_;
	GList* _tmp23_;
	GList* file_collection;
	GList* file_it;
	GFile* _tmp24_;
	GFile* file;
	GFile* _tmp25_;
	gdouble _tmp26_;
	GList* _tmp27_;
	GList* _tmp28_;
	ResticRestoreJoblet* _tmp29_;
	ResticRestoreJoblet* _tmp30_;
	ResticUnlockJoblet* _tmp31_;
	ResticUnlockJoblet* _tmp32_;
	ResticSnapshotsJoblet* _tmp33_;
	ResticSnapshotsJoblet* _tmp34_;
	ResticUnlockJoblet* _tmp35_;
	ResticUnlockJoblet* _tmp36_;
	ResticListJoblet* _tmp37_;
	ResticListJoblet* _tmp38_;
	ResticCheckJoblet* _tmp39_;
	ResticCheckJoblet* _tmp40_;
	ResticUnlockJoblet* _tmp41_;
	ResticUnlockJoblet* _tmp42_;
	ResticCheckJoblet* _tmp43_;
	ResticCheckJoblet* _tmp44_;
	ResticUnlockJoblet* _tmp45_;
	ResticUnlockJoblet* _tmp46_;
	ResticMountJoblet* _tmp47_;
	ResticMountJoblet* _tmp48_;
	DejaDupToolJobMode _tmp49_;
	DejaDupToolJobMode _tmp50_;
};

static gint ResticJoblet_private_offset;
static gpointer restic_joblet_parent_class = NULL;
static gpointer restic_init_joblet_parent_class = NULL;
static gpointer restic_unlock_joblet_parent_class = NULL;
static gint ResticBackupJoblet_private_offset;
static gpointer restic_backup_joblet_parent_class = NULL;
static gpointer restic_delete_joblet_base_parent_class = NULL;
static gint ResticDeleteOldBackupsJoblet_private_offset;
static gpointer restic_delete_old_backups_joblet_parent_class = NULL;
static gpointer restic_delete_oldest_backup_joblet_parent_class = NULL;
static gpointer restic_snapshots_joblet_parent_class = NULL;
static gpointer restic_mount_joblet_parent_class = NULL;
static gpointer restic_list_joblet_parent_class = NULL;
static gint ResticRestoreJoblet_private_offset;
static gpointer restic_restore_joblet_parent_class = NULL;
static gint ResticCheckJoblet_private_offset;
static gpointer restic_check_joblet_parent_class = NULL;
static gpointer restic_job_parent_class = NULL;

VALA_EXTERN GType deja_dup_tool_joblet_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType tool_instance_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType restic_joblet_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ToolInstance* deja_dup_tool_joblet_make_instance (DejaDupToolJoblet* self);
VALA_EXTERN void deja_dup_tool_joblet_prepare (DejaDupToolJoblet* self,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_);
VALA_EXTERN void deja_dup_tool_joblet_prepare_finish (DejaDupToolJoblet* self,
                                          GAsyncResult* _res_,
                                          GError** error);
VALA_EXTERN void deja_dup_tool_joblet_prepare_args (DejaDupToolJoblet* self,
                                        GList** argv,
                                        GList** envp,
                                        GError** error);
VALA_EXTERN gboolean restic_joblet_process_message (ResticJoblet* self,
                                        const gchar* msgid,
                                        JsonReader* reader);
VALA_EXTERN void restic_joblet_handle_no_repository (ResticJoblet* self);
VALA_EXTERN gboolean restic_joblet_handle_out_of_space (ResticJoblet* self);
VALA_EXTERN void deja_dup_tool_joblet_handle_done (DejaDupToolJoblet* self,
                                       gboolean success,
                                       gboolean cancelled);
VALA_EXTERN void restic_joblet_handle_fatal_error (ResticJoblet* self,
                                       gint code,
                                       const gchar* msg);
static ToolInstance* restic_joblet_real_make_instance (DejaDupToolJoblet* base);
VALA_EXTERN GType restic_instance_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ResticInstance* restic_instance_new (void);
VALA_EXTERN ResticInstance* restic_instance_construct (GType object_type);
VALA_EXTERN void deja_dup_tool_joblet_add_handler (DejaDupToolJoblet* self,
                                       gulong id);
static void restic_joblet_handle_message (ResticJoblet* self,
                                   const gchar* msgid,
                                   JsonReader* reader);
static void _restic_joblet_handle_message_restic_instance_message (ResticInstance* _sender,
                                                            const gchar* msgid,
                                                            JsonReader* reader,
                                                            gpointer self);
static void _restic_joblet_handle_fatal_error_restic_instance_fatal_error (ResticInstance* _sender,
                                                                    gint code,
                                                                    const gchar* msg,
                                                                    gpointer self);
static void restic_joblet_real_prepare_data_free (gpointer _data);
static void restic_joblet_real_prepare (DejaDupToolJoblet* base,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_);
static gboolean restic_joblet_real_prepare_co (ResticJobletPrepareData* _data_);
static void restic_joblet_prepare_ready (GObject* source_object,
                                  GAsyncResult* _res_,
                                  gpointer _user_data_);
static void restic_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                      GList** argv,
                                      GList** envp,
                                      GError** error);
static gchar* restic_joblet_restic_cachedir (ResticJoblet* self);
VALA_EXTERN gchar* rclone_fill_envp_from_backend (DejaDupBackend* backend,
                                      GList** envp);
VALA_EXTERN gchar* rclone_rclone_command (void);
static gchar* restic_joblet_get_remote (ResticJoblet* self,
                                 GError** error);
static gboolean restic_joblet_real_process_message (ResticJoblet* self,
                                             const gchar* msgid,
                                             JsonReader* reader);
VALA_EXTERN gchar* restic_joblet_escape_pattern (ResticJoblet* self,
                                     const gchar* path);
VALA_EXTERN gchar* restic_joblet_escape_path (ResticJoblet* self,
                                  const gchar* path);
VALA_EXTERN gint restic_joblet_cmp_prefix (const gchar* a,
                               const gchar* b);
static void restic_joblet_real_handle_no_repository (ResticJoblet* self);
static gboolean restic_joblet_real_handle_out_of_space (ResticJoblet* self);
static void restic_joblet_real_handle_done (DejaDupToolJoblet* base,
                                     gboolean success,
                                     gboolean cancelled);
VALA_EXTERN void deja_dup_tool_joblet_show_error (DejaDupToolJoblet* self,
                                      const gchar* msg,
                                      const gchar* detail);
static void restic_joblet_real_handle_fatal_error (ResticJoblet* self,
                                            gint code,
                                            const gchar* msg);
VALA_EXTERN GFile* deja_dup_backend_file_get_file_from_settings (DejaDupBackendFile* self);
static void restic_joblet_process_error (ResticJoblet* self,
                                  JsonReader* reader);
VALA_EXTERN guint restic_joblet_chain_get_num_snapshots (ResticJoblet* self);
VALA_EXTERN GType deja_dup_tool_job_chain_get_type (void) G_GNUC_CONST ;
VALA_EXTERN DejaDupToolJobChain* deja_dup_tool_joblet_get_chain (DejaDupToolJoblet* self);
VALA_EXTERN void restic_joblet_chain_set_num_snapshots (ResticJoblet* self,
                                            guint num);
VALA_EXTERN ResticJoblet* restic_joblet_new (void);
VALA_EXTERN ResticJoblet* restic_joblet_construct (GType object_type);
VALA_EXTERN DejaDupToolJoblet* deja_dup_tool_joblet_construct (GType object_type);
static void restic_joblet_finalize (GObject * obj);
static GType restic_joblet_get_type_once (void);
VALA_EXTERN GType restic_init_joblet_get_type (void) G_GNUC_CONST ;
static void restic_init_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                           GList** argv,
                                           GList** envp,
                                           GError** error);
VALA_EXTERN ResticInitJoblet* restic_init_joblet_new (void);
VALA_EXTERN ResticInitJoblet* restic_init_joblet_construct (GType object_type);
static GType restic_init_joblet_get_type_once (void);
VALA_EXTERN GType restic_unlock_joblet_get_type (void) G_GNUC_CONST ;
static void restic_unlock_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                             GList** argv,
                                             GList** envp,
                                             GError** error);
VALA_EXTERN ResticUnlockJoblet* restic_unlock_joblet_new (void);
VALA_EXTERN ResticUnlockJoblet* restic_unlock_joblet_construct (GType object_type);
static GObject * restic_unlock_joblet_constructor (GType type,
                                            guint n_construct_properties,
                                            GObjectConstructParam * construct_properties);
static GType restic_unlock_joblet_get_type_once (void);
VALA_EXTERN GType restic_backup_joblet_get_type (void) G_GNUC_CONST ;
static void restic_backup_joblet_real_handle_done (DejaDupToolJoblet* base,
                                            gboolean success,
                                            gboolean cancelled);
static gboolean restic_backup_joblet_real_handle_out_of_space (ResticJoblet* base);
VALA_EXTERN void deja_dup_tool_job_chain_prepend_to_chain (DejaDupToolJobChain* self,
                                               DejaDupToolJoblet* joblet);
VALA_EXTERN ResticBackupJoblet* restic_backup_joblet_new (void);
VALA_EXTERN ResticBackupJoblet* restic_backup_joblet_construct (GType object_type);
VALA_EXTERN ResticDeleteOldestBackupJoblet* restic_delete_oldest_backup_joblet_new (void);
VALA_EXTERN ResticDeleteOldestBackupJoblet* restic_delete_oldest_backup_joblet_construct (GType object_type);
VALA_EXTERN GType restic_delete_joblet_base_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType restic_delete_oldest_backup_joblet_get_type (void) G_GNUC_CONST ;
static void restic_backup_joblet_real_prepare_data_free (gpointer _data);
static void restic_backup_joblet_real_prepare (DejaDupToolJoblet* base,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
static gboolean restic_backup_joblet_real_prepare_co (ResticBackupJobletPrepareData* _data_);
static void restic_backup_joblet_prepare_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_);
static void restic_backup_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                             GList** argv,
                                             GList** envp,
                                             GError** error);
static void restic_backup_joblet_add_include_excludes (ResticBackupJoblet* self,
                                                GList** argv);
static gboolean restic_backup_joblet_process_status (ResticBackupJoblet* self,
                                              JsonReader* reader);
VALA_EXTERN void deja_dup_tool_joblet_disconnect_inst (DejaDupToolJoblet* self);
static gboolean restic_backup_joblet_process_summary (ResticBackupJoblet* self,
                                               JsonReader* reader);
static gboolean restic_backup_joblet_real_process_message (ResticJoblet* base,
                                                    const gchar* msgid,
                                                    JsonReader* reader);
static void restic_backup_joblet_real_handle_no_repository (ResticJoblet* base);
static gboolean restic_backup_joblet_list_contains_file (ResticBackupJoblet* self,
                                                  GList* list,
                                                  GFile* file);
VALA_EXTERN void deja_dup_expand_links_in_list (GList** all,
                                    gboolean keep_internal,
                                    gboolean keep_missing);
static gint _restic_joblet_cmp_prefix_gcompare_func (gconstpointer a,
                                              gconstpointer b);
static void _g_free0_ (gpointer var);
static inline void _g_list_free__g_free0_ (GList* self);
static void restic_backup_joblet_finalize (GObject * obj);
static GType restic_backup_joblet_get_type_once (void);
static void restic_delete_joblet_base_real_prepare_args (DejaDupToolJoblet* base,
                                                  GList** argv,
                                                  GList** envp,
                                                  GError** error);
static void restic_delete_joblet_base_real_prepare_data_free (gpointer _data);
static void restic_delete_joblet_base_real_prepare (DejaDupToolJoblet* base,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static gboolean restic_delete_joblet_base_real_prepare_co (ResticDeleteJobletBasePrepareData* _data_);
static void restic_delete_joblet_base_prepare_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
VALA_EXTERN gchar* deja_dup_mount_manager_get_mount_dir (DejaDupMountManager* self,
                                             DejaDupToolPlugin* tool,
                                             DejaDupBackend* backend);
VALA_EXTERN DejaDupToolPlugin* deja_dup_make_restic_tool (void);
VALA_EXTERN ResticDeleteJobletBase* restic_delete_joblet_base_new (void);
VALA_EXTERN ResticDeleteJobletBase* restic_delete_joblet_base_construct (GType object_type);
static GType restic_delete_joblet_base_get_type_once (void);
VALA_EXTERN GType restic_delete_old_backups_joblet_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ResticDeleteOldBackupsJoblet* restic_delete_old_backups_joblet_new (gint delete_after);
VALA_EXTERN ResticDeleteOldBackupsJoblet* restic_delete_old_backups_joblet_construct (GType object_type,
                                                                          gint delete_after);
static void restic_delete_old_backups_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                                         GList** argv,
                                                         GList** envp,
                                                         GError** error);
VALA_EXTERN gint restic_delete_old_backups_joblet_get_delete_after (ResticDeleteOldBackupsJoblet* self);
static void restic_delete_old_backups_joblet_real_handle_fatal_error (ResticJoblet* base,
                                                               gint code,
                                                               const gchar* msg);
static void restic_delete_old_backups_joblet_set_delete_after (ResticDeleteOldBackupsJoblet* self,
                                                        gint value);
static void restic_delete_old_backups_joblet_finalize (GObject * obj);
static GType restic_delete_old_backups_joblet_get_type_once (void);
static void _vala_restic_delete_old_backups_joblet_get_property (GObject * object,
                                                          guint property_id,
                                                          GValue * value,
                                                          GParamSpec * pspec);
static void _vala_restic_delete_old_backups_joblet_set_property (GObject * object,
                                                          guint property_id,
                                                          const GValue * value,
                                                          GParamSpec * pspec);
static void restic_delete_oldest_backup_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                                           GList** argv,
                                                           GList** envp,
                                                           GError** error);
static void restic_delete_oldest_backup_joblet_real_handle_done (DejaDupToolJoblet* base,
                                                          gboolean success,
                                                          gboolean cancelled);
static void restic_delete_oldest_backup_joblet_real_handle_fatal_error (ResticJoblet* base,
                                                                 gint code,
                                                                 const gchar* msg);
static GType restic_delete_oldest_backup_joblet_get_type_once (void);
VALA_EXTERN GType restic_snapshots_joblet_get_type (void) G_GNUC_CONST ;
static void restic_snapshots_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                                GList** argv,
                                                GList** envp,
                                                GError** error);
static void restic_snapshots_joblet_real_handle_no_repository (ResticJoblet* base);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static gboolean restic_snapshots_joblet_real_process_message (ResticJoblet* base,
                                                       const gchar* msgid,
                                                       JsonReader* reader);
static gboolean restic_snapshots_joblet_process_snapshots (ResticSnapshotsJoblet* self,
                                                    JsonReader* reader);
static void _vala_array_add17 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static void _vala_array_add18 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
VALA_EXTERN ResticSnapshotsJoblet* restic_snapshots_joblet_new (void);
VALA_EXTERN ResticSnapshotsJoblet* restic_snapshots_joblet_construct (GType object_type);
static GType restic_snapshots_joblet_get_type_once (void);
VALA_EXTERN GType restic_mount_joblet_get_type (void) G_GNUC_CONST ;
static void restic_mount_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                            GList** argv,
                                            GList** envp,
                                            GError** error);
VALA_EXTERN ResticMountJoblet* restic_mount_joblet_new (void);
VALA_EXTERN ResticMountJoblet* restic_mount_joblet_construct (GType object_type);
static GType restic_mount_joblet_get_type_once (void);
VALA_EXTERN GType restic_list_joblet_get_type (void) G_GNUC_CONST ;
static void restic_list_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                           GList** argv,
                                           GList** envp,
                                           GError** error);
static gboolean restic_list_joblet_real_process_message (ResticJoblet* base,
                                                  const gchar* msgid,
                                                  JsonReader* reader);
static gboolean restic_list_joblet_process_node (ResticListJoblet* self,
                                          JsonReader* reader);
VALA_EXTERN ResticListJoblet* restic_list_joblet_new (void);
VALA_EXTERN ResticListJoblet* restic_list_joblet_construct (GType object_type);
static GType restic_list_joblet_get_type_once (void);
VALA_EXTERN GType restic_restore_joblet_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ResticRestoreJoblet* restic_restore_joblet_new (GFile* restore_file,
                                                gdouble percentage);
VALA_EXTERN ResticRestoreJoblet* restic_restore_joblet_construct (GType object_type,
                                                      GFile* restore_file,
                                                      gdouble percentage);
static void restic_restore_joblet_real_handle_done (DejaDupToolJoblet* base,
                                             gboolean success,
                                             gboolean cancelled);
VALA_EXTERN gdouble restic_restore_joblet_get_percentage (ResticRestoreJoblet* self);
static void restic_restore_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                              GList** argv,
                                              GList** envp,
                                              GError** error);
VALA_EXTERN GFile* restic_restore_joblet_get_restore_file (ResticRestoreJoblet* self);
static void restic_restore_joblet_set_restore_file (ResticRestoreJoblet* self,
                                             GFile* value);
static void restic_restore_joblet_set_percentage (ResticRestoreJoblet* self,
                                           gdouble value);
static void restic_restore_joblet_finalize (GObject * obj);
static GType restic_restore_joblet_get_type_once (void);
static void _vala_restic_restore_joblet_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_restic_restore_joblet_set_property (GObject * object,
                                               guint property_id,
                                               const GValue * value,
                                               GParamSpec * pspec);
VALA_EXTERN GType restic_check_joblet_get_type (void) G_GNUC_CONST ;
VALA_EXTERN ResticCheckJoblet* restic_check_joblet_new (gboolean read_data);
VALA_EXTERN ResticCheckJoblet* restic_check_joblet_construct (GType object_type,
                                                  gboolean read_data);
static void restic_check_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                            GList** argv,
                                            GList** envp,
                                            GError** error);
VALA_EXTERN gboolean restic_check_joblet_get_read_data (ResticCheckJoblet* self);
static void restic_check_joblet_real_handle_fatal_error (ResticJoblet* base,
                                                  gint code,
                                                  const gchar* msg);
VALA_EXTERN gchar* deja_dup_tool_joblet_make_verification_error_message (const gchar* msg);
static void restic_check_joblet_set_read_data (ResticCheckJoblet* self,
                                        gboolean value);
static void restic_check_joblet_finalize (GObject * obj);
static GType restic_check_joblet_get_type_once (void);
static void _vala_restic_check_joblet_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_restic_check_joblet_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
VALA_EXTERN GType restic_job_get_type (void) G_GNUC_CONST ;
static void restic_job_real_start_data_free (gpointer _data);
static void restic_job_real_start (DejaDupToolJob* base,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_);
static gboolean restic_job_real_start_co (ResticJobStartData* _data_);
VALA_EXTERN void deja_dup_tool_job_chain_append_to_chain (DejaDupToolJobChain* self,
                                              DejaDupToolJoblet* joblet);
static void restic_job_start_ready (GObject* source_object,
                             GAsyncResult* _res_,
                             gpointer _user_data_);
VALA_EXTERN ResticJob* restic_job_new (void);
VALA_EXTERN ResticJob* restic_job_construct (GType object_type);
VALA_EXTERN DejaDupToolJobChain* deja_dup_tool_job_chain_new (void);
VALA_EXTERN DejaDupToolJobChain* deja_dup_tool_job_chain_construct (GType object_type);
static GType restic_job_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);

static inline gpointer
restic_joblet_get_instance_private (ResticJoblet* self)
{
	return G_STRUCT_MEMBER_P (self, ResticJoblet_private_offset);
}

static void
_restic_joblet_handle_message_restic_instance_message (ResticInstance* _sender,
                                                       const gchar* msgid,
                                                       JsonReader* reader,
                                                       gpointer self)
{
	restic_joblet_handle_message ((ResticJoblet*) self, msgid, reader);
}

static void
_restic_joblet_handle_fatal_error_restic_instance_fatal_error (ResticInstance* _sender,
                                                               gint code,
                                                               const gchar* msg,
                                                               gpointer self)
{
	restic_joblet_handle_fatal_error ((ResticJoblet*) self, code, msg);
}

static ToolInstance*
restic_joblet_real_make_instance (DejaDupToolJoblet* base)
{
	ResticJoblet * self;
	ResticInstance* instance = NULL;
	ResticInstance* _tmp0_;
	gulong _tmp1_;
	gulong _tmp2_;
	ToolInstance* result;
	self = (ResticJoblet*) base;
	_tmp0_ = restic_instance_new ();
	instance = _tmp0_;
	_tmp1_ = g_signal_connect_object (instance, "message", (GCallback) _restic_joblet_handle_message_restic_instance_message, self, 0);
	deja_dup_tool_joblet_add_handler ((DejaDupToolJoblet*) self, _tmp1_);
	_tmp2_ = g_signal_connect_object (instance, "fatal-error", (GCallback) _restic_joblet_handle_fatal_error_restic_instance_fatal_error, self, 0);
	deja_dup_tool_joblet_add_handler ((DejaDupToolJoblet*) self, _tmp2_);
	result = (ToolInstance*) instance;
	return result;
}

static void
restic_joblet_real_prepare_data_free (gpointer _data)
{
	ResticJobletPrepareData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ResticJobletPrepareData, _data_);
}

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

static void
restic_joblet_real_prepare (DejaDupToolJoblet* base,
                            GAsyncReadyCallback _callback_,
                            gpointer _user_data_)
{
	ResticJoblet * self;
	ResticJobletPrepareData* _data_;
	ResticJoblet* _tmp0_;
	self = (ResticJoblet*) base;
	_data_ = g_slice_new0 (ResticJobletPrepareData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, restic_joblet_real_prepare_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	restic_joblet_real_prepare_co (_data_);
}

static void
restic_joblet_prepare_finish (DejaDupToolJoblet* base,
                              GAsyncResult* _res_,
                              GError** error)
{
	ResticJobletPrepareData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
restic_joblet_prepare_ready (GObject* source_object,
                             GAsyncResult* _res_,
                             gpointer _user_data_)
{
	ResticJobletPrepareData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	restic_joblet_real_prepare_co (_data_);
}

static gboolean
restic_joblet_real_prepare_co (ResticJobletPrepareData* _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_->_tmp0_ = deja_dup_tool_job_get_tag ((DejaDupToolJob*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (g_strcmp0 (_data_->_tmp1_, "") == 0) {
		deja_dup_tool_job_set_tag ((DejaDupToolJob*) _data_->self, "latest");
	}
	_data_->_state_ = 1;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_joblet_parent_class)->prepare (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, DEJA_DUP_TYPE_TOOL_JOBLET, DejaDupToolJoblet), restic_joblet_prepare_ready, _data_);
	return FALSE;
	_state_1:
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_joblet_parent_class)->prepare_finish (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, DEJA_DUP_TYPE_TOOL_JOBLET, DejaDupToolJoblet), _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_state_ = 2;
	deja_dup_get_tempdir (restic_joblet_prepare_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp2_ = deja_dup_get_tempdir_finish (_data_->_res_);
	_g_free0 (_data_->self->priv->tmpdir);
	_data_->self->priv->tmpdir = _data_->_tmp2_;
	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
restic_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                 GList** argv,
                                 GList** envp,
                                 GError** error)
{
	ResticJoblet * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* cachedir = NULL;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gboolean _tmp7_ = FALSE;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	DejaDupBackend* _tmp17_;
	DejaDupBackend* _tmp18_;
	gchar* _tmp19_;
	const gchar* _tmp20_;
	gchar* _tmp24_ = NULL;
	gchar* _tmp25_;
	gchar* _tmp26_;
	const gchar* _tmp27_;
	GError* _inner_error0_ = NULL;
	self = (ResticJoblet*) base;
	_tmp0_ = restic_plugin_restic_command ();
	*argv = g_list_append (*argv, _tmp0_);
	_tmp1_ = g_strdup ("--json");
	*argv = g_list_append (*argv, _tmp1_);
	_tmp2_ = g_strdup ("--cleanup-cache");
	*argv = g_list_append (*argv, _tmp2_);
	_tmp3_ = restic_joblet_restic_cachedir (self);
	cachedir = _tmp3_;
	_tmp4_ = cachedir;
	if (_tmp4_ != NULL) {
		const gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp5_ = cachedir;
		_tmp6_ = g_strconcat ("--cache-dir=", _tmp5_, NULL);
		*argv = g_list_append (*argv, _tmp6_);
	}
	_tmp8_ = deja_dup_tool_job_get_encrypt_password ((DejaDupToolJob*) self);
	_tmp9_ = _tmp8_;
	if (_tmp9_ == NULL) {
		_tmp7_ = TRUE;
	} else {
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		_tmp10_ = deja_dup_tool_job_get_encrypt_password ((DejaDupToolJob*) self);
		_tmp11_ = _tmp10_;
		_tmp7_ = g_strcmp0 (_tmp11_, "") == 0;
	}
	if (_tmp7_) {
		gchar* _tmp12_;
		gchar* _tmp13_;
		_tmp12_ = g_strdup ("--insecure-no-password");
		*argv = g_list_append (*argv, _tmp12_);
		_tmp13_ = g_strdup ("RESTIC_PASSWORD=");
		*envp = g_list_append (*envp, _tmp13_);
	} else {
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		_tmp14_ = deja_dup_tool_job_get_encrypt_password ((DejaDupToolJob*) self);
		_tmp15_ = _tmp14_;
		_tmp16_ = g_strconcat ("RESTIC_PASSWORD=", _tmp15_, NULL);
		*envp = g_list_append (*envp, _tmp16_);
	}
	_tmp17_ = deja_dup_tool_job_get_backend ((DejaDupToolJob*) self);
	_tmp18_ = _tmp17_;
	_tmp19_ = rclone_fill_envp_from_backend (_tmp18_, envp);
	_g_free0 (self->priv->rclone_remote);
	self->priv->rclone_remote = _tmp19_;
	_tmp20_ = self->priv->rclone_remote;
	if (_tmp20_ != NULL) {
		gchar* _tmp21_;
		gchar* _tmp22_;
		gchar* _tmp23_;
		_tmp21_ = rclone_rclone_command ();
		_tmp22_ = _tmp21_;
		_tmp23_ = g_strconcat ("--option=rclone.program=", _tmp22_, NULL);
		*argv = g_list_append (*argv, _tmp23_);
		_g_free0 (_tmp22_);
	}
	_tmp25_ = restic_joblet_get_remote (self, &_inner_error0_);
	_tmp24_ = _tmp25_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (cachedir);
		return;
	}
	_tmp26_ = _tmp24_;
	_tmp24_ = NULL;
	*argv = g_list_append (*argv, _tmp26_);
	_tmp27_ = self->priv->tmpdir;
	if (deja_dup_ensure_directory_exists (_tmp27_)) {
		const gchar* _tmp28_;
		gchar* _tmp29_;
		_tmp28_ = self->priv->tmpdir;
		_tmp29_ = g_strdup_printf ("TMPDIR=%s", _tmp28_);
		*envp = g_list_append (*envp, _tmp29_);
	}
	_g_free0 (_tmp24_);
	_g_free0 (cachedir);
}

static gboolean
restic_joblet_real_process_message (ResticJoblet* self,
                                    const gchar* msgid,
                                    JsonReader* reader)
{
	gboolean result;
	g_return_val_if_fail (reader != NULL, FALSE);
	result = FALSE;
	return result;
}

gboolean
restic_joblet_process_message (ResticJoblet* self,
                               const gchar* msgid,
                               JsonReader* reader)
{
	ResticJobletClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = RESTIC_JOBLET_GET_CLASS (self);
	if (_klass_->process_message) {
		return _klass_->process_message (self, msgid, reader);
	}
	return FALSE;
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

gchar*
restic_joblet_escape_pattern (ResticJoblet* self,
                              const gchar* path)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (path != NULL, NULL);
	_tmp0_ = string_replace (path, "$", "$$");
	result = _tmp0_;
	return result;
}

gchar*
restic_joblet_escape_path (ResticJoblet* self,
                           const gchar* path)
{
	gchar* escaped = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (path != NULL, NULL);
	_tmp0_ = string_replace (path, "\\", "\\\\");
	escaped = _tmp0_;
	_tmp1_ = escaped;
	_tmp2_ = string_replace (_tmp1_, "*", "\\*");
	_g_free0 (escaped);
	escaped = _tmp2_;
	_tmp3_ = escaped;
	_tmp4_ = string_replace (_tmp3_, "?", "\\?");
	_g_free0 (escaped);
	escaped = _tmp4_;
	_tmp5_ = escaped;
	_tmp6_ = string_replace (_tmp5_, "[", "\\[");
	_g_free0 (escaped);
	escaped = _tmp6_;
	_tmp7_ = escaped;
	_tmp8_ = restic_joblet_escape_pattern (self, _tmp7_);
	result = _tmp8_;
	_g_free0 (escaped);
	return result;
}

static gchar
string_get (const gchar* self,
            glong index)
{
	gchar _tmp0_;
	gchar result;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = ((gchar*) self)[index];
	result = _tmp0_;
	return result;
}

static const gchar*
string_offset (const gchar* self,
               glong offset)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = (const gchar*) (((gchar*) self) + offset);
	return result;
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

gint
restic_joblet_cmp_prefix (const gchar* a,
                          const gchar* b)
{
	gchar* a_copy = NULL;
	gchar* b_copy = NULL;
	const gchar* a_cmp = NULL;
	const gchar* b_cmp = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp3_;
	const gchar* _tmp6_;
	const gchar* _tmp13_;
	GCompareFunc _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	gint result;
	g_return_val_if_fail (a != NULL, 0);
	g_return_val_if_fail (b != NULL, 0);
	a_copy = NULL;
	b_copy = NULL;
	a_cmp = a;
	b_cmp = b;
	_tmp0_ = a_cmp;
	if (string_get (_tmp0_, (glong) 0) == '!') {
		const gchar* _tmp1_;
		const gchar* _tmp2_;
		_tmp1_ = a_cmp;
		_tmp2_ = string_offset (_tmp1_, (glong) 1);
		a_cmp = _tmp2_;
	}
	_tmp3_ = b_cmp;
	if (string_get (_tmp3_, (glong) 0) == '!') {
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = b_cmp;
		_tmp5_ = string_offset (_tmp4_, (glong) 1);
		b_cmp = _tmp5_;
	}
	_tmp6_ = a_cmp;
	if (g_str_has_suffix (_tmp6_, "/*")) {
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		gint _tmp9_;
		gint _tmp10_;
		gchar* _tmp11_;
		const gchar* _tmp12_;
		_tmp7_ = a_cmp;
		_tmp8_ = a_cmp;
		_tmp9_ = strlen (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = string_substring (_tmp7_, (glong) 0, (glong) (_tmp10_ - 1));
		_g_free0 (a_copy);
		a_copy = _tmp11_;
		_tmp12_ = a_copy;
		a_cmp = _tmp12_;
	}
	_tmp13_ = b_cmp;
	if (g_str_has_suffix (_tmp13_, "/*")) {
		const gchar* _tmp14_;
		const gchar* _tmp15_;
		gint _tmp16_;
		gint _tmp17_;
		gchar* _tmp18_;
		const gchar* _tmp19_;
		_tmp14_ = b_cmp;
		_tmp15_ = b_cmp;
		_tmp16_ = strlen (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = string_substring (_tmp14_, (glong) 0, (glong) (_tmp17_ - 1));
		_g_free0 (b_copy);
		b_copy = _tmp18_;
		_tmp19_ = b_copy;
		b_cmp = _tmp19_;
	}
	_tmp20_ = ((GCompareFunc) g_strcmp0);
	_tmp21_ = a_cmp;
	_tmp22_ = b_cmp;
	result = _tmp20_ (_tmp21_, _tmp22_);
	_g_free0 (b_copy);
	_g_free0 (a_copy);
	return result;
}

static void
restic_joblet_real_handle_no_repository (ResticJoblet* self)
{
}

void
restic_joblet_handle_no_repository (ResticJoblet* self)
{
	ResticJobletClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = RESTIC_JOBLET_GET_CLASS (self);
	if (_klass_->handle_no_repository) {
		_klass_->handle_no_repository (self);
	}
}

static gboolean
restic_joblet_real_handle_out_of_space (ResticJoblet* self)
{
	gboolean result;
	result = FALSE;
	return result;
}

gboolean
restic_joblet_handle_out_of_space (ResticJoblet* self)
{
	ResticJobletClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = RESTIC_JOBLET_GET_CLASS (self);
	if (_klass_->handle_out_of_space) {
		return _klass_->handle_out_of_space (self);
	}
	return FALSE;
}

static gchar*
string_strip (const gchar* self)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	g_strstrip (_result_);
	result = _result_;
	return result;
}

static void
restic_joblet_real_handle_done (DejaDupToolJoblet* base,
                                gboolean success,
                                gboolean cancelled)
{
	ResticJoblet * self;
	self = (ResticJoblet*) base;
	if (self->ignore_errors) {
		success = TRUE;
	} else {
		gboolean _tmp0_ = FALSE;
		if (!self->fatal_error_issued) {
			const gchar* _tmp1_;
			_tmp1_ = self->priv->last_error_message;
			_tmp0_ = _tmp1_ != NULL;
		} else {
			_tmp0_ = FALSE;
		}
		if (_tmp0_) {
			const gchar* _tmp2_;
			gchar* _tmp3_;
			gchar* _tmp4_;
			_tmp2_ = self->priv->last_error_message;
			_tmp3_ = string_strip (_tmp2_);
			_tmp4_ = _tmp3_;
			deja_dup_tool_joblet_show_error ((DejaDupToolJoblet*) self, _tmp4_, NULL);
			_g_free0 (_tmp4_);
		}
	}
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_joblet_parent_class)->handle_done (G_TYPE_CHECK_INSTANCE_CAST (self, DEJA_DUP_TYPE_TOOL_JOBLET, DejaDupToolJoblet), success, cancelled);
}

static void
restic_joblet_real_handle_fatal_error (ResticJoblet* self,
                                       gint code,
                                       const gchar* msg)
{
	DejaDupBackendFile* file_backend = NULL;
	DejaDupBackend* _tmp0_;
	DejaDupBackend* _tmp1_;
	DejaDupBackendFile* _tmp2_;
	DejaDupBackendFile* _tmp3_;
	g_return_if_fail (msg != NULL);
	switch (code) {
		case RESTIC_INSTANCE_ERROR_NO_REPOSITORY:
		{
			restic_joblet_handle_no_repository (self);
			return;
		}
		case RESTIC_INSTANCE_ERROR_BAD_PASSWORD:
		{
			g_signal_emit_by_name ((DejaDupToolJob*) self, "bad-encryption-password");
			return;
		}
		case RESTIC_INSTANCE_ERROR_OUT_OF_SPACE:
		{
			if (restic_joblet_handle_out_of_space (self)) {
				return;
			}
			break;
		}
		default:
		break;
	}
	if (self->ignore_errors) {
		return;
	}
	self->fatal_error_issued = TRUE;
	_tmp0_ = deja_dup_tool_job_get_backend ((DejaDupToolJob*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (DEJA_DUP_IS_BACKEND_FILE (_tmp1_) ? ((DejaDupBackendFile*) _tmp1_) : NULL);
	file_backend = _tmp2_;
	_tmp3_ = file_backend;
	if (_tmp3_ != NULL) {
		DejaDupBackendFile* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp4_ = file_backend;
		_tmp5_ = deja_dup_backend_file_replace_path_with_uri (_tmp4_, msg);
		_tmp6_ = _tmp5_;
		deja_dup_tool_joblet_show_error ((DejaDupToolJoblet*) self, _tmp6_, NULL);
		_g_free0 (_tmp6_);
	} else {
		deja_dup_tool_joblet_show_error ((DejaDupToolJoblet*) self, msg, NULL);
	}
	_g_object_unref0 (file_backend);
}

void
restic_joblet_handle_fatal_error (ResticJoblet* self,
                                  gint code,
                                  const gchar* msg)
{
	ResticJobletClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = RESTIC_JOBLET_GET_CLASS (self);
	if (_klass_->handle_fatal_error) {
		_klass_->handle_fatal_error (self, code, msg);
	}
}

static gchar*
restic_joblet_get_remote (ResticJoblet* self,
                          GError** error)
{
	gchar* repo = NULL;
	DejaDupBackendFile* file_backend = NULL;
	DejaDupBackend* _tmp0_;
	DejaDupBackend* _tmp1_;
	DejaDupBackendFile* _tmp2_;
	DejaDupBackendFile* _tmp3_;
	const gchar* _tmp9_;
	const gchar* _tmp12_;
	const gchar* _tmp21_;
	gchar* _tmp22_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	repo = NULL;
	_tmp0_ = deja_dup_tool_job_get_backend ((DejaDupToolJob*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (DEJA_DUP_IS_BACKEND_FILE (_tmp1_) ? ((DejaDupBackendFile*) _tmp1_) : NULL);
	file_backend = _tmp2_;
	_tmp3_ = file_backend;
	if (_tmp3_ != NULL) {
		GFile* file = NULL;
		DejaDupBackendFile* _tmp4_;
		GFile* _tmp5_;
		GFile* _tmp6_;
		_tmp4_ = file_backend;
		_tmp5_ = deja_dup_backend_file_get_file_from_settings (_tmp4_);
		file = _tmp5_;
		_tmp6_ = file;
		if (_tmp6_ != NULL) {
			GFile* _tmp7_;
			gchar* _tmp8_;
			_tmp7_ = file;
			_tmp8_ = g_file_get_path (_tmp7_);
			_g_free0 (repo);
			repo = _tmp8_;
		}
		_g_object_unref0 (file);
	}
	_tmp9_ = self->priv->rclone_remote;
	if (_tmp9_ != NULL) {
		const gchar* _tmp10_;
		gchar* _tmp11_;
		_tmp10_ = self->priv->rclone_remote;
		_tmp11_ = g_strconcat ("rclone:", _tmp10_, NULL);
		_g_free0 (repo);
		repo = _tmp11_;
	}
	_tmp12_ = repo;
	if (_tmp12_ == NULL) {
		gchar* location_pretty = NULL;
		DejaDupBackend* _tmp13_;
		DejaDupBackend* _tmp14_;
		gchar* _tmp15_;
		const gchar* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		GError* _tmp19_;
		GError* _tmp20_;
		_tmp13_ = deja_dup_tool_job_get_backend ((DejaDupToolJob*) self);
		_tmp14_ = _tmp13_;
		_tmp15_ = deja_dup_backend_get_location_pretty (_tmp14_);
		location_pretty = _tmp15_;
		_tmp16_ = location_pretty;
		_tmp17_ = g_strdup_printf (_ ("Could not find storage location ‘%s’."), _tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_NOT_FOUND, _tmp18_);
		_tmp20_ = _tmp19_;
		_g_free0 (_tmp18_);
		_inner_error0_ = _tmp20_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (location_pretty);
		_g_object_unref0 (file_backend);
		_g_free0 (repo);
		return NULL;
	}
	_tmp21_ = repo;
	_tmp22_ = g_strconcat ("--repo=", _tmp21_, NULL);
	result = _tmp22_;
	_g_object_unref0 (file_backend);
	_g_free0 (repo);
	return result;
}

static void
restic_joblet_process_error (ResticJoblet* self,
                             JsonReader* reader)
{
	gchar* item = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* message = NULL;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	const gchar* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (reader != NULL);
	json_reader_read_member (reader, "item");
	_tmp0_ = json_reader_get_string_value (reader);
	_tmp1_ = g_strdup (_tmp0_);
	item = _tmp1_;
	json_reader_end_member (reader);
	json_reader_read_member (reader, "message");
	_tmp2_ = json_reader_get_string_value (reader);
	_tmp3_ = g_strdup (_tmp2_);
	message = _tmp3_;
	json_reader_end_member (reader);
	_tmp5_ = item;
	if (_tmp5_ != NULL) {
		const gchar* _tmp6_;
		_tmp6_ = item;
		_tmp4_ = g_strcmp0 (_tmp6_, "") != 0;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		const gchar* _tmp7_;
		_tmp7_ = item;
		g_signal_emit_by_name ((DejaDupToolJob*) self, "local-file-error", _tmp7_);
	} else {
		gboolean _tmp8_ = FALSE;
		const gchar* _tmp9_;
		_tmp9_ = message;
		if (_tmp9_ != NULL) {
			const gchar* _tmp10_;
			_tmp10_ = message;
			_tmp8_ = g_strcmp0 (_tmp10_, "") != 0;
		} else {
			_tmp8_ = FALSE;
		}
		if (_tmp8_) {
			const gchar* _tmp11_;
			gchar* _tmp12_;
			_tmp11_ = message;
			_tmp12_ = g_strdup (_tmp11_);
			_g_free0 (self->priv->last_error_message);
			self->priv->last_error_message = _tmp12_;
		}
	}
	_g_free0 (message);
	_g_free0 (item);
}

static void
restic_joblet_handle_message (ResticJoblet* self,
                              const gchar* msgid,
                              JsonReader* reader)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (reader != NULL);
	if (g_strcmp0 (msgid, "error") == 0) {
		restic_joblet_process_error (self, reader);
	} else {
		restic_joblet_process_message (self, msgid, reader);
	}
}

static gchar*
restic_joblet_restic_cachedir (ResticJoblet* self)
{
	gchar* dir = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_get_user_cache_dir ();
	_tmp1_ = g_strdup (_tmp0_);
	dir = _tmp1_;
	_tmp2_ = dir;
	if (_tmp2_ == NULL) {
		result = NULL;
		_g_free0 (dir);
		return result;
	}
	_tmp3_ = dir;
	_tmp4_ = g_build_filename (_tmp3_, PACKAGE, "restic", NULL);
	result = _tmp4_;
	_g_free0 (dir);
	return result;
}

guint
restic_joblet_chain_get_num_snapshots (ResticJoblet* self)
{
	DejaDupToolJobChain* _tmp0_;
	DejaDupToolJobChain* _tmp1_;
	gconstpointer _tmp2_;
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	_tmp0_ = deja_dup_tool_joblet_get_chain ((DejaDupToolJoblet*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_object_get_data ((GObject*) _tmp1_, "num-snapshots");
	result = GPOINTER_TO_UINT (_tmp2_);
	return result;
}

void
restic_joblet_chain_set_num_snapshots (ResticJoblet* self,
                                       guint num)
{
	DejaDupToolJobChain* _tmp0_;
	DejaDupToolJobChain* _tmp1_;
	void* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = deja_dup_tool_joblet_get_chain ((DejaDupToolJoblet*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = GUINT_TO_POINTER (num);
	g_object_set_data_full ((GObject*) _tmp1_, "num-snapshots", _tmp2_, NULL);
}

ResticJoblet*
restic_joblet_construct (GType object_type)
{
	ResticJoblet * self = NULL;
	self = (ResticJoblet*) deja_dup_tool_joblet_construct (object_type);
	return self;
}

ResticJoblet*
restic_joblet_new (void)
{
	return restic_joblet_construct (TYPE_RESTIC_JOBLET);
}

static void
restic_joblet_class_init (ResticJobletClass * klass,
                          gpointer klass_data)
{
	restic_joblet_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ResticJoblet_private_offset);
	((DejaDupToolJobletClass *) klass)->make_instance = (ToolInstance* (*) (DejaDupToolJoblet*)) restic_joblet_real_make_instance;
	((DejaDupToolJobletClass *) klass)->prepare = (void (*) (DejaDupToolJoblet*, GAsyncReadyCallback, gpointer)) restic_joblet_real_prepare;
	((DejaDupToolJobletClass *) klass)->prepare_finish = (void (*) (DejaDupToolJoblet*, GAsyncResult*, GError**)) restic_joblet_prepare_finish;
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) restic_joblet_real_prepare_args;
	((ResticJobletClass *) klass)->process_message = (gboolean (*) (ResticJoblet*, const gchar*, JsonReader*)) restic_joblet_real_process_message;
	((ResticJobletClass *) klass)->handle_no_repository = (void (*) (ResticJoblet*)) restic_joblet_real_handle_no_repository;
	((ResticJobletClass *) klass)->handle_out_of_space = (gboolean (*) (ResticJoblet*)) restic_joblet_real_handle_out_of_space;
	((DejaDupToolJobletClass *) klass)->handle_done = (void (*) (DejaDupToolJoblet*, gboolean, gboolean)) restic_joblet_real_handle_done;
	((ResticJobletClass *) klass)->handle_fatal_error = (void (*) (ResticJoblet*, gint, const gchar*)) restic_joblet_real_handle_fatal_error;
	G_OBJECT_CLASS (klass)->finalize = restic_joblet_finalize;
}

static void
restic_joblet_instance_init (ResticJoblet * self,
                             gpointer klass)
{
	self->priv = restic_joblet_get_instance_private (self);
	self->ignore_errors = FALSE;
	self->priv->rclone_remote = NULL;
	self->priv->tmpdir = NULL;
	self->fatal_error_issued = FALSE;
	self->priv->last_error_message = NULL;
}

static void
restic_joblet_finalize (GObject * obj)
{
	ResticJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_RESTIC_JOBLET, ResticJoblet);
	_g_free0 (self->priv->rclone_remote);
	_g_free0 (self->priv->tmpdir);
	_g_free0 (self->priv->last_error_message);
	G_OBJECT_CLASS (restic_joblet_parent_class)->finalize (obj);
}

/**
 * FIXME:
 * - removing old versions of duplicity as we make restic ones (wait until out of beta?)
 * - add README.txt to storage location
 * - look at fixmes in this file and ResticInstance.vala
 * - look at restic bugs in gitlab
 */
 G_GNUC_NO_INLINE static GType
restic_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ResticJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restic_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ResticJoblet), 0, (GInstanceInitFunc) restic_joblet_instance_init, NULL };
	GType restic_joblet_type_id;
	restic_joblet_type_id = g_type_register_static (DEJA_DUP_TYPE_TOOL_JOBLET, "ResticJoblet", &g_define_type_info, 0);
	ResticJoblet_private_offset = g_type_add_instance_private (restic_joblet_type_id, sizeof (ResticJobletPrivate));
	return restic_joblet_type_id;
}

GType
restic_joblet_get_type (void)
{
	static gsize restic_joblet_type_id__once = 0;
	if (g_once_init_enter (&restic_joblet_type_id__once)) {
		GType restic_joblet_type_id;
		restic_joblet_type_id = restic_joblet_get_type_once ();
		g_once_init_leave (&restic_joblet_type_id__once, restic_joblet_type_id);
	}
	return restic_joblet_type_id__once;
}

static void
restic_init_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                      GList** argv,
                                      GList** envp,
                                      GError** error)
{
	ResticInitJoblet * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	GError* _inner_error0_ = NULL;
	self = (ResticInitJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_init_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_JOBLET, ResticJoblet), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = g_strdup ("init");
	*argv = g_list_append (*argv, _tmp0_);
	_tmp1_ = g_strdup ("--repository-version=2");
	*argv = g_list_append (*argv, _tmp1_);
}

ResticInitJoblet*
restic_init_joblet_construct (GType object_type)
{
	ResticInitJoblet * self = NULL;
	self = (ResticInitJoblet*) restic_joblet_construct (object_type);
	return self;
}

ResticInitJoblet*
restic_init_joblet_new (void)
{
	return restic_init_joblet_construct (TYPE_RESTIC_INIT_JOBLET);
}

static void
restic_init_joblet_class_init (ResticInitJobletClass * klass,
                               gpointer klass_data)
{
	restic_init_joblet_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) restic_init_joblet_real_prepare_args;
}

static void
restic_init_joblet_instance_init (ResticInitJoblet * self,
                                  gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
restic_init_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ResticInitJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restic_init_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ResticInitJoblet), 0, (GInstanceInitFunc) restic_init_joblet_instance_init, NULL };
	GType restic_init_joblet_type_id;
	restic_init_joblet_type_id = g_type_register_static (TYPE_RESTIC_JOBLET, "ResticInitJoblet", &g_define_type_info, 0);
	return restic_init_joblet_type_id;
}

GType
restic_init_joblet_get_type (void)
{
	static gsize restic_init_joblet_type_id__once = 0;
	if (g_once_init_enter (&restic_init_joblet_type_id__once)) {
		GType restic_init_joblet_type_id;
		restic_init_joblet_type_id = restic_init_joblet_get_type_once ();
		g_once_init_leave (&restic_init_joblet_type_id__once, restic_init_joblet_type_id);
	}
	return restic_init_joblet_type_id__once;
}

static void
restic_unlock_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                        GList** argv,
                                        GList** envp,
                                        GError** error)
{
	ResticUnlockJoblet * self;
	gchar* _tmp0_;
	GError* _inner_error0_ = NULL;
	self = (ResticUnlockJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_unlock_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_JOBLET, ResticJoblet), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = g_strdup ("unlock");
	*argv = g_list_append (*argv, _tmp0_);
}

ResticUnlockJoblet*
restic_unlock_joblet_construct (GType object_type)
{
	ResticUnlockJoblet * self = NULL;
	self = (ResticUnlockJoblet*) restic_joblet_construct (object_type);
	return self;
}

ResticUnlockJoblet*
restic_unlock_joblet_new (void)
{
	return restic_unlock_joblet_construct (TYPE_RESTIC_UNLOCK_JOBLET);
}

static GObject *
restic_unlock_joblet_constructor (GType type,
                                  guint n_construct_properties,
                                  GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	ResticUnlockJoblet * self;
	parent_class = G_OBJECT_CLASS (restic_unlock_joblet_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_RESTIC_UNLOCK_JOBLET, ResticUnlockJoblet);
	((ResticJoblet*) self)->ignore_errors = TRUE;
	return obj;
}

static void
restic_unlock_joblet_class_init (ResticUnlockJobletClass * klass,
                                 gpointer klass_data)
{
	restic_unlock_joblet_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) restic_unlock_joblet_real_prepare_args;
	G_OBJECT_CLASS (klass)->constructor = restic_unlock_joblet_constructor;
}

static void
restic_unlock_joblet_instance_init (ResticUnlockJoblet * self,
                                    gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
restic_unlock_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ResticUnlockJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restic_unlock_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ResticUnlockJoblet), 0, (GInstanceInitFunc) restic_unlock_joblet_instance_init, NULL };
	GType restic_unlock_joblet_type_id;
	restic_unlock_joblet_type_id = g_type_register_static (TYPE_RESTIC_JOBLET, "ResticUnlockJoblet", &g_define_type_info, 0);
	return restic_unlock_joblet_type_id;
}

GType
restic_unlock_joblet_get_type (void)
{
	static gsize restic_unlock_joblet_type_id__once = 0;
	if (g_once_init_enter (&restic_unlock_joblet_type_id__once)) {
		GType restic_unlock_joblet_type_id;
		restic_unlock_joblet_type_id = restic_unlock_joblet_get_type_once ();
		g_once_init_leave (&restic_unlock_joblet_type_id__once, restic_unlock_joblet_type_id);
	}
	return restic_unlock_joblet_type_id__once;
}

static inline gpointer
restic_backup_joblet_get_instance_private (ResticBackupJoblet* self)
{
	return G_STRUCT_MEMBER_P (self, ResticBackupJoblet_private_offset);
}

static void
restic_backup_joblet_real_handle_done (DejaDupToolJoblet* base,
                                       gboolean success,
                                       gboolean cancelled)
{
	ResticBackupJoblet * self;
	gboolean _tmp0_ = FALSE;
	self = (ResticBackupJoblet*) base;
	if (self->priv->snapshot_made) {
		_tmp0_ = !cancelled;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		success = TRUE;
	}
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_backup_joblet_parent_class)->handle_done ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_JOBLET, ResticJoblet), success, cancelled);
}

static gboolean
restic_backup_joblet_real_handle_out_of_space (ResticJoblet* base)
{
	ResticBackupJoblet * self;
	gboolean result;
	self = (ResticBackupJoblet*) base;
	if (restic_joblet_chain_get_num_snapshots ((ResticJoblet*) self) > ((guint) 1)) {
		DejaDupToolJobChain* _tmp0_;
		DejaDupToolJobChain* _tmp1_;
		ResticBackupJoblet* _tmp2_;
		ResticBackupJoblet* _tmp3_;
		DejaDupToolJobChain* _tmp4_;
		DejaDupToolJobChain* _tmp5_;
		ResticDeleteOldestBackupJoblet* _tmp6_;
		ResticDeleteOldestBackupJoblet* _tmp7_;
		_tmp0_ = deja_dup_tool_joblet_get_chain ((DejaDupToolJoblet*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = restic_backup_joblet_new ();
		_tmp3_ = _tmp2_;
		deja_dup_tool_job_chain_prepend_to_chain (_tmp1_, (DejaDupToolJoblet*) _tmp3_);
		_g_object_unref0 (_tmp3_);
		_tmp4_ = deja_dup_tool_joblet_get_chain ((DejaDupToolJoblet*) self);
		_tmp5_ = _tmp4_;
		_tmp6_ = restic_delete_oldest_backup_joblet_new ();
		_tmp7_ = _tmp6_;
		deja_dup_tool_job_chain_prepend_to_chain (_tmp5_, (DejaDupToolJoblet*) _tmp7_);
		_g_object_unref0 (_tmp7_);
		((ResticJoblet*) self)->ignore_errors = TRUE;
		result = TRUE;
		return result;
	}
	result = FALSE;
	return result;
}

static void
restic_backup_joblet_real_prepare_data_free (gpointer _data)
{
	ResticBackupJobletPrepareData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ResticBackupJobletPrepareData, _data_);
}

static void
restic_backup_joblet_real_prepare (DejaDupToolJoblet* base,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	ResticBackupJoblet * self;
	ResticBackupJobletPrepareData* _data_;
	ResticBackupJoblet* _tmp0_;
	self = (ResticBackupJoblet*) base;
	_data_ = g_slice_new0 (ResticBackupJobletPrepareData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, restic_backup_joblet_real_prepare_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	restic_backup_joblet_real_prepare_co (_data_);
}

static void
restic_backup_joblet_prepare_finish (DejaDupToolJoblet* base,
                                     GAsyncResult* _res_,
                                     GError** error)
{
	ResticBackupJobletPrepareData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
restic_backup_joblet_prepare_ready (GObject* source_object,
                                    GAsyncResult* _res_,
                                    gpointer _user_data_)
{
	ResticBackupJobletPrepareData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	restic_backup_joblet_real_prepare_co (_data_);
}

static gboolean
restic_backup_joblet_real_prepare_co (ResticBackupJobletPrepareData* _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_->_state_ = 1;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_backup_joblet_parent_class)->prepare ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (_data_->self, TYPE_RESTIC_JOBLET, ResticJoblet), restic_backup_joblet_prepare_ready, _data_);
	return FALSE;
	_state_1:
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_backup_joblet_parent_class)->prepare_finish ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (_data_->self, TYPE_RESTIC_JOBLET, ResticJoblet), _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp0_ = deja_dup_tool_job_get_backend ((DejaDupToolJob*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = 0ULL;
	_data_->_tmp3_ = 0ULL;
	_data_->_state_ = 2;
	deja_dup_backend_get_space (_data_->_tmp1_, restic_backup_joblet_prepare_ready, _data_);
	return FALSE;
	_state_2:
	deja_dup_backend_get_space_finish (_data_->_tmp1_, _data_->_res_, &_data_->_tmp2_, &_data_->_tmp3_);
	_data_->self->priv->free_space = _data_->_tmp2_;
	_data_->self->priv->total_space = _data_->_tmp3_;
	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
restic_backup_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                        GList** argv,
                                        GList** envp,
                                        GError** error)
{
	ResticBackupJoblet * self;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GError* _inner_error0_ = NULL;
	self = (ResticBackupJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_backup_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_JOBLET, ResticJoblet), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	deja_dup_tool_job_set_tag ((DejaDupToolJob*) self, "latest");
	_tmp0_ = g_strdup ("backup");
	*argv = g_list_append (*argv, _tmp0_);
	_tmp1_ = g_get_host_name ();
	_tmp2_ = g_strconcat ("--host=", _tmp1_, NULL);
	*argv = g_list_append (*argv, _tmp2_);
	_tmp3_ = g_strdup ("--tag=deja-dup");
	*argv = g_list_append (*argv, _tmp3_);
	_tmp4_ = g_strdup ("--group-by=host,tags");
	*argv = g_list_append (*argv, _tmp4_);
	_tmp5_ = g_strdup ("--exclude-caches");
	*argv = g_list_append (*argv, _tmp5_);
	_tmp6_ = g_strdup ("--exclude-if-present=.deja-dup-ignore");
	*argv = g_list_append (*argv, _tmp6_);
	restic_backup_joblet_add_include_excludes (self, argv);
}

static gboolean
restic_backup_joblet_process_status (ResticBackupJoblet* self,
                                     JsonReader* reader)
{
	gint64 current_seconds = 0LL;
	gint64 total_bytes = 0LL;
	gdouble percent_done = 0.0;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (reader != NULL, FALSE);
	current_seconds = self->priv->seconds_elapsed;
	if (json_reader_read_member (reader, "seconds_elapsed")) {
		self->priv->seconds_elapsed = json_reader_get_int_value (reader);
	} else {
		self->priv->seconds_elapsed = (gint64) 0;
	}
	json_reader_end_member (reader);
	if (current_seconds == self->priv->seconds_elapsed) {
		result = TRUE;
		return result;
	}
	json_reader_read_member (reader, "total_bytes");
	total_bytes = json_reader_get_int_value (reader);
	json_reader_end_member (reader);
	if (((guint64) total_bytes) > self->priv->total_space) {
		gchar* msg = NULL;
		gchar* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		const gchar* _tmp6_;
		_tmp0_ = g_format_size_full ((guint64) total_bytes, G_FORMAT_SIZE_DEFAULT);
		_tmp1_ = _tmp0_;
		_tmp2_ = g_strdup_printf (_ ("Try using a location with at least %s."), _tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = g_strdup_printf ("%s %s", _ ("Backup location is too small."), _tmp3_);
		_tmp5_ = _tmp4_;
		_g_free0 (_tmp3_);
		_g_free0 (_tmp1_);
		msg = _tmp5_;
		_tmp6_ = msg;
		deja_dup_tool_joblet_show_error ((DejaDupToolJoblet*) self, _tmp6_, NULL);
		deja_dup_tool_joblet_disconnect_inst ((DejaDupToolJoblet*) self);
		g_signal_emit_by_name ((DejaDupToolJob*) self, "done", FALSE, FALSE);
		result = TRUE;
		_g_free0 (msg);
		return result;
	}
	json_reader_read_member (reader, "percent_done");
	percent_done = json_reader_get_double_value (reader);
	json_reader_end_member (reader);
	g_signal_emit_by_name ((DejaDupToolJob*) self, "progress", percent_done);
	if (json_reader_read_member (reader, "current_files")) {
		gint count = 0;
		count = json_reader_count_elements (reader);
		if (count > 0) {
			gchar* path = NULL;
			const gchar* _tmp7_;
			gchar* _tmp8_;
			const gchar* _tmp9_;
			GFile* _tmp10_;
			GFile* _tmp11_;
			json_reader_read_element (reader, (guint) 0);
			_tmp7_ = json_reader_get_string_value (reader);
			_tmp8_ = g_strdup (_tmp7_);
			path = _tmp8_;
			json_reader_end_element (reader);
			_tmp9_ = path;
			_tmp10_ = g_file_new_for_path (_tmp9_);
			_tmp11_ = _tmp10_;
			g_signal_emit_by_name ((DejaDupToolJob*) self, "action-file-changed", _tmp11_, TRUE);
			_g_object_unref0 (_tmp11_);
			_g_free0 (path);
		}
	}
	json_reader_end_member (reader);
	result = TRUE;
	return result;
}

static gboolean
restic_backup_joblet_process_summary (ResticBackupJoblet* self,
                                      JsonReader* reader)
{
	gchar* snapshot_id = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (reader != NULL, FALSE);
	json_reader_read_member (reader, "snapshot_id");
	_tmp0_ = json_reader_get_string_value (reader);
	_tmp1_ = g_strdup (_tmp0_);
	snapshot_id = _tmp1_;
	json_reader_end_member (reader);
	_tmp3_ = snapshot_id;
	if (_tmp3_ != NULL) {
		const gchar* _tmp4_;
		_tmp4_ = snapshot_id;
		_tmp2_ = g_strcmp0 (_tmp4_, "") != 0;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		self->priv->snapshot_made = TRUE;
	}
	result = TRUE;
	_g_free0 (snapshot_id);
	return result;
}

static gboolean
restic_backup_joblet_real_process_message (ResticJoblet* base,
                                           const gchar* msgid,
                                           JsonReader* reader)
{
	ResticBackupJoblet * self;
	gboolean result;
	self = (ResticBackupJoblet*) base;
	g_return_val_if_fail (reader != NULL, FALSE);
	if (g_strcmp0 (msgid, "status") == 0) {
		result = restic_backup_joblet_process_status (self, reader);
		return result;
	}
	if (g_strcmp0 (msgid, "summary") == 0) {
		result = restic_backup_joblet_process_summary (self, reader);
		return result;
	}
	result = FALSE;
	return result;
}

static void
restic_backup_joblet_real_handle_no_repository (ResticJoblet* base)
{
	ResticBackupJoblet * self;
	DejaDupToolJobChain* _tmp0_;
	DejaDupToolJobChain* _tmp1_;
	ResticBackupJoblet* _tmp2_;
	ResticBackupJoblet* _tmp3_;
	DejaDupToolJobChain* _tmp4_;
	DejaDupToolJobChain* _tmp5_;
	ResticInitJoblet* _tmp6_;
	ResticInitJoblet* _tmp7_;
	self = (ResticBackupJoblet*) base;
	g_signal_emit_by_name ((DejaDupToolJob*) self, "is-full", TRUE);
	_tmp0_ = deja_dup_tool_joblet_get_chain ((DejaDupToolJoblet*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = restic_backup_joblet_new ();
	_tmp3_ = _tmp2_;
	deja_dup_tool_job_chain_prepend_to_chain (_tmp1_, (DejaDupToolJoblet*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	_tmp4_ = deja_dup_tool_joblet_get_chain ((DejaDupToolJoblet*) self);
	_tmp5_ = _tmp4_;
	_tmp6_ = restic_init_joblet_new ();
	_tmp7_ = _tmp6_;
	deja_dup_tool_job_chain_prepend_to_chain (_tmp5_, (DejaDupToolJoblet*) _tmp7_);
	_g_object_unref0 (_tmp7_);
	deja_dup_tool_joblet_disconnect_inst ((DejaDupToolJoblet*) self);
	g_signal_emit_by_name ((DejaDupToolJob*) self, "done", TRUE, FALSE);
}

static gboolean
restic_backup_joblet_list_contains_file (ResticBackupJoblet* self,
                                         GList* list,
                                         GFile* file)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (file != NULL, FALSE);
	{
		GList* f_collection = NULL;
		GList* f_it = NULL;
		f_collection = list;
		for (f_it = f_collection; f_it != NULL; f_it = f_it->next) {
			GFile* _tmp0_;
			GFile* f = NULL;
			_tmp0_ = _g_object_ref0 ((GFile*) f_it->data);
			f = _tmp0_;
			{
				GFile* _tmp1_;
				_tmp1_ = f;
				if (g_file_equal (_tmp1_, file)) {
					result = TRUE;
					_g_object_unref0 (f);
					return result;
				}
				_g_object_unref0 (f);
			}
		}
	}
	result = FALSE;
	return result;
}

static gint
_restic_joblet_cmp_prefix_gcompare_func (gconstpointer a,
                                         gconstpointer b)
{
	gint result;
	result = restic_joblet_cmp_prefix ((const gchar*) a, (const gchar*) b);
	return result;
}

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
restic_backup_joblet_add_include_excludes (ResticBackupJoblet* self,
                                           GList** argv)
{
	GList* all_exclude_paths = NULL;
	GList* _tmp0_;
	GList* _tmp14_;
	GList* _tmp24_;
	GList* _tmp28_;
	g_return_if_fail (self != NULL);
	deja_dup_expand_links_in_list (&((DejaDupToolJob*) self)->includes, TRUE, FALSE);
	deja_dup_expand_links_in_list (&((DejaDupToolJob*) self)->excludes, FALSE, FALSE);
	deja_dup_expand_links_in_list (&((DejaDupToolJob*) self)->exclude_regexps, FALSE, TRUE);
	all_exclude_paths = NULL;
	_tmp0_ = ((DejaDupToolJob*) self)->excludes;
	{
		GList* file_collection = NULL;
		GList* file_it = NULL;
		file_collection = _tmp0_;
		for (file_it = file_collection; file_it != NULL; file_it = file_it->next) {
			GFile* _tmp1_;
			GFile* file = NULL;
			_tmp1_ = _g_object_ref0 ((GFile*) file_it->data);
			file = _tmp1_;
			{
				GList* _tmp2_;
				GFile* _tmp3_;
				_tmp2_ = ((DejaDupToolJob*) self)->includes;
				_tmp3_ = file;
				if (!restic_backup_joblet_list_contains_file (self, _tmp2_, _tmp3_)) {
					GFile* _tmp4_;
					gchar* _tmp5_;
					gchar* _tmp6_;
					gchar* _tmp7_;
					GFile* _tmp8_;
					gchar* _tmp9_;
					gchar* _tmp10_;
					gchar* _tmp11_;
					gchar* _tmp12_;
					gchar* _tmp13_;
					_tmp4_ = file;
					_tmp5_ = g_file_get_path (_tmp4_);
					_tmp6_ = _tmp5_;
					_tmp7_ = restic_joblet_escape_path ((ResticJoblet*) self, _tmp6_);
					all_exclude_paths = g_list_append (all_exclude_paths, _tmp7_);
					_g_free0 (_tmp6_);
					_tmp8_ = file;
					_tmp9_ = g_file_get_path (_tmp8_);
					_tmp10_ = _tmp9_;
					_tmp11_ = restic_joblet_escape_path ((ResticJoblet*) self, _tmp10_);
					_tmp12_ = _tmp11_;
					_tmp13_ = g_strconcat (_tmp12_, "/*", NULL);
					all_exclude_paths = g_list_append (all_exclude_paths, _tmp13_);
					_g_free0 (_tmp12_);
					_g_free0 (_tmp10_);
				}
				_g_object_unref0 (file);
			}
		}
	}
	_tmp14_ = ((DejaDupToolJob*) self)->includes;
	{
		GList* file_collection = NULL;
		GList* file_it = NULL;
		file_collection = _tmp14_;
		for (file_it = file_collection; file_it != NULL; file_it = file_it->next) {
			GFile* _tmp15_;
			GFile* file = NULL;
			_tmp15_ = _g_object_ref0 ((GFile*) file_it->data);
			file = _tmp15_;
			{
				GFile* _tmp16_;
				gchar* _tmp17_;
				gchar* _tmp18_;
				gchar* _tmp19_;
				gchar* _tmp20_;
				gchar* _tmp21_;
				GFile* _tmp22_;
				gchar* _tmp23_;
				_tmp16_ = file;
				_tmp17_ = g_file_get_path (_tmp16_);
				_tmp18_ = _tmp17_;
				_tmp19_ = restic_joblet_escape_path ((ResticJoblet*) self, _tmp18_);
				_tmp20_ = _tmp19_;
				_tmp21_ = g_strconcat ("!", _tmp20_, NULL);
				all_exclude_paths = g_list_append (all_exclude_paths, _tmp21_);
				_g_free0 (_tmp20_);
				_g_free0 (_tmp18_);
				_tmp22_ = file;
				_tmp23_ = g_file_get_path (_tmp22_);
				*argv = g_list_append (*argv, _tmp23_);
				_g_object_unref0 (file);
			}
		}
	}
	all_exclude_paths = g_list_sort (all_exclude_paths, _restic_joblet_cmp_prefix_gcompare_func);
	_tmp24_ = all_exclude_paths;
	{
		GList* exclude_path_collection = NULL;
		GList* exclude_path_it = NULL;
		exclude_path_collection = _tmp24_;
		for (exclude_path_it = exclude_path_collection; exclude_path_it != NULL; exclude_path_it = exclude_path_it->next) {
			gchar* _tmp25_;
			gchar* exclude_path = NULL;
			_tmp25_ = g_strdup ((const gchar*) exclude_path_it->data);
			exclude_path = _tmp25_;
			{
				const gchar* _tmp26_;
				gchar* _tmp27_;
				_tmp26_ = exclude_path;
				_tmp27_ = g_strconcat ("--exclude=", _tmp26_, NULL);
				*argv = g_list_append (*argv, _tmp27_);
				_g_free0 (exclude_path);
			}
		}
	}
	_tmp28_ = ((DejaDupToolJob*) self)->exclude_regexps;
	{
		GList* regexp_collection = NULL;
		GList* regexp_it = NULL;
		regexp_collection = _tmp28_;
		for (regexp_it = regexp_collection; regexp_it != NULL; regexp_it = regexp_it->next) {
			GFile* _tmp29_;
			GFile* regexp = NULL;
			_tmp29_ = _g_object_ref0 ((GFile*) regexp_it->data);
			regexp = _tmp29_;
			{
				GFile* _tmp30_;
				gchar* _tmp31_;
				gchar* _tmp32_;
				gchar* _tmp33_;
				gchar* _tmp34_;
				gchar* _tmp35_;
				_tmp30_ = regexp;
				_tmp31_ = g_file_get_path (_tmp30_);
				_tmp32_ = _tmp31_;
				_tmp33_ = restic_joblet_escape_pattern ((ResticJoblet*) self, _tmp32_);
				_tmp34_ = _tmp33_;
				_tmp35_ = g_strconcat ("--exclude=", _tmp34_, NULL);
				*argv = g_list_append (*argv, _tmp35_);
				_g_free0 (_tmp34_);
				_g_free0 (_tmp32_);
				_g_object_unref0 (regexp);
			}
		}
	}
	(all_exclude_paths == NULL) ? NULL : (all_exclude_paths = (_g_list_free__g_free0_ (all_exclude_paths), NULL));
}

ResticBackupJoblet*
restic_backup_joblet_construct (GType object_type)
{
	ResticBackupJoblet * self = NULL;
	self = (ResticBackupJoblet*) restic_joblet_construct (object_type);
	return self;
}

ResticBackupJoblet*
restic_backup_joblet_new (void)
{
	return restic_backup_joblet_construct (TYPE_RESTIC_BACKUP_JOBLET);
}

static void
restic_backup_joblet_class_init (ResticBackupJobletClass * klass,
                                 gpointer klass_data)
{
	restic_backup_joblet_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ResticBackupJoblet_private_offset);
	((DejaDupToolJobletClass *) klass)->handle_done = (void (*) (DejaDupToolJoblet*, gboolean, gboolean)) restic_backup_joblet_real_handle_done;
	((ResticJobletClass *) klass)->handle_out_of_space = (gboolean (*) (ResticJoblet*)) restic_backup_joblet_real_handle_out_of_space;
	((DejaDupToolJobletClass *) klass)->prepare = (void (*) (DejaDupToolJoblet*, GAsyncReadyCallback, gpointer)) restic_backup_joblet_real_prepare;
	((DejaDupToolJobletClass *) klass)->prepare_finish = (void (*) (DejaDupToolJoblet*, GAsyncResult*, GError**)) restic_backup_joblet_prepare_finish;
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) restic_backup_joblet_real_prepare_args;
	((ResticJobletClass *) klass)->process_message = (gboolean (*) (ResticJoblet*, const gchar*, JsonReader*)) restic_backup_joblet_real_process_message;
	((ResticJobletClass *) klass)->handle_no_repository = (void (*) (ResticJoblet*)) restic_backup_joblet_real_handle_no_repository;
	G_OBJECT_CLASS (klass)->finalize = restic_backup_joblet_finalize;
}

static void
restic_backup_joblet_instance_init (ResticBackupJoblet * self,
                                    gpointer klass)
{
	self->priv = restic_backup_joblet_get_instance_private (self);
	self->priv->snapshot_made = FALSE;
	self->priv->seconds_elapsed = (gint64) -1;
	self->priv->free_space = DEJA_DUP_BACKEND_INFINITE_SPACE;
	self->priv->total_space = DEJA_DUP_BACKEND_INFINITE_SPACE;
}

static void
restic_backup_joblet_finalize (GObject * obj)
{
	ResticBackupJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_RESTIC_BACKUP_JOBLET, ResticBackupJoblet);
	G_OBJECT_CLASS (restic_backup_joblet_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
restic_backup_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ResticBackupJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restic_backup_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ResticBackupJoblet), 0, (GInstanceInitFunc) restic_backup_joblet_instance_init, NULL };
	GType restic_backup_joblet_type_id;
	restic_backup_joblet_type_id = g_type_register_static (TYPE_RESTIC_JOBLET, "ResticBackupJoblet", &g_define_type_info, 0);
	ResticBackupJoblet_private_offset = g_type_add_instance_private (restic_backup_joblet_type_id, sizeof (ResticBackupJobletPrivate));
	return restic_backup_joblet_type_id;
}

GType
restic_backup_joblet_get_type (void)
{
	static gsize restic_backup_joblet_type_id__once = 0;
	if (g_once_init_enter (&restic_backup_joblet_type_id__once)) {
		GType restic_backup_joblet_type_id;
		restic_backup_joblet_type_id = restic_backup_joblet_get_type_once ();
		g_once_init_leave (&restic_backup_joblet_type_id__once, restic_backup_joblet_type_id);
	}
	return restic_backup_joblet_type_id__once;
}

static void
restic_delete_joblet_base_real_prepare_args (DejaDupToolJoblet* base,
                                             GList** argv,
                                             GList** envp,
                                             GError** error)
{
	ResticDeleteJobletBase * self;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GError* _inner_error0_ = NULL;
	self = (ResticDeleteJobletBase*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_delete_joblet_base_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_JOBLET, ResticJoblet), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = g_strdup ("forget");
	*argv = g_list_append (*argv, _tmp0_);
	_tmp1_ = g_get_host_name ();
	_tmp2_ = g_strconcat ("--host=", _tmp1_, NULL);
	*argv = g_list_append (*argv, _tmp2_);
	_tmp3_ = g_strdup ("--tag=deja-dup");
	*argv = g_list_append (*argv, _tmp3_);
	_tmp4_ = g_strdup ("--group-by=host,tags");
	*argv = g_list_append (*argv, _tmp4_);
	_tmp5_ = g_strdup ("--prune");
	*argv = g_list_append (*argv, _tmp5_);
}

static void
restic_delete_joblet_base_real_prepare_data_free (gpointer _data)
{
	ResticDeleteJobletBasePrepareData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ResticDeleteJobletBasePrepareData, _data_);
}

static void
restic_delete_joblet_base_real_prepare (DejaDupToolJoblet* base,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	ResticDeleteJobletBase * self;
	ResticDeleteJobletBasePrepareData* _data_;
	ResticDeleteJobletBase* _tmp0_;
	self = (ResticDeleteJobletBase*) base;
	_data_ = g_slice_new0 (ResticDeleteJobletBasePrepareData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, restic_delete_joblet_base_real_prepare_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	restic_delete_joblet_base_real_prepare_co (_data_);
}

static void
restic_delete_joblet_base_prepare_finish (DejaDupToolJoblet* base,
                                          GAsyncResult* _res_,
                                          GError** error)
{
	ResticDeleteJobletBasePrepareData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
restic_delete_joblet_base_prepare_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	ResticDeleteJobletBasePrepareData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	restic_delete_joblet_base_real_prepare_co (_data_);
}

static gboolean
restic_delete_joblet_base_real_prepare_co (ResticDeleteJobletBasePrepareData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_delete_joblet_base_parent_class)->prepare ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (_data_->self, TYPE_RESTIC_JOBLET, ResticJoblet), restic_delete_joblet_base_prepare_ready, _data_);
	return FALSE;
	_state_1:
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_delete_joblet_base_parent_class)->prepare_finish ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (_data_->self, TYPE_RESTIC_JOBLET, ResticJoblet), _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp0_ = deja_dup_mount_manager_get_instance ();
	_data_->manager = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->manager;
	_data_->_tmp2_ = deja_dup_make_restic_tool ();
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = deja_dup_tool_job_get_backend ((DejaDupToolJob*) _data_->self);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = deja_dup_mount_manager_get_mount_dir (_data_->_tmp1_, _data_->_tmp3_, _data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_g_object_unref0 (_data_->_tmp3_);
	_data_->dir = _data_->_tmp7_;
	_data_->_tmp8_ = _data_->manager;
	_data_->_tmp9_ = _data_->dir;
	deja_dup_mount_manager_unmount (_data_->_tmp8_, _data_->_tmp9_);
	_g_free0 (_data_->dir);
	_g_object_unref0 (_data_->manager);
	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;
}

ResticDeleteJobletBase*
restic_delete_joblet_base_construct (GType object_type)
{
	ResticDeleteJobletBase * self = NULL;
	self = (ResticDeleteJobletBase*) restic_joblet_construct (object_type);
	return self;
}

ResticDeleteJobletBase*
restic_delete_joblet_base_new (void)
{
	return restic_delete_joblet_base_construct (TYPE_RESTIC_DELETE_JOBLET_BASE);
}

static void
restic_delete_joblet_base_class_init (ResticDeleteJobletBaseClass * klass,
                                      gpointer klass_data)
{
	restic_delete_joblet_base_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) restic_delete_joblet_base_real_prepare_args;
	((DejaDupToolJobletClass *) klass)->prepare = (void (*) (DejaDupToolJoblet*, GAsyncReadyCallback, gpointer)) restic_delete_joblet_base_real_prepare;
	((DejaDupToolJobletClass *) klass)->prepare_finish = (void (*) (DejaDupToolJoblet*, GAsyncResult*, GError**)) restic_delete_joblet_base_prepare_finish;
}

static void
restic_delete_joblet_base_instance_init (ResticDeleteJobletBase * self,
                                         gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
restic_delete_joblet_base_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ResticDeleteJobletBaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restic_delete_joblet_base_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ResticDeleteJobletBase), 0, (GInstanceInitFunc) restic_delete_joblet_base_instance_init, NULL };
	GType restic_delete_joblet_base_type_id;
	restic_delete_joblet_base_type_id = g_type_register_static (TYPE_RESTIC_JOBLET, "ResticDeleteJobletBase", &g_define_type_info, 0);
	return restic_delete_joblet_base_type_id;
}

GType
restic_delete_joblet_base_get_type (void)
{
	static gsize restic_delete_joblet_base_type_id__once = 0;
	if (g_once_init_enter (&restic_delete_joblet_base_type_id__once)) {
		GType restic_delete_joblet_base_type_id;
		restic_delete_joblet_base_type_id = restic_delete_joblet_base_get_type_once ();
		g_once_init_leave (&restic_delete_joblet_base_type_id__once, restic_delete_joblet_base_type_id);
	}
	return restic_delete_joblet_base_type_id__once;
}

static inline gpointer
restic_delete_old_backups_joblet_get_instance_private (ResticDeleteOldBackupsJoblet* self)
{
	return G_STRUCT_MEMBER_P (self, ResticDeleteOldBackupsJoblet_private_offset);
}

ResticDeleteOldBackupsJoblet*
restic_delete_old_backups_joblet_construct (GType object_type,
                                            gint delete_after)
{
	ResticDeleteOldBackupsJoblet * self = NULL;
	self = (ResticDeleteOldBackupsJoblet*) g_object_new (object_type, "delete-after", delete_after, NULL);
	return self;
}

ResticDeleteOldBackupsJoblet*
restic_delete_old_backups_joblet_new (gint delete_after)
{
	return restic_delete_old_backups_joblet_construct (TYPE_RESTIC_DELETE_OLD_BACKUPS_JOBLET, delete_after);
}

static void
restic_delete_old_backups_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                                    GList** argv,
                                                    GList** envp,
                                                    GError** error)
{
	ResticDeleteOldBackupsJoblet * self;
	gint _tmp0_;
	gchar* _tmp1_;
	GError* _inner_error0_ = NULL;
	self = (ResticDeleteOldBackupsJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_delete_old_backups_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_DELETE_JOBLET_BASE, ResticDeleteJobletBase), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = self->priv->_delete_after;
	_tmp1_ = g_strdup_printf ("--keep-within=%dd", _tmp0_);
	*argv = g_list_append (*argv, _tmp1_);
}

static void
restic_delete_old_backups_joblet_real_handle_fatal_error (ResticJoblet* base,
                                                          gint code,
                                                          const gchar* msg)
{
	ResticDeleteOldBackupsJoblet * self;
	self = (ResticDeleteOldBackupsJoblet*) base;
	g_return_if_fail (msg != NULL);
	if (code == RESTIC_INSTANCE_ERROR_ALREADY_LOCKED) {
		((ResticJoblet*) self)->ignore_errors = TRUE;
	}
	RESTIC_JOBLET_CLASS (restic_delete_old_backups_joblet_parent_class)->handle_fatal_error ((ResticJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_DELETE_JOBLET_BASE, ResticDeleteJobletBase), code, msg);
}

gint
restic_delete_old_backups_joblet_get_delete_after (ResticDeleteOldBackupsJoblet* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_delete_after;
	return result;
}

static void
restic_delete_old_backups_joblet_set_delete_after (ResticDeleteOldBackupsJoblet* self,
                                                   gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = restic_delete_old_backups_joblet_get_delete_after (self);
	if (old_value != value) {
		self->priv->_delete_after = value;
		g_object_notify_by_pspec ((GObject *) self, restic_delete_old_backups_joblet_properties[RESTIC_DELETE_OLD_BACKUPS_JOBLET_DELETE_AFTER_PROPERTY]);
	}
}

static void
restic_delete_old_backups_joblet_class_init (ResticDeleteOldBackupsJobletClass * klass,
                                             gpointer klass_data)
{
	restic_delete_old_backups_joblet_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ResticDeleteOldBackupsJoblet_private_offset);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) restic_delete_old_backups_joblet_real_prepare_args;
	((ResticJobletClass *) klass)->handle_fatal_error = (void (*) (ResticJoblet*, gint, const gchar*)) restic_delete_old_backups_joblet_real_handle_fatal_error;
	G_OBJECT_CLASS (klass)->get_property = _vala_restic_delete_old_backups_joblet_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_restic_delete_old_backups_joblet_set_property;
	G_OBJECT_CLASS (klass)->finalize = restic_delete_old_backups_joblet_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), RESTIC_DELETE_OLD_BACKUPS_JOBLET_DELETE_AFTER_PROPERTY, restic_delete_old_backups_joblet_properties[RESTIC_DELETE_OLD_BACKUPS_JOBLET_DELETE_AFTER_PROPERTY] = g_param_spec_int ("delete-after", "delete-after", "delete-after", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
restic_delete_old_backups_joblet_instance_init (ResticDeleteOldBackupsJoblet * self,
                                                gpointer klass)
{
	self->priv = restic_delete_old_backups_joblet_get_instance_private (self);
}

static void
restic_delete_old_backups_joblet_finalize (GObject * obj)
{
	ResticDeleteOldBackupsJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_RESTIC_DELETE_OLD_BACKUPS_JOBLET, ResticDeleteOldBackupsJoblet);
	G_OBJECT_CLASS (restic_delete_old_backups_joblet_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
restic_delete_old_backups_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ResticDeleteOldBackupsJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restic_delete_old_backups_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ResticDeleteOldBackupsJoblet), 0, (GInstanceInitFunc) restic_delete_old_backups_joblet_instance_init, NULL };
	GType restic_delete_old_backups_joblet_type_id;
	restic_delete_old_backups_joblet_type_id = g_type_register_static (TYPE_RESTIC_DELETE_JOBLET_BASE, "ResticDeleteOldBackupsJoblet", &g_define_type_info, 0);
	ResticDeleteOldBackupsJoblet_private_offset = g_type_add_instance_private (restic_delete_old_backups_joblet_type_id, sizeof (ResticDeleteOldBackupsJobletPrivate));
	return restic_delete_old_backups_joblet_type_id;
}

GType
restic_delete_old_backups_joblet_get_type (void)
{
	static gsize restic_delete_old_backups_joblet_type_id__once = 0;
	if (g_once_init_enter (&restic_delete_old_backups_joblet_type_id__once)) {
		GType restic_delete_old_backups_joblet_type_id;
		restic_delete_old_backups_joblet_type_id = restic_delete_old_backups_joblet_get_type_once ();
		g_once_init_leave (&restic_delete_old_backups_joblet_type_id__once, restic_delete_old_backups_joblet_type_id);
	}
	return restic_delete_old_backups_joblet_type_id__once;
}

static void
_vala_restic_delete_old_backups_joblet_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec)
{
	ResticDeleteOldBackupsJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_RESTIC_DELETE_OLD_BACKUPS_JOBLET, ResticDeleteOldBackupsJoblet);
	switch (property_id) {
		case RESTIC_DELETE_OLD_BACKUPS_JOBLET_DELETE_AFTER_PROPERTY:
		g_value_set_int (value, restic_delete_old_backups_joblet_get_delete_after (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_restic_delete_old_backups_joblet_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec)
{
	ResticDeleteOldBackupsJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_RESTIC_DELETE_OLD_BACKUPS_JOBLET, ResticDeleteOldBackupsJoblet);
	switch (property_id) {
		case RESTIC_DELETE_OLD_BACKUPS_JOBLET_DELETE_AFTER_PROPERTY:
		restic_delete_old_backups_joblet_set_delete_after (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
restic_delete_oldest_backup_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                                      GList** argv,
                                                      GList** envp,
                                                      GError** error)
{
	ResticDeleteOldestBackupJoblet * self;
	guint num_snapshots = 0U;
	gchar* _tmp0_;
	GError* _inner_error0_ = NULL;
	self = (ResticDeleteOldestBackupJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_delete_oldest_backup_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_DELETE_JOBLET_BASE, ResticDeleteJobletBase), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	num_snapshots = restic_joblet_chain_get_num_snapshots ((ResticJoblet*) self);
	_tmp0_ = g_strdup_printf ("--keep-last=%u", num_snapshots - 1);
	*argv = g_list_append (*argv, _tmp0_);
}

static void
restic_delete_oldest_backup_joblet_real_handle_done (DejaDupToolJoblet* base,
                                                     gboolean success,
                                                     gboolean cancelled)
{
	ResticDeleteOldestBackupJoblet * self;
	self = (ResticDeleteOldestBackupJoblet*) base;
	if (success) {
		restic_joblet_chain_set_num_snapshots ((ResticJoblet*) self, restic_joblet_chain_get_num_snapshots ((ResticJoblet*) self) - 1);
	}
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_delete_oldest_backup_joblet_parent_class)->handle_done ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_DELETE_JOBLET_BASE, ResticDeleteJobletBase), success, cancelled);
}

static void
restic_delete_oldest_backup_joblet_real_handle_fatal_error (ResticJoblet* base,
                                                            gint code,
                                                            const gchar* msg)
{
	ResticDeleteOldestBackupJoblet * self;
	gchar* new_msg = NULL;
	gchar* _tmp0_;
	const gchar* _tmp4_;
	self = (ResticDeleteOldestBackupJoblet*) base;
	g_return_if_fail (msg != NULL);
	_tmp0_ = g_strdup (msg);
	new_msg = _tmp0_;
	if (code == RESTIC_INSTANCE_ERROR_ALREADY_LOCKED) {
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp1_ = g_strconcat (_ ("The storage location is out of space but busy."), " ", NULL);
		_tmp2_ = _tmp1_;
		_tmp3_ = g_strconcat (_tmp2_, _ ("Try closing any open file manager windows and try again."), NULL);
		_g_free0 (new_msg);
		new_msg = _tmp3_;
		_g_free0 (_tmp2_);
	}
	_tmp4_ = new_msg;
	RESTIC_JOBLET_CLASS (restic_delete_oldest_backup_joblet_parent_class)->handle_fatal_error ((ResticJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_DELETE_JOBLET_BASE, ResticDeleteJobletBase), code, _tmp4_);
	_g_free0 (new_msg);
}

ResticDeleteOldestBackupJoblet*
restic_delete_oldest_backup_joblet_construct (GType object_type)
{
	ResticDeleteOldestBackupJoblet * self = NULL;
	self = (ResticDeleteOldestBackupJoblet*) restic_delete_joblet_base_construct (object_type);
	return self;
}

ResticDeleteOldestBackupJoblet*
restic_delete_oldest_backup_joblet_new (void)
{
	return restic_delete_oldest_backup_joblet_construct (TYPE_RESTIC_DELETE_OLDEST_BACKUP_JOBLET);
}

static void
restic_delete_oldest_backup_joblet_class_init (ResticDeleteOldestBackupJobletClass * klass,
                                               gpointer klass_data)
{
	restic_delete_oldest_backup_joblet_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) restic_delete_oldest_backup_joblet_real_prepare_args;
	((DejaDupToolJobletClass *) klass)->handle_done = (void (*) (DejaDupToolJoblet*, gboolean, gboolean)) restic_delete_oldest_backup_joblet_real_handle_done;
	((ResticJobletClass *) klass)->handle_fatal_error = (void (*) (ResticJoblet*, gint, const gchar*)) restic_delete_oldest_backup_joblet_real_handle_fatal_error;
}

static void
restic_delete_oldest_backup_joblet_instance_init (ResticDeleteOldestBackupJoblet * self,
                                                  gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
restic_delete_oldest_backup_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ResticDeleteOldestBackupJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restic_delete_oldest_backup_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ResticDeleteOldestBackupJoblet), 0, (GInstanceInitFunc) restic_delete_oldest_backup_joblet_instance_init, NULL };
	GType restic_delete_oldest_backup_joblet_type_id;
	restic_delete_oldest_backup_joblet_type_id = g_type_register_static (TYPE_RESTIC_DELETE_JOBLET_BASE, "ResticDeleteOldestBackupJoblet", &g_define_type_info, 0);
	return restic_delete_oldest_backup_joblet_type_id;
}

GType
restic_delete_oldest_backup_joblet_get_type (void)
{
	static gsize restic_delete_oldest_backup_joblet_type_id__once = 0;
	if (g_once_init_enter (&restic_delete_oldest_backup_joblet_type_id__once)) {
		GType restic_delete_oldest_backup_joblet_type_id;
		restic_delete_oldest_backup_joblet_type_id = restic_delete_oldest_backup_joblet_get_type_once ();
		g_once_init_leave (&restic_delete_oldest_backup_joblet_type_id__once, restic_delete_oldest_backup_joblet_type_id);
	}
	return restic_delete_oldest_backup_joblet_type_id__once;
}

static void
restic_snapshots_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                           GList** argv,
                                           GList** envp,
                                           GError** error)
{
	ResticSnapshotsJoblet * self;
	gchar* _tmp0_;
	DejaDupToolJobMode _tmp1_;
	DejaDupToolJobMode _tmp2_;
	GError* _inner_error0_ = NULL;
	self = (ResticSnapshotsJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_snapshots_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_JOBLET, ResticJoblet), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = g_strdup ("snapshots");
	*argv = g_list_append (*argv, _tmp0_);
	_tmp1_ = deja_dup_tool_job_get_mode ((DejaDupToolJob*) self);
	_tmp2_ = _tmp1_;
	if (_tmp2_ == DEJA_DUP_TOOL_JOB_MODE_BACKUP) {
		const gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp3_ = g_get_host_name ();
		_tmp4_ = g_strconcat ("--host=", _tmp3_, NULL);
		*argv = g_list_append (*argv, _tmp4_);
		_tmp5_ = g_strdup ("--tag=deja-dup");
		*argv = g_list_append (*argv, _tmp5_);
	}
}

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 void
restic_snapshots_joblet_real_handle_no_repository (ResticJoblet* base)
{
	ResticSnapshotsJoblet * self;
	GList* _tmp0_;
	self = (ResticSnapshotsJoblet*) base;
	_tmp0_ = NULL;
	g_signal_emit_by_name ((DejaDupToolJob*) self, "collection-dates", _tmp0_);
	(_tmp0_ == NULL) ? NULL : (_tmp0_ = (_g_list_free__g_object_unref0_ (_tmp0_), NULL));
	restic_joblet_chain_set_num_snapshots ((ResticJoblet*) self, (guint) 0);
	((ResticJoblet*) self)->ignore_errors = TRUE;
}

static gboolean
restic_snapshots_joblet_real_process_message (ResticJoblet* base,
                                              const gchar* msgid,
                                              JsonReader* reader)
{
	ResticSnapshotsJoblet * self;
	gboolean result;
	self = (ResticSnapshotsJoblet*) base;
	g_return_val_if_fail (reader != NULL, FALSE);
	if (msgid == NULL) {
		result = restic_snapshots_joblet_process_snapshots (self, reader);
		return result;
	}
	result = FALSE;
	return result;
}

static void
_vala_array_add17 (gchar** * array,
                   gint* length,
                   gint* size,
                   gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add18 (gchar** * array,
                   gint* length,
                   gint* size,
                   gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gchar*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  gint str_array_length1)
{
	gboolean _tmp0_ = FALSE;
	gchar* result;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp16_;
		gint _tmp17_;
		const gchar* res = NULL;
		void* _tmp18_;
		const gchar* _tmp19_ = NULL;
		const gchar* _tmp20_;
		void* ptr = NULL;
		const gchar* _tmp22_;
		void* _tmp23_;
		const gchar* _tmp33_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp10_ = 0;
				const gchar* _tmp11_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					_tmp7_ = i < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp8_ = FALSE;
					if (str_array_length1 == -1) {
						const gchar* _tmp9_;
						_tmp9_ = str_array[i];
						_tmp8_ = _tmp9_ != NULL;
					} else {
						_tmp8_ = FALSE;
					}
					_tmp6_ = _tmp8_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp11_ = str_array[i];
				if (_tmp11_ != NULL) {
					const gchar* _tmp12_;
					gint _tmp13_;
					gint _tmp14_;
					_tmp12_ = str_array[i];
					_tmp13_ = strlen ((const gchar*) _tmp12_);
					_tmp14_ = _tmp13_;
					_tmp10_ = _tmp14_;
				} else {
					_tmp10_ = 0;
				}
				len += (gsize) _tmp10_;
			}
		}
		if (i == 0) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup ("");
			result = _tmp15_;
			return result;
		}
		str_array_length1 = i;
		_tmp16_ = strlen ((const gchar*) separator);
		_tmp17_ = _tmp16_;
		len += (gsize) (_tmp17_ * (i - 1));
		_tmp18_ = g_malloc (len);
		res = _tmp18_;
		_tmp20_ = str_array[0];
		if (_tmp20_ != NULL) {
			const gchar* _tmp21_;
			_tmp21_ = str_array[0];
			_tmp19_ = (const gchar*) _tmp21_;
		} else {
			_tmp19_ = "";
		}
		_tmp22_ = res;
		_tmp23_ = g_stpcpy ((void*) _tmp22_, _tmp19_);
		ptr = _tmp23_;
		{
			gboolean _tmp24_ = FALSE;
			i = 1;
			_tmp24_ = TRUE;
			while (TRUE) {
				void* _tmp26_;
				void* _tmp27_;
				const gchar* _tmp28_ = NULL;
				const gchar* _tmp29_;
				void* _tmp31_;
				void* _tmp32_;
				if (!_tmp24_) {
					gint _tmp25_;
					_tmp25_ = i;
					i = _tmp25_ + 1;
				}
				_tmp24_ = FALSE;
				if (!(i < str_array_length1)) {
					break;
				}
				_tmp26_ = ptr;
				_tmp27_ = g_stpcpy (_tmp26_, (const gchar*) separator);
				ptr = _tmp27_;
				_tmp29_ = str_array[i];
				if (_tmp29_ != NULL) {
					const gchar* _tmp30_;
					_tmp30_ = str_array[i];
					_tmp28_ = (const gchar*) _tmp30_;
				} else {
					_tmp28_ = "";
				}
				_tmp31_ = ptr;
				_tmp32_ = g_stpcpy (_tmp31_, _tmp28_);
				ptr = _tmp32_;
			}
		}
		_tmp33_ = res;
		res = NULL;
		result = (gchar*) _tmp33_;
		return result;
	} else {
		gchar* _tmp34_;
		_tmp34_ = g_strdup ("");
		result = _tmp34_;
		return result;
	}
}

static gboolean
restic_snapshots_joblet_process_snapshots (ResticSnapshotsJoblet* self,
                                           JsonReader* reader)
{
	GList* dates = NULL;
	gchar* this_host = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	GList* _tmp34_;
	GList* _tmp35_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (reader != NULL, FALSE);
	dates = NULL;
	_tmp0_ = g_get_host_name ();
	_tmp1_ = g_strdup (_tmp0_);
	this_host = _tmp1_;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp2_ = FALSE;
			_tmp2_ = TRUE;
			while (TRUE) {
				gchar* tag = NULL;
				const gchar* _tmp4_;
				gchar* _tmp5_;
				gchar* strtime = NULL;
				const gchar* _tmp6_;
				gchar* _tmp7_;
				gchar* hostname = NULL;
				const gchar* _tmp8_;
				gchar* _tmp9_;
				gboolean is_external = FALSE;
				gchar** keywords = NULL;
				gchar** _tmp15_;
				gint keywords_length1;
				gint _keywords_size_;
				const gchar* _tmp16_;
				const gchar* _tmp17_;
				GDateTime* time = NULL;
				const gchar* _tmp21_;
				GTimeZone* _tmp22_;
				GTimeZone* _tmp23_;
				GDateTime* _tmp24_;
				GDateTime* _tmp25_;
				DejaDupSnapshotInfo* info = NULL;
				GDateTime* _tmp26_;
				const gchar* _tmp27_;
				DejaDupSnapshotInfo* _tmp28_;
				DejaDupSnapshotInfo* _tmp29_;
				gchar** _tmp30_;
				gint _tmp30__length1;
				gchar* _tmp31_;
				DejaDupSnapshotInfo* _tmp32_;
				DejaDupSnapshotInfo* _tmp33_;
				if (!_tmp2_) {
					gint _tmp3_;
					_tmp3_ = i;
					i = _tmp3_ + 1;
				}
				_tmp2_ = FALSE;
				if (!(i < json_reader_count_elements (reader))) {
					break;
				}
				json_reader_read_element (reader, (guint) i);
				json_reader_read_member (reader, "id");
				_tmp4_ = json_reader_get_string_value (reader);
				_tmp5_ = g_strdup (_tmp4_);
				tag = _tmp5_;
				json_reader_end_member (reader);
				json_reader_read_member (reader, "time");
				_tmp6_ = json_reader_get_string_value (reader);
				_tmp7_ = g_strdup (_tmp6_);
				strtime = _tmp7_;
				json_reader_end_member (reader);
				json_reader_read_member (reader, "hostname");
				_tmp8_ = json_reader_get_string_value (reader);
				_tmp9_ = g_strdup (_tmp8_);
				hostname = _tmp9_;
				json_reader_end_member (reader);
				is_external = TRUE;
				if (json_reader_read_member (reader, "tags")) {
					{
						gint j = 0;
						j = 0;
						{
							gboolean _tmp10_ = FALSE;
							_tmp10_ = TRUE;
							while (TRUE) {
								gchar* label = NULL;
								const gchar* _tmp12_;
								gchar* _tmp13_;
								const gchar* _tmp14_;
								if (!_tmp10_) {
									gint _tmp11_;
									_tmp11_ = j;
									j = _tmp11_ + 1;
								}
								_tmp10_ = FALSE;
								if (!(j < json_reader_count_elements (reader))) {
									break;
								}
								json_reader_read_element (reader, (guint) j);
								_tmp12_ = json_reader_get_string_value (reader);
								_tmp13_ = g_strdup (_tmp12_);
								label = _tmp13_;
								json_reader_end_element (reader);
								_tmp14_ = label;
								if (g_strcmp0 (_tmp14_, "deja-dup") == 0) {
									is_external = FALSE;
									_g_free0 (label);
									break;
								}
								_g_free0 (label);
							}
						}
					}
				}
				json_reader_end_member (reader);
				_tmp15_ = g_new0 (gchar*, 0 + 1);
				keywords = _tmp15_;
				keywords_length1 = 0;
				_keywords_size_ = keywords_length1;
				_tmp16_ = hostname;
				_tmp17_ = this_host;
				if (g_strcmp0 (_tmp16_, _tmp17_) != 0) {
					const gchar* _tmp18_;
					gchar* _tmp19_;
					_tmp18_ = hostname;
					_tmp19_ = g_strdup (_tmp18_);
					_vala_array_add17 (&keywords, &keywords_length1, &_keywords_size_, _tmp19_);
				}
				if (is_external) {
					gchar* _tmp20_;
					_tmp20_ = g_strdup (C_ ("non-Deja-Dup backup", "external"));
					_vala_array_add18 (&keywords, &keywords_length1, &_keywords_size_, _tmp20_);
				}
				_tmp21_ = strtime;
				_tmp22_ = g_time_zone_new_utc ();
				_tmp23_ = _tmp22_;
				_tmp24_ = g_date_time_new_from_iso8601 (_tmp21_, _tmp23_);
				_tmp25_ = _tmp24_;
				_g_time_zone_unref0 (_tmp23_);
				time = _tmp25_;
				_tmp26_ = time;
				_tmp27_ = tag;
				_tmp28_ = deja_dup_snapshot_info_new (_tmp26_, _tmp27_);
				info = _tmp28_;
				_tmp29_ = info;
				_tmp30_ = keywords;
				_tmp30__length1 = keywords_length1;
				_tmp31_ = _vala_g_strjoinv (", ", _tmp30_, (gint) _tmp30__length1);
				_g_free0 (_tmp29_->external_description);
				_tmp29_->external_description = _tmp31_;
				_tmp32_ = info;
				_tmp33_ = _g_object_ref0 (_tmp32_);
				dates = g_list_prepend (dates, _tmp33_);
				json_reader_end_element (reader);
				_g_object_unref0 (info);
				_g_date_time_unref0 (time);
				keywords = (_vala_array_free (keywords, keywords_length1, (GDestroyNotify) g_free), NULL);
				_g_free0 (hostname);
				_g_free0 (strtime);
				_g_free0 (tag);
			}
		}
	}
	_tmp34_ = dates;
	g_signal_emit_by_name ((DejaDupToolJob*) self, "collection-dates", _tmp34_);
	_tmp35_ = dates;
	restic_joblet_chain_set_num_snapshots ((ResticJoblet*) self, g_list_length (_tmp35_));
	result = TRUE;
	_g_free0 (this_host);
	(dates == NULL) ? NULL : (dates = (_g_list_free__g_object_unref0_ (dates), NULL));
	return result;
}

ResticSnapshotsJoblet*
restic_snapshots_joblet_construct (GType object_type)
{
	ResticSnapshotsJoblet * self = NULL;
	self = (ResticSnapshotsJoblet*) restic_joblet_construct (object_type);
	return self;
}

ResticSnapshotsJoblet*
restic_snapshots_joblet_new (void)
{
	return restic_snapshots_joblet_construct (TYPE_RESTIC_SNAPSHOTS_JOBLET);
}

static void
restic_snapshots_joblet_class_init (ResticSnapshotsJobletClass * klass,
                                    gpointer klass_data)
{
	restic_snapshots_joblet_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) restic_snapshots_joblet_real_prepare_args;
	((ResticJobletClass *) klass)->handle_no_repository = (void (*) (ResticJoblet*)) restic_snapshots_joblet_real_handle_no_repository;
	((ResticJobletClass *) klass)->process_message = (gboolean (*) (ResticJoblet*, const gchar*, JsonReader*)) restic_snapshots_joblet_real_process_message;
}

static void
restic_snapshots_joblet_instance_init (ResticSnapshotsJoblet * self,
                                       gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
restic_snapshots_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ResticSnapshotsJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restic_snapshots_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ResticSnapshotsJoblet), 0, (GInstanceInitFunc) restic_snapshots_joblet_instance_init, NULL };
	GType restic_snapshots_joblet_type_id;
	restic_snapshots_joblet_type_id = g_type_register_static (TYPE_RESTIC_JOBLET, "ResticSnapshotsJoblet", &g_define_type_info, 0);
	return restic_snapshots_joblet_type_id;
}

GType
restic_snapshots_joblet_get_type (void)
{
	static gsize restic_snapshots_joblet_type_id__once = 0;
	if (g_once_init_enter (&restic_snapshots_joblet_type_id__once)) {
		GType restic_snapshots_joblet_type_id;
		restic_snapshots_joblet_type_id = restic_snapshots_joblet_get_type_once ();
		g_once_init_leave (&restic_snapshots_joblet_type_id__once, restic_snapshots_joblet_type_id);
	}
	return restic_snapshots_joblet_type_id__once;
}

static void
restic_mount_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                       GList** argv,
                                       GList** envp,
                                       GError** error)
{
	ResticMountJoblet * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	DejaDupMountManager* manager = NULL;
	DejaDupMountManager* _tmp2_;
	gchar* dir = NULL;
	DejaDupMountManager* _tmp3_;
	DejaDupToolPlugin* _tmp4_;
	DejaDupToolPlugin* _tmp5_;
	DejaDupBackend* _tmp6_;
	DejaDupBackend* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	GError* _inner_error0_ = NULL;
	self = (ResticMountJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_mount_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_JOBLET, ResticJoblet), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = g_strdup ("mount");
	*argv = g_list_append (*argv, _tmp0_);
	_tmp1_ = g_strdup ("--path-template=ids/%I");
	*argv = g_list_append (*argv, _tmp1_);
	_tmp2_ = deja_dup_mount_manager_get_instance ();
	manager = _tmp2_;
	_tmp3_ = manager;
	_tmp4_ = deja_dup_make_restic_tool ();
	_tmp5_ = _tmp4_;
	_tmp6_ = deja_dup_tool_job_get_backend ((DejaDupToolJob*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = deja_dup_mount_manager_get_mount_dir (_tmp3_, _tmp5_, _tmp7_);
	_tmp9_ = _tmp8_;
	_g_object_unref0 (_tmp5_);
	dir = _tmp9_;
	_tmp10_ = dir;
	_tmp11_ = g_strdup (_tmp10_);
	*argv = g_list_append (*argv, _tmp11_);
	_g_free0 (dir);
	_g_object_unref0 (manager);
}

ResticMountJoblet*
restic_mount_joblet_construct (GType object_type)
{
	ResticMountJoblet * self = NULL;
	self = (ResticMountJoblet*) restic_joblet_construct (object_type);
	return self;
}

ResticMountJoblet*
restic_mount_joblet_new (void)
{
	return restic_mount_joblet_construct (TYPE_RESTIC_MOUNT_JOBLET);
}

static void
restic_mount_joblet_class_init (ResticMountJobletClass * klass,
                                gpointer klass_data)
{
	restic_mount_joblet_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) restic_mount_joblet_real_prepare_args;
}

static void
restic_mount_joblet_instance_init (ResticMountJoblet * self,
                                   gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
restic_mount_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ResticMountJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restic_mount_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ResticMountJoblet), 0, (GInstanceInitFunc) restic_mount_joblet_instance_init, NULL };
	GType restic_mount_joblet_type_id;
	restic_mount_joblet_type_id = g_type_register_static (TYPE_RESTIC_JOBLET, "ResticMountJoblet", &g_define_type_info, 0);
	return restic_mount_joblet_type_id;
}

GType
restic_mount_joblet_get_type (void)
{
	static gsize restic_mount_joblet_type_id__once = 0;
	if (g_once_init_enter (&restic_mount_joblet_type_id__once)) {
		GType restic_mount_joblet_type_id;
		restic_mount_joblet_type_id = restic_mount_joblet_get_type_once ();
		g_once_init_leave (&restic_mount_joblet_type_id__once, restic_mount_joblet_type_id);
	}
	return restic_mount_joblet_type_id__once;
}

static void
restic_list_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                      GList** argv,
                                      GList** envp,
                                      GError** error)
{
	ResticListJoblet * self;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	GError* _inner_error0_ = NULL;
	self = (ResticListJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_list_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_JOBLET, ResticJoblet), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = g_strdup ("ls");
	*argv = g_list_append (*argv, _tmp0_);
	_tmp1_ = deja_dup_tool_job_get_tag ((DejaDupToolJob*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	*argv = g_list_append (*argv, _tmp3_);
	_tmp4_ = deja_dup_tool_job_get_tag ((DejaDupToolJob*) self);
	_tmp5_ = _tmp4_;
	if (g_strcmp0 (_tmp5_, "latest") == 0) {
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp6_ = g_get_host_name ();
		_tmp7_ = g_strconcat ("--host=", _tmp6_, NULL);
		*argv = g_list_append (*argv, _tmp7_);
		_tmp8_ = g_strdup ("--tag=deja-dup");
		*argv = g_list_append (*argv, _tmp8_);
	}
}

static gboolean
restic_list_joblet_real_process_message (ResticJoblet* base,
                                         const gchar* msgid,
                                         JsonReader* reader)
{
	ResticListJoblet * self;
	gboolean result;
	self = (ResticListJoblet*) base;
	g_return_val_if_fail (reader != NULL, FALSE);
	if (g_strcmp0 (msgid, "node") == 0) {
		result = restic_list_joblet_process_node (self, reader);
		return result;
	}
	result = FALSE;
	return result;
}

static gboolean
restic_list_joblet_process_node (ResticListJoblet* self,
                                 JsonReader* reader)
{
	gchar* restic_type = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* path = NULL;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	GFileType file_type = 0;
	const gchar* _tmp5_;
	const gchar* _tmp8_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (reader != NULL, FALSE);
	json_reader_read_member (reader, "type");
	_tmp0_ = json_reader_get_string_value (reader);
	_tmp1_ = g_strdup (_tmp0_);
	restic_type = _tmp1_;
	json_reader_end_member (reader);
	_tmp2_ = restic_type;
	if (_tmp2_ == NULL) {
		result = FALSE;
		_g_free0 (restic_type);
		return result;
	}
	json_reader_read_member (reader, "path");
	_tmp3_ = json_reader_get_string_value (reader);
	_tmp4_ = g_strdup (_tmp3_);
	path = _tmp4_;
	json_reader_end_member (reader);
	file_type = G_FILE_TYPE_UNKNOWN;
	_tmp5_ = restic_type;
	if (g_strcmp0 (_tmp5_, "file") == 0) {
		file_type = G_FILE_TYPE_REGULAR;
	} else {
		const gchar* _tmp6_;
		_tmp6_ = restic_type;
		if (g_strcmp0 (_tmp6_, "dir") == 0) {
			file_type = G_FILE_TYPE_DIRECTORY;
		} else {
			const gchar* _tmp7_;
			_tmp7_ = restic_type;
			if (g_strcmp0 (_tmp7_, "symlink") == 0) {
				file_type = G_FILE_TYPE_SYMBOLIC_LINK;
			}
		}
	}
	_tmp8_ = path;
	g_signal_emit_by_name ((DejaDupToolJob*) self, "listed-current-files", _tmp8_, file_type);
	result = TRUE;
	_g_free0 (path);
	_g_free0 (restic_type);
	return result;
}

ResticListJoblet*
restic_list_joblet_construct (GType object_type)
{
	ResticListJoblet * self = NULL;
	self = (ResticListJoblet*) restic_joblet_construct (object_type);
	return self;
}

ResticListJoblet*
restic_list_joblet_new (void)
{
	return restic_list_joblet_construct (TYPE_RESTIC_LIST_JOBLET);
}

static void
restic_list_joblet_class_init (ResticListJobletClass * klass,
                               gpointer klass_data)
{
	restic_list_joblet_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) restic_list_joblet_real_prepare_args;
	((ResticJobletClass *) klass)->process_message = (gboolean (*) (ResticJoblet*, const gchar*, JsonReader*)) restic_list_joblet_real_process_message;
}

static void
restic_list_joblet_instance_init (ResticListJoblet * self,
                                  gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
restic_list_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ResticListJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restic_list_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ResticListJoblet), 0, (GInstanceInitFunc) restic_list_joblet_instance_init, NULL };
	GType restic_list_joblet_type_id;
	restic_list_joblet_type_id = g_type_register_static (TYPE_RESTIC_JOBLET, "ResticListJoblet", &g_define_type_info, 0);
	return restic_list_joblet_type_id;
}

GType
restic_list_joblet_get_type (void)
{
	static gsize restic_list_joblet_type_id__once = 0;
	if (g_once_init_enter (&restic_list_joblet_type_id__once)) {
		GType restic_list_joblet_type_id;
		restic_list_joblet_type_id = restic_list_joblet_get_type_once ();
		g_once_init_leave (&restic_list_joblet_type_id__once, restic_list_joblet_type_id);
	}
	return restic_list_joblet_type_id__once;
}

static inline gpointer
restic_restore_joblet_get_instance_private (ResticRestoreJoblet* self)
{
	return G_STRUCT_MEMBER_P (self, ResticRestoreJoblet_private_offset);
}

ResticRestoreJoblet*
restic_restore_joblet_construct (GType object_type,
                                 GFile* restore_file,
                                 gdouble percentage)
{
	ResticRestoreJoblet * self = NULL;
	self = (ResticRestoreJoblet*) g_object_new (object_type, "restore-file", restore_file, "percentage", percentage, NULL);
	return self;
}

ResticRestoreJoblet*
restic_restore_joblet_new (GFile* restore_file,
                           gdouble percentage)
{
	return restic_restore_joblet_construct (TYPE_RESTIC_RESTORE_JOBLET, restore_file, percentage);
}

static void
restic_restore_joblet_real_handle_done (DejaDupToolJoblet* base,
                                        gboolean success,
                                        gboolean cancelled)
{
	ResticRestoreJoblet * self;
	gboolean _tmp0_ = FALSE;
	self = (ResticRestoreJoblet*) base;
	if (!((ResticJoblet*) self)->fatal_error_issued) {
		_tmp0_ = !success;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		success = TRUE;
	}
	if (success) {
		gdouble _tmp1_;
		_tmp1_ = self->priv->_percentage;
		g_signal_emit_by_name ((DejaDupToolJob*) self, "progress", _tmp1_);
	}
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_restore_joblet_parent_class)->handle_done ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_JOBLET, ResticJoblet), success, cancelled);
}

static void
restic_restore_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                         GList** argv,
                                         GList** envp,
                                         GError** error)
{
	ResticRestoreJoblet * self;
	gchar* _tmp0_ = NULL;
	GFile* _tmp1_;
	gchar* local_target = NULL;
	gchar* _tmp5_;
	gchar* remote_target = NULL;
	DejaDupFileTree* _tmp6_;
	DejaDupFileTree* _tmp7_;
	gchar* _tmp8_;
	gchar* remote_target_dir = NULL;
	gchar* _tmp9_;
	gchar* remote_target_file = NULL;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	GFile* _tmp24_;
	GFile* _tmp25_;
	GFile* _tmp26_;
	GFile* _tmp27_;
	gboolean _tmp28_;
	GError* _inner_error0_ = NULL;
	self = (ResticRestoreJoblet*) base;
	_tmp1_ = self->priv->_restore_file;
	if (_tmp1_ == NULL) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup ("/");
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp2_;
	} else {
		GFile* _tmp3_;
		gchar* _tmp4_;
		_tmp3_ = self->priv->_restore_file;
		_tmp4_ = g_file_get_path (_tmp3_);
		_g_free0 (_tmp0_);
		_tmp0_ = _tmp4_;
	}
	_tmp5_ = g_strdup (_tmp0_);
	local_target = _tmp5_;
	_tmp6_ = deja_dup_tool_job_get_tree ((DejaDupToolJob*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = deja_dup_file_tree_original_path (_tmp7_, local_target);
	remote_target = _tmp8_;
	_tmp9_ = g_path_get_dirname (remote_target);
	remote_target_dir = _tmp9_;
	_tmp10_ = g_path_get_basename (remote_target);
	remote_target_file = _tmp10_;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_restore_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_JOBLET, ResticJoblet), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (remote_target_file);
		_g_free0 (remote_target_dir);
		_g_free0 (remote_target);
		_g_free0 (local_target);
		_g_free0 (_tmp0_);
		return;
	}
	_tmp11_ = g_strdup ("restore");
	*argv = g_list_append (*argv, _tmp11_);
	_tmp12_ = g_strdup ("--sparse");
	*argv = g_list_append (*argv, _tmp12_);
	_tmp13_ = deja_dup_tool_job_get_tag ((DejaDupToolJob*) self);
	_tmp14_ = _tmp13_;
	_tmp15_ = g_strdup_printf ("%s:%s", _tmp14_, remote_target_dir);
	*argv = g_list_append (*argv, _tmp15_);
	_tmp16_ = restic_joblet_escape_path ((ResticJoblet*) self, remote_target_file);
	_tmp17_ = _tmp16_;
	_tmp18_ = g_strconcat ("--include=/", _tmp17_, NULL);
	*argv = g_list_append (*argv, _tmp18_);
	_g_free0 (_tmp17_);
	_tmp19_ = deja_dup_tool_job_get_tag ((DejaDupToolJob*) self);
	_tmp20_ = _tmp19_;
	if (g_strcmp0 (_tmp20_, "latest") == 0) {
		const gchar* _tmp21_;
		gchar* _tmp22_;
		gchar* _tmp23_;
		_tmp21_ = g_get_host_name ();
		_tmp22_ = g_strconcat ("--host=", _tmp21_, NULL);
		*argv = g_list_append (*argv, _tmp22_);
		_tmp23_ = g_strdup ("--tag=deja-dup");
		*argv = g_list_append (*argv, _tmp23_);
	}
	_tmp24_ = deja_dup_tool_job_get_local ((DejaDupToolJob*) self);
	_tmp25_ = _tmp24_;
	_tmp26_ = g_file_get_parent (_tmp25_);
	_tmp27_ = _tmp26_;
	_tmp28_ = _tmp27_ == NULL;
	_g_object_unref0 (_tmp27_);
	if (_tmp28_) {
		gchar* _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		_tmp29_ = g_path_get_dirname (local_target);
		_tmp30_ = _tmp29_;
		_tmp31_ = g_strconcat ("--target=", _tmp30_, NULL);
		*argv = g_list_append (*argv, _tmp31_);
		_g_free0 (_tmp30_);
	} else {
		GFile* _tmp32_;
		GFile* _tmp33_;
		gchar* _tmp34_;
		gchar* _tmp35_;
		gchar* _tmp36_;
		_tmp32_ = deja_dup_tool_job_get_local ((DejaDupToolJob*) self);
		_tmp33_ = _tmp32_;
		_tmp34_ = g_file_get_path (_tmp33_);
		_tmp35_ = _tmp34_;
		_tmp36_ = g_strconcat ("--target=", _tmp35_, NULL);
		*argv = g_list_append (*argv, _tmp36_);
		_g_free0 (_tmp35_);
	}
	_g_free0 (remote_target_file);
	_g_free0 (remote_target_dir);
	_g_free0 (remote_target);
	_g_free0 (local_target);
	_g_free0 (_tmp0_);
}

GFile*
restic_restore_joblet_get_restore_file (ResticRestoreJoblet* self)
{
	GFile* result;
	GFile* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_restore_file;
	result = _tmp0_;
	return result;
}

static void
restic_restore_joblet_set_restore_file (ResticRestoreJoblet* self,
                                        GFile* value)
{
	GFile* old_value;
	g_return_if_fail (self != NULL);
	old_value = restic_restore_joblet_get_restore_file (self);
	if (old_value != value) {
		GFile* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_restore_file);
		self->priv->_restore_file = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, restic_restore_joblet_properties[RESTIC_RESTORE_JOBLET_RESTORE_FILE_PROPERTY]);
	}
}

gdouble
restic_restore_joblet_get_percentage (ResticRestoreJoblet* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, 0.0);
	result = self->priv->_percentage;
	return result;
}

static void
restic_restore_joblet_set_percentage (ResticRestoreJoblet* self,
                                      gdouble value)
{
	gdouble old_value;
	g_return_if_fail (self != NULL);
	old_value = restic_restore_joblet_get_percentage (self);
	if (old_value != value) {
		self->priv->_percentage = value;
		g_object_notify_by_pspec ((GObject *) self, restic_restore_joblet_properties[RESTIC_RESTORE_JOBLET_PERCENTAGE_PROPERTY]);
	}
}

static void
restic_restore_joblet_class_init (ResticRestoreJobletClass * klass,
                                  gpointer klass_data)
{
	restic_restore_joblet_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ResticRestoreJoblet_private_offset);
	((DejaDupToolJobletClass *) klass)->handle_done = (void (*) (DejaDupToolJoblet*, gboolean, gboolean)) restic_restore_joblet_real_handle_done;
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) restic_restore_joblet_real_prepare_args;
	G_OBJECT_CLASS (klass)->get_property = _vala_restic_restore_joblet_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_restic_restore_joblet_set_property;
	G_OBJECT_CLASS (klass)->finalize = restic_restore_joblet_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), RESTIC_RESTORE_JOBLET_RESTORE_FILE_PROPERTY, restic_restore_joblet_properties[RESTIC_RESTORE_JOBLET_RESTORE_FILE_PROPERTY] = g_param_spec_object ("restore-file", "restore-file", "restore-file", g_file_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (G_OBJECT_CLASS (klass), RESTIC_RESTORE_JOBLET_PERCENTAGE_PROPERTY, restic_restore_joblet_properties[RESTIC_RESTORE_JOBLET_PERCENTAGE_PROPERTY] = g_param_spec_double ("percentage", "percentage", "percentage", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
restic_restore_joblet_instance_init (ResticRestoreJoblet * self,
                                     gpointer klass)
{
	self->priv = restic_restore_joblet_get_instance_private (self);
}

static void
restic_restore_joblet_finalize (GObject * obj)
{
	ResticRestoreJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_RESTIC_RESTORE_JOBLET, ResticRestoreJoblet);
	_g_object_unref0 (self->priv->_restore_file);
	G_OBJECT_CLASS (restic_restore_joblet_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
restic_restore_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ResticRestoreJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restic_restore_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ResticRestoreJoblet), 0, (GInstanceInitFunc) restic_restore_joblet_instance_init, NULL };
	GType restic_restore_joblet_type_id;
	restic_restore_joblet_type_id = g_type_register_static (TYPE_RESTIC_JOBLET, "ResticRestoreJoblet", &g_define_type_info, 0);
	ResticRestoreJoblet_private_offset = g_type_add_instance_private (restic_restore_joblet_type_id, sizeof (ResticRestoreJobletPrivate));
	return restic_restore_joblet_type_id;
}

GType
restic_restore_joblet_get_type (void)
{
	static gsize restic_restore_joblet_type_id__once = 0;
	if (g_once_init_enter (&restic_restore_joblet_type_id__once)) {
		GType restic_restore_joblet_type_id;
		restic_restore_joblet_type_id = restic_restore_joblet_get_type_once ();
		g_once_init_leave (&restic_restore_joblet_type_id__once, restic_restore_joblet_type_id);
	}
	return restic_restore_joblet_type_id__once;
}

static void
_vala_restic_restore_joblet_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	ResticRestoreJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_RESTIC_RESTORE_JOBLET, ResticRestoreJoblet);
	switch (property_id) {
		case RESTIC_RESTORE_JOBLET_RESTORE_FILE_PROPERTY:
		g_value_set_object (value, restic_restore_joblet_get_restore_file (self));
		break;
		case RESTIC_RESTORE_JOBLET_PERCENTAGE_PROPERTY:
		g_value_set_double (value, restic_restore_joblet_get_percentage (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_restic_restore_joblet_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec)
{
	ResticRestoreJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_RESTIC_RESTORE_JOBLET, ResticRestoreJoblet);
	switch (property_id) {
		case RESTIC_RESTORE_JOBLET_RESTORE_FILE_PROPERTY:
		restic_restore_joblet_set_restore_file (self, g_value_get_object (value));
		break;
		case RESTIC_RESTORE_JOBLET_PERCENTAGE_PROPERTY:
		restic_restore_joblet_set_percentage (self, g_value_get_double (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
restic_check_joblet_get_instance_private (ResticCheckJoblet* self)
{
	return G_STRUCT_MEMBER_P (self, ResticCheckJoblet_private_offset);
}

ResticCheckJoblet*
restic_check_joblet_construct (GType object_type,
                               gboolean read_data)
{
	ResticCheckJoblet * self = NULL;
	self = (ResticCheckJoblet*) g_object_new (object_type, "read-data", read_data, NULL);
	return self;
}

ResticCheckJoblet*
restic_check_joblet_new (gboolean read_data)
{
	return restic_check_joblet_construct (TYPE_RESTIC_CHECK_JOBLET, read_data);
}

static void
restic_check_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                       GList** argv,
                                       GList** envp,
                                       GError** error)
{
	ResticCheckJoblet * self;
	gchar* _tmp0_;
	gboolean _tmp1_;
	GError* _inner_error0_ = NULL;
	self = (ResticCheckJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (restic_check_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_JOBLET, ResticJoblet), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = g_strdup ("check");
	*argv = g_list_append (*argv, _tmp0_);
	_tmp1_ = self->priv->_read_data;
	if (_tmp1_) {
		gchar* _tmp2_;
		gchar* _tmp3_;
		_tmp2_ = g_strdup ("--read-data-subset=64M");
		*argv = g_list_append (*argv, _tmp2_);
		_tmp3_ = g_strdup ("--no-cache");
		*argv = g_list_append (*argv, _tmp3_);
	} else {
		gchar* _tmp4_;
		_tmp4_ = g_strdup ("--with-cache");
		*argv = g_list_append (*argv, _tmp4_);
	}
}

static void
restic_check_joblet_real_handle_fatal_error (ResticJoblet* base,
                                             gint code,
                                             const gchar* msg)
{
	ResticCheckJoblet * self;
	gchar* new_msg = NULL;
	gchar* _tmp0_;
	self = (ResticCheckJoblet*) base;
	g_return_if_fail (msg != NULL);
	if (code == RESTIC_INSTANCE_ERROR_ALREADY_LOCKED) {
		((ResticJoblet*) self)->ignore_errors = TRUE;
	}
	_tmp0_ = deja_dup_tool_joblet_make_verification_error_message (msg);
	new_msg = _tmp0_;
	RESTIC_JOBLET_CLASS (restic_check_joblet_parent_class)->handle_fatal_error (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_RESTIC_JOBLET, ResticJoblet), code, new_msg);
	_g_free0 (new_msg);
}

gboolean
restic_check_joblet_get_read_data (ResticCheckJoblet* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_read_data;
	return result;
}

static void
restic_check_joblet_set_read_data (ResticCheckJoblet* self,
                                   gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = restic_check_joblet_get_read_data (self);
	if (old_value != value) {
		self->priv->_read_data = value;
		g_object_notify_by_pspec ((GObject *) self, restic_check_joblet_properties[RESTIC_CHECK_JOBLET_READ_DATA_PROPERTY]);
	}
}

static void
restic_check_joblet_class_init (ResticCheckJobletClass * klass,
                                gpointer klass_data)
{
	restic_check_joblet_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ResticCheckJoblet_private_offset);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) restic_check_joblet_real_prepare_args;
	((ResticJobletClass *) klass)->handle_fatal_error = (void (*) (ResticJoblet*, gint, const gchar*)) restic_check_joblet_real_handle_fatal_error;
	G_OBJECT_CLASS (klass)->get_property = _vala_restic_check_joblet_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_restic_check_joblet_set_property;
	G_OBJECT_CLASS (klass)->finalize = restic_check_joblet_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), RESTIC_CHECK_JOBLET_READ_DATA_PROPERTY, restic_check_joblet_properties[RESTIC_CHECK_JOBLET_READ_DATA_PROPERTY] = g_param_spec_boolean ("read-data", "read-data", "read-data", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}

static void
restic_check_joblet_instance_init (ResticCheckJoblet * self,
                                   gpointer klass)
{
	self->priv = restic_check_joblet_get_instance_private (self);
}

static void
restic_check_joblet_finalize (GObject * obj)
{
	ResticCheckJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_RESTIC_CHECK_JOBLET, ResticCheckJoblet);
	G_OBJECT_CLASS (restic_check_joblet_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
restic_check_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ResticCheckJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restic_check_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ResticCheckJoblet), 0, (GInstanceInitFunc) restic_check_joblet_instance_init, NULL };
	GType restic_check_joblet_type_id;
	restic_check_joblet_type_id = g_type_register_static (TYPE_RESTIC_JOBLET, "ResticCheckJoblet", &g_define_type_info, 0);
	ResticCheckJoblet_private_offset = g_type_add_instance_private (restic_check_joblet_type_id, sizeof (ResticCheckJobletPrivate));
	return restic_check_joblet_type_id;
}

GType
restic_check_joblet_get_type (void)
{
	static gsize restic_check_joblet_type_id__once = 0;
	if (g_once_init_enter (&restic_check_joblet_type_id__once)) {
		GType restic_check_joblet_type_id;
		restic_check_joblet_type_id = restic_check_joblet_get_type_once ();
		g_once_init_leave (&restic_check_joblet_type_id__once, restic_check_joblet_type_id);
	}
	return restic_check_joblet_type_id__once;
}

static void
_vala_restic_check_joblet_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	ResticCheckJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_RESTIC_CHECK_JOBLET, ResticCheckJoblet);
	switch (property_id) {
		case RESTIC_CHECK_JOBLET_READ_DATA_PROPERTY:
		g_value_set_boolean (value, restic_check_joblet_get_read_data (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_restic_check_joblet_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	ResticCheckJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_RESTIC_CHECK_JOBLET, ResticCheckJoblet);
	switch (property_id) {
		case RESTIC_CHECK_JOBLET_READ_DATA_PROPERTY:
		restic_check_joblet_set_read_data (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
restic_job_real_start_data_free (gpointer _data)
{
	ResticJobStartData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (ResticJobStartData, _data_);
}

static void
restic_job_real_start (DejaDupToolJob* base,
                       GAsyncReadyCallback _callback_,
                       gpointer _user_data_)
{
	ResticJob * self;
	ResticJobStartData* _data_;
	ResticJob* _tmp0_;
	self = (ResticJob*) base;
	_data_ = g_slice_new0 (ResticJobStartData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, restic_job_real_start_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	restic_job_real_start_co (_data_);
}

static void
restic_job_start_finish (DejaDupToolJob* base,
                         GAsyncResult* _res_)
{
	ResticJobStartData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
restic_job_start_ready (GObject* source_object,
                        GAsyncResult* _res_,
                        gpointer _user_data_)
{
	ResticJobStartData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	restic_job_real_start_co (_data_);
}

static gboolean
restic_job_real_start_co (ResticJobStartData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = deja_dup_tool_job_get_mode ((DejaDupToolJob*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = deja_dup_operation_mode_to_string (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	g_signal_emit_by_name ((DejaDupToolJob*) _data_->self, "action-desc-changed", _data_->_tmp3_);
	_g_free0 (_data_->_tmp3_);
	_data_->_tmp4_ = deja_dup_tool_job_get_mode ((DejaDupToolJob*) _data_->self);
	_data_->_tmp5_ = _data_->_tmp4_;
	switch (_data_->_tmp5_) {
		case DEJA_DUP_TOOL_JOB_MODE_BACKUP:
		{
			_data_->_tmp6_ = deja_dup_get_settings (NULL);
			_data_->settings = _data_->_tmp6_;
			_data_->_tmp7_ = _data_->settings;
			_data_->delete_after = g_settings_get_int ((GSettings*) _data_->_tmp7_, DEJA_DUP_DELETE_AFTER_KEY);
			_data_->_tmp8_ = restic_unlock_joblet_new ();
			_data_->_tmp9_ = _data_->_tmp8_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp9_);
			_g_object_unref0 (_data_->_tmp9_);
			_data_->_tmp10_ = restic_snapshots_joblet_new ();
			_data_->_tmp11_ = _data_->_tmp10_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp11_);
			_g_object_unref0 (_data_->_tmp11_);
			_data_->_tmp12_ = restic_backup_joblet_new ();
			_data_->_tmp13_ = _data_->_tmp12_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp13_);
			_g_object_unref0 (_data_->_tmp13_);
			if (_data_->delete_after > 0) {
				_data_->_tmp14_ = restic_delete_old_backups_joblet_new (_data_->delete_after);
				_data_->_tmp15_ = _data_->_tmp14_;
				deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp15_);
				_g_object_unref0 (_data_->_tmp15_);
			}
			_g_object_unref0 (_data_->settings);
			break;
		}
		case DEJA_DUP_TOOL_JOB_MODE_RESTORE:
		{
			_data_->_tmp16_ = restic_unlock_joblet_new ();
			_data_->_tmp17_ = _data_->_tmp16_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp17_);
			_g_object_unref0 (_data_->_tmp17_);
			_data_->_tmp18_ = deja_dup_tool_job_get_restore_files ((DejaDupToolJob*) _data_->self);
			_data_->_tmp19_ = _data_->_tmp18_;
			if (_data_->_tmp19_ == NULL) {
				_data_->_tmp20_ = restic_restore_joblet_new (NULL, (gdouble) 0);
				_data_->_tmp21_ = _data_->_tmp20_;
				deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp21_);
				_g_object_unref0 (_data_->_tmp21_);
			} else {
				_data_->i = (gdouble) 0;
				_data_->_tmp22_ = deja_dup_tool_job_get_restore_files ((DejaDupToolJob*) _data_->self);
				_data_->_tmp23_ = _data_->_tmp22_;
				{
					_data_->file_collection = _data_->_tmp23_;
					for (_data_->file_it = _data_->file_collection; _data_->file_it != NULL; _data_->file_it = _data_->file_it->next) {
						_data_->_tmp24_ = _g_object_ref0 ((GFile*) _data_->file_it->data);
						_data_->file = _data_->_tmp24_;
						{
							_data_->_tmp25_ = _data_->file;
							_data_->_tmp26_ = _data_->i;
							_data_->i = _data_->_tmp26_ + 1;
							_data_->_tmp27_ = deja_dup_tool_job_get_restore_files ((DejaDupToolJob*) _data_->self);
							_data_->_tmp28_ = _data_->_tmp27_;
							_data_->_tmp29_ = restic_restore_joblet_new (_data_->_tmp25_, _data_->_tmp26_ / g_list_length (_data_->_tmp28_));
							_data_->_tmp30_ = _data_->_tmp29_;
							deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp30_);
							_g_object_unref0 (_data_->_tmp30_);
							_g_object_unref0 (_data_->file);
						}
					}
				}
			}
			break;
		}
		case DEJA_DUP_TOOL_JOB_MODE_LIST_SNAPSHOTS:
		{
			_data_->_tmp31_ = restic_unlock_joblet_new ();
			_data_->_tmp32_ = _data_->_tmp31_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp32_);
			_g_object_unref0 (_data_->_tmp32_);
			_data_->_tmp33_ = restic_snapshots_joblet_new ();
			_data_->_tmp34_ = _data_->_tmp33_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp34_);
			_g_object_unref0 (_data_->_tmp34_);
			break;
		}
		case DEJA_DUP_TOOL_JOB_MODE_LIST_FILES:
		{
			_data_->_tmp35_ = restic_unlock_joblet_new ();
			_data_->_tmp36_ = _data_->_tmp35_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp36_);
			_g_object_unref0 (_data_->_tmp36_);
			_data_->_tmp37_ = restic_list_joblet_new ();
			_data_->_tmp38_ = _data_->_tmp37_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp38_);
			_g_object_unref0 (_data_->_tmp38_);
			break;
		}
		case DEJA_DUP_TOOL_JOB_MODE_VERIFY_BASIC:
		{
			_data_->_tmp39_ = restic_check_joblet_new (FALSE);
			_data_->_tmp40_ = _data_->_tmp39_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp40_);
			_g_object_unref0 (_data_->_tmp40_);
			break;
		}
		case DEJA_DUP_TOOL_JOB_MODE_VERIFY_CLEAN:
		{
			_data_->_tmp41_ = restic_unlock_joblet_new ();
			_data_->_tmp42_ = _data_->_tmp41_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp42_);
			_g_object_unref0 (_data_->_tmp42_);
			_data_->_tmp43_ = restic_check_joblet_new (TRUE);
			_data_->_tmp44_ = _data_->_tmp43_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp44_);
			_g_object_unref0 (_data_->_tmp44_);
			break;
		}
		case DEJA_DUP_TOOL_JOB_MODE_MOUNT:
		{
			_data_->_tmp45_ = restic_unlock_joblet_new ();
			_data_->_tmp46_ = _data_->_tmp45_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp46_);
			_g_object_unref0 (_data_->_tmp46_);
			_data_->_tmp47_ = restic_mount_joblet_new ();
			_data_->_tmp48_ = _data_->_tmp47_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp48_);
			_g_object_unref0 (_data_->_tmp48_);
			break;
		}
		default:
		{
			_data_->_tmp49_ = deja_dup_tool_job_get_mode ((DejaDupToolJob*) _data_->self);
			_data_->_tmp50_ = _data_->_tmp49_;
			g_warning ("ResticJob.vala:830: Unknown mode %d", (gint) _data_->_tmp50_);
			g_signal_emit_by_name ((DejaDupToolJob*) _data_->self, "done", TRUE, FALSE);
			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;
		}
	}
	_data_->_state_ = 1;
	DEJA_DUP_TOOL_JOB_CLASS (restic_job_parent_class)->start ((DejaDupToolJob*) G_TYPE_CHECK_INSTANCE_CAST (_data_->self, DEJA_DUP_TYPE_TOOL_JOB_CHAIN, DejaDupToolJobChain), restic_job_start_ready, _data_);
	return FALSE;
	_state_1:
	DEJA_DUP_TOOL_JOB_CLASS (restic_job_parent_class)->start_finish ((DejaDupToolJob*) G_TYPE_CHECK_INSTANCE_CAST (_data_->self, DEJA_DUP_TYPE_TOOL_JOB_CHAIN, DejaDupToolJobChain), _data_->_res_);
	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;
}

ResticJob*
restic_job_construct (GType object_type)
{
	ResticJob * self = NULL;
	self = (ResticJob*) deja_dup_tool_job_chain_construct (object_type);
	return self;
}

ResticJob*
restic_job_new (void)
{
	return restic_job_construct (TYPE_RESTIC_JOB);
}

static void
restic_job_class_init (ResticJobClass * klass,
                       gpointer klass_data)
{
	restic_job_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobClass *) klass)->start = (void (*) (DejaDupToolJob*, GAsyncReadyCallback, gpointer)) restic_job_real_start;
	((DejaDupToolJobClass *) klass)->start_finish = (void (*) (DejaDupToolJob*, GAsyncResult*)) restic_job_start_finish;
}

static void
restic_job_instance_init (ResticJob * self,
                          gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
restic_job_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ResticJobClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) restic_job_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ResticJob), 0, (GInstanceInitFunc) restic_job_instance_init, NULL };
	GType restic_job_type_id;
	restic_job_type_id = g_type_register_static (DEJA_DUP_TYPE_TOOL_JOB_CHAIN, "ResticJob", &g_define_type_info, 0);
	return restic_job_type_id;
}

GType
restic_job_get_type (void)
{
	static gsize restic_job_type_id__once = 0;
	if (g_once_init_enter (&restic_job_type_id__once)) {
		GType restic_job_type_id;
		restic_job_type_id = restic_job_get_type_once ();
		g_once_init_leave (&restic_job_type_id__once, restic_job_type_id);
	}
	return restic_job_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

