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

/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*- */
/*
    This file is part of Déjà Dup.
    For copyright information, see AUTHORS.

    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 <gtk/gtk.h>
#include <gio/gio.h>
#include "deja.h"
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>


#define DEJA_DUP_TYPE_CONFIG_WIDGET (deja_dup_config_widget_get_type ())
#define DEJA_DUP_CONFIG_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_CONFIG_WIDGET, DejaDupConfigWidget))
#define DEJA_DUP_CONFIG_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_CONFIG_WIDGET, DejaDupConfigWidgetClass))
#define DEJA_DUP_IS_CONFIG_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_CONFIG_WIDGET))
#define DEJA_DUP_IS_CONFIG_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_CONFIG_WIDGET))
#define DEJA_DUP_CONFIG_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_CONFIG_WIDGET, DejaDupConfigWidgetClass))

typedef struct _DejaDupConfigWidget DejaDupConfigWidget;
typedef struct _DejaDupConfigWidgetClass DejaDupConfigWidgetClass;
typedef struct _DejaDupConfigWidgetPrivate DejaDupConfigWidgetPrivate;

#define DEJA_DUP_TYPE_CONFIG_LABEL (deja_dup_config_label_get_type ())
#define DEJA_DUP_CONFIG_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_CONFIG_LABEL, DejaDupConfigLabel))
#define DEJA_DUP_CONFIG_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_CONFIG_LABEL, DejaDupConfigLabelClass))
#define DEJA_DUP_IS_CONFIG_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_CONFIG_LABEL))
#define DEJA_DUP_IS_CONFIG_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_CONFIG_LABEL))
#define DEJA_DUP_CONFIG_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_CONFIG_LABEL, DejaDupConfigLabelClass))

typedef struct _DejaDupConfigLabel DejaDupConfigLabel;
typedef struct _DejaDupConfigLabelClass DejaDupConfigLabelClass;
typedef struct _DejaDupConfigLabelPrivate DejaDupConfigLabelPrivate;

#define DEJA_DUP_TYPE_CONFIG_LABEL_BACKUP_DATE (deja_dup_config_label_backup_date_get_type ())
#define DEJA_DUP_CONFIG_LABEL_BACKUP_DATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEJA_DUP_TYPE_CONFIG_LABEL_BACKUP_DATE, DejaDupConfigLabelBackupDate))
#define DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEJA_DUP_TYPE_CONFIG_LABEL_BACKUP_DATE, DejaDupConfigLabelBackupDateClass))
#define DEJA_DUP_IS_CONFIG_LABEL_BACKUP_DATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEJA_DUP_TYPE_CONFIG_LABEL_BACKUP_DATE))
#define DEJA_DUP_IS_CONFIG_LABEL_BACKUP_DATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEJA_DUP_TYPE_CONFIG_LABEL_BACKUP_DATE))
#define DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEJA_DUP_TYPE_CONFIG_LABEL_BACKUP_DATE, DejaDupConfigLabelBackupDateClass))

typedef struct _DejaDupConfigLabelBackupDate DejaDupConfigLabelBackupDate;
typedef struct _DejaDupConfigLabelBackupDateClass DejaDupConfigLabelBackupDateClass;
typedef struct _DejaDupConfigLabelBackupDatePrivate DejaDupConfigLabelBackupDatePrivate;

#define DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_TYPE_KIND (deja_dup_config_label_backup_date_kind_get_type ())
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _DejaDupConfigLabelBackupDateSetFromConfigData DejaDupConfigLabelBackupDateSetFromConfigData;

struct _DejaDupConfigWidget {
	GtkEventBox parent_instance;
	DejaDupConfigWidgetPrivate * priv;
	gboolean syncing;
	DejaDupFilteredSettings* settings;
	GList* all_settings;
};

struct _DejaDupConfigWidgetClass {
	GtkEventBoxClass parent_class;
	void (*set_from_config) (DejaDupConfigWidget* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*set_from_config_finish) (DejaDupConfigWidget* self, GAsyncResult* _res_);
};

struct _DejaDupConfigLabel {
	DejaDupConfigWidget parent_instance;
	DejaDupConfigLabelPrivate * priv;
	GtkGrid* box;
	GtkLabel* label;
};

struct _DejaDupConfigLabelClass {
	DejaDupConfigWidgetClass parent_class;
	void (*fill_box) (DejaDupConfigLabel* self);
};

struct _DejaDupConfigLabelBackupDate {
	DejaDupConfigLabel parent_instance;
	DejaDupConfigLabelBackupDatePrivate * priv;
};

struct _DejaDupConfigLabelBackupDateClass {
	DejaDupConfigLabelClass parent_class;
};

typedef enum  {
	DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND_LAST,
	DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND_NEXT
} DejaDupConfigLabelBackupDateKind;

struct _DejaDupConfigLabelBackupDatePrivate {
	DejaDupConfigLabelBackupDateKind _kind;
};

struct _DejaDupConfigLabelBackupDateSetFromConfigData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	DejaDupConfigLabelBackupDate* self;
	DejaDupConfigLabelBackupDateKind _tmp0_;
};


static gpointer deja_dup_config_label_backup_date_parent_class = NULL;

GType deja_dup_config_widget_get_type (void) G_GNUC_CONST;
GType deja_dup_config_label_get_type (void) G_GNUC_CONST;
GType deja_dup_config_label_backup_date_get_type (void) G_GNUC_CONST;
GType deja_dup_config_label_backup_date_kind_get_type (void) G_GNUC_CONST;
#define DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DEJA_DUP_TYPE_CONFIG_LABEL_BACKUP_DATE, DejaDupConfigLabelBackupDatePrivate))
enum  {
	DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_DUMMY_PROPERTY,
	DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND
};
DejaDupConfigLabelBackupDate* deja_dup_config_label_backup_date_new (DejaDupConfigLabelBackupDateKind kind);
DejaDupConfigLabelBackupDate* deja_dup_config_label_backup_date_construct (GType object_type, DejaDupConfigLabelBackupDateKind kind);
static void deja_dup_config_label_backup_date_real_fill_box (DejaDupConfigLabel* base);
void deja_dup_config_label_fill_box (DejaDupConfigLabel* self);
static gboolean deja_dup_config_label_backup_date_is_same_day (DejaDupConfigLabelBackupDate* self, GDateTime* one, GDateTime* two);
static gchar* deja_dup_config_label_backup_date_pretty_next_name (DejaDupConfigLabelBackupDate* self, GDateTime* date);
DejaDupConfigLabelBackupDateKind deja_dup_config_label_backup_date_get_kind (DejaDupConfigLabelBackupDate* self);
static gchar* deja_dup_config_label_backup_date_pretty_last_name (DejaDupConfigLabelBackupDate* self, GDateTime* date);
void deja_dup_config_label_backup_date_set_from_config_last (DejaDupConfigLabelBackupDate* self);
void deja_dup_config_label_backup_date_set_from_config_next (DejaDupConfigLabelBackupDate* self);
static void deja_dup_config_label_backup_date_real_set_from_config_data_free (gpointer _data);
static void deja_dup_config_label_backup_date_real_set_from_config (DejaDupConfigWidget* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean deja_dup_config_label_backup_date_real_set_from_config_co (DejaDupConfigLabelBackupDateSetFromConfigData* _data_);
static void deja_dup_config_label_backup_date_set_kind (DejaDupConfigLabelBackupDate* self, DejaDupConfigLabelBackupDateKind value);
static GObject * deja_dup_config_label_backup_date_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
void deja_dup_config_widget_watch_key (DejaDupConfigWidget* self, const gchar* key, DejaDupFilteredSettings* s);
static void deja_dup_config_label_backup_date_finalize (GObject* obj);
static void _vala_deja_dup_config_label_backup_date_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_deja_dup_config_label_backup_date_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


GType deja_dup_config_label_backup_date_kind_get_type (void) {
	static volatile gsize deja_dup_config_label_backup_date_kind_type_id__volatile = 0;
	if (g_once_init_enter (&deja_dup_config_label_backup_date_kind_type_id__volatile)) {
		static const GEnumValue values[] = {{DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND_LAST, "DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND_LAST", "last"}, {DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND_NEXT, "DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND_NEXT", "next"}, {0, NULL, NULL}};
		GType deja_dup_config_label_backup_date_kind_type_id;
		deja_dup_config_label_backup_date_kind_type_id = g_enum_register_static ("DejaDupConfigLabelBackupDateKind", values);
		g_once_init_leave (&deja_dup_config_label_backup_date_kind_type_id__volatile, deja_dup_config_label_backup_date_kind_type_id);
	}
	return deja_dup_config_label_backup_date_kind_type_id__volatile;
}


DejaDupConfigLabelBackupDate* deja_dup_config_label_backup_date_construct (GType object_type, DejaDupConfigLabelBackupDateKind kind) {
	DejaDupConfigLabelBackupDate * self = NULL;
	DejaDupConfigLabelBackupDateKind _tmp0_ = 0;
	_tmp0_ = kind;
	self = (DejaDupConfigLabelBackupDate*) g_object_new (object_type, "kind", _tmp0_, NULL);
	return self;
}


DejaDupConfigLabelBackupDate* deja_dup_config_label_backup_date_new (DejaDupConfigLabelBackupDateKind kind) {
	return deja_dup_config_label_backup_date_construct (DEJA_DUP_TYPE_CONFIG_LABEL_BACKUP_DATE, kind);
}


static void deja_dup_config_label_backup_date_real_fill_box (DejaDupConfigLabel* base) {
	DejaDupConfigLabelBackupDate * self;
	GtkLabel* _tmp0_ = NULL;
	self = (DejaDupConfigLabelBackupDate*) base;
	DEJA_DUP_CONFIG_LABEL_CLASS (deja_dup_config_label_backup_date_parent_class)->fill_box (G_TYPE_CHECK_INSTANCE_CAST (self, DEJA_DUP_TYPE_CONFIG_LABEL, DejaDupConfigLabel));
	_tmp0_ = ((DejaDupConfigLabel*) self)->label;
	gtk_label_set_use_markup (_tmp0_, TRUE);
}


static gboolean deja_dup_config_label_backup_date_is_same_day (DejaDupConfigLabelBackupDate* self, GDateTime* one, GDateTime* two) {
	gboolean result = FALSE;
	gint ny = 0;
	gint nm = 0;
	gint nd = 0;
	gint dy = 0;
	gint dm = 0;
	gint dd = 0;
	GDateTime* _tmp0_ = NULL;
	gint _tmp1_ = 0;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	GDateTime* _tmp4_ = NULL;
	gint _tmp5_ = 0;
	gint _tmp6_ = 0;
	gint _tmp7_ = 0;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	gint _tmp10_ = 0;
	gint _tmp11_ = 0;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (one != NULL, FALSE);
	g_return_val_if_fail (two != NULL, FALSE);
	_tmp0_ = one;
	g_date_time_get_ymd (_tmp0_, &_tmp1_, &_tmp2_, &_tmp3_);
	ny = _tmp1_;
	nm = _tmp2_;
	nd = _tmp3_;
	_tmp4_ = two;
	g_date_time_get_ymd (_tmp4_, &_tmp5_, &_tmp6_, &_tmp7_);
	dy = _tmp5_;
	dm = _tmp6_;
	dd = _tmp7_;
	_tmp10_ = ny;
	_tmp11_ = dy;
	if (_tmp10_ == _tmp11_) {
		gint _tmp12_ = 0;
		gint _tmp13_ = 0;
		_tmp12_ = nm;
		_tmp13_ = dm;
		_tmp9_ = _tmp12_ == _tmp13_;
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		gint _tmp14_ = 0;
		gint _tmp15_ = 0;
		_tmp14_ = nd;
		_tmp15_ = dd;
		_tmp8_ = _tmp14_ == _tmp15_;
	} else {
		_tmp8_ = FALSE;
	}
	result = _tmp8_;
	return result;
}


static gchar* deja_dup_config_label_backup_date_pretty_next_name (DejaDupConfigLabelBackupDate* self, GDateTime* date) {
	gchar* result = NULL;
	GDateTime* now = NULL;
	GDateTime* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	DejaDupConfigLabelBackupDateKind _tmp2_ = 0;
	GDateTime* _tmp7_ = NULL;
	GDateTime* _tmp8_ = NULL;
	gboolean _tmp9_ = FALSE;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (date != NULL, NULL);
	_tmp0_ = g_date_time_new_now_local ();
	now = _tmp0_;
	_tmp2_ = self->priv->_kind;
	if (_tmp2_ == DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND_NEXT) {
		GDateTime* _tmp3_ = NULL;
		GDateTime* _tmp4_ = NULL;
		gint _tmp5_ = 0;
		_tmp3_ = now;
		_tmp4_ = date;
		_tmp5_ = g_date_time_compare (_tmp3_, _tmp4_);
		_tmp1_ = _tmp5_ > 0;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		GDateTime* _tmp6_ = NULL;
		_tmp6_ = now;
		date = _tmp6_;
	}
	_tmp7_ = date;
	_tmp8_ = now;
	_tmp9_ = deja_dup_config_label_backup_date_is_same_day (self, _tmp7_, _tmp8_);
	if (_tmp9_) {
		const gchar* _tmp10_ = NULL;
		gchar* _tmp11_ = NULL;
		_tmp10_ = _ ("Next backup is today.");
		_tmp11_ = g_strdup (_tmp10_);
		result = _tmp11_;
		_g_date_time_unref0 (now);
		return result;
	} else {
		GDateTime* _tmp12_ = NULL;
		GDateTime* _tmp13_ = NULL;
		GDateTime* _tmp14_ = NULL;
		GDateTime* _tmp15_ = NULL;
		gboolean _tmp16_ = FALSE;
		gboolean _tmp17_ = FALSE;
		_tmp12_ = date;
		_tmp13_ = now;
		_tmp14_ = g_date_time_add_days (_tmp13_, 1);
		_tmp15_ = _tmp14_;
		_tmp16_ = deja_dup_config_label_backup_date_is_same_day (self, _tmp12_, _tmp15_);
		_tmp17_ = _tmp16_;
		_g_date_time_unref0 (_tmp15_);
		if (_tmp17_) {
			const gchar* _tmp18_ = NULL;
			gchar* _tmp19_ = NULL;
			_tmp18_ = _ ("Next backup is tomorrow.");
			_tmp19_ = g_strdup (_tmp18_);
			result = _tmp19_;
			_g_date_time_unref0 (now);
			return result;
		} else {
			GDateTime* _tmp20_ = NULL;
			gint _tmp21_ = 0;
			GDateTime* _tmp22_ = NULL;
			gint _tmp23_ = 0;
			GDateTime* _tmp24_ = NULL;
			gint _tmp25_ = 0;
			GDateTime* _tmp26_ = NULL;
			gint diff = 0;
			GDateTime* _tmp27_ = NULL;
			GDateTime* _tmp28_ = NULL;
			GTimeSpan _tmp29_ = 0LL;
			gint _tmp30_ = 0;
			const gchar* _tmp31_ = NULL;
			gint _tmp32_ = 0;
			gchar* _tmp33_ = NULL;
			_tmp20_ = now;
			_tmp21_ = g_date_time_get_year (_tmp20_);
			_tmp22_ = now;
			_tmp23_ = g_date_time_get_month (_tmp22_);
			_tmp24_ = now;
			_tmp25_ = g_date_time_get_day_of_month (_tmp24_);
			_tmp26_ = g_date_time_new_local (_tmp21_, _tmp23_, _tmp25_, 0, 0, 0.0);
			_g_date_time_unref0 (now);
			now = _tmp26_;
			_tmp27_ = date;
			_tmp28_ = now;
			_tmp29_ = g_date_time_difference (_tmp27_, _tmp28_);
			diff = (gint) (_tmp29_ / G_TIME_SPAN_DAY);
			_tmp30_ = diff;
			_tmp31_ = g_dngettext (GETTEXT_PACKAGE, "Next backup is %d day from now.", "Next backup is %d days from now.", (gulong) _tmp30_);
			_tmp32_ = diff;
			_tmp33_ = g_strdup_printf (_tmp31_, _tmp32_);
			result = _tmp33_;
			_g_date_time_unref0 (now);
			return result;
		}
	}
	_g_date_time_unref0 (now);
}


static gchar* deja_dup_config_label_backup_date_pretty_last_name (DejaDupConfigLabelBackupDate* self, GDateTime* date) {
	gchar* result = NULL;
	GDateTime* now = NULL;
	GDateTime* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	DejaDupConfigLabelBackupDateKind _tmp2_ = 0;
	GDateTime* _tmp7_ = NULL;
	GDateTime* _tmp8_ = NULL;
	gboolean _tmp9_ = FALSE;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (date != NULL, NULL);
	_tmp0_ = g_date_time_new_now_local ();
	now = _tmp0_;
	_tmp2_ = self->priv->_kind;
	if (_tmp2_ == DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND_LAST) {
		GDateTime* _tmp3_ = NULL;
		GDateTime* _tmp4_ = NULL;
		gint _tmp5_ = 0;
		_tmp3_ = now;
		_tmp4_ = date;
		_tmp5_ = g_date_time_compare (_tmp3_, _tmp4_);
		_tmp1_ = _tmp5_ < 0;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		GDateTime* _tmp6_ = NULL;
		_tmp6_ = now;
		date = _tmp6_;
	}
	_tmp7_ = date;
	_tmp8_ = now;
	_tmp9_ = deja_dup_config_label_backup_date_is_same_day (self, _tmp7_, _tmp8_);
	if (_tmp9_) {
		const gchar* _tmp10_ = NULL;
		gchar* _tmp11_ = NULL;
		_tmp10_ = _ ("Last backup was today.");
		_tmp11_ = g_strdup (_tmp10_);
		result = _tmp11_;
		_g_date_time_unref0 (now);
		return result;
	} else {
		GDateTime* _tmp12_ = NULL;
		GDateTime* _tmp13_ = NULL;
		GDateTime* _tmp14_ = NULL;
		GDateTime* _tmp15_ = NULL;
		gboolean _tmp16_ = FALSE;
		gboolean _tmp17_ = FALSE;
		_tmp12_ = date;
		_tmp13_ = now;
		_tmp14_ = g_date_time_add_days (_tmp13_, -1);
		_tmp15_ = _tmp14_;
		_tmp16_ = deja_dup_config_label_backup_date_is_same_day (self, _tmp12_, _tmp15_);
		_tmp17_ = _tmp16_;
		_g_date_time_unref0 (_tmp15_);
		if (_tmp17_) {
			const gchar* _tmp18_ = NULL;
			gchar* _tmp19_ = NULL;
			_tmp18_ = _ ("Last backup was yesterday.");
			_tmp19_ = g_strdup (_tmp18_);
			result = _tmp19_;
			_g_date_time_unref0 (now);
			return result;
		} else {
			GDateTime* _tmp20_ = NULL;
			gint _tmp21_ = 0;
			GDateTime* _tmp22_ = NULL;
			gint _tmp23_ = 0;
			GDateTime* _tmp24_ = NULL;
			gint _tmp25_ = 0;
			GDateTime* _tmp26_ = NULL;
			gint diff = 0;
			GDateTime* _tmp27_ = NULL;
			GDateTime* _tmp28_ = NULL;
			GTimeSpan _tmp29_ = 0LL;
			gint _tmp30_ = 0;
			const gchar* _tmp31_ = NULL;
			gint _tmp32_ = 0;
			gchar* _tmp33_ = NULL;
			_tmp20_ = now;
			_tmp21_ = g_date_time_get_year (_tmp20_);
			_tmp22_ = now;
			_tmp23_ = g_date_time_get_month (_tmp22_);
			_tmp24_ = now;
			_tmp25_ = g_date_time_get_day_of_month (_tmp24_);
			_tmp26_ = g_date_time_new_local (_tmp21_, _tmp23_, _tmp25_, 0, 0, 0.0);
			_g_date_time_unref0 (now);
			now = _tmp26_;
			_tmp27_ = now;
			_tmp28_ = date;
			_tmp29_ = g_date_time_difference (_tmp27_, _tmp28_);
			diff = (gint) ((_tmp29_ / G_TIME_SPAN_DAY) + 1);
			_tmp30_ = diff;
			_tmp31_ = g_dngettext (GETTEXT_PACKAGE, "Last backup was %d day ago.", "Last backup was %d days ago.", (gulong) _tmp30_);
			_tmp32_ = diff;
			_tmp33_ = g_strdup_printf (_tmp31_, _tmp32_);
			result = _tmp33_;
			_g_date_time_unref0 (now);
			return result;
		}
	}
	_g_date_time_unref0 (now);
}


void deja_dup_config_label_backup_date_set_from_config_last (DejaDupConfigLabelBackupDate* self) {
	gchar* val = NULL;
	gchar* _tmp0_ = NULL;
	GTimeVal time = {0};
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = deja_dup_last_run_date (DEJA_DUP_TIMESTAMP_TYPE_BACKUP);
	val = _tmp0_;
	g_get_current_time (&time);
	_tmp2_ = val;
	if (g_strcmp0 (_tmp2_, "") == 0) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp3_ = NULL;
		gboolean _tmp4_ = FALSE;
		_tmp3_ = val;
		_tmp4_ = g_time_val_from_iso8601 (_tmp3_, &time);
		_tmp1_ = !_tmp4_;
	}
	if (_tmp1_) {
		GtkLabel* _tmp5_ = NULL;
		const gchar* _tmp6_ = NULL;
		gchar* _tmp7_ = NULL;
		gchar* _tmp8_ = NULL;
		_tmp5_ = ((DejaDupConfigLabel*) self)->label;
		_tmp6_ = _ ("No recent backups.");
		_tmp7_ = g_strdup_printf ("<b>%s</b>", _tmp6_);
		_tmp8_ = _tmp7_;
		gtk_label_set_label (_tmp5_, _tmp8_);
		_g_free0 (_tmp8_);
	} else {
		GtkLabel* _tmp9_ = NULL;
		GTimeVal _tmp10_ = {0};
		GDateTime* _tmp11_ = NULL;
		GDateTime* _tmp12_ = NULL;
		gchar* _tmp13_ = NULL;
		gchar* _tmp14_ = NULL;
		gchar* _tmp15_ = NULL;
		gchar* _tmp16_ = NULL;
		_tmp9_ = ((DejaDupConfigLabel*) self)->label;
		_tmp10_ = time;
		_tmp11_ = g_date_time_new_from_timeval_local (&_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = deja_dup_config_label_backup_date_pretty_last_name (self, _tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = g_strdup_printf ("<b>%s</b>", _tmp14_);
		_tmp16_ = _tmp15_;
		gtk_label_set_label (_tmp9_, _tmp16_);
		_g_free0 (_tmp16_);
		_g_free0 (_tmp14_);
		_g_date_time_unref0 (_tmp12_);
	}
	_g_free0 (val);
}


void deja_dup_config_label_backup_date_set_from_config_next (DejaDupConfigLabelBackupDate* self) {
	GDateTime* next = NULL;
	GDateTime* _tmp0_ = NULL;
	GDateTime* _tmp1_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = deja_dup_next_run_date ();
	next = _tmp0_;
	_tmp1_ = next;
	if (_tmp1_ == NULL) {
		GtkLabel* _tmp2_ = NULL;
		const gchar* _tmp3_ = NULL;
		gchar* _tmp4_ = NULL;
		gchar* _tmp5_ = NULL;
		_tmp2_ = ((DejaDupConfigLabel*) self)->label;
		_tmp3_ = _ ("No backup scheduled.");
		_tmp4_ = g_strdup_printf ("<b>%s</b>", _tmp3_);
		_tmp5_ = _tmp4_;
		gtk_label_set_label (_tmp2_, _tmp5_);
		_g_free0 (_tmp5_);
	} else {
		GtkLabel* _tmp6_ = NULL;
		GDateTime* _tmp7_ = NULL;
		gchar* _tmp8_ = NULL;
		gchar* _tmp9_ = NULL;
		gchar* _tmp10_ = NULL;
		gchar* _tmp11_ = NULL;
		_tmp6_ = ((DejaDupConfigLabel*) self)->label;
		_tmp7_ = next;
		_tmp8_ = deja_dup_config_label_backup_date_pretty_next_name (self, _tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = g_strdup_printf ("<b>%s</b>", _tmp9_);
		_tmp11_ = _tmp10_;
		gtk_label_set_label (_tmp6_, _tmp11_);
		_g_free0 (_tmp11_);
		_g_free0 (_tmp9_);
	}
	_g_date_time_unref0 (next);
}


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


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


static void deja_dup_config_label_backup_date_real_set_from_config (DejaDupConfigWidget* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	DejaDupConfigLabelBackupDate * self;
	DejaDupConfigLabelBackupDateSetFromConfigData* _data_;
	DejaDupConfigLabelBackupDate* _tmp0_ = NULL;
	self = (DejaDupConfigLabelBackupDate*) base;
	_data_ = g_slice_new0 (DejaDupConfigLabelBackupDateSetFromConfigData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, deja_dup_config_label_backup_date_real_set_from_config);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, deja_dup_config_label_backup_date_real_set_from_config_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	deja_dup_config_label_backup_date_real_set_from_config_co (_data_);
}


static void deja_dup_config_label_backup_date_real_set_from_config_finish (DejaDupConfigWidget* base, GAsyncResult* _res_) {
	DejaDupConfigLabelBackupDateSetFromConfigData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static gboolean deja_dup_config_label_backup_date_real_set_from_config_co (DejaDupConfigLabelBackupDateSetFromConfigData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = 0;
	_data_->_tmp0_ = _data_->self->priv->_kind;
	if (_data_->_tmp0_ == DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND_LAST) {
		deja_dup_config_label_backup_date_set_from_config_last (_data_->self);
	} else {
		deja_dup_config_label_backup_date_set_from_config_next (_data_->self);
	}
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


DejaDupConfigLabelBackupDateKind deja_dup_config_label_backup_date_get_kind (DejaDupConfigLabelBackupDate* self) {
	DejaDupConfigLabelBackupDateKind result;
	DejaDupConfigLabelBackupDateKind _tmp0_ = 0;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->priv->_kind;
	result = _tmp0_;
	return result;
}


static void deja_dup_config_label_backup_date_set_kind (DejaDupConfigLabelBackupDate* self, DejaDupConfigLabelBackupDateKind value) {
	DejaDupConfigLabelBackupDateKind _tmp0_ = 0;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	self->priv->_kind = _tmp0_;
	g_object_notify ((GObject *) self, "kind");
}


static GObject * deja_dup_config_label_backup_date_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	DejaDupConfigLabelBackupDate * self;
	DejaDupConfigLabelBackupDateKind _tmp0_ = 0;
	parent_class = G_OBJECT_CLASS (deja_dup_config_label_backup_date_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DEJA_DUP_TYPE_CONFIG_LABEL_BACKUP_DATE, DejaDupConfigLabelBackupDate);
	deja_dup_config_widget_watch_key ((DejaDupConfigWidget*) self, DEJA_DUP_LAST_BACKUP_KEY, NULL);
	_tmp0_ = self->priv->_kind;
	if (_tmp0_ == DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND_NEXT) {
		deja_dup_config_widget_watch_key ((DejaDupConfigWidget*) self, DEJA_DUP_PERIODIC_KEY, NULL);
		deja_dup_config_widget_watch_key ((DejaDupConfigWidget*) self, DEJA_DUP_PERIODIC_PERIOD_KEY, NULL);
	}
	return obj;
}


static void deja_dup_config_label_backup_date_class_init (DejaDupConfigLabelBackupDateClass * klass) {
	deja_dup_config_label_backup_date_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (DejaDupConfigLabelBackupDatePrivate));
	((DejaDupConfigLabelClass *) klass)->fill_box = deja_dup_config_label_backup_date_real_fill_box;
	((DejaDupConfigWidgetClass *) klass)->set_from_config = deja_dup_config_label_backup_date_real_set_from_config;
	((DejaDupConfigWidgetClass *) klass)->set_from_config_finish = deja_dup_config_label_backup_date_real_set_from_config_finish;
	G_OBJECT_CLASS (klass)->get_property = _vala_deja_dup_config_label_backup_date_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_deja_dup_config_label_backup_date_set_property;
	G_OBJECT_CLASS (klass)->constructor = deja_dup_config_label_backup_date_constructor;
	G_OBJECT_CLASS (klass)->finalize = deja_dup_config_label_backup_date_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND, g_param_spec_enum ("kind", "kind", "kind", DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_TYPE_KIND, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}


static void deja_dup_config_label_backup_date_instance_init (DejaDupConfigLabelBackupDate * self) {
	self->priv = DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_GET_PRIVATE (self);
}


static void deja_dup_config_label_backup_date_finalize (GObject* obj) {
	DejaDupConfigLabelBackupDate * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DEJA_DUP_TYPE_CONFIG_LABEL_BACKUP_DATE, DejaDupConfigLabelBackupDate);
	G_OBJECT_CLASS (deja_dup_config_label_backup_date_parent_class)->finalize (obj);
}


GType deja_dup_config_label_backup_date_get_type (void) {
	static volatile gsize deja_dup_config_label_backup_date_type_id__volatile = 0;
	if (g_once_init_enter (&deja_dup_config_label_backup_date_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (DejaDupConfigLabelBackupDateClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) deja_dup_config_label_backup_date_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DejaDupConfigLabelBackupDate), 0, (GInstanceInitFunc) deja_dup_config_label_backup_date_instance_init, NULL };
		GType deja_dup_config_label_backup_date_type_id;
		deja_dup_config_label_backup_date_type_id = g_type_register_static (DEJA_DUP_TYPE_CONFIG_LABEL, "DejaDupConfigLabelBackupDate", &g_define_type_info, 0);
		g_once_init_leave (&deja_dup_config_label_backup_date_type_id__volatile, deja_dup_config_label_backup_date_type_id);
	}
	return deja_dup_config_label_backup_date_type_id__volatile;
}


static void _vala_deja_dup_config_label_backup_date_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	DejaDupConfigLabelBackupDate * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DEJA_DUP_TYPE_CONFIG_LABEL_BACKUP_DATE, DejaDupConfigLabelBackupDate);
	switch (property_id) {
		case DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND:
		g_value_set_enum (value, deja_dup_config_label_backup_date_get_kind (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_deja_dup_config_label_backup_date_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	DejaDupConfigLabelBackupDate * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DEJA_DUP_TYPE_CONFIG_LABEL_BACKUP_DATE, DejaDupConfigLabelBackupDate);
	switch (property_id) {
		case DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND:
		deja_dup_config_label_backup_date_set_kind (self, g_value_get_enum (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



