/* ConfigLabelBackupDate.c generated by valac 0.12.1, 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 <common.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <config.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;
	DejaDupSimpleSettings* 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;
	GtkBox* hbox;
	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;
};


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 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_date_name (DejaDupConfigLabelBackupDate* self, GDateTime* date);
DejaDupConfigLabelBackupDateKind deja_dup_config_label_backup_date_get_kind (DejaDupConfigLabelBackupDate* self);
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, DejaDupSimpleSettings* 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;
	self = (DejaDupConfigLabelBackupDate*) g_object_new (object_type, "kind", kind, 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 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;
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (one != NULL, FALSE);
	g_return_val_if_fail (two != NULL, FALSE);
	g_date_time_get_ymd (one, &_tmp0_, &_tmp1_, &_tmp2_);
	ny = _tmp0_;
	nm = _tmp1_;
	nd = _tmp2_;
	g_date_time_get_ymd (two, &_tmp3_, &_tmp4_, &_tmp5_);
	dy = _tmp3_;
	dm = _tmp4_;
	dd = _tmp5_;
	if (ny == dy) {
		_tmp7_ = nm == dm;
	} else {
		_tmp7_ = FALSE;
	}
	if (_tmp7_) {
		_tmp6_ = nd == dd;
	} else {
		_tmp6_ = FALSE;
	}
	result = _tmp6_;
	return result;
}


static gchar* deja_dup_config_label_backup_date_pretty_date_name (DejaDupConfigLabelBackupDate* self, GDateTime* date) {
	gchar* result = NULL;
	GDateTime* _tmp0_ = NULL;
	GDateTime* now;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp3_;
	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_;
	if (self->priv->_kind == DEJA_DUP_CONFIG_LABEL_BACKUP_DATE_KIND_NEXT) {
		gint _tmp2_;
		_tmp2_ = g_date_time_compare (now, date);
		_tmp1_ = _tmp2_ > 0;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		date = now;
	}
	_tmp3_ = deja_dup_config_label_backup_date_is_same_day (self, date, now);
	if (_tmp3_) {
		const gchar* _tmp4_ = NULL;
		gchar* _tmp5_;
		_tmp4_ = _ ("Today");
		_tmp5_ = g_strdup (_tmp4_);
		result = _tmp5_;
		_g_date_time_unref0 (now);
		return result;
	} else {
		GDateTime* _tmp6_ = NULL;
		GDateTime* _tmp7_;
		gboolean _tmp8_;
		gboolean _tmp9_;
		_tmp6_ = g_date_time_add_days (now, -1);
		_tmp7_ = _tmp6_;
		_tmp8_ = deja_dup_config_label_backup_date_is_same_day (self, date, _tmp7_);
		_tmp9_ = _tmp8_;
		_g_date_time_unref0 (_tmp7_);
		if (_tmp9_) {
			const gchar* _tmp10_ = NULL;
			gchar* _tmp11_;
			_tmp10_ = _ ("Yesterday");
			_tmp11_ = g_strdup (_tmp10_);
			result = _tmp11_;
			_g_date_time_unref0 (now);
			return result;
		} else {
			GDateTime* _tmp12_ = NULL;
			GDateTime* _tmp13_;
			gboolean _tmp14_;
			gboolean _tmp15_;
			_tmp12_ = g_date_time_add_days (now, 1);
			_tmp13_ = _tmp12_;
			_tmp14_ = deja_dup_config_label_backup_date_is_same_day (self, date, _tmp13_);
			_tmp15_ = _tmp14_;
			_g_date_time_unref0 (_tmp13_);
			if (_tmp15_) {
				const gchar* _tmp16_ = NULL;
				gchar* _tmp17_;
				_tmp16_ = _ ("Tomorrow");
				_tmp17_ = g_strdup (_tmp16_);
				result = _tmp17_;
				_g_date_time_unref0 (now);
				return result;
			} else {
				gint _tmp18_;
				_tmp18_ = g_date_time_compare (now, date);
				if (_tmp18_ < 0) {
					gint _tmp19_;
					gint _tmp20_;
					gint _tmp21_;
					GDateTime* _tmp22_ = NULL;
					GTimeSpan _tmp23_;
					GTimeSpan diff;
					const gchar* _tmp24_ = NULL;
					gchar* _tmp25_ = NULL;
					_tmp19_ = g_date_time_get_year (now);
					_tmp20_ = g_date_time_get_month (now);
					_tmp21_ = g_date_time_get_day_of_month (now);
					_tmp22_ = g_date_time_new_local (_tmp19_, _tmp20_, _tmp21_, 0, 0, 0.0);
					_g_date_time_unref0 (now);
					now = _tmp22_;
					_tmp23_ = g_date_time_difference (date, now);
					diff = _tmp23_ / G_TIME_SPAN_DAY;
					_tmp24_ = g_dngettext (GETTEXT_PACKAGE, "%d day from now", "%d days from now", (gulong) diff);
					_tmp25_ = g_strdup_printf (_tmp24_, diff);
					result = _tmp25_;
					_g_date_time_unref0 (now);
					return result;
				} else {
					gint _tmp26_;
					gint _tmp27_;
					gint _tmp28_;
					GDateTime* _tmp29_ = NULL;
					GTimeSpan _tmp30_;
					gint diff;
					const gchar* _tmp31_ = NULL;
					gchar* _tmp32_ = NULL;
					_tmp26_ = g_date_time_get_year (now);
					_tmp27_ = g_date_time_get_month (now);
					_tmp28_ = g_date_time_get_day_of_month (now);
					_tmp29_ = g_date_time_new_local (_tmp26_, _tmp27_, _tmp28_, 0, 0, 0.0);
					_g_date_time_unref0 (now);
					now = _tmp29_;
					_tmp30_ = g_date_time_difference (now, date);
					diff = (_tmp30_ / G_TIME_SPAN_DAY) + 1;
					_tmp31_ = g_dngettext (GETTEXT_PACKAGE, "%d day ago", "%d days ago", (gulong) diff);
					_tmp32_ = g_strdup_printf (_tmp31_, diff);
					result = _tmp32_;
					_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* _tmp0_ = NULL;
	gchar* val;
	GTimeVal time = {0};
	gboolean _tmp1_ = FALSE;
	g_return_if_fail (self != NULL);
	_tmp0_ = deja_dup_last_run_date (DEJA_DUP_TIMESTAMP_TYPE_BACKUP);
	val = _tmp0_;
	g_get_current_time (&time);
	if (g_strcmp0 (val, "") == 0) {
		_tmp1_ = TRUE;
	} else {
		gboolean _tmp2_;
		_tmp2_ = g_time_val_from_iso8601 (val, &time);
		_tmp1_ = !_tmp2_;
	}
	if (_tmp1_) {
		const gchar* _tmp3_ = NULL;
		_tmp3_ = _ ("None");
		gtk_label_set_label (((DejaDupConfigLabel*) self)->label, _tmp3_);
	} else {
		GDateTime* _tmp4_ = NULL;
		GDateTime* _tmp5_;
		gchar* _tmp6_ = NULL;
		gchar* _tmp7_;
		_tmp4_ = g_date_time_new_from_timeval_local (&time);
		_tmp5_ = _tmp4_;
		_tmp6_ = deja_dup_config_label_backup_date_pretty_date_name (self, _tmp5_);
		_tmp7_ = _tmp6_;
		gtk_label_set_label (((DejaDupConfigLabel*) self)->label, _tmp7_);
		_g_free0 (_tmp7_);
		_g_date_time_unref0 (_tmp5_);
	}
	_g_free0 (val);
}


void deja_dup_config_label_backup_date_set_from_config_next (DejaDupConfigLabelBackupDate* self) {
	GDateTime* _tmp0_ = NULL;
	GDateTime* next;
	g_return_if_fail (self != NULL);
	_tmp0_ = deja_dup_next_run_date ();
	next = _tmp0_;
	if (next != NULL) {
		gchar* _tmp1_ = NULL;
		gchar* _tmp2_;
		_tmp1_ = deja_dup_config_label_backup_date_pretty_date_name (self, next);
		_tmp2_ = _tmp1_;
		gtk_label_set_label (((DejaDupConfigLabel*) self)->label, _tmp2_);
		_g_free0 (_tmp2_);
	} else {
		const gchar* _tmp3_ = NULL;
		_tmp3_ = _ ("None");
		gtk_label_set_label (((DejaDupConfigLabel*) self)->label, _tmp3_);
	}
	_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_;
	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);
	_data_->self = _g_object_ref0 (self);
	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:
	if (data->self->priv->_kind == 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;
	g_return_val_if_fail (self != NULL, 0);
	result = self->priv->_kind;
	return result;
}


static void deja_dup_config_label_backup_date_set_kind (DejaDupConfigLabelBackupDate* self, DejaDupConfigLabelBackupDateKind value) {
	g_return_if_fail (self != NULL);
	self->priv->_kind = value;
	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;
	parent_class = G_OBJECT_CLASS (deja_dup_config_label_backup_date_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = DEJA_DUP_CONFIG_LABEL_BACKUP_DATE (obj);
	deja_dup_config_widget_watch_key ((DejaDupConfigWidget*) self, DEJA_DUP_LAST_BACKUP_KEY, NULL);
	if (self->priv->_kind == 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));
	DEJA_DUP_CONFIG_WIDGET_CLASS (klass)->set_from_config = deja_dup_config_label_backup_date_real_set_from_config;
	DEJA_DUP_CONFIG_WIDGET_CLASS (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 = DEJA_DUP_CONFIG_LABEL_BACKUP_DATE (obj);
	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 = DEJA_DUP_CONFIG_LABEL_BACKUP_DATE (object);
	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 = DEJA_DUP_CONFIG_LABEL_BACKUP_DATE (object);
	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;
	}
}



