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

/*
 * Copyright © 2023 Alain M. (https://github.com/alainm23/planify)
 *
 * This program 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.
 *
 * This program 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 this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 *
 * Authored by: Alain M. <alainmh23@gmail.com>
 */

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include "planify.h"
#include <gio/gio.h>
#include <json-glib/json-glib.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define OBJECTS_TYPE_BACKUP (objects_backup_get_type ())
#define OBJECTS_BACKUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OBJECTS_TYPE_BACKUP, ObjectsBackup))
#define OBJECTS_BACKUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OBJECTS_TYPE_BACKUP, ObjectsBackupClass))
#define OBJECTS_IS_BACKUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OBJECTS_TYPE_BACKUP))
#define OBJECTS_IS_BACKUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OBJECTS_TYPE_BACKUP))
#define OBJECTS_BACKUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OBJECTS_TYPE_BACKUP, ObjectsBackupClass))

typedef struct _ObjectsBackup ObjectsBackup;
typedef struct _ObjectsBackupClass ObjectsBackupClass;
typedef struct _ObjectsBackupPrivate ObjectsBackupPrivate;
enum  {
	OBJECTS_BACKUP_0_PROPERTY,
	OBJECTS_BACKUP_VERSION_PROPERTY,
	OBJECTS_BACKUP_DATE_PROPERTY,
	OBJECTS_BACKUP_LOCAL_INBOX_PROJECT_ID_PROPERTY,
	OBJECTS_BACKUP_PROJECTS_PROPERTY,
	OBJECTS_BACKUP_SECTIONS_PROPERTY,
	OBJECTS_BACKUP_ITEMS_PROPERTY,
	OBJECTS_BACKUP_LABELS_PROPERTY,
	OBJECTS_BACKUP_SOURCES_PROPERTY,
	OBJECTS_BACKUP_PATH_PROPERTY,
	OBJECTS_BACKUP_ERROR_PROPERTY,
	OBJECTS_BACKUP_DATETIME_PROPERTY,
	OBJECTS_BACKUP_TITLE_PROPERTY,
	OBJECTS_BACKUP_NUM_PROPERTIES
};
static GParamSpec* objects_backup_properties[OBJECTS_BACKUP_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _json_object_unref0(var) ((var == NULL) ? NULL : (var = (json_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_time_zone_unref0(var) ((var == NULL) ? NULL : (var = (g_time_zone_unref (var), NULL)))
enum  {
	OBJECTS_BACKUP_DELETED_SIGNAL,
	OBJECTS_BACKUP_NUM_SIGNALS
};
static guint objects_backup_signals[OBJECTS_BACKUP_NUM_SIGNALS] = {0};

struct _ObjectsBackup {
	GObject parent_instance;
	ObjectsBackupPrivate * priv;
};

struct _ObjectsBackupClass {
	GObjectClass parent_class;
};

struct _ObjectsBackupPrivate {
	gchar* _version;
	gchar* _date;
	gchar* _local_inbox_project_id;
	GeeArrayList* _projects;
	GeeArrayList* _sections;
	GeeArrayList* _items;
	GeeArrayList* _labels;
	GeeArrayList* _sources;
	gchar* _path;
	gchar* _error;
	GDateTime* _datetime;
	gchar* _title;
};

static gint ObjectsBackup_private_offset;
static gpointer objects_backup_parent_class = NULL;

VALA_EXTERN GType objects_backup_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ObjectsBackup, g_object_unref)
VALA_EXTERN ObjectsBackup* objects_backup_new_from_file (GFile* file);
VALA_EXTERN ObjectsBackup* objects_backup_construct_from_file (GType object_type,
                                                   GFile* file);
VALA_EXTERN void objects_backup_set_path (ObjectsBackup* self,
                              const gchar* value);
VALA_EXTERN void objects_backup_set_version (ObjectsBackup* self,
                                 const gchar* value);
VALA_EXTERN void objects_backup_set_date (ObjectsBackup* self,
                              const gchar* value);
VALA_EXTERN void objects_backup_set_local_inbox_project_id (ObjectsBackup* self,
                                                const gchar* value);
VALA_EXTERN GeeArrayList* objects_backup_get_sources (ObjectsBackup* self);
VALA_EXTERN GeeArrayList* objects_backup_get_labels (ObjectsBackup* self);
VALA_EXTERN GeeArrayList* objects_backup_get_projects (ObjectsBackup* self);
VALA_EXTERN const gchar* objects_backup_get_version (ObjectsBackup* self);
VALA_EXTERN GeeArrayList* objects_backup_get_sections (ObjectsBackup* self);
VALA_EXTERN GeeArrayList* objects_backup_get_items (ObjectsBackup* self);
VALA_EXTERN void objects_backup_set_error (ObjectsBackup* self,
                               const gchar* value);
VALA_EXTERN gboolean objects_backup_valid (ObjectsBackup* self);
VALA_EXTERN const gchar* objects_backup_get_error (ObjectsBackup* self);
VALA_EXTERN const gchar* objects_backup_get_date (ObjectsBackup* self);
VALA_EXTERN ObjectsBackup* objects_backup_new (void);
VALA_EXTERN ObjectsBackup* objects_backup_construct (GType object_type);
VALA_EXTERN const gchar* objects_backup_get_local_inbox_project_id (ObjectsBackup* self);
VALA_EXTERN void objects_backup_set_projects (ObjectsBackup* self,
                                  GeeArrayList* value);
VALA_EXTERN void objects_backup_set_sections (ObjectsBackup* self,
                                  GeeArrayList* value);
VALA_EXTERN void objects_backup_set_items (ObjectsBackup* self,
                               GeeArrayList* value);
VALA_EXTERN void objects_backup_set_labels (ObjectsBackup* self,
                                GeeArrayList* value);
VALA_EXTERN void objects_backup_set_sources (ObjectsBackup* self,
                                 GeeArrayList* value);
VALA_EXTERN const gchar* objects_backup_get_path (ObjectsBackup* self);
VALA_EXTERN GDateTime* objects_backup_get_datetime (ObjectsBackup* self);
VALA_EXTERN const gchar* objects_backup_get_title (ObjectsBackup* self);
static void objects_backup_finalize (GObject * obj);
static GType objects_backup_get_type_once (void);
static void _vala_objects_backup_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec);
static void _vala_objects_backup_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec);

static inline gpointer
objects_backup_get_instance_private (ObjectsBackup* self)
{
	return G_STRUCT_MEMBER_P (self, ObjectsBackup_private_offset);
}

static gchar*
g_date_time_to_string (GDateTime* self)
{
	gchar* _tmp0_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_date_time_format (self, "%FT%H:%M:%S%z");
	result = _tmp0_;
	return result;
}

static gpointer
_json_object_ref0 (gpointer self)
{
	return self ? json_object_ref (self) : NULL;
}

ObjectsBackup*
objects_backup_construct_from_file (GType object_type,
                                    GFile* file)
{
	ObjectsBackup * self = NULL;
	JsonParser* parser = NULL;
	JsonParser* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (file != NULL, NULL);
	self = (ObjectsBackup*) g_object_new (object_type, NULL);
	_tmp0_ = json_parser_new ();
	parser = _tmp0_;
	{
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		JsonObject* node = NULL;
		JsonNode* _tmp5_;
		JsonObject* _tmp6_;
		JsonObject* _tmp7_;
		JsonObject* _tmp8_;
		const gchar* _tmp9_;
		JsonObject* _tmp10_;
		const gchar* _tmp11_;
		JsonObject* settings = NULL;
		JsonObject* _tmp12_;
		JsonObject* _tmp13_;
		JsonObject* _tmp14_;
		JsonObject* _tmp15_;
		const gchar* _tmp16_;
		GeeArrayList* _tmp17_;
		JsonArray* _sources = NULL;
		JsonObject* _tmp18_;
		JsonArray* _tmp19_;
		JsonArray* _tmp20_;
		GList* _tmp21_;
		GeeArrayList* _tmp26_;
		JsonArray* _labels = NULL;
		JsonObject* _tmp27_;
		JsonArray* _tmp28_;
		JsonArray* _tmp29_;
		GList* _tmp30_;
		GeeArrayList* _tmp35_;
		JsonArray* _projects = NULL;
		JsonObject* _tmp36_;
		JsonArray* _tmp37_;
		JsonArray* _tmp38_;
		GList* _tmp39_;
		GeeArrayList* _tmp53_;
		JsonArray* _sections = NULL;
		JsonObject* _tmp54_;
		JsonArray* _tmp55_;
		JsonArray* _tmp56_;
		GList* _tmp57_;
		GeeArrayList* _tmp62_;
		JsonArray* _items = NULL;
		JsonObject* _tmp63_;
		JsonArray* _tmp64_;
		JsonArray* _tmp65_;
		GList* _tmp66_;
		_tmp1_ = g_file_get_path (file);
		_tmp2_ = _tmp1_;
		json_parser_load_from_file (parser, _tmp2_, &_inner_error0_);
		_g_free0 (_tmp2_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp3_ = g_file_get_path (file);
		_tmp4_ = _tmp3_;
		objects_backup_set_path (self, _tmp4_);
		_g_free0 (_tmp4_);
		_tmp5_ = json_parser_get_root (parser);
		_tmp6_ = json_node_get_object (_tmp5_);
		_tmp7_ = _json_object_ref0 (_tmp6_);
		node = _tmp7_;
		_tmp8_ = node;
		_tmp9_ = json_object_get_string_member (_tmp8_, "version");
		objects_backup_set_version (self, _tmp9_);
		_tmp10_ = node;
		_tmp11_ = json_object_get_string_member (_tmp10_, "date");
		objects_backup_set_date (self, _tmp11_);
		_tmp12_ = node;
		_tmp13_ = json_object_get_object_member (_tmp12_, "settings");
		_tmp14_ = _json_object_ref0 (_tmp13_);
		settings = _tmp14_;
		_tmp15_ = settings;
		_tmp16_ = json_object_get_string_member (_tmp15_, "local-inbox-project-id");
		objects_backup_set_local_inbox_project_id (self, _tmp16_);
		_tmp17_ = self->priv->_sources;
		gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp17_);
		_tmp18_ = node;
		_tmp19_ = json_object_get_array_member (_tmp18_, "sources");
		_sources = _tmp19_;
		_tmp20_ = _sources;
		_tmp21_ = json_array_get_elements (_tmp20_);
		{
			GList* item_collection = NULL;
			GList* item_it = NULL;
			item_collection = _tmp21_;
			for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
				JsonNode* item = NULL;
				item = (JsonNode*) item_it->data;
				{
					GeeArrayList* _tmp22_;
					JsonNode* _tmp23_;
					ObjectsSource* _tmp24_;
					ObjectsSource* _tmp25_;
					_tmp22_ = self->priv->_sources;
					_tmp23_ = item;
					_tmp24_ = objects_source_new_from_import_json (_tmp23_);
					_tmp25_ = _tmp24_;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp22_, _tmp25_);
					_g_object_unref0 (_tmp25_);
				}
			}
			(item_collection == NULL) ? NULL : (item_collection = (g_list_free (item_collection), NULL));
		}
		_tmp26_ = self->priv->_labels;
		gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp26_);
		_tmp27_ = node;
		_tmp28_ = json_object_get_array_member (_tmp27_, "labels");
		_labels = _tmp28_;
		_tmp29_ = _labels;
		_tmp30_ = json_array_get_elements (_tmp29_);
		{
			GList* item_collection = NULL;
			GList* item_it = NULL;
			item_collection = _tmp30_;
			for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
				JsonNode* item = NULL;
				item = (JsonNode*) item_it->data;
				{
					GeeArrayList* _tmp31_;
					JsonNode* _tmp32_;
					ObjectsLabel* _tmp33_;
					ObjectsLabel* _tmp34_;
					_tmp31_ = self->priv->_labels;
					_tmp32_ = item;
					_tmp33_ = objects_label_new_from_import_json (_tmp32_);
					_tmp34_ = _tmp33_;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp31_, _tmp34_);
					_g_object_unref0 (_tmp34_);
				}
			}
			(item_collection == NULL) ? NULL : (item_collection = (g_list_free (item_collection), NULL));
		}
		_tmp35_ = self->priv->_projects;
		gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp35_);
		_tmp36_ = node;
		_tmp37_ = json_object_get_array_member (_tmp36_, "projects");
		_projects = _tmp37_;
		_tmp38_ = _projects;
		_tmp39_ = json_array_get_elements (_tmp38_);
		{
			GList* item_collection = NULL;
			GList* item_it = NULL;
			item_collection = _tmp39_;
			for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
				JsonNode* item = NULL;
				item = (JsonNode*) item_it->data;
				{
					ObjectsProject* _project = NULL;
					JsonNode* _tmp40_;
					ObjectsProject* _tmp41_;
					const gchar* _tmp42_;
					_tmp40_ = item;
					_tmp41_ = objects_project_new_from_import_json (_tmp40_);
					_project = _tmp41_;
					_tmp42_ = self->priv->_version;
					if (g_strcmp0 (_tmp42_, "1.0") == 0) {
						ObjectsProject* _tmp43_;
						const gchar* _tmp44_;
						const gchar* _tmp45_;
						gchar* _tmp46_;
						gchar* _tmp47_;
						gboolean _tmp48_;
						_tmp43_ = _project;
						_tmp44_ = objects_project_get_source_id (_tmp43_);
						_tmp45_ = _tmp44_;
						_tmp46_ = source_type_to_string (SOURCE_TYPE_CALDAV);
						_tmp47_ = _tmp46_;
						_tmp48_ = g_strcmp0 (_tmp45_, _tmp47_) != 0;
						_g_free0 (_tmp47_);
						if (_tmp48_) {
							GeeArrayList* _tmp49_;
							ObjectsProject* _tmp50_;
							_tmp49_ = self->priv->_projects;
							_tmp50_ = _project;
							gee_abstract_collection_add ((GeeAbstractCollection*) _tmp49_, _tmp50_);
						}
					} else {
						GeeArrayList* _tmp51_;
						ObjectsProject* _tmp52_;
						_tmp51_ = self->priv->_projects;
						_tmp52_ = _project;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp51_, _tmp52_);
					}
					_g_object_unref0 (_project);
				}
			}
			(item_collection == NULL) ? NULL : (item_collection = (g_list_free (item_collection), NULL));
		}
		_tmp53_ = self->priv->_sections;
		gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp53_);
		_tmp54_ = node;
		_tmp55_ = json_object_get_array_member (_tmp54_, "sections");
		_sections = _tmp55_;
		_tmp56_ = _sections;
		_tmp57_ = json_array_get_elements (_tmp56_);
		{
			GList* item_collection = NULL;
			GList* item_it = NULL;
			item_collection = _tmp57_;
			for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
				JsonNode* item = NULL;
				item = (JsonNode*) item_it->data;
				{
					GeeArrayList* _tmp58_;
					JsonNode* _tmp59_;
					ObjectsSection* _tmp60_;
					ObjectsSection* _tmp61_;
					_tmp58_ = self->priv->_sections;
					_tmp59_ = item;
					_tmp60_ = objects_section_new_from_import_json (_tmp59_);
					_tmp61_ = _tmp60_;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp58_, _tmp61_);
					_g_object_unref0 (_tmp61_);
				}
			}
			(item_collection == NULL) ? NULL : (item_collection = (g_list_free (item_collection), NULL));
		}
		_tmp62_ = self->priv->_items;
		gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp62_);
		_tmp63_ = node;
		_tmp64_ = json_object_get_array_member (_tmp63_, "items");
		_items = _tmp64_;
		_tmp65_ = _items;
		_tmp66_ = json_array_get_elements (_tmp65_);
		{
			GList* item_collection = NULL;
			GList* item_it = NULL;
			item_collection = _tmp66_;
			for (item_it = item_collection; item_it != NULL; item_it = item_it->next) {
				JsonNode* item = NULL;
				item = (JsonNode*) item_it->data;
				{
					GeeArrayList* _tmp67_;
					JsonNode* _tmp68_;
					GeeArrayList* _tmp69_;
					ObjectsItem* _tmp70_;
					ObjectsItem* _tmp71_;
					_tmp67_ = self->priv->_items;
					_tmp68_ = item;
					_tmp69_ = self->priv->_labels;
					_tmp70_ = objects_item_new_from_import_json (_tmp68_, _tmp69_);
					_tmp71_ = _tmp70_;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp67_, _tmp71_);
					_g_object_unref0 (_tmp71_);
				}
			}
			(item_collection == NULL) ? NULL : (item_collection = (g_list_free (item_collection), NULL));
		}
		_json_object_unref0 (settings);
		_json_object_unref0 (node);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp72_;
		const gchar* _tmp73_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp72_ = e;
		_tmp73_ = _tmp72_->message;
		objects_backup_set_error (self, _tmp73_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (parser);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	_g_object_unref0 (parser);
	return self;
}

