[tracker/wip/carlosg/domain-ontologies: 37/39] libtracker-data: Use data location directly to tracker_data_backup_*()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/domain-ontologies: 37/39] libtracker-data: Use data location directly to tracker_data_backup_*()
- Date: Tue, 6 Jun 2017 18:33:18 +0000 (UTC)
commit f47fa06c163741a1f377fee3bbfe69adea966782
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Jun 6 03:02:18 2017 +0200
libtracker-data: Use data location directly to tracker_data_backup_*()
Instead of figuring it out from the journal filename.
src/libtracker-data/libtracker-data.vapi | 2 +-
src/libtracker-data/tracker-data-backup.c | 8 +++-----
src/libtracker-data/tracker-data-backup.h | 1 +
src/tracker-store/tracker-backup.vala | 2 +-
tests/libtracker-data/tracker-backup-test.c | 1 +
5 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/libtracker-data/libtracker-data.vapi b/src/libtracker-data/libtracker-data.vapi
index a7fe354..c831916 100644
--- a/src/libtracker-data/libtracker-data.vapi
+++ b/src/libtracker-data/libtracker-data.vapi
@@ -224,7 +224,7 @@ namespace Tracker {
[CCode (cheader_filename = "libtracker-data/tracker-data-backup.h")]
public delegate void BackupFinished (GLib.Error error);
- public void backup_save (GLib.File destination, owned BackupFinished callback);
+ public void backup_save (GLib.File destination, GLib.File data_location, owned BackupFinished
callback);
public void backup_restore (GLib.File journal, string? cache_location, string? data_location,
GLib.File? ontology_location, BusyCallback busy_callback) throws GLib.Error;
}
diff --git a/src/libtracker-data/tracker-data-backup.c b/src/libtracker-data/tracker-data-backup.c
index 8ff950d..cdcf045 100644
--- a/src/libtracker-data/tracker-data-backup.c
+++ b/src/libtracker-data/tracker-data-backup.c
@@ -409,6 +409,7 @@ restore_from_temp (GFile *cache_location,
void
tracker_data_backup_save (GFile *destination,
+ GFile *data_location,
TrackerDataBackupFinished callback,
gpointer user_data,
GDestroyNotify destroy)
@@ -430,16 +431,13 @@ tracker_data_backup_save (GFile *destination,
info = g_new0 (BackupSaveInfo, 1);
info->destination = g_object_ref (destination);
- info->journal = g_file_new_for_path (tracker_db_journal_get_filename ());
info->callback = callback;
info->user_data = user_data;
info->destroy = destroy;
- parent = g_file_get_parent (info->journal);
- directory = g_file_get_path (parent);
- g_object_unref (parent);
path = g_file_get_path (destination);
+ directory = g_file_get_path (data_location);
journal_dir = g_dir_open (directory, 0, NULL);
f_name = g_dir_read_name (journal_dir);
files = g_ptr_array_new ();
@@ -566,7 +564,7 @@ tracker_data_backup_restore (GFile *journal,
info = g_new0 (BackupSaveInfo, 1);
#ifndef DISABLE_JOURNAL
- info->destination = g_file_new_for_path (tracker_db_journal_get_filename ());
+ info->destination = g_file_get_child (data_location, TRACKER_DB_JOURNAL_FILENAME);
#else
info->destination = g_file_new_for_path (tracker_db_manager_get_file (TRACKER_DB_METADATA));
#endif /* DISABLE_JOURNAL */
diff --git a/src/libtracker-data/tracker-data-backup.h b/src/libtracker-data/tracker-data-backup.h
index 4bfc361..856d9c6 100644
--- a/src/libtracker-data/tracker-data-backup.h
+++ b/src/libtracker-data/tracker-data-backup.h
@@ -44,6 +44,7 @@ typedef void (*TrackerDataBackupFinished) (GError *error, gpointer user_data);
GQuark tracker_data_backup_error_quark (void);
void tracker_data_backup_save (GFile *destination,
+ GFile *data_location,
TrackerDataBackupFinished callback,
gpointer user_data,
GDestroyNotify destroy);
diff --git a/src/tracker-store/tracker-backup.vala b/src/tracker-store/tracker-backup.vala
index c634877..70a6379 100644
--- a/src/tracker-store/tracker-backup.vala
+++ b/src/tracker-store/tracker-backup.vala
@@ -40,7 +40,7 @@ public class Tracker.Backup : Object {
yield Tracker.Store.pause ();
Error backup_error = null;
- Data.backup_save (destination, error => {
+ Data.backup_save (destination, null, error => {
backup_error = error;
save.callback ();
});
diff --git a/tests/libtracker-data/tracker-backup-test.c b/tests/libtracker-data/tracker-backup-test.c
index 07df28f..30c5d9b 100644
--- a/tests/libtracker-data/tracker-backup-test.c
+++ b/tests/libtracker-data/tracker-backup-test.c
@@ -152,6 +152,7 @@ test_backup_and_restore_helper (const gchar *db_location,
g_free (backup_filename);
g_free (backup_location);
tracker_data_backup_save (backup_file,
+ data_location,
backup_finished_cb,
NULL,
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]