/* ToolJobChain.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from ToolJobChain.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 <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.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_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;
typedef struct _DejaDupToolJobChainPrivate DejaDupToolJobChainPrivate;

#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;
enum  {
	DEJA_DUP_TOOL_JOB_CHAIN_0_PROPERTY,
	DEJA_DUP_TOOL_JOB_CHAIN_NUM_PROPERTIES
};
static GParamSpec* deja_dup_tool_job_chain_properties[DEJA_DUP_TOOL_JOB_CHAIN_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _DejaDupToolJobChainStartData DejaDupToolJobChainStartData;
typedef struct _DejaDupToolJobChainStartFirstData DejaDupToolJobChainStartFirstData;

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

struct _DejaDupToolJobChainClass {
	DejaDupToolJobClass parent_class;
};

struct _DejaDupToolJobChainPrivate {
	GList* chain;
	DejaDupToolJoblet* current;
};

struct _DejaDupToolJobChainStartData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DejaDupToolJobChain* self;
	GList* _tmp0_;
};

struct _DejaDupToolJobChainStartFirstData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DejaDupToolJobChain* self;
	GList* _tmp0_;
	gconstpointer _tmp1_;
	DejaDupToolJoblet* _tmp2_;
	GList* _tmp3_;
	DejaDupToolJoblet* _tmp4_;
	DejaDupToolJoblet* _tmp5_;
};

static gint DejaDupToolJobChain_private_offset;
static gpointer deja_dup_tool_job_chain_parent_class = NULL;

VALA_EXTERN GType deja_dup_tool_job_chain_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType deja_dup_tool_joblet_get_type (void) G_GNUC_CONST ;
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void deja_dup_tool_job_chain_real_start_data_free (gpointer _data);
static void deja_dup_tool_job_chain_real_start (DejaDupToolJob* base,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static gboolean deja_dup_tool_job_chain_real_start_co (DejaDupToolJobChainStartData* _data_);
static void deja_dup_tool_job_chain_start_first (DejaDupToolJobChain* self,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_);
static void deja_dup_tool_job_chain_start_first_finish (DejaDupToolJobChain* self,
                                                 GAsyncResult* _res_);
static void deja_dup_tool_job_chain_start_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
static void deja_dup_tool_job_chain_real_stop (DejaDupToolJob* base);
static void deja_dup_tool_job_chain_real_pause (DejaDupToolJob* base,
                                         const gchar* reason);
static void deja_dup_tool_job_chain_real_resume (DejaDupToolJob* base);
VALA_EXTERN void deja_dup_tool_job_chain_prepend_to_chain (DejaDupToolJobChain* self,
                                               DejaDupToolJoblet* joblet);
VALA_EXTERN void deja_dup_tool_job_chain_append_to_chain (DejaDupToolJobChain* self,
                                              DejaDupToolJoblet* joblet);
static void deja_dup_tool_job_chain_sync_property (DejaDupToolJobChain* self,
                                            DejaDupToolJob* job,
                                            const gchar* property);
static void deja_dup_tool_job_chain_sync_job (DejaDupToolJobChain* self,
                                       DejaDupToolJoblet* job);
static void deja_dup_tool_job_chain_handle_done (DejaDupToolJobChain* self,
                                          gboolean success,
                                          gboolean cancelled);
static void _deja_dup_tool_job_chain_handle_done_deja_dup_tool_job_done (DejaDupToolJob* _sender,
                                                                  gboolean success,
                                                                  gboolean cancelled,
                                                                  gpointer self);
static void __lambda19_ (DejaDupToolJobChain* self,
                  const gchar* e,
                  const gchar* d);
static void ___lambda19__deja_dup_tool_job_raise_error (DejaDupToolJob* _sender,
                                                 const gchar* errstr,
                                                 const gchar* detail,
                                                 gpointer self);
static void __lambda20_ (DejaDupToolJobChain* self,
                  const gchar* a);
static void ___lambda20__deja_dup_tool_job_action_desc_changed (DejaDupToolJob* _sender,
                                                         const gchar* action,
                                                         gpointer self);
static void __lambda21_ (DejaDupToolJobChain* self,
                  GFile* f,
                  gboolean a);
static void ___lambda21__deja_dup_tool_job_action_file_changed (DejaDupToolJob* _sender,
                                                         GFile* file,
                                                         gboolean actual,
                                                         gpointer self);
static void __lambda22_ (DejaDupToolJobChain* self,
                  const gchar* f);
static void ___lambda22__deja_dup_tool_job_local_file_error (DejaDupToolJob* _sender,
                                                      const gchar* file,
                                                      gpointer self);
static void __lambda23_ (DejaDupToolJobChain* self,
                  gdouble p);
static void ___lambda23__deja_dup_tool_job_progress (DejaDupToolJob* _sender,
                                              gdouble percent,
                                              gpointer self);
static void __lambda24_ (DejaDupToolJobChain* self,
                  gboolean f);
static void ___lambda24__deja_dup_tool_job_is_full (DejaDupToolJob* _sender,
                                             gboolean first,
                                             gpointer self);
static void __lambda25_ (DejaDupToolJobChain* self);
static void ___lambda25__deja_dup_tool_job_bad_encryption_password (DejaDupToolJob* _sender,
                                                             gpointer self);
static void __lambda26_ (DejaDupToolJobChain* self,
                  const gchar* s,
                  const gchar* h,
                  const gchar* d,
                  const gchar* a,
                  gboolean safe,
                  GVariant* state);
static void ___lambda26__deja_dup_tool_job_question (DejaDupToolJob* _sender,
                                              const gchar* summary,
                                              const gchar* header,
                                              const gchar* description,
                                              const gchar* action,
                                              gboolean safe,
                                              GVariant* state,
                                              gpointer self);
static void __lambda27_ (DejaDupToolJobChain* self,
                  GList* d);
static void ___lambda27__deja_dup_tool_job_collection_dates (DejaDupToolJob* _sender,
                                                      GList* infos,
                                                      gpointer self);
static void __lambda28_ (DejaDupToolJobChain* self,
                  const gchar* f,
                  GFileType t);
static void ___lambda28__deja_dup_tool_job_listed_current_files (DejaDupToolJob* _sender,
                                                          const gchar* file,
                                                          GFileType type,
                                                          gpointer self);
VALA_EXTERN void deja_dup_tool_joblet_set_chain (DejaDupToolJoblet* self,
                                     DejaDupToolJobChain* value);
static void deja_dup_tool_job_chain_clear_current (DejaDupToolJobChain* self);
static void deja_dup_tool_job_chain_start_first_data_free (gpointer _data);
static gboolean deja_dup_tool_job_chain_start_first_co (DejaDupToolJobChainStartFirstData* _data_);
static void deja_dup_tool_job_chain_start_first_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
VALA_EXTERN DejaDupToolJobChain* deja_dup_tool_job_chain_new (void);
VALA_EXTERN DejaDupToolJobChain* deja_dup_tool_job_chain_construct (GType object_type);
static void deja_dup_tool_job_chain_finalize (GObject * obj);
static GType deja_dup_tool_job_chain_get_type_once (void);

static inline gpointer
deja_dup_tool_job_chain_get_instance_private (DejaDupToolJobChain* self)
{
	return G_STRUCT_MEMBER_P (self, DejaDupToolJobChain_private_offset);
}

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

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

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

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

static void
deja_dup_tool_job_chain_real_start (DejaDupToolJob* base,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	DejaDupToolJobChain * self;
	DejaDupToolJobChainStartData* _data_;
	DejaDupToolJobChain* _tmp0_;
	self = (DejaDupToolJobChain*) base;
	_data_ = g_slice_new0 (DejaDupToolJobChainStartData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, deja_dup_tool_job_chain_real_start_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	deja_dup_tool_job_chain_real_start_co (_data_);
}

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

static void
deja_dup_tool_job_chain_start_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	DejaDupToolJobChainStartData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	deja_dup_tool_job_chain_real_start_co (_data_);
}

static gboolean
deja_dup_tool_job_chain_real_start_co (DejaDupToolJobChainStartData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->chain;
	if (_data_->_tmp0_ == NULL) {
		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_chain_start_first (_data_->self, deja_dup_tool_job_chain_start_ready, _data_);
	return FALSE;
	_state_1:
	deja_dup_tool_job_chain_start_first_finish (_data_->self, _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;
}

static void
deja_dup_tool_job_chain_real_stop (DejaDupToolJob* base)
{
	DejaDupToolJobChain * self;
	DejaDupToolJoblet* _tmp0_;
	self = (DejaDupToolJobChain*) base;
	(self->priv->chain == NULL) ? NULL : (self->priv->chain = (_g_list_free__g_object_unref0_ (self->priv->chain), NULL));
	self->priv->chain = NULL;
	_tmp0_ = self->priv->current;
	if (_tmp0_ != NULL) {
		DejaDupToolJoblet* _tmp1_;
		_tmp1_ = self->priv->current;
		deja_dup_tool_job_stop ((DejaDupToolJob*) _tmp1_);
	} else {
		g_signal_emit_by_name ((DejaDupToolJob*) self, "done", TRUE, TRUE);
	}
}

static void
deja_dup_tool_job_chain_real_pause (DejaDupToolJob* base,
                                    const gchar* reason)
{
	DejaDupToolJobChain * self;
	DejaDupToolJoblet* _tmp0_;
	self = (DejaDupToolJobChain*) base;
	_tmp0_ = self->priv->current;
	if (_tmp0_ != NULL) {
		DejaDupToolJoblet* _tmp1_;
		_tmp1_ = self->priv->current;
		deja_dup_tool_job_pause ((DejaDupToolJob*) _tmp1_, reason);
	}
}

static void
deja_dup_tool_job_chain_real_resume (DejaDupToolJob* base)
{
	DejaDupToolJobChain * self;
	DejaDupToolJoblet* _tmp0_;
	self = (DejaDupToolJobChain*) base;
	_tmp0_ = self->priv->current;
	if (_tmp0_ != NULL) {
		DejaDupToolJoblet* _tmp1_;
		_tmp1_ = self->priv->current;
		deja_dup_tool_job_resume ((DejaDupToolJob*) _tmp1_);
	}
}

void
deja_dup_tool_job_chain_prepend_to_chain (DejaDupToolJobChain* self,
                                          DejaDupToolJoblet* joblet)
{
	DejaDupToolJoblet* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (joblet != NULL);
	_tmp0_ = _g_object_ref0 (joblet);
	self->priv->chain = g_list_prepend (self->priv->chain, _tmp0_);
}

void
deja_dup_tool_job_chain_append_to_chain (DejaDupToolJobChain* self,
                                         DejaDupToolJoblet* joblet)
{
	DejaDupToolJoblet* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (joblet != NULL);
	_tmp0_ = _g_object_ref0 (joblet);
	self->priv->chain = g_list_append (self->priv->chain, _tmp0_);
}

static void
deja_dup_tool_job_chain_sync_property (DejaDupToolJobChain* self,
                                       DejaDupToolJob* job,
                                       const gchar* property)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	g_return_if_fail (property != NULL);
	g_object_bind_property_with_closures ((GObject*) self, property, (GObject*) job, property, G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
}

static void
_deja_dup_tool_job_chain_handle_done_deja_dup_tool_job_done (DejaDupToolJob* _sender,
                                                             gboolean success,
                                                             gboolean cancelled,
                                                             gpointer self)
{
	deja_dup_tool_job_chain_handle_done ((DejaDupToolJobChain*) self, success, cancelled);
}

static void
__lambda19_ (DejaDupToolJobChain* self,
             const gchar* e,
             const gchar* d)
{
	g_return_if_fail (e != NULL);
	g_signal_emit_by_name ((DejaDupToolJob*) self, "raise-error", e, d);
}

static void
___lambda19__deja_dup_tool_job_raise_error (DejaDupToolJob* _sender,
                                            const gchar* errstr,
                                            const gchar* detail,
                                            gpointer self)
{
	__lambda19_ ((DejaDupToolJobChain*) self, errstr, detail);
}

static void
__lambda20_ (DejaDupToolJobChain* self,
             const gchar* a)
{
	g_return_if_fail (a != NULL);
	g_signal_emit_by_name ((DejaDupToolJob*) self, "action-desc-changed", a);
}

static void
___lambda20__deja_dup_tool_job_action_desc_changed (DejaDupToolJob* _sender,
                                                    const gchar* action,
                                                    gpointer self)
{
	__lambda20_ ((DejaDupToolJobChain*) self, action);
}

static void
__lambda21_ (DejaDupToolJobChain* self,
             GFile* f,
             gboolean a)
{
	g_return_if_fail (f != NULL);
	g_signal_emit_by_name ((DejaDupToolJob*) self, "action-file-changed", f, a);
}

static void
___lambda21__deja_dup_tool_job_action_file_changed (DejaDupToolJob* _sender,
                                                    GFile* file,
                                                    gboolean actual,
                                                    gpointer self)
{
	__lambda21_ ((DejaDupToolJobChain*) self, file, actual);
}

static void
__lambda22_ (DejaDupToolJobChain* self,
             const gchar* f)
{
	g_return_if_fail (f != NULL);
	g_signal_emit_by_name ((DejaDupToolJob*) self, "local-file-error", f);
}

static void
___lambda22__deja_dup_tool_job_local_file_error (DejaDupToolJob* _sender,
                                                 const gchar* file,
                                                 gpointer self)
{
	__lambda22_ ((DejaDupToolJobChain*) self, file);
}

static void
__lambda23_ (DejaDupToolJobChain* self,
             gdouble p)
{
	g_signal_emit_by_name ((DejaDupToolJob*) self, "progress", p);
}

static void
___lambda23__deja_dup_tool_job_progress (DejaDupToolJob* _sender,
                                         gdouble percent,
                                         gpointer self)
{
	__lambda23_ ((DejaDupToolJobChain*) self, percent);
}

static void
__lambda24_ (DejaDupToolJobChain* self,
             gboolean f)
{
	g_signal_emit_by_name ((DejaDupToolJob*) self, "is-full", f);
}

static void
___lambda24__deja_dup_tool_job_is_full (DejaDupToolJob* _sender,
                                        gboolean first,
                                        gpointer self)
{
	__lambda24_ ((DejaDupToolJobChain*) self, first);
}

static void
__lambda25_ (DejaDupToolJobChain* self)
{
	g_signal_emit_by_name ((DejaDupToolJob*) self, "bad-encryption-password");
}

static void
___lambda25__deja_dup_tool_job_bad_encryption_password (DejaDupToolJob* _sender,
                                                        gpointer self)
{
	__lambda25_ ((DejaDupToolJobChain*) self);
}

static void
__lambda26_ (DejaDupToolJobChain* self,
             const gchar* s,
             const gchar* h,
             const gchar* d,
             const gchar* a,
             gboolean safe,
             GVariant* state)
{
	g_return_if_fail (s != NULL);
	g_signal_emit_by_name ((DejaDupToolJob*) self, "question", s, h, d, a, safe, state);
}

static void
___lambda26__deja_dup_tool_job_question (DejaDupToolJob* _sender,
                                         const gchar* summary,
                                         const gchar* header,
                                         const gchar* description,
                                         const gchar* action,
                                         gboolean safe,
                                         GVariant* state,
                                         gpointer self)
{
	__lambda26_ ((DejaDupToolJobChain*) self, summary, header, description, action, safe, state);
}

static void
__lambda27_ (DejaDupToolJobChain* self,
             GList* d)
{
	g_signal_emit_by_name ((DejaDupToolJob*) self, "collection-dates", d);
}

static void
___lambda27__deja_dup_tool_job_collection_dates (DejaDupToolJob* _sender,
                                                 GList* infos,
                                                 gpointer self)
{
	__lambda27_ ((DejaDupToolJobChain*) self, infos);
}

static void
__lambda28_ (DejaDupToolJobChain* self,
             const gchar* f,
             GFileType t)
{
	g_return_if_fail (f != NULL);
	g_signal_emit_by_name ((DejaDupToolJob*) self, "listed-current-files", f, t);
}

static void
___lambda28__deja_dup_tool_job_listed_current_files (DejaDupToolJob* _sender,
                                                     const gchar* file,
                                                     GFileType type,
                                                     gpointer self)
{
	__lambda28_ ((DejaDupToolJobChain*) self, file, type);
}

static void
deja_dup_tool_job_chain_sync_job (DejaDupToolJobChain* self,
                                  DejaDupToolJoblet* job)
{
	GList* _tmp0_;
	GList* _tmp1_;
	GList* _tmp2_;
	GList* _tmp3_;
	GList* _tmp4_;
	GList* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (job != NULL);
	g_signal_connect_object ((DejaDupToolJob*) job, "done", (GCallback) _deja_dup_tool_job_chain_handle_done_deja_dup_tool_job_done, self, 0);
	g_signal_connect_object ((DejaDupToolJob*) job, "raise-error", (GCallback) ___lambda19__deja_dup_tool_job_raise_error, self, 0);
	g_signal_connect_object ((DejaDupToolJob*) job, "action-desc-changed", (GCallback) ___lambda20__deja_dup_tool_job_action_desc_changed, self, 0);
	g_signal_connect_object ((DejaDupToolJob*) job, "action-file-changed", (GCallback) ___lambda21__deja_dup_tool_job_action_file_changed, self, 0);
	g_signal_connect_object ((DejaDupToolJob*) job, "local-file-error", (GCallback) ___lambda22__deja_dup_tool_job_local_file_error, self, 0);
	g_signal_connect_object ((DejaDupToolJob*) job, "progress", (GCallback) ___lambda23__deja_dup_tool_job_progress, self, 0);
	g_signal_connect_object ((DejaDupToolJob*) job, "is-full", (GCallback) ___lambda24__deja_dup_tool_job_is_full, self, 0);
	g_signal_connect_object ((DejaDupToolJob*) job, "bad-encryption-password", (GCallback) ___lambda25__deja_dup_tool_job_bad_encryption_password, self, 0);
	g_signal_connect_object ((DejaDupToolJob*) job, "question", (GCallback) ___lambda26__deja_dup_tool_job_question, self, 0);
	g_signal_connect_object ((DejaDupToolJob*) job, "collection-dates", (GCallback) ___lambda27__deja_dup_tool_job_collection_dates, self, 0);
	g_signal_connect_object ((DejaDupToolJob*) job, "listed-current-files", (GCallback) ___lambda28__deja_dup_tool_job_listed_current_files, self, 0);
	deja_dup_tool_job_chain_sync_property (self, (DejaDupToolJob*) job, "mode");
	deja_dup_tool_job_chain_sync_property (self, (DejaDupToolJob*) job, "flags");
	deja_dup_tool_job_chain_sync_property (self, (DejaDupToolJob*) job, "local");
	deja_dup_tool_job_chain_sync_property (self, (DejaDupToolJob*) job, "backend");
	deja_dup_tool_job_chain_sync_property (self, (DejaDupToolJob*) job, "encrypt-password");
	deja_dup_tool_job_chain_sync_property (self, (DejaDupToolJob*) job, "tag");
	deja_dup_tool_job_chain_sync_property (self, (DejaDupToolJob*) job, "restore-files");
	deja_dup_tool_job_chain_sync_property (self, (DejaDupToolJob*) job, "tree");
	deja_dup_tool_job_chain_sync_property (self, (DejaDupToolJob*) job, "question-state");
	_tmp0_ = ((DejaDupToolJob*) self)->includes;
	_tmp1_ = g_list_copy_deep (_tmp0_, (GCopyFunc) g_object_ref, NULL);
	(((DejaDupToolJob*) job)->includes == NULL) ? NULL : (((DejaDupToolJob*) job)->includes = (_g_list_free__g_object_unref0_ (((DejaDupToolJob*) job)->includes), NULL));
	((DejaDupToolJob*) job)->includes = _tmp1_;
	_tmp2_ = ((DejaDupToolJob*) self)->excludes;
	_tmp3_ = g_list_copy_deep (_tmp2_, (GCopyFunc) g_object_ref, NULL);
	(((DejaDupToolJob*) job)->excludes == NULL) ? NULL : (((DejaDupToolJob*) job)->excludes = (_g_list_free__g_object_unref0_ (((DejaDupToolJob*) job)->excludes), NULL));
	((DejaDupToolJob*) job)->excludes = _tmp3_;
	_tmp4_ = ((DejaDupToolJob*) self)->exclude_regexps;
	_tmp5_ = g_list_copy_deep (_tmp4_, (GCopyFunc) g_object_ref, NULL);
	(((DejaDupToolJob*) job)->exclude_regexps == NULL) ? NULL : (((DejaDupToolJob*) job)->exclude_regexps = (_g_list_free__g_object_unref0_ (((DejaDupToolJob*) job)->exclude_regexps), NULL));
	((DejaDupToolJob*) job)->exclude_regexps = _tmp5_;
	deja_dup_tool_joblet_set_chain (job, self);
}

static void
deja_dup_tool_job_chain_clear_current (DejaDupToolJobChain* self)
{
	DejaDupToolJoblet* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->current;
	if (_tmp0_ != NULL) {
		DejaDupToolJoblet* _tmp1_;
		_tmp1_ = self->priv->current;
		deja_dup_tool_joblet_set_chain (_tmp1_, NULL);
	}
	_g_object_unref0 (self->priv->current);
	self->priv->current = NULL;
}

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

static void
deja_dup_tool_job_chain_start_first (DejaDupToolJobChain* self,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	DejaDupToolJobChainStartFirstData* _data_;
	DejaDupToolJobChain* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (DejaDupToolJobChainStartFirstData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, deja_dup_tool_job_chain_start_first_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	deja_dup_tool_job_chain_start_first_co (_data_);
}

static void
deja_dup_tool_job_chain_start_first_finish (DejaDupToolJobChain* self,
                                            GAsyncResult* _res_)
{
	DejaDupToolJobChainStartFirstData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
deja_dup_tool_job_chain_start_first_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	DejaDupToolJobChainStartFirstData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	deja_dup_tool_job_chain_start_first_co (_data_);
}

static gboolean
deja_dup_tool_job_chain_start_first_co (DejaDupToolJobChainStartFirstData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->chain;
	_data_->_tmp1_ = _data_->_tmp0_->data;
	_data_->_tmp2_ = _g_object_ref0 ((DejaDupToolJoblet*) _data_->_tmp1_);
	_g_object_unref0 (_data_->self->priv->current);
	_data_->self->priv->current = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->self->priv->chain;
	_data_->self->priv->chain = g_list_remove_link (_data_->self->priv->chain, _data_->_tmp3_);
	_data_->_tmp4_ = _data_->self->priv->current;
	deja_dup_tool_job_chain_sync_job (_data_->self, _data_->_tmp4_);
	_data_->_tmp5_ = _data_->self->priv->current;
	_data_->_state_ = 1;
	deja_dup_tool_job_start ((DejaDupToolJob*) _data_->_tmp5_, deja_dup_tool_job_chain_start_first_ready, _data_);
	return FALSE;
	_state_1:
	deja_dup_tool_job_start_finish ((DejaDupToolJob*) _data_->_tmp5_, _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;
}

static void
deja_dup_tool_job_chain_handle_done (DejaDupToolJobChain* self,
                                     gboolean success,
                                     gboolean cancelled)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	g_return_if_fail (self != NULL);
	deja_dup_tool_job_chain_clear_current (self);
	if (success) {
		_tmp1_ = !cancelled;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		GList* _tmp2_;
		_tmp2_ = self->priv->chain;
		_tmp0_ = _tmp2_ != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		deja_dup_tool_job_chain_start_first (self, NULL, NULL);
		return;
	}
	g_signal_emit_by_name ((DejaDupToolJob*) self, "done", success, cancelled);
}

DejaDupToolJobChain*
deja_dup_tool_job_chain_construct (GType object_type)
{
	DejaDupToolJobChain * self = NULL;
	self = (DejaDupToolJobChain*) deja_dup_tool_job_construct (object_type);
	return self;
}

DejaDupToolJobChain*
deja_dup_tool_job_chain_new (void)
{
	return deja_dup_tool_job_chain_construct (DEJA_DUP_TYPE_TOOL_JOB_CHAIN);
}

static void
deja_dup_tool_job_chain_class_init (DejaDupToolJobChainClass * klass,
                                    gpointer klass_data)
{
	deja_dup_tool_job_chain_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DejaDupToolJobChain_private_offset);
	((DejaDupToolJobClass *) klass)->start = (void (*) (DejaDupToolJob*, GAsyncReadyCallback, gpointer)) deja_dup_tool_job_chain_real_start;
	((DejaDupToolJobClass *) klass)->start_finish = (void (*) (DejaDupToolJob*, GAsyncResult*)) deja_dup_tool_job_chain_start_finish;
	((DejaDupToolJobClass *) klass)->stop = (void (*) (DejaDupToolJob*)) deja_dup_tool_job_chain_real_stop;
	((DejaDupToolJobClass *) klass)->pause = (void (*) (DejaDupToolJob*, const gchar*)) deja_dup_tool_job_chain_real_pause;
	((DejaDupToolJobClass *) klass)->resume = (void (*) (DejaDupToolJob*)) deja_dup_tool_job_chain_real_resume;
	G_OBJECT_CLASS (klass)->finalize = deja_dup_tool_job_chain_finalize;
}

static void
deja_dup_tool_job_chain_instance_init (DejaDupToolJobChain * self,
                                       gpointer klass)
{
	self->priv = deja_dup_tool_job_chain_get_instance_private (self);
}

static void
deja_dup_tool_job_chain_finalize (GObject * obj)
{
	DejaDupToolJobChain * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DEJA_DUP_TYPE_TOOL_JOB_CHAIN, DejaDupToolJobChain);
	(self->priv->chain == NULL) ? NULL : (self->priv->chain = (_g_list_free__g_object_unref0_ (self->priv->chain), NULL));
	_g_object_unref0 (self->priv->current);
	G_OBJECT_CLASS (deja_dup_tool_job_chain_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
deja_dup_tool_job_chain_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DejaDupToolJobChainClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) deja_dup_tool_job_chain_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DejaDupToolJobChain), 0, (GInstanceInitFunc) deja_dup_tool_job_chain_instance_init, NULL };
	GType deja_dup_tool_job_chain_type_id;
	deja_dup_tool_job_chain_type_id = g_type_register_static (DEJA_DUP_TYPE_TOOL_JOB, "DejaDupToolJobChain", &g_define_type_info, 0);
	DejaDupToolJobChain_private_offset = g_type_add_instance_private (deja_dup_tool_job_chain_type_id, sizeof (DejaDupToolJobChainPrivate));
	return deja_dup_tool_job_chain_type_id;
}

GType
deja_dup_tool_job_chain_get_type (void)
{
	static gsize deja_dup_tool_job_chain_type_id__once = 0;
	if (g_once_init_enter (&deja_dup_tool_job_chain_type_id__once)) {
		GType deja_dup_tool_job_chain_type_id;
		deja_dup_tool_job_chain_type_id = deja_dup_tool_job_chain_get_type_once ();
		g_once_init_leave (&deja_dup_tool_job_chain_type_id__once, deja_dup_tool_job_chain_type_id);
	}
	return deja_dup_tool_job_chain_type_id__once;
}