ObjectsBackup*
objects_backup_new_from_file (GFile* file)
{
	return objects_backup_construct_from_file (OBJECTS_TYPE_BACKUP, file);
}

gboolean
objects_backup_valid (ObjectsBackup* self)
{
	const gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	gboolean _tmp4_ = FALSE;
	const gchar* _tmp5_;
	GeeArrayList* _tmp7_;
	gboolean _tmp8_;
	gboolean _tmp9_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_error;
	if (g_strcmp0 (_tmp0_, "") != 0) {
		result = FALSE;
		return result;
	}
	_tmp2_ = self->priv->_version;
	if (_tmp2_ == NULL) {
		_tmp1_ = TRUE;
	} else {
		const gchar* _tmp3_;
		_tmp3_ = self->priv->_version;
		_tmp1_ = g_strcmp0 (_tmp3_, "") == 0;
	}
	if (_tmp1_) {
		result = FALSE;
		return result;
	}
	_tmp5_ = self->priv->_date;
	if (_tmp5_ == NULL) {
		_tmp4_ = TRUE;
	} else {
		const gchar* _tmp6_;
		_tmp6_ = self->priv->_date;
		_tmp4_ = g_strcmp0 (_tmp6_, "") == 0;
	}
	if (_tmp4_) {
		result = FALSE;
		return result;
	}
	_tmp7_ = self->priv->_projects;
	_tmp8_ = gee_collection_get_is_empty ((GeeCollection*) _tmp7_);
	_tmp9_ = _tmp8_;
	if (_tmp9_) {
		result = FALSE;
		return result;
	}
	result = TRUE;
	return result;
}

