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

/* Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include <gio/gio.h>
#include <gobject/gvaluecollector.h>

#define DATA_OBJECT_INVALID_OBJECT_ID ((gint64) -1)
#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 TYPE_DATA_COLLECTION (data_collection_get_type ())
#define DATA_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_COLLECTION, DataCollection))
#define DATA_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_COLLECTION, DataCollectionClass))
#define IS_DATA_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_COLLECTION))
#define IS_DATA_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_COLLECTION))
#define DATA_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_COLLECTION, DataCollectionClass))

typedef struct _DataCollection DataCollection;
typedef struct _DataCollectionClass DataCollectionClass;
typedef struct _DataCollectionPrivate DataCollectionPrivate;

#define TYPE_DATA_OBJECT (data_object_get_type ())
#define DATA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_OBJECT, DataObject))
#define DATA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_OBJECT, DataObjectClass))
#define IS_DATA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_OBJECT))
#define IS_DATA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_OBJECT))
#define DATA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_OBJECT, DataObjectClass))

typedef struct _DataObject DataObject;
typedef struct _DataObjectClass DataObjectClass;

#define TYPE_ALTERATION (alteration_get_type ())
#define ALTERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ALTERATION, Alteration))
#define ALTERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ALTERATION, AlterationClass))
#define IS_ALTERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ALTERATION))
#define IS_ALTERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ALTERATION))
#define ALTERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ALTERATION, AlterationClass))

typedef struct _Alteration Alteration;
typedef struct _AlterationClass AlterationClass;
typedef gint64 (*Comparator) (void* a, void* b, gpointer user_data);
typedef gboolean (*ComparatorPredicate) (DataObject* object, Alteration* alteration, gpointer user_data);
typedef gboolean (*ProgressMonitor) (guint64 current, guint64 total, gboolean do_event_loop, gpointer user_data);

#define TYPE_MARKER (marker_get_type ())
#define MARKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MARKER, Marker))
#define IS_MARKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MARKER))
#define MARKER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MARKER, MarkerIface))

typedef struct _Marker Marker;
typedef struct _MarkerIface MarkerIface;

#define TYPE_SOURCE_COLLECTION (source_collection_get_type ())
#define SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SOURCE_COLLECTION, SourceCollection))
#define SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SOURCE_COLLECTION, SourceCollectionClass))
#define IS_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SOURCE_COLLECTION))
#define IS_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SOURCE_COLLECTION))
#define SOURCE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SOURCE_COLLECTION, SourceCollectionClass))

typedef struct _SourceCollection SourceCollection;
typedef struct _SourceCollectionClass SourceCollectionClass;
typedef struct _SourceCollectionPrivate SourceCollectionPrivate;

#define TYPE_DATA_SOURCE (data_source_get_type ())
#define DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_SOURCE, DataSource))
#define DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_SOURCE, DataSourceClass))
#define IS_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_SOURCE))
#define IS_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_SOURCE))
#define DATA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_SOURCE, DataSourceClass))

typedef struct _DataSource DataSource;
typedef struct _DataSourceClass DataSourceClass;

#define TYPE_SOURCE_BACKLINK (source_backlink_get_type ())
#define SOURCE_BACKLINK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SOURCE_BACKLINK, SourceBacklink))
#define SOURCE_BACKLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SOURCE_BACKLINK, SourceBacklinkClass))
#define IS_SOURCE_BACKLINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SOURCE_BACKLINK))
#define IS_SOURCE_BACKLINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SOURCE_BACKLINK))
#define SOURCE_BACKLINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SOURCE_BACKLINK, SourceBacklinkClass))

typedef struct _SourceBacklink SourceBacklink;
typedef struct _SourceBacklinkClass SourceBacklinkClass;

#define TYPE_DATABASE_SOURCE_COLLECTION (database_source_collection_get_type ())
#define DATABASE_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollection))
#define DATABASE_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollectionClass))
#define IS_DATABASE_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_SOURCE_COLLECTION))
#define IS_DATABASE_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_SOURCE_COLLECTION))
#define DATABASE_SOURCE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollectionClass))

typedef struct _DatabaseSourceCollection DatabaseSourceCollection;
typedef struct _DatabaseSourceCollectionClass DatabaseSourceCollectionClass;
typedef struct _DatabaseSourceCollectionPrivate DatabaseSourceCollectionPrivate;

#define TYPE_TOMBSTONE_SOURCE_COLLECTION (tombstone_source_collection_get_type ())
#define TOMBSTONE_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TOMBSTONE_SOURCE_COLLECTION, TombstoneSourceCollection))
#define TOMBSTONE_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TOMBSTONE_SOURCE_COLLECTION, TombstoneSourceCollectionClass))
#define IS_TOMBSTONE_SOURCE_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TOMBSTONE_SOURCE_COLLECTION))
#define IS_TOMBSTONE_SOURCE_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TOMBSTONE_SOURCE_COLLECTION))
#define TOMBSTONE_SOURCE_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TOMBSTONE_SOURCE_COLLECTION, TombstoneSourceCollectionClass))

typedef struct _TombstoneSourceCollection TombstoneSourceCollection;
typedef struct _TombstoneSourceCollectionClass TombstoneSourceCollectionClass;
typedef struct _TombstoneSourceCollectionPrivate TombstoneSourceCollectionPrivate;

#define TYPE_TOMBSTONE (tombstone_get_type ())
#define TOMBSTONE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TOMBSTONE, Tombstone))
#define TOMBSTONE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TOMBSTONE, TombstoneClass))
#define IS_TOMBSTONE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TOMBSTONE))
#define IS_TOMBSTONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TOMBSTONE))
#define TOMBSTONE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TOMBSTONE, TombstoneClass))

typedef struct _Tombstone Tombstone;
typedef struct _TombstoneClass TombstoneClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef gint64 (*GetSourceDatabaseKey) (DataSource* source, gpointer user_data);

#define TYPE_TOMBSTONE_ID (tombstone_id_get_type ())
typedef struct _TombstoneID TombstoneID;
#define _alteration_unref0(var) ((var == NULL) ? NULL : (var = (alteration_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define TYPE_THUMBNAIL_SOURCE (thumbnail_source_get_type ())
#define THUMBNAIL_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_THUMBNAIL_SOURCE, ThumbnailSource))
#define THUMBNAIL_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_THUMBNAIL_SOURCE, ThumbnailSourceClass))
#define IS_THUMBNAIL_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_THUMBNAIL_SOURCE))
#define IS_THUMBNAIL_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_THUMBNAIL_SOURCE))
#define THUMBNAIL_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_THUMBNAIL_SOURCE, ThumbnailSourceClass))

typedef struct _ThumbnailSource ThumbnailSource;
typedef struct _ThumbnailSourceClass ThumbnailSourceClass;

#define TYPE_MEDIA_SOURCE (media_source_get_type ())
#define MEDIA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEDIA_SOURCE, MediaSource))
#define MEDIA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEDIA_SOURCE, MediaSourceClass))
#define IS_MEDIA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEDIA_SOURCE))
#define IS_MEDIA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MEDIA_SOURCE))
#define MEDIA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MEDIA_SOURCE, MediaSourceClass))

typedef struct _MediaSource MediaSource;
typedef struct _MediaSourceClass MediaSourceClass;

#define TYPE_DATABASE_ERROR (database_error_get_type ())
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define TYPE_DIRECTORY_MONITOR (directory_monitor_get_type ())
#define DIRECTORY_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DIRECTORY_MONITOR, DirectoryMonitor))
#define DIRECTORY_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DIRECTORY_MONITOR, DirectoryMonitorClass))
#define IS_DIRECTORY_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DIRECTORY_MONITOR))
#define IS_DIRECTORY_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DIRECTORY_MONITOR))
#define DIRECTORY_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DIRECTORY_MONITOR, DirectoryMonitorClass))

typedef struct _DirectoryMonitor DirectoryMonitor;
typedef struct _DirectoryMonitorClass DirectoryMonitorClass;
#define _data_collection_unref0(var) ((var == NULL) ? NULL : (var = (data_collection_unref (var), NULL)))

#define TYPE_DATA_SET (data_set_get_type ())
#define DATA_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_SET, DataSet))
#define DATA_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_SET, DataSetClass))
#define IS_DATA_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_SET))
#define IS_DATA_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_SET))
#define DATA_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_SET, DataSetClass))

typedef struct _DataSet DataSet;
typedef struct _DataSetClass DataSetClass;
#define _data_set_unref0(var) ((var == NULL) ? NULL : (var = (data_set_unref (var), NULL)))
typedef struct _TombstoneSourceCollectionAsyncScanData TombstoneSourceCollectionAsyncScanData;

#define TYPE_TOMBSTONED_FILE (tombstoned_file_get_type ())
#define TOMBSTONED_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TOMBSTONED_FILE, TombstonedFile))
#define TOMBSTONED_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TOMBSTONED_FILE, TombstonedFileClass))
#define IS_TOMBSTONED_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TOMBSTONED_FILE))
#define IS_TOMBSTONED_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TOMBSTONED_FILE))
#define TOMBSTONED_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TOMBSTONED_FILE, TombstonedFileClass))

typedef struct _TombstonedFile TombstonedFile;
typedef struct _TombstonedFileClass TombstonedFileClass;
typedef struct _TombstonedFilePrivate TombstonedFilePrivate;
typedef struct _ParamSpecTombstonedFile ParamSpecTombstonedFile;
typedef struct _DataObjectPrivate DataObjectPrivate;
typedef struct _DataSourcePrivate DataSourcePrivate;

#define TYPE_SOURCE_HOLDING_TANK (source_holding_tank_get_type ())
#define SOURCE_HOLDING_TANK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SOURCE_HOLDING_TANK, SourceHoldingTank))
#define SOURCE_HOLDING_TANK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SOURCE_HOLDING_TANK, SourceHoldingTankClass))
#define IS_SOURCE_HOLDING_TANK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SOURCE_HOLDING_TANK))
#define IS_SOURCE_HOLDING_TANK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SOURCE_HOLDING_TANK))
#define SOURCE_HOLDING_TANK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SOURCE_HOLDING_TANK, SourceHoldingTankClass))

typedef struct _SourceHoldingTank SourceHoldingTank;
typedef struct _SourceHoldingTankClass SourceHoldingTankClass;

#define TYPE_SOURCE_SNAPSHOT (source_snapshot_get_type ())
#define SOURCE_SNAPSHOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SOURCE_SNAPSHOT, SourceSnapshot))
#define SOURCE_SNAPSHOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SOURCE_SNAPSHOT, SourceSnapshotClass))
#define IS_SOURCE_SNAPSHOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SOURCE_SNAPSHOT))
#define IS_SOURCE_SNAPSHOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SOURCE_SNAPSHOT))
#define SOURCE_SNAPSHOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SOURCE_SNAPSHOT, SourceSnapshotClass))

typedef struct _SourceSnapshot SourceSnapshot;
typedef struct _SourceSnapshotClass SourceSnapshotClass;
typedef struct _TombstonePrivate TombstonePrivate;

#define TYPE_TOMBSTONE_ROW (tombstone_row_get_type ())
#define TOMBSTONE_ROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TOMBSTONE_ROW, TombstoneRow))
#define TOMBSTONE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TOMBSTONE_ROW, TombstoneRowClass))
#define IS_TOMBSTONE_ROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TOMBSTONE_ROW))
#define IS_TOMBSTONE_ROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TOMBSTONE_ROW))
#define TOMBSTONE_ROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TOMBSTONE_ROW, TombstoneRowClass))

typedef struct _TombstoneRow TombstoneRow;
typedef struct _TombstoneRowClass TombstoneRowClass;
enum  {
	TOMBSTONE_0_PROPERTY,
	TOMBSTONE_NUM_PROPERTIES
};
static GParamSpec* tombstone_properties[TOMBSTONE_NUM_PROPERTIES];
typedef enum  {
	TOMBSTONE_REASON_REMOVED_BY_USER = 0,
	TOMBSTONE_REASON_AUTO_DETECTED_DUPLICATE = 1
} TombstoneReason;

#define TOMBSTONE_TYPE_REASON (tombstone_reason_get_type ())
#define _tombstone_row_unref0(var) ((var == NULL) ? NULL : (var = (tombstone_row_unref (var), NULL)))

#define TYPE_DATABASE_TABLE (database_table_get_type ())
#define DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATABASE_TABLE, DatabaseTable))
#define DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATABASE_TABLE, DatabaseTableClass))
#define IS_DATABASE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATABASE_TABLE))
#define IS_DATABASE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATABASE_TABLE))
#define DATABASE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATABASE_TABLE, DatabaseTableClass))

typedef struct _DatabaseTable DatabaseTable;
typedef struct _DatabaseTableClass DatabaseTableClass;

#define TYPE_TOMBSTONE_TABLE (tombstone_table_get_type ())
#define TOMBSTONE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TOMBSTONE_TABLE, TombstoneTable))
#define TOMBSTONE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TOMBSTONE_TABLE, TombstoneTableClass))
#define IS_TOMBSTONE_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TOMBSTONE_TABLE))
#define IS_TOMBSTONE_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TOMBSTONE_TABLE))
#define TOMBSTONE_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TOMBSTONE_TABLE, TombstoneTableClass))

typedef struct _TombstoneTable TombstoneTable;
typedef struct _TombstoneTableClass TombstoneTableClass;
#define _database_table_unref0(var) ((var == NULL) ? NULL : (var = (database_table_unref (var), NULL)))

#define TYPE_BACKING_FILE_STATE (backing_file_state_get_type ())
#define BACKING_FILE_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BACKING_FILE_STATE, BackingFileState))
#define BACKING_FILE_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BACKING_FILE_STATE, BackingFileStateClass))
#define IS_BACKING_FILE_STATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BACKING_FILE_STATE))
#define IS_BACKING_FILE_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BACKING_FILE_STATE))
#define BACKING_FILE_STATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BACKING_FILE_STATE, BackingFileStateClass))

typedef struct _BackingFileState BackingFileState;
typedef struct _BackingFileStateClass BackingFileStateClass;
typedef struct _BackingFileStatePrivate BackingFileStatePrivate;
#define _tombstoned_file_unref0(var) ((var == NULL) ? NULL : (var = (tombstoned_file_unref (var), NULL)))
#define _backing_file_state_unref0(var) ((var == NULL) ? NULL : (var = (backing_file_state_unref (var), NULL)))
typedef struct _TombstoneRowPrivate TombstoneRowPrivate;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _MarkerIface {
	GTypeInterface parent_iface;
	void (*mark) (Marker* self, DataObject* object);
	void (*unmark) (Marker* self, DataObject* object);
	gboolean (*toggle) (Marker* self, DataObject* object);
	void (*mark_many) (Marker* self, GeeCollection* list);
	void (*unmark_many) (Marker* self, GeeCollection* list);
	void (*mark_all) (Marker* self);
	gint (*get_count) (Marker* self);
	GeeCollection* (*get_all) (Marker* self);
};

struct _DataCollection {
	GTypeInstance parent_instance;
	volatile int ref_count;
	DataCollectionPrivate * priv;
};

struct _DataCollectionClass {
	GTypeClass parent_class;
	void (*finalize) (DataCollection *self);
	gchar* (*to_string) (DataCollection* self);
	void (*notify_items_added) (DataCollection* self, GeeIterable* added);
	void (*notify_items_removed) (DataCollection* self, GeeIterable* removed);
	void (*notify_contents_altered) (DataCollection* self, GeeIterable* added, GeeIterable* removed);
	void (*notify_items_altered) (DataCollection* self, GeeMap* items);
	void (*notify_ordering_changed) (DataCollection* self);
	void (*notify_property_set) (DataCollection* self, const gchar* name, GValue* old, GValue* val);
	void (*notify_property_cleared) (DataCollection* self, const gchar* name);
	gboolean (*valid_type) (DataCollection* self, DataObject* object);
	void (*set_comparator) (DataCollection* self, Comparator comparator, gpointer comparator_target, ComparatorPredicate predicate, gpointer predicate_target);
	void (*reset_comparator) (DataCollection* self);
	GeeCollection* (*get_all) (DataCollection* self);
	gint (*get_count) (DataCollection* self);
	DataObject* (*get_at) (DataCollection* self, gint index);
	gint (*index_of) (DataCollection* self, DataObject* object);
	gboolean (*contains) (DataCollection* self, DataObject* object);
	gboolean (*add) (DataCollection* self, DataObject* object);
	GeeCollection* (*add_many) (DataCollection* self, GeeCollection* objects, ProgressMonitor monitor, gpointer monitor_target);
	void (*remove_marked) (DataCollection* self, Marker* m);
	void (*clear) (DataCollection* self);
	void (*close) (DataCollection* self);
	void (*notify_frozen) (DataCollection* self);
	void (*notify_thawed) (DataCollection* self);
	void (*items_added) (DataCollection* self, GeeIterable* added);
	void (*items_removed) (DataCollection* self, GeeIterable* removed);
	void (*contents_altered) (DataCollection* self, GeeIterable* added, GeeIterable* removed);
	void (*items_altered) (DataCollection* self, GeeMap* items);
	void (*ordering_changed) (DataCollection* self);
	void (*property_set) (DataCollection* self, const gchar* name, GValue* old, GValue* val);
	void (*property_cleared) (DataCollection* self, const gchar* name);
	void (*frozen) (DataCollection* self);
	void (*thawed) (DataCollection* self);
};

struct _SourceCollection {
	DataCollection parent_instance;
	SourceCollectionPrivate * priv;
};

struct _SourceCollectionClass {
	DataCollectionClass parent_class;
	gboolean (*holds_type_of_source) (SourceCollection* self, DataSource* source);
	void (*notify_items_unlinking) (SourceCollection* self, GeeCollection* unlinking);
	void (*notify_items_relinked) (SourceCollection* self, GeeCollection* relinked);
	void (*notify_item_destroyed) (SourceCollection* self, DataSource* source);
	void (*notify_items_destroyed) (SourceCollection* self, GeeCollection* destroyed);
	void (*notify_unlinked_destroyed) (SourceCollection* self, DataSource* unlinked);
	void (*notify_backlink_removed) (SourceCollection* self, SourceBacklink* backlink, GeeCollection* sources);
	gboolean (*has_backlink) (SourceCollection* self, SourceBacklink* backlink);
	void (*remove_backlink) (SourceCollection* self, SourceBacklink* backlink);
	void (*items_unlinking) (SourceCollection* self, GeeCollection* unlinking);
	void (*items_relinked) (SourceCollection* self, GeeCollection* relinked);
	void (*item_destroyed) (SourceCollection* self, DataSource* source);
	void (*items_destroyed) (SourceCollection* self, GeeCollection* destroyed);
	void (*unlinked_destroyed) (SourceCollection* self, DataSource* source);
	void (*backlink_removed) (SourceCollection* self, SourceBacklink* backlink, GeeCollection* sources);
};

struct _DatabaseSourceCollection {
	SourceCollection parent_instance;
	DatabaseSourceCollectionPrivate * priv;
};

struct _DatabaseSourceCollectionClass {
	SourceCollectionClass parent_class;
};

struct _TombstoneSourceCollection {
	DatabaseSourceCollection parent_instance;
	TombstoneSourceCollectionPrivate * priv;
};

struct _TombstoneSourceCollectionClass {
	DatabaseSourceCollectionClass parent_class;
};

struct _TombstoneSourceCollectionPrivate {
	GeeHashMap* file_map;
};

struct _TombstoneID {
	gint64 id;
};

typedef enum  {
	DATABASE_ERROR_ERROR,
	DATABASE_ERROR_BACKING,
	DATABASE_ERROR_MEMORY,
	DATABASE_ERROR_ABORT,
	DATABASE_ERROR_LIMITS,
	DATABASE_ERROR_TYPESPEC
} DatabaseError;
#define DATABASE_ERROR database_error_quark ()

struct _TombstoneSourceCollectionAsyncScanData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TombstoneSourceCollection* self;
	DirectoryMonitor* monitor;
	GCancellable* cancellable;
	Marker* marker;
	Marker* _tmp0_;
	GeeList* _object_list;
	DataSet* _tmp1_;
	DataSet* _tmp2_;
	GeeList* _tmp3_;
	GeeList* _tmp4_;
	gint _object_size;
	GeeList* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	gint _object_index;
	gint _tmp8_;
	gint _tmp9_;
	DataObject* object;
	GeeList* _tmp10_;
	gpointer _tmp11_;
	Tombstone* tombstone;
	DataObject* _tmp12_;
	Tombstone* _tmp13_;
	GFile* file;
	Tombstone* _tmp14_;
	GFile* _tmp15_;
	GFileInfo* info;
	GFile* _tmp16_;
	GFileInfo* _tmp17_;
	GFileInfo* _tmp18_;
	GFileInfo* _tmp19_;
	GFile* _tmp20_;
	GFileInfo* _tmp21_;
	GFileInfo* _tmp22_;
	GError* err;
	GError* _tmp23_;
	GError* _tmp24_;
	GFile* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	GError* _tmp28_;
	const gchar* _tmp29_;
	GFileInfo* _tmp30_;
	Marker* _tmp31_;
	Tombstone* _tmp32_;
	Marker* _tmp33_;
	Marker* _tmp34_;
	Marker* _tmp35_;
	GError* err2;
	GError* _tmp36_;
	GError* _inner_error0_;
};

struct _TombstonedFile {
	GTypeInstance parent_instance;
	volatile int ref_count;
	TombstonedFilePrivate * priv;
	GFile* file;
	gint64 filesize;
	gchar* md5;
};

struct _TombstonedFileClass {
	GTypeClass parent_class;
	void (*finalize) (TombstonedFile *self);
};

struct _ParamSpecTombstonedFile {
	GParamSpec parent_instance;
};

struct _DataObject {
	GObject parent_instance;
	DataObjectPrivate * priv;
};

struct _DataObjectClass {
	GObjectClass parent_class;
	void (*notify_altered) (DataObject* self, Alteration* alteration);
	void (*notify_membership_changed) (DataObject* self, DataCollection* collection);
	void (*notify_collection_property_set) (DataObject* self, const gchar* name, GValue* old, GValue* val);
	void (*notify_collection_property_cleared) (DataObject* self, const gchar* name);
	gchar* (*get_name) (DataObject* self);
	gchar* (*to_string) (DataObject* self);
};

struct _DataSource {
	DataObject parent_instance;
	DataSourcePrivate * priv;
};

struct _DataSourceClass {
	DataObjectClass parent_class;
	void (*notify_held_in_tank) (DataSource* self, SourceHoldingTank* holding_tank);
	void (*notify_unlinking) (DataSource* self, SourceCollection* collection);
	void (*notify_unlinked) (DataSource* self);
	void (*notify_relinking) (DataSource* self, SourceCollection* collection);
	void (*notify_relinked) (DataSource* self);
	gchar* (*get_typename) (DataSource* self);
	gint64 (*get_instance_id) (DataSource* self);
	gchar* (*get_source_id) (DataSource* self);
	void (*commit_backlinks) (DataSource* self, SourceCollection* sources, const gchar* dehydrated);
	SourceSnapshot* (*save_snapshot) (DataSource* self);
	gboolean (*internal_delete_backing) (DataSource* self, GError** error);
	gboolean (*equals) (DataSource* self, DataSource* source);
	void (*destroy) (DataSource* self);
	void (*unlinked) (DataSource* self, SourceCollection* sources);
	void (*relinked) (DataSource* self, SourceCollection* sources);
	void (*destroyed) (DataSource* self);
};

struct _Tombstone {
	DataSource parent_instance;
	TombstonePrivate * priv;
};

struct _TombstoneClass {
	DataSourceClass parent_class;
};

struct _TombstonePrivate {
	TombstoneRow* row;
	GFile* file;
};

struct _BackingFileState {
	GTypeInstance parent_instance;
	volatile int ref_count;
	BackingFileStatePrivate * priv;
	gchar* filepath;
	gint64 filesize;
	GDateTime* modification_time;
	gchar* md5;
};

struct _BackingFileStateClass {
	GTypeClass parent_class;
	void (*finalize) (BackingFileState *self);
};

struct _TombstoneRow {
	GTypeInstance parent_instance;
	volatile int ref_count;
	TombstoneRowPrivate * priv;
	TombstoneID id;
	gchar* filepath;
	gint64 filesize;
	gchar* md5;
	gint64 time_created;
	TombstoneReason reason;
};

struct _TombstoneRowClass {
	GTypeClass parent_class;
	void (*finalize) (TombstoneRow *self);
};

static gint TombstoneSourceCollection_private_offset;
static gpointer tombstone_source_collection_parent_class = NULL;
static gpointer tombstoned_file_parent_class = NULL;
static gint Tombstone_private_offset;
static gpointer tombstone_parent_class = NULL;
VALA_EXTERN TombstoneSourceCollection* tombstone_global;
TombstoneSourceCollection* tombstone_global = NULL;

VALA_EXTERN gpointer data_collection_ref (gpointer instance);
VALA_EXTERN void data_collection_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_data_collection (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags);
VALA_EXTERN void value_set_data_collection (GValue* value,
                                gpointer v_object);
VALA_EXTERN void value_take_data_collection (GValue* value,
                                 gpointer v_object);
VALA_EXTERN gpointer value_get_data_collection (const GValue* value);
VALA_EXTERN GType data_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataCollection, data_collection_unref)
VALA_EXTERN GType data_object_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataObject, g_object_unref)
VALA_EXTERN gpointer alteration_ref (gpointer instance);
VALA_EXTERN void alteration_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_alteration (const gchar* name,
                                   const gchar* nick,
                                   const gchar* blurb,
                                   GType object_type,
                                   GParamFlags flags);
VALA_EXTERN void value_set_alteration (GValue* value,
                           gpointer v_object);
VALA_EXTERN void value_take_alteration (GValue* value,
                            gpointer v_object);
VALA_EXTERN gpointer value_get_alteration (const GValue* value);
VALA_EXTERN GType alteration_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Alteration, alteration_unref)
VALA_EXTERN GType marker_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Marker, g_object_unref)
VALA_EXTERN GType source_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SourceCollection, data_collection_unref)
VALA_EXTERN GType data_source_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataSource, g_object_unref)
VALA_EXTERN gpointer source_backlink_ref (gpointer instance);
VALA_EXTERN void source_backlink_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_source_backlink (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags);
VALA_EXTERN void value_set_source_backlink (GValue* value,
                                gpointer v_object);
VALA_EXTERN void value_take_source_backlink (GValue* value,
                                 gpointer v_object);
VALA_EXTERN gpointer value_get_source_backlink (const GValue* value);
VALA_EXTERN GType source_backlink_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SourceBacklink, source_backlink_unref)
VALA_EXTERN GType database_source_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DatabaseSourceCollection, data_collection_unref)
VALA_EXTERN GType tombstone_source_collection_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TombstoneSourceCollection, data_collection_unref)
VALA_EXTERN GType tombstone_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Tombstone, g_object_unref)
VALA_EXTERN gboolean source_collection_holds_type_of_source (SourceCollection* self,
                                                 DataSource* source);
VALA_EXTERN void data_collection_notify_contents_altered (DataCollection* self,
                                              GeeIterable* added,
                                              GeeIterable* removed);
VALA_EXTERN void data_collection_notify_items_altered (DataCollection* self,
                                           GeeMap* items);
VALA_EXTERN guint file_hash (GFile* file);
static guint _file_hash_gee_hash_data_func (gconstpointer v,
                                     gpointer self);
VALA_EXTERN gboolean file_equal (GFile* a,
                     GFile* b);
static gboolean _file_equal_gee_equal_data_func (gconstpointer a,
                                          gconstpointer b,
                                          gpointer self);
VALA_EXTERN TombstoneSourceCollection* tombstone_source_collection_new (void);
VALA_EXTERN TombstoneSourceCollection* tombstone_source_collection_construct (GType object_type);
static gint64 tombstone_source_collection_get_tombstone_id (DataSource* source);
static gint64 _tombstone_source_collection_get_tombstone_id_get_source_database_key (DataSource* source,
                                                                              gpointer self);
VALA_EXTERN DatabaseSourceCollection* database_source_collection_construct (GType object_type,
                                                                const gchar* name,
                                                                GetSourceDatabaseKey source_key_func,
                                                                gpointer source_key_func_target);
static gboolean tombstone_source_collection_real_holds_type_of_source (SourceCollection* base,
                                                                DataSource* source);
VALA_EXTERN GType tombstone_id_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TombstoneID* tombstone_id_dup (const TombstoneID* self);
VALA_EXTERN void tombstone_id_free (TombstoneID* self);
VALA_EXTERN void tombstone_get_tombstone_id (Tombstone* self,
                                 TombstoneID* result);
static void tombstone_source_collection_real_notify_contents_altered (DataCollection* base,
                                                               GeeIterable* added,
                                                               GeeIterable* removed);
VALA_EXTERN GFile* tombstone_get_file (Tombstone* self);
static void tombstone_source_collection_real_notify_items_altered (DataCollection* base,
                                                            GeeMap* items);
VALA_EXTERN gboolean alteration_has_subject (Alteration* self,
                                 const gchar* subject);
VALA_EXTERN GeeCollection* alteration_get_details (Alteration* self,
                                       const gchar* subject);
VALA_EXTERN Tombstone* tombstone_source_collection_locate (TombstoneSourceCollection* self,
                                               GFile* file);
VALA_EXTERN gboolean tombstone_source_collection_matches (TombstoneSourceCollection* self,
                                              GFile* file);
VALA_EXTERN void tombstone_source_collection_resurrect (TombstoneSourceCollection* self,
                                            Tombstone* tombstone);
VALA_EXTERN GType thumbnail_source_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ThumbnailSource, g_object_unref)
VALA_EXTERN GType media_source_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MediaSource, g_object_unref)
VALA_EXTERN gint source_collection_destroy_marked (SourceCollection* self,
                                       Marker* marker,
                                       gboolean delete_backing,
                                       ProgressMonitor monitor,
                                       gpointer monitor_target,
                                       GeeList* not_removed);
VALA_EXTERN Marker* data_collection_mark (DataCollection* self,
                              DataObject* object);
VALA_EXTERN void tombstone_source_collection_resurrect_many (TombstoneSourceCollection* self,
                                                 GeeCollection* tombstones);
VALA_EXTERN Marker* data_collection_mark_many (DataCollection* self,
                                   GeeCollection* objects);
VALA_EXTERN void data_collection_freeze_notifications (DataCollection* self);
VALA_EXTERN void database_table_begin_transaction (void);
VALA_EXTERN GQuark database_error_quark (void);
VALA_EXTERN GType database_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void database_table_commit_transaction (GError** error);
VALA_EXTERN void app_window_database_error (GError* err);
VALA_EXTERN void data_collection_thaw_notifications (DataCollection* self);
VALA_EXTERN GType directory_monitor_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DirectoryMonitor, g_object_unref)
VALA_EXTERN void tombstone_source_collection_launch_scan (TombstoneSourceCollection* self,
                                              DirectoryMonitor* monitor,
                                              GCancellable* cancellable);
static void tombstone_source_collection_async_scan (TombstoneSourceCollection* self,
                                             DirectoryMonitor* monitor,
                                             GCancellable* cancellable,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static void tombstone_source_collection_async_scan_finish (TombstoneSourceCollection* self,
                                                    GAsyncResult* _res_);
static void tombstone_source_collection_async_scan_data_free (gpointer _data);
static gboolean tombstone_source_collection_async_scan_co (TombstoneSourceCollectionAsyncScanData* _data_);
VALA_EXTERN Marker* data_collection_start_marking (DataCollection* self);
VALA_EXTERN gpointer data_set_ref (gpointer instance);
VALA_EXTERN void data_set_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_data_set (const gchar* name,
                                 const gchar* nick,
                                 const gchar* blurb,
                                 GType object_type,
                                 GParamFlags flags);
VALA_EXTERN void value_set_data_set (GValue* value,
                         gpointer v_object);
VALA_EXTERN void value_take_data_set (GValue* value,
                          gpointer v_object);
VALA_EXTERN gpointer value_get_data_set (const GValue* value);
VALA_EXTERN GType data_set_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DataSet, data_set_unref)
VALA_EXTERN DataSet* data_collection_get_dataset_copy (DataCollection* self);
VALA_EXTERN GeeList* data_set_get_all (DataSet* self);
VALA_EXTERN GFileInfo* directory_monitor_get_file_info (DirectoryMonitor* self,
                                            GFile* file);
static void tombstone_source_collection_async_scan_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
VALA_EXTERN void marker_mark (Marker* self,
                  DataObject* object);
static gboolean _tombstone_source_collection_async_scan_co_gsource_func (gpointer self);
VALA_EXTERN gint marker_get_count (Marker* self);
static void tombstone_source_collection_finalize (DataCollection * obj);
static GType tombstone_source_collection_get_type_once (void);
VALA_EXTERN gpointer tombstoned_file_ref (gpointer instance);
VALA_EXTERN void tombstoned_file_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_tombstoned_file (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags);
VALA_EXTERN void value_set_tombstoned_file (GValue* value,
                                gpointer v_object);
VALA_EXTERN void value_take_tombstoned_file (GValue* value,
                                 gpointer v_object);
VALA_EXTERN gpointer value_get_tombstoned_file (const GValue* value);
VALA_EXTERN GType tombstoned_file_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TombstonedFile, tombstoned_file_unref)
VALA_EXTERN TombstonedFile* tombstoned_file_new (GFile* file,
                                     gint64 filesize,
                                     const gchar* md5);
VALA_EXTERN TombstonedFile* tombstoned_file_construct (GType object_type,
                                           GFile* file,
                                           gint64 filesize,
                                           const gchar* md5);
static void tombstoned_file_finalize (TombstonedFile * obj);
static GType tombstoned_file_get_type_once (void);
VALA_EXTERN gpointer source_holding_tank_ref (gpointer instance);
VALA_EXTERN void source_holding_tank_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_source_holding_tank (const gchar* name,
                                            const gchar* nick,
                                            const gchar* blurb,
                                            GType object_type,
                                            GParamFlags flags);
VALA_EXTERN void value_set_source_holding_tank (GValue* value,
                                    gpointer v_object);
VALA_EXTERN void value_take_source_holding_tank (GValue* value,
                                     gpointer v_object);
VALA_EXTERN gpointer value_get_source_holding_tank (const GValue* value);
VALA_EXTERN GType source_holding_tank_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SourceHoldingTank, source_holding_tank_unref)
VALA_EXTERN gpointer source_snapshot_ref (gpointer instance);
VALA_EXTERN void source_snapshot_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_source_snapshot (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags);
VALA_EXTERN void value_set_source_snapshot (GValue* value,
                                gpointer v_object);
VALA_EXTERN void value_take_source_snapshot (GValue* value,
                                 gpointer v_object);
VALA_EXTERN gpointer value_get_source_snapshot (const GValue* value);
VALA_EXTERN GType source_snapshot_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SourceSnapshot, source_snapshot_unref)
VALA_EXTERN gpointer tombstone_row_ref (gpointer instance);
VALA_EXTERN void tombstone_row_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_tombstone_row (const gchar* name,
                                      const gchar* nick,
                                      const gchar* blurb,
                                      GType object_type,
                                      GParamFlags flags);
VALA_EXTERN void value_set_tombstone_row (GValue* value,
                              gpointer v_object);
VALA_EXTERN void value_take_tombstone_row (GValue* value,
                               gpointer v_object);
VALA_EXTERN gpointer value_get_tombstone_row (const GValue* value);
VALA_EXTERN GType tombstone_row_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TombstoneRow, tombstone_row_unref)
VALA_EXTERN gchar* data_source_get_typename (DataSource* self);
VALA_EXTERN gint64 data_source_get_instance_id (DataSource* self);
VALA_EXTERN gchar* data_object_get_name (DataObject* self);
VALA_EXTERN gchar* data_object_to_string (DataObject* self);
VALA_EXTERN void data_source_destroy (DataSource* self);
VALA_EXTERN GType tombstone_reason_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gint tombstone_reason_serialize (TombstoneReason self);
VALA_EXTERN TombstoneReason tombstone_reason_unserialize (gint value);
static Tombstone* tombstone_new (TombstoneRow* row);
static Tombstone* tombstone_construct (GType object_type,
                                TombstoneRow* row);
VALA_EXTERN DataSource* data_source_construct (GType object_type,
                                   gint64 object_id);
VALA_EXTERN void tombstone_init (void);
VALA_EXTERN gpointer database_table_ref (gpointer instance);
VALA_EXTERN void database_table_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_database_table (const gchar* name,
                                       const gchar* nick,
                                       const gchar* blurb,
                                       GType object_type,
                                       GParamFlags flags);
VALA_EXTERN void value_set_database_table (GValue* value,
                               gpointer v_object);
VALA_EXTERN void value_take_database_table (GValue* value,
                                gpointer v_object);
VALA_EXTERN gpointer value_get_database_table (const GValue* value);
VALA_EXTERN GType database_table_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DatabaseTable, database_table_unref)
VALA_EXTERN GType tombstone_table_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TombstoneTable, database_table_unref)
VALA_EXTERN TombstoneTable* tombstone_table_get_instance (void);
VALA_EXTERN TombstoneRow** tombstone_table_fetch_all (TombstoneTable* self,
                                          gint* result_length1,
                                          GError** error);
VALA_EXTERN GeeCollection* data_collection_add_many (DataCollection* self,
                                         GeeCollection* objects,
                                         ProgressMonitor monitor,
                                         gpointer monitor_target);
VALA_EXTERN void tombstone_terminate (void);
VALA_EXTERN void tombstone_entomb_many_sources (GeeCollection* sources,
                                    TombstoneReason reason,
                                    GError** error);
VALA_EXTERN gpointer backing_file_state_ref (gpointer instance);
VALA_EXTERN void backing_file_state_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_backing_file_state (const gchar* name,
                                           const gchar* nick,
                                           const gchar* blurb,
                                           GType object_type,
                                           GParamFlags flags);
VALA_EXTERN void value_set_backing_file_state (GValue* value,
                                   gpointer v_object);
VALA_EXTERN void value_take_backing_file_state (GValue* value,
                                    gpointer v_object);
VALA_EXTERN gpointer value_get_backing_file_state (const GValue* value);
VALA_EXTERN GType backing_file_state_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BackingFileState, backing_file_state_unref)
VALA_EXTERN BackingFileState** media_source_get_backing_files_state (MediaSource* self,
                                                         gint* result_length1);
VALA_EXTERN GFile* backing_file_state_get_file (BackingFileState* self);
VALA_EXTERN void tombstone_entomb_many_files (GeeCollection* files,
                                  TombstoneReason reason,
                                  GError** error);
VALA_EXTERN TombstoneRow* tombstone_table_add (TombstoneTable* self,
                                   const gchar* filepath,
                                   gint64 filesize,
                                   const gchar* md5,
                                   TombstoneReason reason,
                                   GError** error);
static gchar* tombstone_real_get_typename (DataSource* base);
static gint64 tombstone_real_get_instance_id (DataSource* base);
static gchar* tombstone_real_get_name (DataObject* base);
static gchar* tombstone_real_to_string (DataObject* base);
VALA_EXTERN gchar* tombstone_get_md5 (Tombstone* self);
VALA_EXTERN gboolean is_string_empty (const gchar* s);
VALA_EXTERN TombstoneReason tombstone_get_reason (Tombstone* self);
VALA_EXTERN void tombstone_move (Tombstone* self,
                     GFile* file);
VALA_EXTERN void tombstone_table_update_file (TombstoneTable* self,
                                  TombstoneID* tombstone_id,
                                  const gchar* filepath,
                                  GError** error);
VALA_EXTERN void data_object_notify_altered (DataObject* self,
                                 Alteration* alteration);
VALA_EXTERN Alteration* alteration_new (const gchar* subject,
                            const gchar* detail);
VALA_EXTERN Alteration* alteration_construct (GType object_type,
                                  const gchar* subject,
                                  const gchar* detail);
VALA_EXTERN gboolean tombstone_matches (Tombstone* self,
                            GFile* file,
                            gint64 filesize,
                            const gchar* md5);
static void tombstone_real_destroy (DataSource* base);
VALA_EXTERN void tombstone_table_remove (TombstoneTable* self,
                             TombstoneID* tombstone_id,
                             GError** error);
static void tombstone_finalize (GObject * obj);
static GType tombstone_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
tombstone_source_collection_get_instance_private (TombstoneSourceCollection* self)
{
	return G_STRUCT_MEMBER_P (self, TombstoneSourceCollection_private_offset);
}

static guint
_file_hash_gee_hash_data_func (gconstpointer v,
                               gpointer self)
{
	guint result;
	result = file_hash ((GFile*) v);
	return result;
}

static gboolean
_file_equal_gee_equal_data_func (gconstpointer a,
                                 gconstpointer b,
                                 gpointer self)
{
	gboolean result;
	result = file_equal ((GFile*) a, (GFile*) b);
	return result;
}

static gint64
_tombstone_source_collection_get_tombstone_id_get_source_database_key (DataSource* source,
                                                                       gpointer self)
{
	gint64 result;
	result = tombstone_source_collection_get_tombstone_id (source);
	return result;
}

TombstoneSourceCollection*
tombstone_source_collection_construct (GType object_type)
{
	TombstoneSourceCollection* self = NULL;
	self = (TombstoneSourceCollection*) database_source_collection_construct (object_type, "Tombstones", _tombstone_source_collection_get_tombstone_id_get_source_database_key, NULL);
	return self;
}

TombstoneSourceCollection*
tombstone_source_collection_new (void)
{
	return tombstone_source_collection_construct (TYPE_TOMBSTONE_SOURCE_COLLECTION);
}

static gboolean
tombstone_source_collection_real_holds_type_of_source (SourceCollection* base,
                                                       DataSource* source)
{
	TombstoneSourceCollection * self;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TOMBSTONE_SOURCE_COLLECTION, TombstoneSourceCollection);
	g_return_val_if_fail (IS_DATA_SOURCE (source), FALSE);
	result = IS_TOMBSTONE (source);
	return result;
}

static gint64
tombstone_source_collection_get_tombstone_id (DataSource* source)
{
	TombstoneID _tmp0_ = {0};
	gint64 result;
	g_return_val_if_fail (IS_DATA_SOURCE (source), -1LL);
	tombstone_get_tombstone_id (G_TYPE_CHECK_INSTANCE_CAST (source, TYPE_TOMBSTONE, Tombstone), &_tmp0_);
	result = _tmp0_.id;
	return result;
}

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

static void
tombstone_source_collection_real_notify_contents_altered (DataCollection* base,
                                                          GeeIterable* added,
                                                          GeeIterable* removed)
{
	TombstoneSourceCollection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TOMBSTONE_SOURCE_COLLECTION, TombstoneSourceCollection);
	g_return_if_fail ((added == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (added, GEE_TYPE_ITERABLE));
	g_return_if_fail ((removed == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (removed, GEE_TYPE_ITERABLE));
	if (added != NULL) {
		{
			GeeIterator* _object_it = NULL;
			GeeIterator* _tmp0_;
			_tmp0_ = gee_iterable_iterator (added);
			_object_it = _tmp0_;
			while (TRUE) {
				GeeIterator* _tmp1_;
				DataObject* object = NULL;
				GeeIterator* _tmp2_;
				gpointer _tmp3_;
				Tombstone* tombstone = NULL;
				DataObject* _tmp4_;
				Tombstone* _tmp5_;
				GeeHashMap* _tmp6_;
				Tombstone* _tmp7_;
				GFile* _tmp8_;
				GFile* _tmp9_;
				Tombstone* _tmp10_;
				_tmp1_ = _object_it;
				if (!gee_iterator_next (_tmp1_)) {
					break;
				}
				_tmp2_ = _object_it;
				_tmp3_ = gee_iterator_get (_tmp2_);
				object = (DataObject*) _tmp3_;
				_tmp4_ = object;
				_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp4_, TYPE_TOMBSTONE, Tombstone));
				tombstone = _tmp5_;
				_tmp6_ = self->priv->file_map;
				_tmp7_ = tombstone;
				_tmp8_ = tombstone_get_file (_tmp7_);
				_tmp9_ = _tmp8_;
				_tmp10_ = tombstone;
				gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp9_, _tmp10_);
				_g_object_unref0 (_tmp9_);
				_g_object_unref0 (tombstone);
				_g_object_unref0 (object);
			}
			_g_object_unref0 (_object_it);
		}
	}
	if (removed != NULL) {
		{
			GeeIterator* _object_it = NULL;
			GeeIterator* _tmp11_;
			_tmp11_ = gee_iterable_iterator (removed);
			_object_it = _tmp11_;
			while (TRUE) {
				GeeIterator* _tmp12_;
				DataObject* object = NULL;
				GeeIterator* _tmp13_;
				gpointer _tmp14_;
				Tombstone* tombstone = NULL;
				DataObject* _tmp15_;
				Tombstone* _tmp16_;
				GeeHashMap* _tmp17_;
				Tombstone* _tmp18_;
				GFile* _tmp19_;
				GFile* _tmp20_;
				gboolean _tmp21_;
				_tmp12_ = _object_it;
				if (!gee_iterator_next (_tmp12_)) {
					break;
				}
				_tmp13_ = _object_it;
				_tmp14_ = gee_iterator_get (_tmp13_);
				object = (DataObject*) _tmp14_;
				_tmp15_ = object;
				_tmp16_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, TYPE_TOMBSTONE, Tombstone));
				tombstone = _tmp16_;
				_tmp17_ = self->priv->file_map;
				_tmp18_ = tombstone;
				_tmp19_ = tombstone_get_file (_tmp18_);
				_tmp20_ = _tmp19_;
				_tmp21_ = gee_abstract_map_has_key (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp20_);
				_g_object_unref0 (_tmp20_);
				if (_tmp21_) {
					gboolean is_removed = FALSE;
					GeeHashMap* _tmp22_;
					Tombstone* _tmp23_;
					GFile* _tmp24_;
					GFile* _tmp25_;
					gboolean _tmp26_;
					_tmp22_ = self->priv->file_map;
					_tmp23_ = tombstone;
					_tmp24_ = tombstone_get_file (_tmp23_);
					_tmp25_ = _tmp24_;
					_tmp26_ = gee_abstract_map_unset (G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp25_, NULL);
					_g_object_unref0 (_tmp25_);
					is_removed = _tmp26_;
					_vala_assert (is_removed, "is_removed");
				}
				_g_object_unref0 (tombstone);
				_g_object_unref0 (object);
			}
			_g_object_unref0 (_object_it);
		}
	}
	DATA_COLLECTION_CLASS (tombstone_source_collection_parent_class)->notify_contents_altered (G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATABASE_SOURCE_COLLECTION, DatabaseSourceCollection), TYPE_DATA_COLLECTION, DataCollection), added, removed);
}

static void
tombstone_source_collection_real_notify_items_altered (DataCollection* base,
                                                       GeeMap* items)
{
	TombstoneSourceCollection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TOMBSTONE_SOURCE_COLLECTION, TombstoneSourceCollection);
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (items, GEE_TYPE_MAP));
	{
		GeeIterator* _object_it = NULL;
		GeeSet* _tmp0_;
		GeeSet* _tmp1_;
		GeeSet* _tmp2_;
		GeeIterator* _tmp3_;
		GeeIterator* _tmp4_;
		_tmp0_ = gee_map_get_keys (items);
		_tmp1_ = _tmp0_;
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GEE_TYPE_ITERABLE, GeeIterable));
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp2_);
		_object_it = _tmp4_;
		while (TRUE) {
			GeeIterator* _tmp5_;
			DataObject* object = NULL;
			GeeIterator* _tmp6_;
			gpointer _tmp7_;
			Alteration* alteration = NULL;
			DataObject* _tmp8_;
			gpointer _tmp9_;
			Alteration* _tmp10_;
			Tombstone* tombstone = NULL;
			DataObject* _tmp11_;
			Tombstone* _tmp12_;
			_tmp5_ = _object_it;
			if (!gee_iterator_next (_tmp5_)) {
				break;
			}
			_tmp6_ = _object_it;
			_tmp7_ = gee_iterator_get (_tmp6_);
			object = (DataObject*) _tmp7_;
			_tmp8_ = object;
			_tmp9_ = gee_map_get (items, _tmp8_);
			alteration = (Alteration*) _tmp9_;
			_tmp10_ = alteration;
			if (!alteration_has_subject (_tmp10_, "file")) {
				_alteration_unref0 (alteration);
				_g_object_unref0 (object);
				continue;
			}
			_tmp11_ = object;
			_tmp12_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, TYPE_TOMBSTONE, Tombstone));
			tombstone = _tmp12_;
			{
				GeeIterator* _detail_it = NULL;
				Alteration* _tmp13_;
				GeeCollection* _tmp14_;
				GeeCollection* _tmp15_;
				GeeIterator* _tmp16_;
				GeeIterator* _tmp17_;
				_tmp13_ = alteration;
				_tmp14_ = alteration_get_details (_tmp13_, "file");
				_tmp15_ = _tmp14_;
				_tmp16_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, GEE_TYPE_ITERABLE, GeeIterable));
				_tmp17_ = _tmp16_;
				_g_object_unref0 (_tmp15_);
				_detail_it = _tmp17_;
				while (TRUE) {
					GeeIterator* _tmp18_;
					gchar* detail = NULL;
					GeeIterator* _tmp19_;
					gpointer _tmp20_;
					GFile* old_file = NULL;
					const gchar* _tmp21_;
					GFile* _tmp22_;
					gboolean removed = FALSE;
					GeeHashMap* _tmp23_;
					GFile* _tmp24_;
					GeeHashMap* _tmp25_;
					Tombstone* _tmp26_;
					GFile* _tmp27_;
					GFile* _tmp28_;
					Tombstone* _tmp29_;
					_tmp18_ = _detail_it;
					if (!gee_iterator_next (_tmp18_)) {
						break;
					}
					_tmp19_ = _detail_it;
					_tmp20_ = gee_iterator_get (_tmp19_);
					detail = (gchar*) _tmp20_;
					_tmp21_ = detail;
					_tmp22_ = g_file_new_for_path (_tmp21_);
					old_file = _tmp22_;
					_tmp23_ = self->priv->file_map;
					_tmp24_ = old_file;
					removed = gee_abstract_map_unset (G_TYPE_CHECK_INSTANCE_CAST (_tmp23_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp24_, NULL);
					_vala_assert (removed, "removed");
					_tmp25_ = self->priv->file_map;
					_tmp26_ = tombstone;
					_tmp27_ = tombstone_get_file (_tmp26_);
					_tmp28_ = _tmp27_;
					_tmp29_ = tombstone;
					gee_abstract_map_set (G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), _tmp28_, _tmp29_);
					_g_object_unref0 (_tmp28_);
					_g_object_unref0 (old_file);
					_g_free0 (detail);
					break;
				}
				_g_object_unref0 (_detail_it);
			}
			_g_object_unref0 (tombstone);
			_alteration_unref0 (alteration);
			_g_object_unref0 (object);
		}
		_g_object_unref0 (_object_it);
	}
}

Tombstone*
tombstone_source_collection_locate (TombstoneSourceCollection* self,
                                    GFile* file)
{
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	Tombstone* result;
	g_return_val_if_fail (IS_TOMBSTONE_SOURCE_COLLECTION (self), NULL);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (file, g_file_get_type ()), NULL);
	_tmp0_ = self->priv->file_map;
	_tmp1_ = gee_abstract_map_get (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), file);
	result = (Tombstone*) _tmp1_;
	return result;
}

gboolean
tombstone_source_collection_matches (TombstoneSourceCollection* self,
                                     GFile* file)
{
	GeeHashMap* _tmp0_;
	gboolean result;
	g_return_val_if_fail (IS_TOMBSTONE_SOURCE_COLLECTION (self), FALSE);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (file, g_file_get_type ()), FALSE);
	_tmp0_ = self->priv->file_map;
	result = gee_abstract_map_has_key (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_ABSTRACT_MAP, GeeAbstractMap), file);
	return result;
}

void
tombstone_source_collection_resurrect (TombstoneSourceCollection* self,
                                       Tombstone* tombstone)
{
	Marker* _tmp0_;
	Marker* _tmp1_;
	g_return_if_fail (IS_TOMBSTONE_SOURCE_COLLECTION (self));
	g_return_if_fail (IS_TOMBSTONE (tombstone));
	_tmp0_ = data_collection_mark (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATA_COLLECTION, DataCollection), G_TYPE_CHECK_INSTANCE_CAST (tombstone, TYPE_DATA_OBJECT, DataObject));
	_tmp1_ = _tmp0_;
	source_collection_destroy_marked (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SOURCE_COLLECTION, SourceCollection), _tmp1_, FALSE, NULL, NULL, NULL);
	_g_object_unref0 (_tmp1_);
}

void
tombstone_source_collection_resurrect_many (TombstoneSourceCollection* self,
                                            GeeCollection* tombstones)
{
	Marker* marker = NULL;
	Marker* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (IS_TOMBSTONE_SOURCE_COLLECTION (self));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (tombstones, GEE_TYPE_COLLECTION));
	_tmp0_ = data_collection_mark_many (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATA_COLLECTION, DataCollection), tombstones);
	marker = _tmp0_;
	data_collection_freeze_notifications (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATA_COLLECTION, DataCollection));
	database_table_begin_transaction ();
	source_collection_destroy_marked (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_SOURCE_COLLECTION, SourceCollection), marker, FALSE, NULL, NULL, NULL);
	{
		database_table_commit_transaction (&_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == DATABASE_ERROR) {
				goto __catch0_database_error;
			}
			_g_object_unref0 (marker);
			g_critical ("file %s: line %d: unexpected 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;
		}
	}
	goto __finally0;
	__catch0_database_error:
	{
		GError* err = NULL;
		GError* _tmp1_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = err;
		app_window_database_error (_tmp1_);
		_g_error_free0 (err);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (marker);
		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;
	}
	data_collection_thaw_notifications (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATA_COLLECTION, DataCollection));
	_g_object_unref0 (marker);
}

void
tombstone_source_collection_launch_scan (TombstoneSourceCollection* self,
                                         DirectoryMonitor* monitor,
                                         GCancellable* cancellable)
{
	g_return_if_fail (IS_TOMBSTONE_SOURCE_COLLECTION (self));
	g_return_if_fail ((monitor == NULL) || IS_DIRECTORY_MONITOR (monitor));
	g_return_if_fail ((cancellable == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (cancellable, g_cancellable_get_type ()));
	tombstone_source_collection_async_scan (self, monitor, cancellable, NULL, NULL);
}

static void
tombstone_source_collection_async_scan_data_free (gpointer _data)
{
	TombstoneSourceCollectionAsyncScanData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->monitor);
	_g_object_unref0 (_data_->cancellable);
	_data_collection_unref0 (_data_->self);
	g_slice_free (TombstoneSourceCollectionAsyncScanData, _data_);
}

static gpointer
_data_collection_ref0 (gpointer self)
{
	return self ? data_collection_ref (self) : NULL;
}

static void
tombstone_source_collection_async_scan (TombstoneSourceCollection* self,
                                        DirectoryMonitor* monitor,
                                        GCancellable* cancellable,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	TombstoneSourceCollectionAsyncScanData* _data_;
	TombstoneSourceCollection* _tmp0_;
	DirectoryMonitor* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (IS_TOMBSTONE_SOURCE_COLLECTION (self));
	g_return_if_fail ((monitor == NULL) || IS_DIRECTORY_MONITOR (monitor));
	g_return_if_fail ((cancellable == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (cancellable, g_cancellable_get_type ()));
	_data_ = g_slice_new0 (TombstoneSourceCollectionAsyncScanData);
	_data_->_async_result = g_task_new (NULL, cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, tombstone_source_collection_async_scan_data_free);
	_tmp0_ = _data_collection_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (monitor);
	_g_object_unref0 (_data_->monitor);
	_data_->monitor = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	tombstone_source_collection_async_scan_co (_data_);
}

static void
tombstone_source_collection_async_scan_finish (TombstoneSourceCollection* self,
                                               GAsyncResult* _res_)
{
	TombstoneSourceCollectionAsyncScanData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		return;
	}
}

static void
tombstone_source_collection_async_scan_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	TombstoneSourceCollectionAsyncScanData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	tombstone_source_collection_async_scan_co (_data_);
}

static gboolean
_tombstone_source_collection_async_scan_co_gsource_func (gpointer self)
{
	gboolean result;
	result = tombstone_source_collection_async_scan_co (self);
	return result;
}

static gboolean
tombstone_source_collection_async_scan_co (TombstoneSourceCollectionAsyncScanData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = data_collection_start_marking (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, TYPE_DATA_COLLECTION, DataCollection));
	_data_->marker = _data_->_tmp0_;
	{
		_data_->_tmp1_ = data_collection_get_dataset_copy (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, TYPE_DATA_COLLECTION, DataCollection));
		_data_->_tmp2_ = _data_->_tmp1_;
		_data_->_tmp3_ = data_set_get_all (_data_->_tmp2_);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_set_unref0 (_data_->_tmp2_);
		_data_->_object_list = _data_->_tmp4_;
		_data_->_tmp5_ = _data_->_object_list;
		_data_->_tmp6_ = gee_collection_get_size (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp5_, GEE_TYPE_COLLECTION, GeeCollection));
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_object_size = _data_->_tmp7_;
		_data_->_object_index = -1;
		while (TRUE) {
			_data_->_object_index = _data_->_object_index + 1;
			_data_->_tmp8_ = _data_->_object_index;
			_data_->_tmp9_ = _data_->_object_size;
			if (!(_data_->_tmp8_ < _data_->_tmp9_)) {
				break;
			}
			_data_->_tmp10_ = _data_->_object_list;
			_data_->_tmp11_ = gee_list_get (_data_->_tmp10_, _data_->_object_index);
			_data_->object = (DataObject*) _data_->_tmp11_;
			_data_->_tmp12_ = _data_->object;
			_data_->_tmp13_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp12_, TYPE_TOMBSTONE, Tombstone));
			_data_->tombstone = _data_->_tmp13_;
			_data_->_tmp14_ = _data_->tombstone;
			_data_->_tmp15_ = tombstone_get_file (_data_->_tmp14_);
			_data_->file = _data_->_tmp15_;
			_data_->info = NULL;
			if (_data_->monitor != NULL) {
				_data_->_tmp16_ = _data_->file;
				_data_->_tmp17_ = directory_monitor_get_file_info (_data_->monitor, _data_->_tmp16_);
				_g_object_unref0 (_data_->info);
				_data_->info = _data_->_tmp17_;
			}
			_data_->_tmp18_ = _data_->info;
			if (_data_->_tmp18_ == NULL) {
				{
					_data_->_tmp20_ = _data_->file;
					_data_->_state_ = 1;
					g_file_query_info_async (_data_->_tmp20_, G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, G_PRIORITY_LOW, _data_->cancellable, tombstone_source_collection_async_scan_ready, _data_);
					return FALSE;
					_state_1:
					_data_->_tmp21_ = g_file_query_info_finish (_data_->_tmp20_, _data_->_res_, &_data_->_inner_error0_);
					_data_->_tmp19_ = _data_->_tmp21_;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						goto __catch0_g_error;
					}
					_data_->_tmp22_ = _data_->_tmp19_;
					_data_->_tmp19_ = NULL;
					_g_object_unref0 (_data_->info);
					_data_->info = _data_->_tmp22_;
					_g_object_unref0 (_data_->_tmp19_);
				}
				goto __finally0;
				__catch0_g_error:
				{
					_data_->err = _data_->_inner_error0_;
					_data_->_inner_error0_ = NULL;
					_data_->_tmp23_ = _data_->err;
					if (g_error_matches (_data_->_tmp23_, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
						_g_error_free0 (_data_->err);
						_g_object_unref0 (_data_->info);
						_g_object_unref0 (_data_->file);
						_g_object_unref0 (_data_->tombstone);
						_g_object_unref0 (_data_->object);
						break;
					}
					_data_->_tmp24_ = _data_->err;
					if (!g_error_matches (_data_->_tmp24_, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) {
						_data_->_tmp25_ = _data_->file;
						_data_->_tmp26_ = g_file_get_path (_data_->_tmp25_);
						_data_->_tmp27_ = _data_->_tmp26_;
						_data_->_tmp28_ = _data_->err;
						_data_->_tmp29_ = _data_->_tmp28_->message;
						g_warning ("Tombstone.vala:138: Unable to check for existence of tombstoned file %" \
"s: %s", _data_->_tmp27_, _data_->_tmp29_);
						_g_free0 (_data_->_tmp27_);
					}
					_g_error_free0 (_data_->err);
				}
				__finally0:
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_g_object_unref0 (_data_->info);
					_g_object_unref0 (_data_->file);
					_g_object_unref0 (_data_->tombstone);
					_g_object_unref0 (_data_->object);
					_g_object_unref0 (_data_->_object_list);
					_g_object_unref0 (_data_->marker);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
					g_clear_error (&_data_->_inner_error0_);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
			}
			_data_->_tmp30_ = _data_->info;
			if (_data_->_tmp30_ == NULL) {
				_data_->_tmp31_ = _data_->marker;
				_data_->_tmp32_ = _data_->tombstone;
				marker_mark (_data_->_tmp31_, G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp32_, TYPE_DATA_OBJECT, DataObject));
			}
			g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _tombstone_source_collection_async_scan_co_gsource_func, _data_, NULL);
			_data_->_state_ = 2;
			return FALSE;
			_state_2:
			;
			_g_object_unref0 (_data_->info);
			_g_object_unref0 (_data_->file);
			_g_object_unref0 (_data_->tombstone);
			_g_object_unref0 (_data_->object);
		}
		_g_object_unref0 (_data_->_object_list);
	}
	_data_->_tmp33_ = _data_->marker;
	if (marker_get_count (_data_->_tmp33_) > 0) {
		_data_->_tmp34_ = _data_->marker;
		g_debug ("Tombstone.vala:153: Resurrecting %d tombstones with no backing file", marker_get_count (_data_->_tmp34_));
		database_table_begin_transaction ();
		_data_->_tmp35_ = _data_->marker;
		source_collection_destroy_marked (G_TYPE_CHECK_INSTANCE_CAST (_data_->self, TYPE_SOURCE_COLLECTION, SourceCollection), _data_->_tmp35_, FALSE, NULL, NULL, NULL);
		{
			database_table_commit_transaction (&_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				if (_data_->_inner_error0_->domain == DATABASE_ERROR) {
					goto __catch1_database_error;
				}
				_g_object_unref0 (_data_->marker);
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
				g_clear_error (&_data_->_inner_error0_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
		goto __finally1;
		__catch1_database_error:
		{
			_data_->err2 = _data_->_inner_error0_;
			_data_->_inner_error0_ = NULL;
			_data_->_tmp36_ = _data_->err2;
			app_window_database_error (_data_->_tmp36_);
			_g_error_free0 (_data_->err2);
		}
		__finally1:
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->marker);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_g_object_unref0 (_data_->marker);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
tombstone_source_collection_class_init (TombstoneSourceCollectionClass * klass,
                                        gpointer klass_data)
{
	tombstone_source_collection_parent_class = g_type_class_peek_parent (klass);
	((DataCollectionClass *) klass)->finalize = tombstone_source_collection_finalize;
	g_type_class_adjust_private_offset (klass, &TombstoneSourceCollection_private_offset);
	((SourceCollectionClass *) klass)->holds_type_of_source = (gboolean (*) (SourceCollection*, DataSource*)) tombstone_source_collection_real_holds_type_of_source;
	((DataCollectionClass *) klass)->notify_contents_altered = (void (*) (DataCollection*, GeeIterable*, GeeIterable*)) tombstone_source_collection_real_notify_contents_altered;
	((DataCollectionClass *) klass)->notify_items_altered = (void (*) (DataCollection*, GeeMap*)) tombstone_source_collection_real_notify_items_altered;
}

static void
tombstone_source_collection_instance_init (TombstoneSourceCollection * self,
                                           gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = tombstone_source_collection_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (g_file_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, TYPE_TOMBSTONE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _file_hash_gee_hash_data_func, NULL, NULL, _file_equal_gee_equal_data_func, NULL, NULL, NULL, NULL, NULL);
	self->priv->file_map = _tmp0_;
}

static void
tombstone_source_collection_finalize (DataCollection * obj)
{
	TombstoneSourceCollection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TOMBSTONE_SOURCE_COLLECTION, TombstoneSourceCollection);
	_g_object_unref0 (self->priv->file_map);
	DATA_COLLECTION_CLASS (tombstone_source_collection_parent_class)->finalize (obj);
}

static GType
tombstone_source_collection_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TombstoneSourceCollectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tombstone_source_collection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TombstoneSourceCollection), 0, (GInstanceInitFunc) tombstone_source_collection_instance_init, NULL };
	GType tombstone_source_collection_type_id;
	tombstone_source_collection_type_id = g_type_register_static (TYPE_DATABASE_SOURCE_COLLECTION, "TombstoneSourceCollection", &g_define_type_info, 0);
	TombstoneSourceCollection_private_offset = g_type_add_instance_private (tombstone_source_collection_type_id, sizeof (TombstoneSourceCollectionPrivate));
	return tombstone_source_collection_type_id;
}

GType
tombstone_source_collection_get_type (void)
{
	static volatile gsize tombstone_source_collection_type_id__once = 0;
	if (g_once_init_enter (&tombstone_source_collection_type_id__once)) {
		GType tombstone_source_collection_type_id;
		tombstone_source_collection_type_id = tombstone_source_collection_get_type_once ();
		g_once_init_leave (&tombstone_source_collection_type_id__once, tombstone_source_collection_type_id);
	}
	return tombstone_source_collection_type_id__once;
}

TombstonedFile*
tombstoned_file_construct (GType object_type,
                           GFile* file,
                           gint64 filesize,
                           const gchar* md5)
{
	TombstonedFile* self = NULL;
	GFile* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (file, g_file_get_type ()), NULL);
	self = (TombstonedFile*) g_type_create_instance (object_type);
	_tmp0_ = _g_object_ref0 (file);
	_g_object_unref0 (self->file);
	self->file = _tmp0_;
	self->filesize = filesize;
	_tmp1_ = g_strdup (md5);
	_g_free0 (self->md5);
	self->md5 = _tmp1_;
	return self;
}

TombstonedFile*
tombstoned_file_new (GFile* file,
                     gint64 filesize,
                     const gchar* md5)
{
	return tombstoned_file_construct (TYPE_TOMBSTONED_FILE, file, filesize, md5);
}

static void
value_tombstoned_file_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
value_tombstoned_file_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		tombstoned_file_unref (value->data[0].v_pointer);
	}
}

static void
value_tombstoned_file_copy_value (const GValue* src_value,
                                  GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = tombstoned_file_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
value_tombstoned_file_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
value_tombstoned_file_collect_value (GValue* value,
                                     guint n_collect_values,
                                     GTypeCValue* collect_values,
                                     guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		TombstonedFile * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = tombstoned_file_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
value_tombstoned_file_lcopy_value (const GValue* value,
                                   guint n_collect_values,
                                   GTypeCValue* collect_values,
                                   guint collect_flags)
{
	TombstonedFile ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = tombstoned_file_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
param_spec_tombstoned_file (const gchar* name,
                            const gchar* nick,
                            const gchar* blurb,
                            GType object_type,
                            GParamFlags flags)
{
	ParamSpecTombstonedFile* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_TOMBSTONED_FILE), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
value_get_tombstoned_file (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TOMBSTONED_FILE), NULL);
	return value->data[0].v_pointer;
}

void
value_set_tombstoned_file (GValue* value,
                           gpointer v_object)
{
	TombstonedFile * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TOMBSTONED_FILE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TOMBSTONED_FILE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		tombstoned_file_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		tombstoned_file_unref (old);
	}
}

void
value_take_tombstoned_file (GValue* value,
                            gpointer v_object)
{
	TombstonedFile * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_TOMBSTONED_FILE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_TOMBSTONED_FILE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		tombstoned_file_unref (old);
	}
}

static void
tombstoned_file_class_init (TombstonedFileClass * klass,
                            gpointer klass_data)
{
	tombstoned_file_parent_class = g_type_class_peek_parent (klass);
	((TombstonedFileClass *) klass)->finalize = tombstoned_file_finalize;
}

static void
tombstoned_file_instance_init (TombstonedFile * self,
                               gpointer klass)
{
	self->ref_count = 1;
}

static void
tombstoned_file_finalize (TombstonedFile * obj)
{
	TombstonedFile * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TOMBSTONED_FILE, TombstonedFile);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->file);
	_g_free0 (self->md5);
}

static GType
tombstoned_file_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_tombstoned_file_init, value_tombstoned_file_free_value, value_tombstoned_file_copy_value, value_tombstoned_file_peek_pointer, "p", value_tombstoned_file_collect_value, "p", value_tombstoned_file_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (TombstonedFileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tombstoned_file_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TombstonedFile), 0, (GInstanceInitFunc) tombstoned_file_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType tombstoned_file_type_id;
	tombstoned_file_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TombstonedFile", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return tombstoned_file_type_id;
}

GType
tombstoned_file_get_type (void)
{
	static volatile gsize tombstoned_file_type_id__once = 0;
	if (g_once_init_enter (&tombstoned_file_type_id__once)) {
		GType tombstoned_file_type_id;
		tombstoned_file_type_id = tombstoned_file_get_type_once ();
		g_once_init_leave (&tombstoned_file_type_id__once, tombstoned_file_type_id);
	}
	return tombstoned_file_type_id__once;
}

gpointer
tombstoned_file_ref (gpointer instance)
{
	TombstonedFile * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
tombstoned_file_unref (gpointer instance)
{
	TombstonedFile * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		TOMBSTONED_FILE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
tombstone_get_instance_private (Tombstone* self)
{
	return G_STRUCT_MEMBER_P (self, Tombstone_private_offset);
}

gint
tombstone_reason_serialize (TombstoneReason self)
{
	gint result;
	result = (gint) self;
	return result;
}

TombstoneReason
tombstone_reason_unserialize (gint value)
{
	TombstoneReason result;
	switch ((TombstoneReason) value) {
		case TOMBSTONE_REASON_AUTO_DETECTED_DUPLICATE:
		{
			result = TOMBSTONE_REASON_AUTO_DETECTED_DUPLICATE;
			return result;
		}
		default:
		case TOMBSTONE_REASON_REMOVED_BY_USER:
		{
			result = TOMBSTONE_REASON_REMOVED_BY_USER;
			return result;
		}
	}
}

static GType
tombstone_reason_get_type_once (void)
{
	static const GEnumValue values[] = {{TOMBSTONE_REASON_REMOVED_BY_USER, "TOMBSTONE_REASON_REMOVED_BY_USER", "removed-by-user"}, {TOMBSTONE_REASON_AUTO_DETECTED_DUPLICATE, "TOMBSTONE_REASON_AUTO_DETECTED_DUPLICATE", "auto-detected-duplicate"}, {0, NULL, NULL}};
	GType tombstone_reason_type_id;
	tombstone_reason_type_id = g_enum_register_static ("TombstoneReason", values);
	return tombstone_reason_type_id;
}

GType
tombstone_reason_get_type (void)
{
	static volatile gsize tombstone_reason_type_id__once = 0;
	if (g_once_init_enter (&tombstone_reason_type_id__once)) {
		GType tombstone_reason_type_id;
		tombstone_reason_type_id = tombstone_reason_get_type_once ();
		g_once_init_leave (&tombstone_reason_type_id__once, tombstone_reason_type_id);
	}
	return tombstone_reason_type_id__once;
}

static gpointer
_tombstone_row_ref0 (gpointer self)
{
	return self ? tombstone_row_ref (self) : NULL;
}

static Tombstone*
tombstone_construct (GType object_type,
                     TombstoneRow* row)
{
	Tombstone * self = NULL;
	TombstoneRow* _tmp0_;
	g_return_val_if_fail (IS_TOMBSTONE_ROW (row), NULL);
	self = (Tombstone*) data_source_construct (object_type, DATA_OBJECT_INVALID_OBJECT_ID);
	_tmp0_ = _tombstone_row_ref0 (row);
	_tombstone_row_unref0 (self->priv->row);
	self->priv->row = _tmp0_;
	return self;
}

static Tombstone*
tombstone_new (TombstoneRow* row)
{
	return tombstone_construct (TYPE_TOMBSTONE, row);
}

void
tombstone_init (void)
{
	TombstoneSourceCollection* _tmp0_;
	TombstoneRow** rows = NULL;
	gint rows_length1;
	gint _rows_size_;
	TombstoneRow** _tmp9_;
	gint _tmp9__length1;
	GError* _inner_error0_ = NULL;
	_tmp0_ = tombstone_source_collection_new ();
	_data_collection_unref0 (tombstone_global);
	tombstone_global = _tmp0_;
	rows = NULL;
	rows_length1 = 0;
	_rows_size_ = rows_length1;
	{
		TombstoneRow** _tmp1_ = NULL;
		TombstoneTable* _tmp2_;
		TombstoneTable* _tmp3_;
		gint _tmp4_ = 0;
		TombstoneRow** _tmp5_;
		TombstoneRow** _tmp6_;
		gint _tmp6__length1;
		gint _tmp1__length1;
		gint __tmp1__size_;
		TombstoneRow** _tmp7_;
		gint _tmp7__length1;
		_tmp2_ = tombstone_table_get_instance ();
		_tmp3_ = _tmp2_;
		_tmp5_ = tombstone_table_fetch_all (_tmp3_, &_tmp4_, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_tmp6__length1 = _tmp4_;
		_database_table_unref0 (_tmp3_);
		_tmp1_ = _tmp6_;
		_tmp1__length1 = _tmp6__length1;
		__tmp1__size_ = _tmp1__length1;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == DATABASE_ERROR) {
				goto __catch0_database_error;
			}
			rows = (_vala_array_free (rows, rows_length1, (GDestroyNotify) tombstone_row_unref), NULL);
			g_critical ("file %s: line %d: unexpected 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;
		}
		_tmp7_ = _tmp1_;
		_tmp7__length1 = _tmp1__length1;
		_tmp1_ = NULL;
		_tmp1__length1 = 0;
		rows = (_vala_array_free (rows, rows_length1, (GDestroyNotify) tombstone_row_unref), NULL);
		rows = _tmp7_;
		rows_length1 = _tmp7__length1;
		_rows_size_ = rows_length1;
		_tmp1_ = (_vala_array_free (_tmp1_, _tmp1__length1, (GDestroyNotify) tombstone_row_unref), NULL);
	}
	goto __finally0;
	__catch0_database_error:
	{
		GError* err = NULL;
		GError* _tmp8_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp8_ = err;
		app_window_database_error (_tmp8_);
		_g_error_free0 (err);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		rows = (_vala_array_free (rows, rows_length1, (GDestroyNotify) tombstone_row_unref), NULL);
		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;
	}
	_tmp9_ = rows;
	_tmp9__length1 = rows_length1;
	if (_tmp9_ != NULL) {
		GeeArrayList* tombstones = NULL;
		GeeArrayList* _tmp10_;
		TombstoneRow** _tmp11_;
		gint _tmp11__length1;
		TombstoneSourceCollection* _tmp17_;
		GeeArrayList* _tmp18_;
		GeeCollection* _tmp19_;
		GeeCollection* _tmp20_;
		_tmp10_ = gee_array_list_new (TYPE_TOMBSTONE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
		tombstones = _tmp10_;
		_tmp11_ = rows;
		_tmp11__length1 = rows_length1;
		{
			TombstoneRow** row_collection = NULL;
			gint row_collection_length1 = 0;
			gint _row_collection_size_ = 0;
			gint row_it = 0;
			row_collection = _tmp11_;
			row_collection_length1 = _tmp11__length1;
			for (row_it = 0; row_it < row_collection_length1; row_it = row_it + 1) {
				TombstoneRow* _tmp12_;
				TombstoneRow* row = NULL;
				_tmp12_ = _tombstone_row_ref0 (row_collection[row_it]);
				row = _tmp12_;
				{
					GeeArrayList* _tmp13_;
					TombstoneRow* _tmp14_;
					Tombstone* _tmp15_;
					Tombstone* _tmp16_;
					_tmp13_ = tombstones;
					_tmp14_ = row;
					_tmp15_ = tombstone_new (_tmp14_);
					_tmp16_ = _tmp15_;
					gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp16_);
					_g_object_unref0 (_tmp16_);
					_tombstone_row_unref0 (row);
				}
			}
		}
		_tmp17_ = tombstone_global;
		_tmp18_ = tombstones;
		_tmp19_ = data_collection_add_many (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, TYPE_DATA_COLLECTION, DataCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, GEE_TYPE_COLLECTION, GeeCollection), NULL, NULL);
		_tmp20_ = _tmp19_;
		_g_object_unref0 (_tmp20_);
		_g_object_unref0 (tombstones);
	}
	rows = (_vala_array_free (rows, rows_length1, (GDestroyNotify) tombstone_row_unref), NULL);
}

void
tombstone_terminate (void)
{
}

static gpointer
_backing_file_state_ref0 (gpointer self)
{
	return self ? backing_file_state_ref (self) : NULL;
}

void
tombstone_entomb_many_sources (GeeCollection* sources,
                               TombstoneReason reason,
                               GError** error)
{
	GeeCollection* files = NULL;
	GeeArrayList* _tmp0_;
	GeeCollection* _tmp18_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (sources, GEE_TYPE_COLLECTION));
	_tmp0_ = gee_array_list_new (TYPE_TOMBSTONED_FILE, (GBoxedCopyFunc) tombstoned_file_ref, (GDestroyNotify) tombstoned_file_unref, NULL, NULL, NULL);
	files = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GEE_TYPE_COLLECTION, GeeCollection);
	{
		GeeIterator* _source_it = NULL;
		GeeIterator* _tmp1_;
		_tmp1_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (sources, GEE_TYPE_ITERABLE, GeeIterable));
		_source_it = _tmp1_;
		while (TRUE) {
			GeeIterator* _tmp2_;
			MediaSource* source = NULL;
			GeeIterator* _tmp3_;
			gpointer _tmp4_;
			MediaSource* _tmp5_;
			gint _tmp6_ = 0;
			BackingFileState** _tmp7_;
			_tmp2_ = _source_it;
			if (!gee_iterator_next (_tmp2_)) {
				break;
			}
			_tmp3_ = _source_it;
			_tmp4_ = gee_iterator_get (_tmp3_);
			source = (MediaSource*) _tmp4_;
			_tmp5_ = source;
			_tmp7_ = media_source_get_backing_files_state (_tmp5_, &_tmp6_);
			{
				BackingFileState** state_collection = NULL;
				gint state_collection_length1 = 0;
				gint _state_collection_size_ = 0;
				gint state_it = 0;
				state_collection = _tmp7_;
				state_collection_length1 = _tmp6_;
				for (state_it = 0; state_it < state_collection_length1; state_it = state_it + 1) {
					BackingFileState* _tmp8_;
					BackingFileState* state = NULL;
					_tmp8_ = _backing_file_state_ref0 (state_collection[state_it]);
					state = _tmp8_;
					{
						GeeCollection* _tmp9_;
						BackingFileState* _tmp10_;
						GFile* _tmp11_;
						GFile* _tmp12_;
						BackingFileState* _tmp13_;
						BackingFileState* _tmp14_;
						const gchar* _tmp15_;
						TombstonedFile* _tmp16_;
						TombstonedFile* _tmp17_;
						_tmp9_ = files;
						_tmp10_ = state;
						_tmp11_ = backing_file_state_get_file (_tmp10_);
						_tmp12_ = _tmp11_;
						_tmp13_ = state;
						_tmp14_ = state;
						_tmp15_ = _tmp14_->md5;
						_tmp16_ = tombstoned_file_new (_tmp12_, _tmp13_->filesize, _tmp15_);
						_tmp17_ = _tmp16_;
						gee_collection_add (_tmp9_, _tmp17_);
						_tombstoned_file_unref0 (_tmp17_);
						_g_object_unref0 (_tmp12_);
						_backing_file_state_unref0 (state);
					}
				}
				state_collection = (_vala_array_free (state_collection, state_collection_length1, (GDestroyNotify) backing_file_state_unref), NULL);
			}
			_g_object_unref0 (source);
		}
		_g_object_unref0 (_source_it);
	}
	_tmp18_ = files;
	tombstone_entomb_many_files (_tmp18_, reason, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == DATABASE_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (files);
			return;
		} else {
			_g_object_unref0 (files);
			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;
		}
	}
	_g_object_unref0 (files);
}

void
tombstone_entomb_many_files (GeeCollection* files,
                             TombstoneReason reason,
                             GError** error)
{
	Marker* to_destroy = NULL;
	TombstoneSourceCollection* _tmp0_;
	Marker* _tmp1_;
	TombstoneSourceCollection* _tmp13_;
	Marker* _tmp14_;
	GeeArrayList* tombstones = NULL;
	GeeArrayList* _tmp15_;
	TombstoneSourceCollection* _tmp35_;
	GeeArrayList* _tmp36_;
	GeeCollection* _tmp37_;
	GeeCollection* _tmp38_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (files, GEE_TYPE_COLLECTION));
	_tmp0_ = tombstone_global;
	_tmp1_ = data_collection_start_marking (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_DATA_COLLECTION, DataCollection));
	to_destroy = _tmp1_;
	{
		GeeIterator* _file_it = NULL;
		GeeIterator* _tmp2_;
		_tmp2_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (files, GEE_TYPE_ITERABLE, GeeIterable));
		_file_it = _tmp2_;
		while (TRUE) {
			GeeIterator* _tmp3_;
			TombstonedFile* file = NULL;
			GeeIterator* _tmp4_;
			gpointer _tmp5_;
			Tombstone* tombstone = NULL;
			TombstoneSourceCollection* _tmp6_;
			TombstonedFile* _tmp7_;
			GFile* _tmp8_;
			Tombstone* _tmp9_;
			Tombstone* _tmp10_;
			_tmp3_ = _file_it;
			if (!gee_iterator_next (_tmp3_)) {
				break;
			}
			_tmp4_ = _file_it;
			_tmp5_ = gee_iterator_get (_tmp4_);
			file = (TombstonedFile*) _tmp5_;
			_tmp6_ = tombstone_global;
			_tmp7_ = file;
			_tmp8_ = _tmp7_->file;
			_tmp9_ = tombstone_source_collection_locate (_tmp6_, _tmp8_);
			tombstone = _tmp9_;
			_tmp10_ = tombstone;
			if (_tmp10_ != NULL) {
				Marker* _tmp11_;
				Tombstone* _tmp12_;
				_tmp11_ = to_destroy;
				_tmp12_ = tombstone;
				marker_mark (_tmp11_, G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, TYPE_DATA_OBJECT, DataObject));
			}
			_g_object_unref0 (tombstone);
			_tombstoned_file_unref0 (file);
		}
		_g_object_unref0 (_file_it);
	}
	_tmp13_ = tombstone_global;
	_tmp14_ = to_destroy;
	source_collection_destroy_marked (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, TYPE_SOURCE_COLLECTION, SourceCollection), _tmp14_, FALSE, NULL, NULL, NULL);
	_tmp15_ = gee_array_list_new (TYPE_TOMBSTONE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	tombstones = _tmp15_;
	{
		GeeIterator* _file_it = NULL;
		GeeIterator* _tmp16_;
		_tmp16_ = gee_iterable_iterator (G_TYPE_CHECK_INSTANCE_CAST (files, GEE_TYPE_ITERABLE, GeeIterable));
		_file_it = _tmp16_;
		while (TRUE) {
			GeeIterator* _tmp17_;
			TombstonedFile* file = NULL;
			GeeIterator* _tmp18_;
			gpointer _tmp19_;
			TombstoneRow* _tmp20_ = NULL;
			TombstoneTable* _tmp21_;
			TombstoneTable* _tmp22_;
			TombstonedFile* _tmp23_;
			GFile* _tmp24_;
			gchar* _tmp25_;
			gchar* _tmp26_;
			TombstonedFile* _tmp27_;
			TombstonedFile* _tmp28_;
			const gchar* _tmp29_;
			TombstoneRow* _tmp30_;
			TombstoneRow* _tmp31_;
			GeeArrayList* _tmp32_;
			Tombstone* _tmp33_;
			Tombstone* _tmp34_;
			_tmp17_ = _file_it;
			if (!gee_iterator_next (_tmp17_)) {
				break;
			}
			_tmp18_ = _file_it;
			_tmp19_ = gee_iterator_get (_tmp18_);
			file = (TombstonedFile*) _tmp19_;
			_tmp21_ = tombstone_table_get_instance ();
			_tmp22_ = _tmp21_;
			_tmp23_ = file;
			_tmp24_ = _tmp23_->file;
			_tmp25_ = g_file_get_path (_tmp24_);
			_tmp26_ = _tmp25_;
			_tmp27_ = file;
			_tmp28_ = file;
			_tmp29_ = _tmp28_->md5;
			_tmp30_ = tombstone_table_add (_tmp22_, _tmp26_, _tmp27_->filesize, _tmp29_, reason, &_inner_error0_);
			_tmp31_ = _tmp30_;
			_g_free0 (_tmp26_);
			_database_table_unref0 (_tmp22_);
			_tmp20_ = _tmp31_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				if (_inner_error0_->domain == DATABASE_ERROR) {
					g_propagate_error (error, _inner_error0_);
					_tombstoned_file_unref0 (file);
					_g_object_unref0 (_file_it);
					_g_object_unref0 (tombstones);
					_g_object_unref0 (to_destroy);
					return;
				} else {
					_tombstoned_file_unref0 (file);
					_g_object_unref0 (_file_it);
					_g_object_unref0 (tombstones);
					_g_object_unref0 (to_destroy);
					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;
				}
			}
			_tmp32_ = tombstones;
			_tmp33_ = tombstone_new (_tmp20_);
			_tmp34_ = _tmp33_;
			gee_abstract_collection_add (G_TYPE_CHECK_INSTANCE_CAST (_tmp32_, GEE_TYPE_ABSTRACT_COLLECTION, GeeAbstractCollection), _tmp34_);
			_g_object_unref0 (_tmp34_);
			_tombstone_row_unref0 (_tmp20_);
			_tombstoned_file_unref0 (file);
		}
		_g_object_unref0 (_file_it);
	}
	_tmp35_ = tombstone_global;
	_tmp36_ = tombstones;
	_tmp37_ = data_collection_add_many (G_TYPE_CHECK_INSTANCE_CAST (_tmp35_, TYPE_DATA_COLLECTION, DataCollection), G_TYPE_CHECK_INSTANCE_CAST (_tmp36_, GEE_TYPE_COLLECTION, GeeCollection), NULL, NULL);
	_tmp38_ = _tmp37_;
	_g_object_unref0 (_tmp38_);
	_g_object_unref0 (tombstones);
	_g_object_unref0 (to_destroy);
}

static gchar*
tombstone_real_get_typename (DataSource* base)
{
	Tombstone * self;
	gchar* _tmp0_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TOMBSTONE, Tombstone);
	_tmp0_ = g_strdup ("tombstone");
	result = _tmp0_;
	return result;
}

static gint64
tombstone_real_get_instance_id (DataSource* base)
{
	Tombstone * self;
	TombstoneID _tmp0_ = {0};
	gint64 result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TOMBSTONE, Tombstone);
	tombstone_get_tombstone_id (self, &_tmp0_);
	result = _tmp0_.id;
	return result;
}

static gchar*
tombstone_real_get_name (DataObject* base)
{
	Tombstone * self;
	TombstoneRow* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TOMBSTONE, Tombstone);
	_tmp0_ = self->priv->row;
	_tmp1_ = _tmp0_->filepath;
	_tmp2_ = g_strdup (_tmp1_);
	result = _tmp2_;
	return result;
}

static gchar*
tombstone_real_to_string (DataObject* base)
{
	Tombstone * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TOMBSTONE, Tombstone);
	_tmp0_ = data_object_get_name (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATA_OBJECT, DataObject));
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup_printf ("Tombstone %s", _tmp1_);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	result = _tmp3_;
	return result;
}

void
tombstone_get_tombstone_id (Tombstone* self,
                            TombstoneID* result)
{
	TombstoneRow* _tmp0_;
	TombstoneID _tmp1_;
	g_return_if_fail (IS_TOMBSTONE (self));
	_tmp0_ = self->priv->row;
	_tmp1_ = _tmp0_->id;
	*result = _tmp1_;
	return;
}

GFile*
tombstone_get_file (Tombstone* self)
{
	GFile* _tmp0_;
	GFile* _tmp4_;
	GFile* _tmp5_;
	GFile* result;
	g_return_val_if_fail (IS_TOMBSTONE (self), NULL);
	_tmp0_ = self->priv->file;
	if (_tmp0_ == NULL) {
		TombstoneRow* _tmp1_;
		const gchar* _tmp2_;
		GFile* _tmp3_;
		_tmp1_ = self->priv->row;
		_tmp2_ = _tmp1_->filepath;
		_tmp3_ = g_file_new_for_path (_tmp2_);
		_g_object_unref0 (self->priv->file);
		self->priv->file = _tmp3_;
	}
	_tmp4_ = self->priv->file;
	_tmp5_ = _g_object_ref0 (_tmp4_);
	result = _tmp5_;
	return result;
}

gchar*
tombstone_get_md5 (Tombstone* self)
{
	const gchar* _tmp0_ = NULL;
	TombstoneRow* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp5_;
	gchar* result;
	g_return_val_if_fail (IS_TOMBSTONE (self), NULL);
	_tmp1_ = self->priv->row;
	_tmp2_ = _tmp1_->md5;
	if (is_string_empty (_tmp2_)) {
		_tmp0_ = NULL;
	} else {
		TombstoneRow* _tmp3_;
		const gchar* _tmp4_;
		_tmp3_ = self->priv->row;
		_tmp4_ = _tmp3_->md5;
		_tmp0_ = _tmp4_;
	}
	_tmp5_ = g_strdup (_tmp0_);
	result = _tmp5_;
	return result;
}

TombstoneReason
tombstone_get_reason (Tombstone* self)
{
	TombstoneRow* _tmp0_;
	TombstoneReason result;
	g_return_val_if_fail (IS_TOMBSTONE (self), 0);
	_tmp0_ = self->priv->row;
	result = _tmp0_->reason;
	return result;
}

void
tombstone_move (Tombstone* self,
                GFile* file)
{
	gchar* old_filepath = NULL;
	TombstoneRow* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	TombstoneRow* _tmp10_;
	gchar* _tmp11_;
	GFile* _tmp12_;
	Alteration* _tmp13_;
	Alteration* _tmp14_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (IS_TOMBSTONE (self));
	g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (file, g_file_get_type ()));
	{
		TombstoneTable* _tmp0_;
		TombstoneTable* _tmp1_;
		TombstoneRow* _tmp2_;
		TombstoneID _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp0_ = tombstone_table_get_instance ();
		_tmp1_ = _tmp0_;
		_tmp2_ = self->priv->row;
		_tmp3_ = _tmp2_->id;
		_tmp4_ = g_file_get_path (file);
		_tmp5_ = _tmp4_;
		tombstone_table_update_file (_tmp1_, &_tmp3_, _tmp5_, &_inner_error0_);
		_g_free0 (_tmp5_);
		_database_table_unref0 (_tmp1_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == DATABASE_ERROR) {
				goto __catch0_database_error;
			}
			g_critical ("file %s: line %d: unexpected 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;
		}
	}
	goto __finally0;
	__catch0_database_error:
	{
		GError* err = NULL;
		GError* _tmp6_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp6_ = err;
		app_window_database_error (_tmp6_);
		_g_error_free0 (err);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
	_tmp7_ = self->priv->row;
	_tmp8_ = _tmp7_->filepath;
	_tmp9_ = g_strdup (_tmp8_);
	old_filepath = _tmp9_;
	_tmp10_ = self->priv->row;
	_tmp11_ = g_file_get_path (file);
	_g_free0 (_tmp10_->filepath);
	_tmp10_->filepath = _tmp11_;
	_tmp12_ = _g_object_ref0 (file);
	_g_object_unref0 (self->priv->file);
	self->priv->file = _tmp12_;
	_tmp13_ = alteration_new ("file", old_filepath);
	_tmp14_ = _tmp13_;
	data_object_notify_altered (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATA_OBJECT, DataObject), _tmp14_);
	_alteration_unref0 (_tmp14_);
	_g_free0 (old_filepath);
}

gboolean
tombstone_matches (Tombstone* self,
                   GFile* file,
                   gint64 filesize,
                   const gchar* md5)
{
	TombstoneRow* _tmp0_;
	const gchar* _tmp1_ = NULL;
	TombstoneRow* _tmp2_;
	const gchar* _tmp3_;
	gchar* this_md5 = NULL;
	gchar* _tmp6_;
	const gchar* _tmp7_ = NULL;
	gchar* other_md5 = NULL;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	GFile* _tmp11_;
	GFile* _tmp12_;
	gboolean _tmp13_;
	gboolean result;
	g_return_val_if_fail (IS_TOMBSTONE (self), FALSE);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (file, g_file_get_type ()), FALSE);
	_tmp0_ = self->priv->row;
	if (_tmp0_->filesize != filesize) {
		result = FALSE;
		return result;
	}
	_tmp2_ = self->priv->row;
	_tmp3_ = _tmp2_->md5;
	if (is_string_empty (_tmp3_)) {
		_tmp1_ = NULL;
	} else {
		TombstoneRow* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = self->priv->row;
		_tmp5_ = _tmp4_->md5;
		_tmp1_ = _tmp5_;
	}
	_tmp6_ = g_strdup (_tmp1_);
	this_md5 = _tmp6_;
	if (is_string_empty (md5)) {
		_tmp7_ = NULL;
	} else {
		_tmp7_ = md5;
	}
	_tmp8_ = g_strdup (_tmp7_);
	other_md5 = _tmp8_;
	_tmp9_ = this_md5;
	_tmp10_ = other_md5;
	if (g_strcmp0 (_tmp9_, _tmp10_) != 0) {
		result = FALSE;
		_g_free0 (other_md5);
		_g_free0 (this_md5);
		return result;
	}
	_tmp11_ = tombstone_get_file (self);
	_tmp12_ = _tmp11_;
	_tmp13_ = !g_file_equal (_tmp12_, file);
	_g_object_unref0 (_tmp12_);
	if (_tmp13_) {
		result = FALSE;
		_g_free0 (other_md5);
		_g_free0 (this_md5);
		return result;
	}
	result = TRUE;
	_g_free0 (other_md5);
	_g_free0 (this_md5);
	return result;
}

static void
tombstone_real_destroy (DataSource* base)
{
	Tombstone * self;
	GError* _inner_error0_ = NULL;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, TYPE_TOMBSTONE, Tombstone);
	{
		TombstoneTable* _tmp0_;
		TombstoneTable* _tmp1_;
		TombstoneRow* _tmp2_;
		TombstoneID _tmp3_;
		_tmp0_ = tombstone_table_get_instance ();
		_tmp1_ = _tmp0_;
		_tmp2_ = self->priv->row;
		_tmp3_ = _tmp2_->id;
		tombstone_table_remove (_tmp1_, &_tmp3_, &_inner_error0_);
		_database_table_unref0 (_tmp1_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == DATABASE_ERROR) {
				goto __catch0_database_error;
			}
			g_critical ("file %s: line %d: unexpected 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;
		}
	}
	goto __finally0;
	__catch0_database_error:
	{
		GError* err = NULL;
		GError* _tmp4_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp4_ = err;
		app_window_database_error (_tmp4_);
		_g_error_free0 (err);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
	DATA_SOURCE_CLASS (tombstone_parent_class)->destroy (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_DATA_SOURCE, DataSource));
}

static void
tombstone_class_init (TombstoneClass * klass,
                      gpointer klass_data)
{
	tombstone_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &Tombstone_private_offset);
	((DataSourceClass *) klass)->get_typename = (gchar* (*) (DataSource*)) tombstone_real_get_typename;
	((DataSourceClass *) klass)->get_instance_id = (gint64 (*) (DataSource*)) tombstone_real_get_instance_id;
	((DataObjectClass *) klass)->get_name = (gchar* (*) (DataObject*)) tombstone_real_get_name;
	((DataObjectClass *) klass)->to_string = (gchar* (*) (DataObject*)) tombstone_real_to_string;
	((DataSourceClass *) klass)->destroy = (void (*) (DataSource*)) tombstone_real_destroy;
	G_OBJECT_CLASS (klass)->finalize = tombstone_finalize;
}

static void
tombstone_instance_init (Tombstone * self,
                         gpointer klass)
{
	self->priv = tombstone_get_instance_private (self);
	self->priv->file = NULL;
}

static void
tombstone_finalize (GObject * obj)
{
	Tombstone * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_TOMBSTONE, Tombstone);
	_tombstone_row_unref0 (self->priv->row);
	_g_object_unref0 (self->priv->file);
	G_OBJECT_CLASS (tombstone_parent_class)->finalize (obj);
}

static GType
tombstone_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TombstoneClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tombstone_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Tombstone), 0, (GInstanceInitFunc) tombstone_instance_init, NULL };
	GType tombstone_type_id;
	tombstone_type_id = g_type_register_static (TYPE_DATA_SOURCE, "Tombstone", &g_define_type_info, 0);
	Tombstone_private_offset = g_type_add_instance_private (tombstone_type_id, sizeof (TombstonePrivate));
	return tombstone_type_id;
}

GType
tombstone_get_type (void)
{
	static volatile gsize tombstone_type_id__once = 0;
	if (g_once_init_enter (&tombstone_type_id__once)) {
		GType tombstone_type_id;
		tombstone_type_id = tombstone_get_type_once ();
		g_once_init_leave (&tombstone_type_id__once, tombstone_type_id);
	}
	return tombstone_type_id__once;
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

