/* OperationStatus.c generated by valac, the Vala compiler
 * generated from OperationStatus.vala, do not modify */

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*- */
/*
    This file is part of Déjà Dup.
    © 2008,2009 Michael Terry <mike@mterry.name>

    Déjà Dup is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Déjà Dup is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Déjà Dup.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>


#define DEJA_DUP_TYPE_OPERATION (deja_dup_operation_get_type ())
#define DEJA_DUP_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_OPERATION, DejaDupOperation))
#define DEJA_DUP_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_OPERATION, DejaDupOperationClass))
#define DEJA_DUP_IS_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_OPERATION))
#define DEJA_DUP_IS_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_OPERATION))
#define DEJA_DUP_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_OPERATION, DejaDupOperationClass))

typedef struct _DejaDupOperation DejaDupOperation;
typedef struct _DejaDupOperationClass DejaDupOperationClass;
typedef struct _DejaDupOperationPrivate DejaDupOperationPrivate;

#define DEJA_DUP_TYPE_DUPLICITY (deja_dup_duplicity_get_type ())
#define DEJA_DUP_DUPLICITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_DUPLICITY, DejaDupDuplicity))
#define DEJA_DUP_DUPLICITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_DUPLICITY, DejaDupDuplicityClass))
#define DEJA_DUP_IS_DUPLICITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_DUPLICITY))
#define DEJA_DUP_IS_DUPLICITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_DUPLICITY))
#define DEJA_DUP_DUPLICITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_DUPLICITY, DejaDupDuplicityClass))

typedef struct _DejaDupDuplicity DejaDupDuplicity;
typedef struct _DejaDupDuplicityClass DejaDupDuplicityClass;

#define DEJA_DUP_TYPE_OPERATION_STATUS (deja_dup_operation_status_get_type ())
#define DEJA_DUP_OPERATION_STATUS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_OPERATION_STATUS, DejaDupOperationStatus))
#define DEJA_DUP_OPERATION_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_OPERATION_STATUS, DejaDupOperationStatusClass))
#define DEJA_DUP_IS_OPERATION_STATUS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_OPERATION_STATUS))
#define DEJA_DUP_IS_OPERATION_STATUS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_OPERATION_STATUS))
#define DEJA_DUP_OPERATION_STATUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_OPERATION_STATUS, DejaDupOperationStatusClass))

typedef struct _DejaDupOperationStatus DejaDupOperationStatus;
typedef struct _DejaDupOperationStatusClass DejaDupOperationStatusClass;
typedef struct _DejaDupOperationStatusPrivate DejaDupOperationStatusPrivate;

#define DEJA_DUP_OPERATION_TYPE_MODE (deja_dup_operation_mode_get_type ())

struct _DejaDupOperation {
	GObject parent_instance;
	DejaDupOperationPrivate * priv;
	DejaDupDuplicity* dup;
	char* passphrase;
};

struct _DejaDupOperationClass {
	GObjectClass parent_class;
	void (*start) (DejaDupOperation* self, GError** error);
	void (*connect_to_dup) (DejaDupOperation* self);
	void (*operation_finished) (DejaDupOperation* self, DejaDupDuplicity* dup, gboolean success, gboolean cancelled);
	GList* (*make_argv) (DejaDupOperation* self, GError** error);
};

struct _DejaDupOperationStatus {
	DejaDupOperation parent_instance;
	DejaDupOperationStatusPrivate * priv;
};

struct _DejaDupOperationStatusClass {
	DejaDupOperationClass parent_class;
};

typedef enum  {
	DEJA_DUP_OPERATION_MODE_INVALID,
	DEJA_DUP_OPERATION_MODE_BACKUP,
	DEJA_DUP_OPERATION_MODE_RESTORE,
	DEJA_DUP_OPERATION_MODE_STATUS,
	DEJA_DUP_OPERATION_MODE_LIST
} DejaDupOperationMode;


static gpointer deja_dup_operation_status_parent_class = NULL;

GType deja_dup_operation_get_type (void);
GType deja_dup_duplicity_get_type (void);
GType deja_dup_operation_status_get_type (void);
enum  {
	DEJA_DUP_OPERATION_STATUS_DUMMY_PROPERTY
};
GType deja_dup_operation_mode_get_type (void);
DejaDupOperationStatus* deja_dup_operation_status_new (guint xid);
DejaDupOperationStatus* deja_dup_operation_status_construct (GType object_type, guint xid);
static void _lambda12_ (DejaDupDuplicity* d, GList* dates, DejaDupOperationStatus* self);
static void __lambda12__deja_dup_duplicity_collection_dates (DejaDupDuplicity* _sender, GList* dates, gpointer self);
void deja_dup_operation_connect_to_dup (DejaDupOperation* self);
static void deja_dup_operation_status_real_connect_to_dup (DejaDupOperation* base);



DejaDupOperationStatus* deja_dup_operation_status_construct (GType object_type, guint xid) {
	DejaDupOperationStatus * self;
	self = (DejaDupOperationStatus*) g_object_new (object_type, "xid", xid, "mode", DEJA_DUP_OPERATION_MODE_STATUS, NULL);
	return self;
}


DejaDupOperationStatus* deja_dup_operation_status_new (guint xid) {
	return deja_dup_operation_status_construct (DEJA_DUP_TYPE_OPERATION_STATUS, xid);
}


static void _lambda12_ (DejaDupDuplicity* d, GList* dates, DejaDupOperationStatus* self) {
	g_return_if_fail (d != NULL);
	g_signal_emit_by_name (self, "collection-dates", dates);
}


static void __lambda12__deja_dup_duplicity_collection_dates (DejaDupDuplicity* _sender, GList* dates, gpointer self) {
	_lambda12_ (_sender, dates, self);
}


static void deja_dup_operation_status_real_connect_to_dup (DejaDupOperation* base) {
	DejaDupOperationStatus * self;
	self = (DejaDupOperationStatus*) base;
	g_signal_connect_object (((DejaDupOperation*) self)->dup, "collection-dates", (GCallback) __lambda12__deja_dup_duplicity_collection_dates, self, 0);
	DEJA_DUP_OPERATION_CLASS (deja_dup_operation_status_parent_class)->connect_to_dup (DEJA_DUP_OPERATION (self));
}


static void deja_dup_operation_status_class_init (DejaDupOperationStatusClass * klass) {
	deja_dup_operation_status_parent_class = g_type_class_peek_parent (klass);
	DEJA_DUP_OPERATION_CLASS (klass)->connect_to_dup = deja_dup_operation_status_real_connect_to_dup;
	g_signal_new ("collection_dates", DEJA_DUP_TYPE_OPERATION_STATUS, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
}


static void deja_dup_operation_status_instance_init (DejaDupOperationStatus * self) {
}


GType deja_dup_operation_status_get_type (void) {
	static volatile gsize deja_dup_operation_status_type_id__volatile = 0;
	if (g_once_init_enter (&deja_dup_operation_status_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DejaDupOperationStatusClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) deja_dup_operation_status_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DejaDupOperationStatus), 0, (GInstanceInitFunc) deja_dup_operation_status_instance_init, NULL };
		GType deja_dup_operation_status_type_id;
		deja_dup_operation_status_type_id = g_type_register_static (DEJA_DUP_TYPE_OPERATION, "DejaDupOperationStatus", &g_define_type_info, 0);
		g_once_init_leave (&deja_dup_operation_status_type_id__volatile, deja_dup_operation_status_type_id);
	}
	return deja_dup_operation_status_type_id__volatile;
}