ObjectsBackup*
objects_backup_construct (GType object_type)
{
	ObjectsBackup * self = NULL;
	self = (ObjectsBackup*) g_object_new (object_type, NULL);
	return self;
}

ObjectsBackup*
objects_backup_new (void)
{
	return objects_backup_construct (OBJECTS_TYPE_BACKUP);
}

const gchar*
objects_backup_get_version (ObjectsBackup* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_version;
	result = _tmp0_;
	return result;
}

void
objects_backup_set_version (ObjectsBackup* self,
                            const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_backup_get_version (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_version);
		self->priv->_version = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_backup_properties[OBJECTS_BACKUP_VERSION_PROPERTY]);
	}
}

const gchar*
objects_backup_get_date (ObjectsBackup* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_date;
	result = _tmp0_;
	return result;
}

void
objects_backup_set_date (ObjectsBackup* self,
                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_backup_get_date (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_date);
		self->priv->_date = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_backup_properties[OBJECTS_BACKUP_DATE_PROPERTY]);
	}
}

const gchar*
objects_backup_get_local_inbox_project_id (ObjectsBackup* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_local_inbox_project_id;
	result = _tmp0_;
	return result;
}

void
objects_backup_set_local_inbox_project_id (ObjectsBackup* self,
                                           const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_backup_get_local_inbox_project_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_local_inbox_project_id);
		self->priv->_local_inbox_project_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_backup_properties[OBJECTS_BACKUP_LOCAL_INBOX_PROJECT_ID_PROPERTY]);
	}
}

