/* BorgJob.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from BorgJob.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>
#include <glib/gstdio.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#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_BORG_JOBLET (borg_joblet_get_type ())
#define BORG_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BORG_JOBLET, BorgJoblet))
#define BORG_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BORG_JOBLET, BorgJobletClass))
#define IS_BORG_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BORG_JOBLET))
#define IS_BORG_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BORG_JOBLET))
#define BORG_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BORG_JOBLET, BorgJobletClass))

typedef struct _BorgJoblet BorgJoblet;
typedef struct _BorgJobletClass BorgJobletClass;
typedef struct _BorgJobletPrivate BorgJobletPrivate;
enum  {
	BORG_JOBLET_0_PROPERTY,
	BORG_JOBLET_NUM_PROPERTIES
};
static GParamSpec* borg_joblet_properties[BORG_JOBLET_NUM_PROPERTIES];

#define TYPE_BORG_INSTANCE (borg_instance_get_type ())
#define BORG_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BORG_INSTANCE, BorgInstance))
#define BORG_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BORG_INSTANCE, BorgInstanceClass))
#define IS_BORG_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BORG_INSTANCE))
#define IS_BORG_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BORG_INSTANCE))
#define BORG_INSTANCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BORG_INSTANCE, BorgInstanceClass))

typedef struct _BorgInstance BorgInstance;
typedef struct _BorgInstanceClass BorgInstanceClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TYPE_BORG_INIT_JOBLET (borg_init_joblet_get_type ())
#define BORG_INIT_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BORG_INIT_JOBLET, BorgInitJoblet))
#define BORG_INIT_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BORG_INIT_JOBLET, BorgInitJobletClass))
#define IS_BORG_INIT_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BORG_INIT_JOBLET))
#define IS_BORG_INIT_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BORG_INIT_JOBLET))
#define BORG_INIT_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BORG_INIT_JOBLET, BorgInitJobletClass))

typedef struct _BorgInitJoblet BorgInitJoblet;
typedef struct _BorgInitJobletClass BorgInitJobletClass;
typedef struct _BorgInitJobletPrivate BorgInitJobletPrivate;
enum  {
	BORG_INIT_JOBLET_0_PROPERTY,
	BORG_INIT_JOBLET_NUM_PROPERTIES
};
static GParamSpec* borg_init_joblet_properties[BORG_INIT_JOBLET_NUM_PROPERTIES];

#define TYPE_BORG_BACKUP_JOBLET (borg_backup_joblet_get_type ())
#define BORG_BACKUP_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BORG_BACKUP_JOBLET, BorgBackupJoblet))
#define BORG_BACKUP_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BORG_BACKUP_JOBLET, BorgBackupJobletClass))
#define IS_BORG_BACKUP_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BORG_BACKUP_JOBLET))
#define IS_BORG_BACKUP_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BORG_BACKUP_JOBLET))
#define BORG_BACKUP_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BORG_BACKUP_JOBLET, BorgBackupJobletClass))

typedef struct _BorgBackupJoblet BorgBackupJoblet;
typedef struct _BorgBackupJobletClass BorgBackupJobletClass;
typedef struct _BorgBackupJobletPrivate BorgBackupJobletPrivate;
enum  {
	BORG_BACKUP_JOBLET_0_PROPERTY,
	BORG_BACKUP_JOBLET_NUM_PROPERTIES
};
static GParamSpec* borg_backup_joblet_properties[BORG_BACKUP_JOBLET_NUM_PROPERTIES];
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_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_BORG_STATUS_JOBLET (borg_status_joblet_get_type ())
#define BORG_STATUS_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BORG_STATUS_JOBLET, BorgStatusJoblet))
#define BORG_STATUS_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BORG_STATUS_JOBLET, BorgStatusJobletClass))
#define IS_BORG_STATUS_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BORG_STATUS_JOBLET))
#define IS_BORG_STATUS_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BORG_STATUS_JOBLET))
#define BORG_STATUS_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BORG_STATUS_JOBLET, BorgStatusJobletClass))

typedef struct _BorgStatusJoblet BorgStatusJoblet;
typedef struct _BorgStatusJobletClass BorgStatusJobletClass;
typedef struct _BorgStatusJobletPrivate BorgStatusJobletPrivate;
enum  {
	BORG_STATUS_JOBLET_0_PROPERTY,
	BORG_STATUS_JOBLET_NUM_PROPERTIES
};
static GParamSpec* borg_status_joblet_properties[BORG_STATUS_JOBLET_NUM_PROPERTIES];
#define _g_time_zone_unref0(var) ((var == NULL) ? NULL : (var = (g_time_zone_unref (var), NULL)))

#define TYPE_BORG_LIST_JOBLET (borg_list_joblet_get_type ())
#define BORG_LIST_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BORG_LIST_JOBLET, BorgListJoblet))
#define BORG_LIST_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BORG_LIST_JOBLET, BorgListJobletClass))
#define IS_BORG_LIST_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BORG_LIST_JOBLET))
#define IS_BORG_LIST_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BORG_LIST_JOBLET))
#define BORG_LIST_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BORG_LIST_JOBLET, BorgListJobletClass))

typedef struct _BorgListJoblet BorgListJoblet;
typedef struct _BorgListJobletClass BorgListJobletClass;
typedef struct _BorgListJobletPrivate BorgListJobletPrivate;
enum  {
	BORG_LIST_JOBLET_0_PROPERTY,
	BORG_LIST_JOBLET_NUM_PROPERTIES
};
static GParamSpec* borg_list_joblet_properties[BORG_LIST_JOBLET_NUM_PROPERTIES];

#define TYPE_BORG_RESTORE_JOBLET (borg_restore_joblet_get_type ())
#define BORG_RESTORE_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BORG_RESTORE_JOBLET, BorgRestoreJoblet))
#define BORG_RESTORE_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BORG_RESTORE_JOBLET, BorgRestoreJobletClass))
#define IS_BORG_RESTORE_JOBLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BORG_RESTORE_JOBLET))
#define IS_BORG_RESTORE_JOBLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BORG_RESTORE_JOBLET))
#define BORG_RESTORE_JOBLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BORG_RESTORE_JOBLET, BorgRestoreJobletClass))

typedef struct _BorgRestoreJoblet BorgRestoreJoblet;
typedef struct _BorgRestoreJobletClass BorgRestoreJobletClass;
typedef struct _BorgRestoreJobletPrivate BorgRestoreJobletPrivate;
enum  {
	BORG_RESTORE_JOBLET_0_PROPERTY,
	BORG_RESTORE_JOBLET_RESTORE_FILE_PROPERTY,
	BORG_RESTORE_JOBLET_NUM_PROPERTIES
};
static GParamSpec* borg_restore_joblet_properties[BORG_RESTORE_JOBLET_NUM_PROPERTIES];
typedef struct _DejaDupToolJobChainPrivate DejaDupToolJobChainPrivate;

#define TYPE_BORG_JOB (borg_job_get_type ())
#define BORG_JOB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BORG_JOB, BorgJob))
#define BORG_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BORG_JOB, BorgJobClass))
#define IS_BORG_JOB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BORG_JOB))
#define IS_BORG_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BORG_JOB))
#define BORG_JOB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BORG_JOB, BorgJobClass))

typedef struct _BorgJob BorgJob;
typedef struct _BorgJobClass BorgJobClass;
typedef struct _BorgJobPrivate BorgJobPrivate;
enum  {
	BORG_JOB_0_PROPERTY,
	BORG_JOB_NUM_PROPERTIES
};
static GParamSpec* borg_job_properties[BORG_JOB_NUM_PROPERTIES];
typedef struct _BorgJobStartData BorgJobStartData;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

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 _BorgJoblet {
	DejaDupToolJoblet parent_instance;
	BorgJobletPrivate * priv;
};

struct _BorgJobletClass {
	DejaDupToolJobletClass parent_class;
	gboolean (*process_message) (BorgJoblet* self, const gchar* msgid, JsonReader* reader);
};

struct _BorgInitJoblet {
	BorgJoblet parent_instance;
	BorgInitJobletPrivate * priv;
};

struct _BorgInitJobletClass {
	BorgJobletClass parent_class;
};

struct _BorgBackupJoblet {
	BorgJoblet parent_instance;
	BorgBackupJobletPrivate * priv;
};

struct _BorgBackupJobletClass {
	BorgJobletClass parent_class;
};

struct _BorgStatusJoblet {
	BorgJoblet parent_instance;
	BorgStatusJobletPrivate * priv;
};

struct _BorgStatusJobletClass {
	BorgJobletClass parent_class;
};

struct _BorgListJoblet {
	BorgJoblet parent_instance;
	BorgListJobletPrivate * priv;
};

struct _BorgListJobletClass {
	BorgJobletClass parent_class;
};

struct _BorgRestoreJoblet {
	BorgJoblet parent_instance;
	BorgRestoreJobletPrivate * priv;
};

struct _BorgRestoreJobletClass {
	BorgJobletClass parent_class;
};

struct _BorgRestoreJobletPrivate {
	GFile* _restore_file;
};

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

struct _DejaDupToolJobChainClass {
	DejaDupToolJobClass parent_class;
};

struct _BorgJob {
	DejaDupToolJobChain parent_instance;
	BorgJobPrivate * priv;
};

struct _BorgJobClass {
	DejaDupToolJobChainClass parent_class;
};

struct _BorgJobStartData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BorgJob* self;
	DejaDupToolJobMode _tmp0_;
	DejaDupToolJobMode _tmp1_;
	BorgBackupJoblet* _tmp2_;
	BorgBackupJoblet* _tmp3_;
	GList* _tmp4_;
	GList* _tmp5_;
	GList* file_collection;
	GList* file_it;
	GFile* _tmp6_;
	GFile* file;
	GFile* _tmp7_;
	BorgRestoreJoblet* _tmp8_;
	BorgRestoreJoblet* _tmp9_;
	BorgStatusJoblet* _tmp10_;
	BorgStatusJoblet* _tmp11_;
	BorgListJoblet* _tmp12_;
	BorgListJoblet* _tmp13_;
	DejaDupToolJobMode _tmp14_;
	DejaDupToolJobMode _tmp15_;
};

static gpointer borg_joblet_parent_class = NULL;
static gpointer borg_init_joblet_parent_class = NULL;
static gpointer borg_backup_joblet_parent_class = NULL;
static gpointer borg_status_joblet_parent_class = NULL;
static gpointer borg_list_joblet_parent_class = NULL;
static gint BorgRestoreJoblet_private_offset;
static gpointer borg_restore_joblet_parent_class = NULL;
static gpointer borg_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 borg_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_args (DejaDupToolJoblet* self,
                                        GList** argv,
                                        GList** envp,
                                        GError** error);
VALA_EXTERN gboolean borg_joblet_process_message (BorgJoblet* self,
                                      const gchar* msgid,
                                      JsonReader* reader);
static ToolInstance* borg_joblet_real_make_instance (DejaDupToolJoblet* base);
VALA_EXTERN GType borg_instance_get_type (void) G_GNUC_CONST ;
VALA_EXTERN BorgInstance* borg_instance_new (void);
VALA_EXTERN BorgInstance* borg_instance_construct (GType object_type);
VALA_EXTERN void deja_dup_tool_joblet_add_handler (DejaDupToolJoblet* self,
                                       gulong id);
static void borg_joblet_handle_message (BorgJoblet* self,
                                 BorgInstance* inst,
                                 JsonReader* reader);
static void _borg_joblet_handle_message_borg_instance_message (BorgInstance* _sender,
                                                        JsonReader* reader,
                                                        gpointer self);
static void borg_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                    GList** argv,
                                    GList** envp,
                                    GError** error);
VALA_EXTERN gchar* borg_joblet_get_remote (BorgJoblet* self,
                               gboolean add_tag,
                               GError** error);
VALA_EXTERN GFile* deja_dup_backend_file_get_file_from_settings (DejaDupBackendFile* self);
static gboolean borg_joblet_real_process_message (BorgJoblet* self,
                                           const gchar* msgid,
                                           JsonReader* reader);
static gchar* borg_joblet_get_log_msgid (BorgJoblet* self,
                                  JsonReader* reader);
static gboolean borg_joblet_process_common_log_messages (BorgJoblet* self,
                                                  const gchar* msgid,
                                                  JsonReader* reader);
VALA_EXTERN void deja_dup_tool_joblet_show_error (DejaDupToolJoblet* self,
                                      const gchar* msg,
                                      const gchar* detail);
static void borg_joblet_process_unhandled_message (BorgJoblet* self,
                                            const gchar* msgid,
                                            JsonReader* reader);
VALA_EXTERN BorgJoblet* borg_joblet_new (void);
VALA_EXTERN BorgJoblet* borg_joblet_construct (GType object_type);
VALA_EXTERN DejaDupToolJoblet* deja_dup_tool_joblet_construct (GType object_type);
static GType borg_joblet_get_type_once (void);
VALA_EXTERN GType borg_init_joblet_get_type (void) G_GNUC_CONST ;
static void borg_init_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                         GList** argv,
                                         GList** envp,
                                         GError** error);
VALA_EXTERN BorgInitJoblet* borg_init_joblet_new (void);
VALA_EXTERN BorgInitJoblet* borg_init_joblet_construct (GType object_type);
static GType borg_init_joblet_get_type_once (void);
VALA_EXTERN GType borg_backup_joblet_get_type (void) G_GNUC_CONST ;
static void borg_backup_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                           GList** argv,
                                           GList** envp,
                                           GError** error);
static void borg_backup_joblet_add_include_excludes (BorgBackupJoblet* self,
                                              GList** argv);
static gboolean borg_backup_joblet_process_progress (BorgBackupJoblet* self,
                                              JsonReader* reader);
static gboolean borg_backup_joblet_real_process_message (BorgJoblet* base,
                                                  const gchar* msgid,
                                                  JsonReader* reader);
VALA_EXTERN void deja_dup_tool_joblet_disconnect_inst (DejaDupToolJoblet* 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 deja_dup_tool_job_chain_append_to_chain (DejaDupToolJobChain* self,
                                              DejaDupToolJoblet* joblet);
VALA_EXTERN BorgBackupJoblet* borg_backup_joblet_new (void);
VALA_EXTERN BorgBackupJoblet* borg_backup_joblet_construct (GType object_type);
VALA_EXTERN void deja_dup_tool_joblet_finish (DejaDupToolJoblet* self);
static gint borg_backup_joblet_cmp_prefix (BorgBackupJoblet* self,
                                    GFile* a,
                                    GFile* b);
static void _g_object_unref0_ (gpointer var);
static GType borg_backup_joblet_get_type_once (void);
VALA_EXTERN GType borg_status_joblet_get_type (void) G_GNUC_CONST ;
static void borg_status_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                           GList** argv,
                                           GList** envp,
                                           GError** error);
static gboolean borg_status_joblet_real_process_message (BorgJoblet* base,
                                                  const gchar* msgid,
                                                  JsonReader* reader);
static gboolean borg_status_joblet_process_status (BorgStatusJoblet* self,
                                            JsonReader* reader);
static inline void _g_list_free__g_object_unref0_ (GList* self);
VALA_EXTERN BorgStatusJoblet* borg_status_joblet_new (void);
VALA_EXTERN BorgStatusJoblet* borg_status_joblet_construct (GType object_type);
static GType borg_status_joblet_get_type_once (void);
VALA_EXTERN GType borg_list_joblet_get_type (void) G_GNUC_CONST ;
static void borg_list_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                         GList** argv,
                                         GList** envp,
                                         GError** error);
static gboolean borg_list_joblet_real_process_message (BorgJoblet* base,
                                                const gchar* msgid,
                                                JsonReader* reader);
VALA_EXTERN BorgListJoblet* borg_list_joblet_new (void);
VALA_EXTERN BorgListJoblet* borg_list_joblet_construct (GType object_type);
static GType borg_list_joblet_get_type_once (void);
VALA_EXTERN GType borg_restore_joblet_get_type (void) G_GNUC_CONST ;
VALA_EXTERN BorgRestoreJoblet* borg_restore_joblet_new (GFile* restore_file);
VALA_EXTERN BorgRestoreJoblet* borg_restore_joblet_construct (GType object_type,
                                                  GFile* restore_file);
static void borg_restore_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                            GList** argv,
                                            GList** envp,
                                            GError** error);
VALA_EXTERN GFile* borg_restore_joblet_get_restore_file (BorgRestoreJoblet* self);
static void borg_restore_joblet_set_restore_file (BorgRestoreJoblet* self,
                                           GFile* value);
static void borg_restore_joblet_finalize (GObject * obj);
static GType borg_restore_joblet_get_type_once (void);
static void _vala_borg_restore_joblet_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_borg_restore_joblet_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
VALA_EXTERN GType borg_job_get_type (void) G_GNUC_CONST ;
static void borg_job_real_start_data_free (gpointer _data);
static void borg_job_real_start (DejaDupToolJob* base,
                          GAsyncReadyCallback _callback_,
                          gpointer _user_data_);
static gboolean borg_job_real_start_co (BorgJobStartData* _data_);
static void borg_job_start_ready (GObject* source_object,
                           GAsyncResult* _res_,
                           gpointer _user_data_);
VALA_EXTERN BorgJob* borg_job_new (void);
VALA_EXTERN BorgJob* borg_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 borg_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 gssize _vala_array_length (gpointer array);

static void
_borg_joblet_handle_message_borg_instance_message (BorgInstance* _sender,
                                                   JsonReader* reader,
                                                   gpointer self)
{
	borg_joblet_handle_message ((BorgJoblet*) self, _sender, reader);
}

static ToolInstance*
borg_joblet_real_make_instance (DejaDupToolJoblet* base)
{
	BorgJoblet * self;
	BorgInstance* instance = NULL;
	BorgInstance* _tmp0_;
	gulong _tmp1_;
	ToolInstance* result;
	self = (BorgJoblet*) base;
	_tmp0_ = borg_instance_new ();
	instance = _tmp0_;
	_tmp1_ = g_signal_connect_object (instance, "message", (GCallback) _borg_joblet_handle_message_borg_instance_message, self, 0);
	deja_dup_tool_joblet_add_handler ((DejaDupToolJoblet*) self, _tmp1_);
	result = (ToolInstance*) instance;
	return result;
}

static void
borg_joblet_real_prepare_args (DejaDupToolJoblet* base,
                               GList** argv,
                               GList** envp,
                               GError** error)
{
	BorgJoblet * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_ = NULL;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp8_;
	self = (BorgJoblet*) base;
	_tmp0_ = borg_plugin_borg_command ();
	*argv = g_list_append (*argv, _tmp0_);
	_tmp1_ = g_strdup ("--info");
	*argv = g_list_append (*argv, _tmp1_);
	_tmp2_ = g_strdup ("--log-json");
	*argv = g_list_append (*argv, _tmp2_);
	_tmp4_ = deja_dup_tool_job_get_encrypt_password ((DejaDupToolJob*) self);
	_tmp5_ = _tmp4_;
	if (_tmp5_ != NULL) {
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp6_ = deja_dup_tool_job_get_encrypt_password ((DejaDupToolJob*) self);
		_tmp7_ = _tmp6_;
		_tmp3_ = _tmp7_;
	} else {
		_tmp3_ = "";
	}
	_tmp8_ = g_strconcat ("BORG_PASSPHRASE=", _tmp3_, NULL);
	*envp = g_list_append (*envp, _tmp8_);
}

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

gchar*
borg_joblet_get_remote (BorgJoblet* self,
                        gboolean add_tag,
                        GError** error)
{
	gchar* repo = NULL;
	DejaDupBackendFile* file_backend = NULL;
	DejaDupBackend* _tmp0_;
	DejaDupBackend* _tmp1_;
	DejaDupBackendFile* _tmp2_;
	DejaDupBackendFile* _tmp3_;
	const gchar* _tmp9_;
	gboolean _tmp18_ = FALSE;
	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_ = repo;
	if (_tmp9_ == NULL) {
		gchar* location_pretty = NULL;
		DejaDupBackend* _tmp10_;
		DejaDupBackend* _tmp11_;
		gchar* _tmp12_;
		const gchar* _tmp13_;
		gchar* _tmp14_;
		gchar* _tmp15_;
		GError* _tmp16_;
		GError* _tmp17_;
		_tmp10_ = deja_dup_tool_job_get_backend ((DejaDupToolJob*) self);
		_tmp11_ = _tmp10_;
		_tmp12_ = deja_dup_backend_get_location_pretty (_tmp11_);
		location_pretty = _tmp12_;
		_tmp13_ = location_pretty;
		_tmp14_ = g_strdup_printf (_ ("Could not find storage location ‘%s’."), _tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_NOT_FOUND, _tmp15_);
		_tmp17_ = _tmp16_;
		_g_free0 (_tmp15_);
		_inner_error0_ = _tmp17_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (location_pretty);
		_g_object_unref0 (file_backend);
		_g_free0 (repo);
		return NULL;
	}
	if (add_tag) {
		const gchar* _tmp19_;
		const gchar* _tmp20_;
		_tmp19_ = deja_dup_tool_job_get_tag ((DejaDupToolJob*) self);
		_tmp20_ = _tmp19_;
		_tmp18_ = _tmp20_ != NULL;
	} else {
		_tmp18_ = FALSE;
	}
	if (_tmp18_) {
		const gchar* _tmp21_;
		const gchar* _tmp22_;
		const gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		gchar* _tmp26_;
		_tmp21_ = repo;
		_tmp22_ = deja_dup_tool_job_get_tag ((DejaDupToolJob*) self);
		_tmp23_ = _tmp22_;
		_tmp24_ = g_strconcat ("::", _tmp23_, NULL);
		_tmp25_ = _tmp24_;
		_tmp26_ = g_strconcat (_tmp21_, _tmp25_, NULL);
		_g_free0 (repo);
		repo = _tmp26_;
		_g_free0 (_tmp25_);
	}
	result = repo;
	_g_object_unref0 (file_backend);
	return result;
}

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

gboolean
borg_joblet_process_message (BorgJoblet* self,
                             const gchar* msgid,
                             JsonReader* reader)
{
	BorgJobletClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = BORG_JOBLET_GET_CLASS (self);
	if (_klass_->process_message) {
		return _klass_->process_message (self, msgid, reader);
	}
	return FALSE;
}

static gchar*
borg_joblet_get_log_msgid (BorgJoblet* self,
                           JsonReader* reader)
{
	gchar* type = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* msgid = NULL;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (reader != NULL, NULL);
	json_reader_read_member (reader, "type");
	_tmp0_ = json_reader_get_string_value (reader);
	_tmp1_ = g_strdup (_tmp0_);
	type = _tmp1_;
	json_reader_end_member (reader);
	_tmp2_ = type;
	if (g_strcmp0 (_tmp2_, "log_message") != 0) {
		result = NULL;
		_g_free0 (type);
		return result;
	}
	_tmp3_ = g_strdup ("");
	msgid = _tmp3_;
	if (json_reader_read_member (reader, "msgid")) {
		const gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp4_ = json_reader_get_string_value (reader);
		_tmp5_ = g_strdup (_tmp4_);
		_g_free0 (msgid);
		msgid = _tmp5_;
	}
	json_reader_end_member (reader);
	result = msgid;
	_g_free0 (type);
	return result;
}

static gboolean
borg_joblet_process_common_log_messages (BorgJoblet* self,
                                         const gchar* msgid,
                                         JsonReader* reader)
{
	gchar* levelname = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (reader != NULL, FALSE);
	if (msgid == NULL) {
		result = FALSE;
		return result;
	}
	json_reader_read_member (reader, "levelname");
	_tmp0_ = json_reader_get_string_value (reader);
	_tmp1_ = g_strdup (_tmp0_);
	levelname = _tmp1_;
	json_reader_end_member (reader);
	if (g_strcmp0 (msgid, "") == 0) {
		const gchar* _tmp3_;
		_tmp3_ = levelname;
		_tmp2_ = g_strcmp0 (_tmp3_, "ERROR") == 0;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		gchar* message = NULL;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		const gchar* _tmp6_;
		json_reader_read_member (reader, "message");
		_tmp4_ = json_reader_get_string_value (reader);
		_tmp5_ = g_strdup (_tmp4_);
		message = _tmp5_;
		json_reader_end_member (reader);
		_tmp6_ = message;
		deja_dup_tool_joblet_show_error ((DejaDupToolJoblet*) self, "Failed with an unknown error.", _tmp6_);
		result = TRUE;
		_g_free0 (message);
		_g_free0 (levelname);
		return result;
	}
	if (g_strcmp0 (msgid, "PassphraseWrong") == 0) {
		g_signal_emit_by_name ((DejaDupToolJob*) self, "bad-encryption-password");
		result = TRUE;
		_g_free0 (levelname);
		return result;
	}
	result = FALSE;
	_g_free0 (levelname);
	return result;
}

static void
borg_joblet_process_unhandled_message (BorgJoblet* self,
                                       const gchar* msgid,
                                       JsonReader* reader)
{
	gchar* levelname = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (reader != NULL);
	if (msgid == NULL) {
		return;
	}
	json_reader_read_member (reader, "levelname");
	_tmp0_ = json_reader_get_string_value (reader);
	_tmp1_ = g_strdup (_tmp0_);
	levelname = _tmp1_;
	json_reader_end_member (reader);
	_tmp2_ = levelname;
	if (g_strcmp0 (_tmp2_, "ERROR") == 0) {
		gchar* message = NULL;
		const gchar* _tmp3_;
		gchar* _tmp4_;
		const gchar* _tmp5_;
		json_reader_read_member (reader, "message");
		_tmp3_ = json_reader_get_string_value (reader);
		_tmp4_ = g_strdup (_tmp3_);
		message = _tmp4_;
		json_reader_end_member (reader);
		_tmp5_ = message;
		deja_dup_tool_joblet_show_error ((DejaDupToolJoblet*) self, "Failed with an unknown error.", _tmp5_);
		_g_free0 (message);
	}
	_g_free0 (levelname);
}

static void
borg_joblet_handle_message (BorgJoblet* self,
                            BorgInstance* inst,
                            JsonReader* reader)
{
	gchar* msgid = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (reader != NULL);
	_tmp0_ = borg_joblet_get_log_msgid (self, reader);
	msgid = _tmp0_;
	_tmp1_ = msgid;
	if (borg_joblet_process_common_log_messages (self, _tmp1_, reader)) {
		_g_free0 (msgid);
		return;
	}
	_tmp2_ = msgid;
	if (borg_joblet_process_message (self, _tmp2_, reader)) {
		_g_free0 (msgid);
		return;
	}
	_tmp3_ = msgid;
	borg_joblet_process_unhandled_message (self, _tmp3_, reader);
	_g_free0 (msgid);
}

BorgJoblet*
borg_joblet_construct (GType object_type)
{
	BorgJoblet * self = NULL;
	self = (BorgJoblet*) deja_dup_tool_joblet_construct (object_type);
	return self;
}

BorgJoblet*
borg_joblet_new (void)
{
	return borg_joblet_construct (TYPE_BORG_JOBLET);
}

static void
borg_joblet_class_init (BorgJobletClass * klass,
                        gpointer klass_data)
{
	borg_joblet_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobletClass *) klass)->make_instance = (ToolInstance* (*) (DejaDupToolJoblet*)) borg_joblet_real_make_instance;
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) borg_joblet_real_prepare_args;
	((BorgJobletClass *) klass)->process_message = (gboolean (*) (BorgJoblet*, const gchar*, JsonReader*)) borg_joblet_real_process_message;
}

static void
borg_joblet_instance_init (BorgJoblet * self,
                           gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
borg_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BorgJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) borg_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BorgJoblet), 0, (GInstanceInitFunc) borg_joblet_instance_init, NULL };
	GType borg_joblet_type_id;
	borg_joblet_type_id = g_type_register_static (DEJA_DUP_TYPE_TOOL_JOBLET, "BorgJoblet", &g_define_type_info, 0);
	return borg_joblet_type_id;
}

GType
borg_joblet_get_type (void)
{
	static gsize borg_joblet_type_id__once = 0;
	if (g_once_init_enter (&borg_joblet_type_id__once)) {
		GType borg_joblet_type_id;
		borg_joblet_type_id = borg_joblet_get_type_once ();
		g_once_init_leave (&borg_joblet_type_id__once, borg_joblet_type_id);
	}
	return borg_joblet_type_id__once;
}

static void
borg_init_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                    GList** argv,
                                    GList** envp,
                                    GError** error)
{
	BorgInitJoblet * self;
	gchar* _tmp0_;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_ = NULL;
	gchar* _tmp8_;
	gchar* _tmp9_;
	GError* _inner_error0_ = NULL;
	self = (BorgInitJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (borg_init_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BORG_JOBLET, BorgJoblet), 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_);
	_tmp2_ = deja_dup_tool_job_get_encrypt_password ((DejaDupToolJob*) self);
	_tmp3_ = _tmp2_;
	if (_tmp3_ != NULL) {
		_tmp1_ = "repokey-blake2";
	} else {
		_tmp1_ = "none";
	}
	_tmp4_ = g_strconcat ("--encryption=", _tmp1_, NULL);
	*argv = g_list_append (*argv, _tmp4_);
	_tmp5_ = g_strdup ("--make-parent-dirs");
	*argv = g_list_append (*argv, _tmp5_);
	_tmp6_ = g_strdup ("--progress");
	*argv = g_list_append (*argv, _tmp6_);
	_tmp8_ = borg_joblet_get_remote ((BorgJoblet*) self, FALSE, &_inner_error0_);
	_tmp7_ = _tmp8_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp9_ = _tmp7_;
	_tmp7_ = NULL;
	*argv = g_list_append (*argv, _tmp9_);
	_g_free0 (_tmp7_);
}

BorgInitJoblet*
borg_init_joblet_construct (GType object_type)
{
	BorgInitJoblet * self = NULL;
	self = (BorgInitJoblet*) borg_joblet_construct (object_type);
	return self;
}

BorgInitJoblet*
borg_init_joblet_new (void)
{
	return borg_init_joblet_construct (TYPE_BORG_INIT_JOBLET);
}

static void
borg_init_joblet_class_init (BorgInitJobletClass * klass,
                             gpointer klass_data)
{
	borg_init_joblet_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) borg_init_joblet_real_prepare_args;
}

static void
borg_init_joblet_instance_init (BorgInitJoblet * self,
                                gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
borg_init_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BorgInitJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) borg_init_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BorgInitJoblet), 0, (GInstanceInitFunc) borg_init_joblet_instance_init, NULL };
	GType borg_init_joblet_type_id;
	borg_init_joblet_type_id = g_type_register_static (TYPE_BORG_JOBLET, "BorgInitJoblet", &g_define_type_info, 0);
	return borg_init_joblet_type_id;
}

GType
borg_init_joblet_get_type (void)
{
	static gsize borg_init_joblet_type_id__once = 0;
	if (g_once_init_enter (&borg_init_joblet_type_id__once)) {
		GType borg_init_joblet_type_id;
		borg_init_joblet_type_id = borg_init_joblet_get_type_once ();
		g_once_init_leave (&borg_init_joblet_type_id__once, borg_init_joblet_type_id);
	}
	return borg_init_joblet_type_id__once;
}

static void
borg_backup_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                      GList** argv,
                                      GList** envp,
                                      GError** error)
{
	BorgBackupJoblet * self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GDateTime* now = NULL;
	GDateTime* _tmp2_;
	GDateTime* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_ = NULL;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GError* _inner_error0_ = NULL;
	self = (BorgBackupJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (borg_backup_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BORG_JOBLET, BorgJoblet), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = deja_dup_tool_job_get_tag ((DejaDupToolJob*) self);
	_tmp1_ = _tmp0_;
	_vala_assert (_tmp1_ == NULL, "tag == null");
	_tmp2_ = g_date_time_new_now_utc ();
	now = _tmp2_;
	_tmp3_ = now;
	_tmp4_ = g_date_time_format (_tmp3_, "%s");
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strdup_printf ("%s.%s", PACKAGE, _tmp5_);
	_tmp7_ = _tmp6_;
	deja_dup_tool_job_set_tag ((DejaDupToolJob*) self, _tmp7_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	_tmp8_ = g_strdup ("create");
	*argv = g_list_append (*argv, _tmp8_);
	_tmp9_ = g_strdup ("--progress");
	*argv = g_list_append (*argv, _tmp9_);
	_tmp10_ = g_strdup_printf ("--comment=%s %s", PACKAGE, VERSION);
	*argv = g_list_append (*argv, _tmp10_);
	borg_backup_joblet_add_include_excludes (self, argv);
	_tmp12_ = borg_joblet_get_remote ((BorgJoblet*) self, TRUE, &_inner_error0_);
	_tmp11_ = _tmp12_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_date_time_unref0 (now);
		return;
	}
	_tmp13_ = _tmp11_;
	_tmp11_ = NULL;
	*argv = g_list_append (*argv, _tmp13_);
	_g_free0 (_tmp11_);
	_g_date_time_unref0 (now);
}

static gboolean
borg_backup_joblet_process_progress (BorgBackupJoblet* self,
                                     JsonReader* reader)
{
	gint64 current = 0LL;
	gint64 total = 0LL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (reader != NULL, FALSE);
	json_reader_read_member (reader, "current");
	current = json_reader_get_int_value (reader);
	json_reader_end_member (reader);
	json_reader_read_member (reader, "total");
	total = json_reader_get_int_value (reader);
	json_reader_end_member (reader);
	if (total > ((gint64) 0)) {
		g_signal_emit_by_name ((DejaDupToolJob*) self, "progress", ((gdouble) current) / total);
	}
	result = TRUE;
	return result;
}

static gboolean
borg_backup_joblet_real_process_message (BorgJoblet* base,
                                         const gchar* msgid,
                                         JsonReader* reader)
{
	BorgBackupJoblet * self;
	gchar* type = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean result;
	self = (BorgBackupJoblet*) base;
	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_);
	type = _tmp1_;
	json_reader_end_member (reader);
	if (g_strcmp0 (msgid, "Repository.DoesNotExist") == 0) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = g_strcmp0 (msgid, "Repository.InvalidRepository") == 0;
	}
	if (_tmp2_) {
		DejaDupToolJobChain* _tmp3_;
		DejaDupToolJobChain* _tmp4_;
		BorgInitJoblet* _tmp5_;
		BorgInitJoblet* _tmp6_;
		DejaDupToolJobChain* _tmp7_;
		DejaDupToolJobChain* _tmp8_;
		BorgBackupJoblet* _tmp9_;
		BorgBackupJoblet* _tmp10_;
		deja_dup_tool_joblet_disconnect_inst ((DejaDupToolJoblet*) self);
		g_signal_emit_by_name ((DejaDupToolJob*) self, "is-full", TRUE);
		deja_dup_tool_job_set_tag ((DejaDupToolJob*) self, NULL);
		_tmp3_ = deja_dup_tool_joblet_get_chain ((DejaDupToolJoblet*) self);
		_tmp4_ = _tmp3_;
		_tmp5_ = borg_init_joblet_new ();
		_tmp6_ = _tmp5_;
		deja_dup_tool_job_chain_append_to_chain (_tmp4_, (DejaDupToolJoblet*) _tmp6_);
		_g_object_unref0 (_tmp6_);
		_tmp7_ = deja_dup_tool_joblet_get_chain ((DejaDupToolJoblet*) self);
		_tmp8_ = _tmp7_;
		_tmp9_ = borg_backup_joblet_new ();
		_tmp10_ = _tmp9_;
		deja_dup_tool_job_chain_append_to_chain (_tmp8_, (DejaDupToolJoblet*) _tmp10_);
		_g_object_unref0 (_tmp10_);
		deja_dup_tool_joblet_finish ((DejaDupToolJoblet*) self);
		result = TRUE;
		_g_free0 (type);
		return result;
	} else {
		const gchar* _tmp11_;
		_tmp11_ = type;
		if (g_strcmp0 (_tmp11_, "progress_progress") == 0) {
			result = borg_backup_joblet_process_progress (self, reader);
			_g_free0 (type);
			return result;
		}
	}
	result = FALSE;
	_g_free0 (type);
	return result;
}

static gint
borg_backup_joblet_cmp_prefix (BorgBackupJoblet* self,
                               GFile* a,
                               GFile* b)
{
	gboolean _tmp0_ = FALSE;
	gint result;
	g_return_val_if_fail (self != NULL, 0);
	if (a == NULL) {
		_tmp0_ = b == NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		result = 0;
		return result;
	} else {
		gboolean _tmp1_ = FALSE;
		if (b == NULL) {
			_tmp1_ = TRUE;
		} else {
			_tmp1_ = g_file_has_prefix (a, b);
		}
		if (_tmp1_) {
			result = -1;
			return result;
		} else {
			gboolean _tmp2_ = FALSE;
			if (a == NULL) {
				_tmp2_ = TRUE;
			} else {
				_tmp2_ = g_file_has_prefix (b, a);
			}
			if (_tmp2_) {
				result = 1;
				return result;
			} else {
				result = 0;
				return result;
			}
		}
	}
}

static GList*
vala_g_list_remove_full (GList* self,
                         gconstpointer data,
                         GFreeFunc func)
{
	GList* l = NULL;
	GList* result;
	l = self;
	while (TRUE) {
		GList* _tmp0_;
		GList* _tmp1_;
		gconstpointer _tmp2_;
		_tmp0_ = l;
		if (!(_tmp0_ != NULL)) {
			break;
		}
		_tmp1_ = l;
		_tmp2_ = ((GList*) _tmp1_)->data;
		if (_tmp2_ != data) {
			GList* _tmp3_;
			GList* _tmp4_;
			_tmp3_ = l;
			_tmp4_ = ((GList*) _tmp3_)->next;
			l = _tmp4_;
		} else {
			GList* _tmp5_;
			gconstpointer _tmp6_;
			GList* _tmp7_;
			_tmp5_ = l;
			_tmp6_ = ((GList*) _tmp5_)->data;
			func (_tmp6_);
			_tmp7_ = l;
			self = g_list_delete_link (self, (GList*) _tmp7_);
			break;
		}
	}
	result = self;
	return result;
}

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

static void
borg_backup_joblet_add_include_excludes (BorgBackupJoblet* self,
                                         GList** argv)
{
	gchar* _tmp0_;
	GList* _tmp1_;
	gchar* _tmp7_;
	GList* _tmp8_;
	GList* _tmp29_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup ("--pattern=Psh");
	*argv = g_list_append (*argv, _tmp0_);
	_tmp1_ = ((DejaDupToolJob*) self)->exclude_regexps;
	{
		GList* r_collection = NULL;
		GList* r_it = NULL;
		r_collection = _tmp1_;
		for (r_it = r_collection; r_it != NULL; r_it = r_it->next) {
			GFile* _tmp2_;
			GFile* r = NULL;
			_tmp2_ = _g_object_ref0 ((GFile*) r_it->data);
			r = _tmp2_;
			{
				GFile* _tmp3_;
				gchar* _tmp4_;
				gchar* _tmp5_;
				gchar* _tmp6_;
				_tmp3_ = r;
				_tmp4_ = g_file_get_path (_tmp3_);
				_tmp5_ = _tmp4_;
				_tmp6_ = g_strconcat ("--pattern=-", _tmp5_, NULL);
				*argv = g_list_append (*argv, _tmp6_);
				_g_free0 (_tmp5_);
				_g_object_unref0 (r);
			}
		}
	}
	((DejaDupToolJob*) self)->includes = g_list_sort (((DejaDupToolJob*) self)->includes, (GCompareFunc) borg_backup_joblet_cmp_prefix);
	((DejaDupToolJob*) self)->excludes = g_list_sort (((DejaDupToolJob*) self)->excludes, (GCompareFunc) borg_backup_joblet_cmp_prefix);
	_tmp7_ = g_strdup ("--pattern=Ppp");
	*argv = g_list_append (*argv, _tmp7_);
	_tmp8_ = ((DejaDupToolJob*) self)->includes;
	{
		GList* i_collection = NULL;
		GList* i_it = NULL;
		i_collection = _tmp8_;
		for (i_it = i_collection; i_it != NULL; i_it = i_it->next) {
			GFile* _tmp9_;
			GFile* i = NULL;
			_tmp9_ = _g_object_ref0 ((GFile*) i_it->data);
			i = _tmp9_;
			{
				GList* excludes2 = NULL;
				GList* _tmp10_;
				GList* _tmp11_;
				GList* _tmp12_;
				GFile* _tmp21_;
				gchar* _tmp22_;
				gchar* _tmp23_;
				gchar* _tmp24_;
				GFile* _tmp25_;
				gchar* _tmp26_;
				gchar* _tmp27_;
				gchar* _tmp28_;
				_tmp10_ = ((DejaDupToolJob*) self)->excludes;
				_tmp11_ = g_list_copy (_tmp10_);
				excludes2 = _tmp11_;
				_tmp12_ = excludes2;
				{
					GList* e_collection = NULL;
					GList* e_it = NULL;
					e_collection = _tmp12_;
					for (e_it = e_collection; e_it != NULL; e_it = e_it->next) {
						GFile* _tmp13_;
						GFile* e = NULL;
						_tmp13_ = _g_object_ref0 ((GFile*) e_it->data);
						e = _tmp13_;
						{
							GFile* _tmp14_;
							GFile* _tmp15_;
							_tmp14_ = e;
							_tmp15_ = i;
							if (g_file_has_prefix (_tmp14_, _tmp15_)) {
								GFile* _tmp16_;
								gchar* _tmp17_;
								gchar* _tmp18_;
								gchar* _tmp19_;
								GFile* _tmp20_;
								_tmp16_ = e;
								_tmp17_ = g_file_get_path (_tmp16_);
								_tmp18_ = _tmp17_;
								_tmp19_ = g_strconcat ("--pattern=-", _tmp18_, NULL);
								*argv = g_list_append (*argv, _tmp19_);
								_g_free0 (_tmp18_);
								_tmp20_ = e;
								((DejaDupToolJob*) self)->excludes = vala_g_list_remove_full (((DejaDupToolJob*) self)->excludes, _tmp20_, _g_object_unref0_);
							}
							_g_object_unref0 (e);
						}
					}
				}
				_tmp21_ = i;
				_tmp22_ = g_file_get_path (_tmp21_);
				_tmp23_ = _tmp22_;
				_tmp24_ = g_strconcat ("--pattern=R", _tmp23_, NULL);
				*argv = g_list_append (*argv, _tmp24_);
				_g_free0 (_tmp23_);
				_tmp25_ = i;
				_tmp26_ = g_file_get_path (_tmp25_);
				_tmp27_ = _tmp26_;
				_tmp28_ = g_strconcat ("--pattern=+", _tmp27_, NULL);
				*argv = g_list_append (*argv, _tmp28_);
				_g_free0 (_tmp27_);
				(excludes2 == NULL) ? NULL : (excludes2 = (g_list_free (excludes2), NULL));
				_g_object_unref0 (i);
			}
		}
	}
	_tmp29_ = ((DejaDupToolJob*) self)->excludes;
	{
		GList* e_collection = NULL;
		GList* e_it = NULL;
		e_collection = _tmp29_;
		for (e_it = e_collection; e_it != NULL; e_it = e_it->next) {
			GFile* _tmp30_;
			GFile* e = NULL;
			_tmp30_ = _g_object_ref0 ((GFile*) e_it->data);
			e = _tmp30_;
			{
				GFile* _tmp31_;
				gchar* _tmp32_;
				gchar* _tmp33_;
				gchar* _tmp34_;
				_tmp31_ = e;
				_tmp32_ = g_file_get_path (_tmp31_);
				_tmp33_ = _tmp32_;
				_tmp34_ = g_strconcat ("--pattern=-", _tmp33_, NULL);
				*argv = g_list_append (*argv, _tmp34_);
				_g_free0 (_tmp33_);
				_g_object_unref0 (e);
			}
		}
	}
}

BorgBackupJoblet*
borg_backup_joblet_construct (GType object_type)
{
	BorgBackupJoblet * self = NULL;
	self = (BorgBackupJoblet*) borg_joblet_construct (object_type);
	return self;
}

BorgBackupJoblet*
borg_backup_joblet_new (void)
{
	return borg_backup_joblet_construct (TYPE_BORG_BACKUP_JOBLET);
}

static void
borg_backup_joblet_class_init (BorgBackupJobletClass * klass,
                               gpointer klass_data)
{
	borg_backup_joblet_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) borg_backup_joblet_real_prepare_args;
	((BorgJobletClass *) klass)->process_message = (gboolean (*) (BorgJoblet*, const gchar*, JsonReader*)) borg_backup_joblet_real_process_message;
}

static void
borg_backup_joblet_instance_init (BorgBackupJoblet * self,
                                  gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
borg_backup_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BorgBackupJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) borg_backup_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BorgBackupJoblet), 0, (GInstanceInitFunc) borg_backup_joblet_instance_init, NULL };
	GType borg_backup_joblet_type_id;
	borg_backup_joblet_type_id = g_type_register_static (TYPE_BORG_JOBLET, "BorgBackupJoblet", &g_define_type_info, 0);
	return borg_backup_joblet_type_id;
}

GType
borg_backup_joblet_get_type (void)
{
	static gsize borg_backup_joblet_type_id__once = 0;
	if (g_once_init_enter (&borg_backup_joblet_type_id__once)) {
		GType borg_backup_joblet_type_id;
		borg_backup_joblet_type_id = borg_backup_joblet_get_type_once ();
		g_once_init_leave (&borg_backup_joblet_type_id__once, borg_backup_joblet_type_id);
	}
	return borg_backup_joblet_type_id__once;
}

static void
borg_status_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                      GList** argv,
                                      GList** envp,
                                      GError** error)
{
	BorgStatusJoblet * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GError* _inner_error0_ = NULL;
	self = (BorgStatusJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (borg_status_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BORG_JOBLET, BorgJoblet), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = g_strdup ("list");
	*argv = g_list_append (*argv, _tmp0_);
	_tmp1_ = g_strdup ("--json");
	*argv = g_list_append (*argv, _tmp1_);
	_tmp3_ = borg_joblet_get_remote ((BorgJoblet*) self, TRUE, &_inner_error0_);
	_tmp2_ = _tmp3_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp4_ = _tmp2_;
	_tmp2_ = NULL;
	*argv = g_list_append (*argv, _tmp4_);
	_g_free0 (_tmp2_);
}

static gboolean
borg_status_joblet_real_process_message (BorgJoblet* base,
                                         const gchar* msgid,
                                         JsonReader* reader)
{
	BorgStatusJoblet * self;
	gboolean result;
	self = (BorgStatusJoblet*) base;
	g_return_val_if_fail (reader != NULL, FALSE);
	if (g_strcmp0 (msgid, "Repository.InvalidRepository") == 0) {
		deja_dup_tool_joblet_finish ((DejaDupToolJoblet*) self);
		result = TRUE;
		return result;
	}
	result = borg_status_joblet_process_status (self, reader);
	return result;
}

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

static gboolean
borg_status_joblet_process_status (BorgStatusJoblet* self,
                                   JsonReader* reader)
{
	GList* dates = NULL;
	GList* _tmp14_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (reader != NULL, FALSE);
	dates = NULL;
	json_reader_read_member (reader, "archives");
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				gchar* tag = NULL;
				const gchar* _tmp2_;
				gchar* _tmp3_;
				gchar* strtime = NULL;
				const gchar* _tmp4_;
				gchar* _tmp5_;
				GDateTime* time = NULL;
				const gchar* _tmp6_;
				GTimeZone* _tmp7_;
				GTimeZone* _tmp8_;
				GDateTime* _tmp9_;
				GDateTime* _tmp10_;
				GDateTime* _tmp11_;
				const gchar* _tmp12_;
				DejaDupSnapshotInfo* _tmp13_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				if (!(i < json_reader_count_elements (reader))) {
					break;
				}
				json_reader_read_element (reader, (guint) i);
				json_reader_read_member (reader, "archive");
				_tmp2_ = json_reader_get_string_value (reader);
				_tmp3_ = g_strdup (_tmp2_);
				tag = _tmp3_;
				json_reader_end_member (reader);
				json_reader_read_member (reader, "time");
				_tmp4_ = json_reader_get_string_value (reader);
				_tmp5_ = g_strdup (_tmp4_);
				strtime = _tmp5_;
				json_reader_end_member (reader);
				_tmp6_ = strtime;
				_tmp7_ = g_time_zone_new_utc ();
				_tmp8_ = _tmp7_;
				_tmp9_ = g_date_time_new_from_iso8601 (_tmp6_, _tmp8_);
				_tmp10_ = _tmp9_;
				_g_time_zone_unref0 (_tmp8_);
				time = _tmp10_;
				_tmp11_ = time;
				_tmp12_ = tag;
				_tmp13_ = deja_dup_snapshot_info_new (_tmp11_, _tmp12_);
				dates = g_list_prepend (dates, _tmp13_);
				json_reader_end_element (reader);
				_g_date_time_unref0 (time);
				_g_free0 (strtime);
				_g_free0 (tag);
			}
		}
	}
	_tmp14_ = dates;
	g_signal_emit_by_name ((DejaDupToolJob*) self, "collection-dates", _tmp14_);
	result = TRUE;
	(dates == NULL) ? NULL : (dates = (_g_list_free__g_object_unref0_ (dates), NULL));
	return result;
}

BorgStatusJoblet*
borg_status_joblet_construct (GType object_type)
{
	BorgStatusJoblet * self = NULL;
	self = (BorgStatusJoblet*) borg_joblet_construct (object_type);
	return self;
}

BorgStatusJoblet*
borg_status_joblet_new (void)
{
	return borg_status_joblet_construct (TYPE_BORG_STATUS_JOBLET);
}

static void
borg_status_joblet_class_init (BorgStatusJobletClass * klass,
                               gpointer klass_data)
{
	borg_status_joblet_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) borg_status_joblet_real_prepare_args;
	((BorgJobletClass *) klass)->process_message = (gboolean (*) (BorgJoblet*, const gchar*, JsonReader*)) borg_status_joblet_real_process_message;
}

static void
borg_status_joblet_instance_init (BorgStatusJoblet * self,
                                  gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
borg_status_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BorgStatusJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) borg_status_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BorgStatusJoblet), 0, (GInstanceInitFunc) borg_status_joblet_instance_init, NULL };
	GType borg_status_joblet_type_id;
	borg_status_joblet_type_id = g_type_register_static (TYPE_BORG_JOBLET, "BorgStatusJoblet", &g_define_type_info, 0);
	return borg_status_joblet_type_id;
}

GType
borg_status_joblet_get_type (void)
{
	static gsize borg_status_joblet_type_id__once = 0;
	if (g_once_init_enter (&borg_status_joblet_type_id__once)) {
		GType borg_status_joblet_type_id;
		borg_status_joblet_type_id = borg_status_joblet_get_type_once ();
		g_once_init_leave (&borg_status_joblet_type_id__once, borg_status_joblet_type_id);
	}
	return borg_status_joblet_type_id__once;
}

static void
borg_list_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                    GList** argv,
                                    GList** envp,
                                    GError** error)
{
	BorgListJoblet * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GError* _inner_error0_ = NULL;
	self = (BorgListJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (borg_list_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BORG_JOBLET, BorgJoblet), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = g_strdup ("list");
	*argv = g_list_append (*argv, _tmp0_);
	_tmp1_ = g_strdup ("--json-lines");
	*argv = g_list_append (*argv, _tmp1_);
	_tmp3_ = borg_joblet_get_remote ((BorgJoblet*) self, TRUE, &_inner_error0_);
	_tmp2_ = _tmp3_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp4_ = _tmp2_;
	_tmp2_ = NULL;
	*argv = g_list_append (*argv, _tmp4_);
	_g_free0 (_tmp2_);
}

static gboolean
borg_list_joblet_real_process_message (BorgJoblet* base,
                                       const gchar* msgid,
                                       JsonReader* reader)
{
	BorgListJoblet * self;
	gchar* path = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* borg_type = NULL;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	GFileType file_type = 0;
	const gchar* _tmp4_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gboolean result;
	self = (BorgListJoblet*) base;
	g_return_val_if_fail (reader != NULL, FALSE);
	json_reader_read_member (reader, "path");
	_tmp0_ = json_reader_get_string_value (reader);
	_tmp1_ = g_strdup (_tmp0_);
	path = _tmp1_;
	json_reader_end_member (reader);
	json_reader_read_member (reader, "type");
	_tmp2_ = json_reader_get_string_value (reader);
	_tmp3_ = g_strdup (_tmp2_);
	borg_type = _tmp3_;
	json_reader_end_member (reader);
	file_type = G_FILE_TYPE_UNKNOWN;
	_tmp4_ = borg_type;
	if (g_strcmp0 (_tmp4_, "-") == 0) {
		file_type = G_FILE_TYPE_REGULAR;
	} else {
		const gchar* _tmp5_;
		_tmp5_ = borg_type;
		if (g_strcmp0 (_tmp5_, "d") == 0) {
			file_type = G_FILE_TYPE_DIRECTORY;
		} else {
			const gchar* _tmp6_;
			_tmp6_ = borg_type;
			if (g_strcmp0 (_tmp6_, "s") == 0) {
				file_type = G_FILE_TYPE_SYMBOLIC_LINK;
			}
		}
	}
	_tmp7_ = path;
	_tmp8_ = g_strconcat ("/", _tmp7_, NULL);
	_tmp9_ = _tmp8_;
	g_signal_emit_by_name ((DejaDupToolJob*) self, "listed-current-files", _tmp9_, file_type);
	_g_free0 (_tmp9_);
	result = TRUE;
	_g_free0 (borg_type);
	_g_free0 (path);
	return result;
}

BorgListJoblet*
borg_list_joblet_construct (GType object_type)
{
	BorgListJoblet * self = NULL;
	self = (BorgListJoblet*) borg_joblet_construct (object_type);
	return self;
}

BorgListJoblet*
borg_list_joblet_new (void)
{
	return borg_list_joblet_construct (TYPE_BORG_LIST_JOBLET);
}

static void
borg_list_joblet_class_init (BorgListJobletClass * klass,
                             gpointer klass_data)
{
	borg_list_joblet_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) borg_list_joblet_real_prepare_args;
	((BorgJobletClass *) klass)->process_message = (gboolean (*) (BorgJoblet*, const gchar*, JsonReader*)) borg_list_joblet_real_process_message;
}

static void
borg_list_joblet_instance_init (BorgListJoblet * self,
                                gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
borg_list_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BorgListJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) borg_list_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BorgListJoblet), 0, (GInstanceInitFunc) borg_list_joblet_instance_init, NULL };
	GType borg_list_joblet_type_id;
	borg_list_joblet_type_id = g_type_register_static (TYPE_BORG_JOBLET, "BorgListJoblet", &g_define_type_info, 0);
	return borg_list_joblet_type_id;
}

GType
borg_list_joblet_get_type (void)
{
	static gsize borg_list_joblet_type_id__once = 0;
	if (g_once_init_enter (&borg_list_joblet_type_id__once)) {
		GType borg_list_joblet_type_id;
		borg_list_joblet_type_id = borg_list_joblet_get_type_once ();
		g_once_init_leave (&borg_list_joblet_type_id__once, borg_list_joblet_type_id);
	}
	return borg_list_joblet_type_id__once;
}

static inline gpointer
borg_restore_joblet_get_instance_private (BorgRestoreJoblet* self)
{
	return G_STRUCT_MEMBER_P (self, BorgRestoreJoblet_private_offset);
}

BorgRestoreJoblet*
borg_restore_joblet_construct (GType object_type,
                               GFile* restore_file)
{
	BorgRestoreJoblet * self = NULL;
	g_return_val_if_fail (restore_file != NULL, NULL);
	self = (BorgRestoreJoblet*) g_object_new (object_type, "restore-file", restore_file, NULL);
	return self;
}

BorgRestoreJoblet*
borg_restore_joblet_new (GFile* restore_file)
{
	return borg_restore_joblet_construct (TYPE_BORG_RESTORE_JOBLET, restore_file);
}

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

static void
borg_restore_joblet_real_prepare_args (DejaDupToolJoblet* base,
                                       GList** argv,
                                       GList** envp,
                                       GError** error)
{
	BorgRestoreJoblet * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* path = NULL;
	GFile* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gchar* _tmp8_;
	GFile* _tmp9_;
	GFile* _tmp10_;
	GFile* _tmp11_;
	GFile* _tmp12_;
	gboolean _tmp13_;
	gchar* _tmp19_ = NULL;
	gchar* _tmp20_;
	gchar* _tmp21_;
	const gchar* _tmp22_;
	gchar* _tmp23_;
	GFile* _tmp24_;
	GFile* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	GError* _inner_error0_ = NULL;
	self = (BorgRestoreJoblet*) base;
	DEJA_DUP_TOOL_JOBLET_CLASS (borg_restore_joblet_parent_class)->prepare_args ((DejaDupToolJoblet*) G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BORG_JOBLET, BorgJoblet), argv, envp, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp0_ = g_strdup ("extract");
	*argv = g_list_append (*argv, _tmp0_);
	_tmp1_ = g_strdup ("--list");
	*argv = g_list_append (*argv, _tmp1_);
	_tmp2_ = self->priv->_restore_file;
	_tmp3_ = g_file_get_path (_tmp2_);
	path = _tmp3_;
	_tmp4_ = path;
	_tmp5_ = path;
	_tmp6_ = strlen (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = string_slice (_tmp4_, (glong) 1, (glong) _tmp7_);
	_g_free0 (path);
	path = _tmp8_;
	_tmp9_ = deja_dup_tool_job_get_local ((DejaDupToolJob*) self);
	_tmp10_ = _tmp9_;
	_tmp11_ = g_file_get_parent (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = _tmp12_ != NULL;
	_g_object_unref0 (_tmp12_);
	if (_tmp13_) {
		gchar** parts = NULL;
		const gchar* _tmp14_;
		gchar** _tmp15_;
		gchar** _tmp16_;
		gint parts_length1;
		gint _parts_size_;
		gchar** _tmp17_;
		gint _tmp17__length1;
		gchar* _tmp18_;
		_tmp14_ = path;
		_tmp16_ = _tmp15_ = g_strsplit (_tmp14_, "/", 0);
		parts = _tmp16_;
		parts_length1 = _vala_array_length (_tmp15_);
		_parts_size_ = parts_length1;
		_tmp17_ = parts;
		_tmp17__length1 = parts_length1;
		_tmp18_ = g_strdup_printf ("--strip-components=%d", _tmp17__length1 - 1);
		*argv = g_list_append (*argv, _tmp18_);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp20_ = borg_joblet_get_remote ((BorgJoblet*) self, TRUE, &_inner_error0_);
	_tmp19_ = _tmp20_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (path);
		return;
	}
	_tmp21_ = _tmp19_;
	_tmp19_ = NULL;
	*argv = g_list_append (*argv, _tmp21_);
	_tmp22_ = path;
	_tmp23_ = g_strdup (_tmp22_);
	*argv = g_list_append (*argv, _tmp23_);
	_tmp24_ = deja_dup_tool_job_get_local ((DejaDupToolJob*) self);
	_tmp25_ = _tmp24_;
	_tmp26_ = g_file_get_path (_tmp25_);
	_tmp27_ = _tmp26_;
	g_chdir (_tmp27_);
	_g_free0 (_tmp27_);
	_g_free0 (_tmp19_);
	_g_free0 (path);
}

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

static void
borg_restore_joblet_set_restore_file (BorgRestoreJoblet* self,
                                      GFile* value)
{
	GFile* old_value;
	g_return_if_fail (self != NULL);
	old_value = borg_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, borg_restore_joblet_properties[BORG_RESTORE_JOBLET_RESTORE_FILE_PROPERTY]);
	}
}

static void
borg_restore_joblet_class_init (BorgRestoreJobletClass * klass,
                                gpointer klass_data)
{
	borg_restore_joblet_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BorgRestoreJoblet_private_offset);
	((DejaDupToolJobletClass *) klass)->prepare_args = (void (*) (DejaDupToolJoblet*, GList**, GList**, GError**)) borg_restore_joblet_real_prepare_args;
	G_OBJECT_CLASS (klass)->get_property = _vala_borg_restore_joblet_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_borg_restore_joblet_set_property;
	G_OBJECT_CLASS (klass)->finalize = borg_restore_joblet_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BORG_RESTORE_JOBLET_RESTORE_FILE_PROPERTY, borg_restore_joblet_properties[BORG_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));
}

static void
borg_restore_joblet_instance_init (BorgRestoreJoblet * self,
                                   gpointer klass)
{
	self->priv = borg_restore_joblet_get_instance_private (self);
}

static void
borg_restore_joblet_finalize (GObject * obj)
{
	BorgRestoreJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BORG_RESTORE_JOBLET, BorgRestoreJoblet);
	_g_object_unref0 (self->priv->_restore_file);
	G_OBJECT_CLASS (borg_restore_joblet_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
borg_restore_joblet_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BorgRestoreJobletClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) borg_restore_joblet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BorgRestoreJoblet), 0, (GInstanceInitFunc) borg_restore_joblet_instance_init, NULL };
	GType borg_restore_joblet_type_id;
	borg_restore_joblet_type_id = g_type_register_static (TYPE_BORG_JOBLET, "BorgRestoreJoblet", &g_define_type_info, 0);
	BorgRestoreJoblet_private_offset = g_type_add_instance_private (borg_restore_joblet_type_id, sizeof (BorgRestoreJobletPrivate));
	return borg_restore_joblet_type_id;
}

GType
borg_restore_joblet_get_type (void)
{
	static gsize borg_restore_joblet_type_id__once = 0;
	if (g_once_init_enter (&borg_restore_joblet_type_id__once)) {
		GType borg_restore_joblet_type_id;
		borg_restore_joblet_type_id = borg_restore_joblet_get_type_once ();
		g_once_init_leave (&borg_restore_joblet_type_id__once, borg_restore_joblet_type_id);
	}
	return borg_restore_joblet_type_id__once;
}

static void
_vala_borg_restore_joblet_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	BorgRestoreJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BORG_RESTORE_JOBLET, BorgRestoreJoblet);
	switch (property_id) {
		case BORG_RESTORE_JOBLET_RESTORE_FILE_PROPERTY:
		g_value_set_object (value, borg_restore_joblet_get_restore_file (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_borg_restore_joblet_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	BorgRestoreJoblet * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BORG_RESTORE_JOBLET, BorgRestoreJoblet);
	switch (property_id) {
		case BORG_RESTORE_JOBLET_RESTORE_FILE_PROPERTY:
		borg_restore_joblet_set_restore_file (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

static void
borg_job_real_start (DejaDupToolJob* base,
                     GAsyncReadyCallback _callback_,
                     gpointer _user_data_)
{
	BorgJob * self;
	BorgJobStartData* _data_;
	BorgJob* _tmp0_;
	self = (BorgJob*) base;
	_data_ = g_slice_new0 (BorgJobStartData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, borg_job_real_start_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	borg_job_real_start_co (_data_);
}

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

static void
borg_job_start_ready (GObject* source_object,
                      GAsyncResult* _res_,
                      gpointer _user_data_)
{
	BorgJobStartData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	borg_job_real_start_co (_data_);
}

static gboolean
borg_job_real_start_co (BorgJobStartData* _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_;
	switch (_data_->_tmp1_) {
		case DEJA_DUP_TOOL_JOB_MODE_BACKUP:
		{
			_data_->_tmp2_ = borg_backup_joblet_new ();
			_data_->_tmp3_ = _data_->_tmp2_;
			deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp3_);
			_g_object_unref0 (_data_->_tmp3_);
			break;
		}
		case DEJA_DUP_TOOL_JOB_MODE_RESTORE:
		{
			_data_->_tmp4_ = deja_dup_tool_job_get_restore_files ((DejaDupToolJob*) _data_->self);
			_data_->_tmp5_ = _data_->_tmp4_;
			{
				_data_->file_collection = _data_->_tmp5_;
				for (_data_->file_it = _data_->file_collection; _data_->file_it != NULL; _data_->file_it = _data_->file_it->next) {
					_data_->_tmp6_ = _g_object_ref0 ((GFile*) _data_->file_it->data);
					_data_->file = _data_->_tmp6_;
					{
						_data_->_tmp7_ = _data_->file;
						_data_->_tmp8_ = borg_restore_joblet_new (_data_->_tmp7_);
						_data_->_tmp9_ = _data_->_tmp8_;
						deja_dup_tool_job_chain_append_to_chain ((DejaDupToolJobChain*) _data_->self, (DejaDupToolJoblet*) _data_->_tmp9_);
						_g_object_unref0 (_data_->_tmp9_);
						_g_object_unref0 (_data_->file);
					}
				}
			}
			break;
		}
		case DEJA_DUP_TOOL_JOB_MODE_LIST_SNAPSHOTS:
		{
			_data_->_tmp10_ = borg_status_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_);
			break;
		}
		case DEJA_DUP_TOOL_JOB_MODE_LIST_FILES:
		{
			_data_->_tmp12_ = borg_list_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_);
			break;
		}
		default:
		{
			_data_->_tmp14_ = deja_dup_tool_job_get_mode ((DejaDupToolJob*) _data_->self);
			_data_->_tmp15_ = _data_->_tmp14_;
			g_warning ("BorgJob.vala:382: Unknown mode %d", (gint) _data_->_tmp15_);
			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 (borg_job_parent_class)->start ((DejaDupToolJob*) G_TYPE_CHECK_INSTANCE_CAST (_data_->self, DEJA_DUP_TYPE_TOOL_JOB_CHAIN, DejaDupToolJobChain), borg_job_start_ready, _data_);
	return FALSE;
	_state_1:
	DEJA_DUP_TOOL_JOB_CLASS (borg_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;
}

BorgJob*
borg_job_construct (GType object_type)
{
	BorgJob * self = NULL;
	self = (BorgJob*) deja_dup_tool_job_chain_construct (object_type);
	return self;
}

BorgJob*
borg_job_new (void)
{
	return borg_job_construct (TYPE_BORG_JOB);
}

static void
borg_job_class_init (BorgJobClass * klass,
                     gpointer klass_data)
{
	borg_job_parent_class = g_type_class_peek_parent (klass);
	((DejaDupToolJobClass *) klass)->start = (void (*) (DejaDupToolJob*, GAsyncReadyCallback, gpointer)) borg_job_real_start;
	((DejaDupToolJobClass *) klass)->start_finish = (void (*) (DejaDupToolJob*, GAsyncResult*)) borg_job_start_finish;
}

static void
borg_job_instance_init (BorgJob * self,
                        gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
borg_job_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BorgJobClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) borg_job_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BorgJob), 0, (GInstanceInitFunc) borg_job_instance_init, NULL };
	GType borg_job_type_id;
	borg_job_type_id = g_type_register_static (DEJA_DUP_TYPE_TOOL_JOB_CHAIN, "BorgJob", &g_define_type_info, 0);
	return borg_job_type_id;
}

GType
borg_job_get_type (void)
{
	static gsize borg_job_type_id__once = 0;
	if (g_once_init_enter (&borg_job_type_id__once)) {
		GType borg_job_type_id;
		borg_job_type_id = borg_job_get_type_once ();
		g_once_init_leave (&borg_job_type_id__once, borg_job_type_id);
	}
	return borg_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);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