GeeArrayList*
objects_backup_get_projects (ObjectsBackup* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_projects;
	result = _tmp0_;
	return result;
}

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

void
objects_backup_set_projects (ObjectsBackup* self,
                             GeeArrayList* value)
{
	GeeArrayList* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_backup_get_projects (self);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_projects);
		self->priv->_projects = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_backup_properties[OBJECTS_BACKUP_PROJECTS_PROPERTY]);
	}
}

GeeArrayList*
objects_backup_get_sections (ObjectsBackup* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_sections;
	result = _tmp0_;
	return result;
}

void
objects_backup_set_sections (ObjectsBackup* self,
                             GeeArrayList* value)
{
	GeeArrayList* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_backup_get_sections (self);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_sections);
		self->priv->_sections = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_backup_properties[OBJECTS_BACKUP_SECTIONS_PROPERTY]);
	}
}

GeeArrayList*
objects_backup_get_items (ObjectsBackup* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_items;
	result = _tmp0_;
	return result;
}

void
objects_backup_set_items (ObjectsBackup* self,
                          GeeArrayList* value)
{
	GeeArrayList* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_backup_get_items (self);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_items);
		self->priv->_items = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_backup_properties[OBJECTS_BACKUP_ITEMS_PROPERTY]);
	}
}

GeeArrayList*
objects_backup_get_labels (ObjectsBackup* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_labels;
	result = _tmp0_;
	return result;
}

void
objects_backup_set_labels (ObjectsBackup* self,
                           GeeArrayList* value)
{
	GeeArrayList* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_backup_get_labels (self);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_labels);
		self->priv->_labels = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_backup_properties[OBJECTS_BACKUP_LABELS_PROPERTY]);
	}
}

GeeArrayList*
objects_backup_get_sources (ObjectsBackup* self)
{
	GeeArrayList* result;
	GeeArrayList* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_sources;
	result = _tmp0_;
	return result;
}

void
objects_backup_set_sources (ObjectsBackup* self,
                            GeeArrayList* value)
{
	GeeArrayList* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_backup_get_sources (self);
	if (old_value != value) {
		GeeArrayList* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_sources);
		self->priv->_sources = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_backup_properties[OBJECTS_BACKUP_SOURCES_PROPERTY]);
	}
}

const gchar*
objects_backup_get_path (ObjectsBackup* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_path;
	result = _tmp0_;
	return result;
}

void
objects_backup_set_path (ObjectsBackup* self,
                         const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_backup_get_path (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_path);
		self->priv->_path = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_backup_properties[OBJECTS_BACKUP_PATH_PROPERTY]);
	}
}

const gchar*
objects_backup_get_error (ObjectsBackup* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_error;
	result = _tmp0_;
	return result;
}

void
objects_backup_set_error (ObjectsBackup* self,
                          const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = objects_backup_get_error (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_error);
		self->priv->_error = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, objects_backup_properties[OBJECTS_BACKUP_ERROR_PROPERTY]);
	}
}

GDateTime*
objects_backup_get_datetime (ObjectsBackup* self)
{
	GDateTime* result;
	const gchar* _tmp0_;
	GTimeZone* _tmp1_;
	GTimeZone* _tmp2_;
	GDateTime* _tmp3_;
	GDateTime* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_date;
	_tmp1_ = g_time_zone_new_local ();
	_tmp2_ = _tmp1_;
	_tmp3_ = g_date_time_new_from_iso8601 (_tmp0_, _tmp2_);
	_g_date_time_unref0 (self->priv->_datetime);
	self->priv->_datetime = _tmp3_;
	_g_time_zone_unref0 (_tmp2_);
	_tmp4_ = self->priv->_datetime;
	result = _tmp4_;
	return result;
}

const gchar*
objects_backup_get_title (ObjectsBackup* self)
{
	const gchar* result;
	GDateTime* _tmp0_;
	GDateTime* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = objects_backup_get_datetime (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_date_time_format (_tmp1_, "%c");
	_g_free0 (self->priv->_title);
	self->priv->_title = _tmp2_;
	_tmp3_ = self->priv->_title;
	result = _tmp3_;
	return result;
}

static void
objects_backup_class_init (ObjectsBackupClass * klass,
                           gpointer klass_data)
{
	objects_backup_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ObjectsBackup_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_objects_backup_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_objects_backup_set_property;
	G_OBJECT_CLASS (klass)->finalize = objects_backup_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_BACKUP_VERSION_PROPERTY, objects_backup_properties[OBJECTS_BACKUP_VERSION_PROPERTY] = g_param_spec_string ("version", "version", "version", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_BACKUP_DATE_PROPERTY, objects_backup_properties[OBJECTS_BACKUP_DATE_PROPERTY] = g_param_spec_string ("date", "date", "date", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_BACKUP_LOCAL_INBOX_PROJECT_ID_PROPERTY, objects_backup_properties[OBJECTS_BACKUP_LOCAL_INBOX_PROJECT_ID_PROPERTY] = g_param_spec_string ("local-inbox-project-id", "local-inbox-project-id", "local-inbox-project-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_BACKUP_PROJECTS_PROPERTY, objects_backup_properties[OBJECTS_BACKUP_PROJECTS_PROPERTY] = g_param_spec_object ("projects", "projects", "projects", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_BACKUP_SECTIONS_PROPERTY, objects_backup_properties[OBJECTS_BACKUP_SECTIONS_PROPERTY] = g_param_spec_object ("sections", "sections", "sections", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_BACKUP_ITEMS_PROPERTY, objects_backup_properties[OBJECTS_BACKUP_ITEMS_PROPERTY] = g_param_spec_object ("items", "items", "items", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_BACKUP_LABELS_PROPERTY, objects_backup_properties[OBJECTS_BACKUP_LABELS_PROPERTY] = g_param_spec_object ("labels", "labels", "labels", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_BACKUP_SOURCES_PROPERTY, objects_backup_properties[OBJECTS_BACKUP_SOURCES_PROPERTY] = g_param_spec_object ("sources", "sources", "sources", GEE_TYPE_ARRAY_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_BACKUP_PATH_PROPERTY, objects_backup_properties[OBJECTS_BACKUP_PATH_PROPERTY] = g_param_spec_string ("path", "path", "path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_BACKUP_ERROR_PROPERTY, objects_backup_properties[OBJECTS_BACKUP_ERROR_PROPERTY] = g_param_spec_string ("error", "error", "error", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_BACKUP_DATETIME_PROPERTY, objects_backup_properties[OBJECTS_BACKUP_DATETIME_PROPERTY] = g_param_spec_boxed ("datetime", "datetime", "datetime", G_TYPE_DATE_TIME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), OBJECTS_BACKUP_TITLE_PROPERTY, objects_backup_properties[OBJECTS_BACKUP_TITLE_PROPERTY] = g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	objects_backup_signals[OBJECTS_BACKUP_DELETED_SIGNAL] = g_signal_new ("deleted", OBJECTS_TYPE_BACKUP, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
objects_backup_instance_init (ObjectsBackup * self,
                              gpointer klass)
{
	gchar* _tmp0_;
	GDateTime* _tmp1_;
	GDateTime* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GeeArrayList* _tmp5_;
	GeeArrayList* _tmp6_;
	GeeArrayList* _tmp7_;
	GeeArrayList* _tmp8_;
	GeeArrayList* _tmp9_;
	gchar* _tmp10_;
	self->priv = objects_backup_get_instance_private (self);
	_tmp0_ = g_strdup ("");
	self->priv->_version = _tmp0_;
	_tmp1_ = g_date_time_new_now_local ();
	_tmp2_ = _tmp1_;
	_tmp3_ = g_date_time_to_string (_tmp2_);
	self->priv->_date = _tmp3_;
	_g_date_time_unref0 (_tmp2_);
	_tmp4_ = g_strdup ("");
	self->priv->_local_inbox_project_id = _tmp4_;
	_tmp5_ = gee_array_list_new (OBJECTS_TYPE_PROJECT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->_projects = _tmp5_;
	_tmp6_ = gee_array_list_new (OBJECTS_TYPE_SECTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->_sections = _tmp6_;
	_tmp7_ = gee_array_list_new (OBJECTS_TYPE_ITEM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->_items = _tmp7_;
	_tmp8_ = gee_array_list_new (OBJECTS_TYPE_LABEL, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->_labels = _tmp8_;
	_tmp9_ = gee_array_list_new (OBJECTS_TYPE_SOURCE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->_sources = _tmp9_;
	_tmp10_ = g_strdup ("");
	self->priv->_error = _tmp10_;
}

static void
objects_backup_finalize (GObject * obj)
{
	ObjectsBackup * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, OBJECTS_TYPE_BACKUP, ObjectsBackup);
	_g_free0 (self->priv->_version);
	_g_free0 (self->priv->_date);
	_g_free0 (self->priv->_local_inbox_project_id);
	_g_object_unref0 (self->priv->_projects);
	_g_object_unref0 (self->priv->_sections);
	_g_object_unref0 (self->priv->_items);
	_g_object_unref0 (self->priv->_labels);
	_g_object_unref0 (self->priv->_sources);
	_g_free0 (self->priv->_path);
	_g_free0 (self->priv->_error);
	_g_date_time_unref0 (self->priv->_datetime);
	_g_free0 (self->priv->_title);
	G_OBJECT_CLASS (objects_backup_parent_class)->finalize (obj);
}

static GType
objects_backup_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ObjectsBackupClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) objects_backup_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ObjectsBackup), 0, (GInstanceInitFunc) objects_backup_instance_init, NULL };
	GType objects_backup_type_id;
	objects_backup_type_id = g_type_register_static (G_TYPE_OBJECT, "ObjectsBackup", &g_define_type_info, 0);
	ObjectsBackup_private_offset = g_type_add_instance_private (objects_backup_type_id, sizeof (ObjectsBackupPrivate));
	return objects_backup_type_id;
}

GType
objects_backup_get_type (void)
{
	static volatile gsize objects_backup_type_id__once = 0;
	if (g_once_init_enter (&objects_backup_type_id__once)) {
		GType objects_backup_type_id;
		objects_backup_type_id = objects_backup_get_type_once ();
		g_once_init_leave (&objects_backup_type_id__once, objects_backup_type_id);
	}
	return objects_backup_type_id__once;
}

static void
_vala_objects_backup_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec)
{
	ObjectsBackup * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, OBJECTS_TYPE_BACKUP, ObjectsBackup);
	switch (property_id) {
		case OBJECTS_BACKUP_VERSION_PROPERTY:
		g_value_set_string (value, objects_backup_get_version (self));
		break;
		case OBJECTS_BACKUP_DATE_PROPERTY:
		g_value_set_string (value, objects_backup_get_date (self));
		break;
		case OBJECTS_BACKUP_LOCAL_INBOX_PROJECT_ID_PROPERTY:
		g_value_set_string (value, objects_backup_get_local_inbox_project_id (self));
		break;
		case OBJECTS_BACKUP_PROJECTS_PROPERTY:
		g_value_set_object (value, objects_backup_get_projects (self));
		break;
		case OBJECTS_BACKUP_SECTIONS_PROPERTY:
		g_value_set_object (value, objects_backup_get_sections (self));
		break;
		case OBJECTS_BACKUP_ITEMS_PROPERTY:
		g_value_set_object (value, objects_backup_get_items (self));
		break;
		case OBJECTS_BACKUP_LABELS_PROPERTY:
		g_value_set_object (value, objects_backup_get_labels (self));
		break;
		case OBJECTS_BACKUP_SOURCES_PROPERTY:
		g_value_set_object (value, objects_backup_get_sources (self));
		break;
		case OBJECTS_BACKUP_PATH_PROPERTY:
		g_value_set_string (value, objects_backup_get_path (self));
		break;
		case OBJECTS_BACKUP_ERROR_PROPERTY:
		g_value_set_string (value, objects_backup_get_error (self));
		break;
		case OBJECTS_BACKUP_DATETIME_PROPERTY:
		g_value_set_boxed (value, objects_backup_get_datetime (self));
		break;
		case OBJECTS_BACKUP_TITLE_PROPERTY:
		g_value_set_string (value, objects_backup_get_title (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_objects_backup_set_property (GObject * object,
                                   guint property_id,
                                   const GValue * value,
                                   GParamSpec * pspec)
{
	ObjectsBackup * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, OBJECTS_TYPE_BACKUP, ObjectsBackup);
	switch (property_id) {
		case OBJECTS_BACKUP_VERSION_PROPERTY:
		objects_backup_set_version (self, g_value_get_string (value));
		break;
		case OBJECTS_BACKUP_DATE_PROPERTY:
		objects_backup_set_date (self, g_value_get_string (value));
		break;
		case OBJECTS_BACKUP_LOCAL_INBOX_PROJECT_ID_PROPERTY:
		objects_backup_set_local_inbox_project_id (self, g_value_get_string (value));
		break;
		case OBJECTS_BACKUP_PROJECTS_PROPERTY:
		objects_backup_set_projects (self, g_value_get_object (value));
		break;
		case OBJECTS_BACKUP_SECTIONS_PROPERTY:
		objects_backup_set_sections (self, g_value_get_object (value));
		break;
		case OBJECTS_BACKUP_ITEMS_PROPERTY:
		objects_backup_set_items (self, g_value_get_object (value));
		break;
		case OBJECTS_BACKUP_LABELS_PROPERTY:
		objects_backup_set_labels (self, g_value_get_object (value));
		break;
		case OBJECTS_BACKUP_SOURCES_PROPERTY:
		objects_backup_set_sources (self, g_value_get_object (value));
		break;
		case OBJECTS_BACKUP_PATH_PROPERTY:
		objects_backup_set_path (self, g_value_get_string (value));
		break;
		case OBJECTS_BACKUP_ERROR_PROPERTY:
		objects_backup_set_error (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

