[tracker/urho-sync] Changed the paths of the meta-backup and the journal
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/urho-sync] Changed the paths of the meta-backup and the journal
- Date: Thu, 20 Aug 2009 13:36:11 +0000 (UTC)
commit b937a201f7588a4f401bc13f51e47a4754e1e3b2
Author: Philip Van Hoof <philip codeminded be>
Date: Thu Aug 20 14:58:54 2009 +0200
Changed the paths of the meta-backup and the journal
src/libtracker-data/tracker-data-backup.c | 18 ++------------
src/libtracker-db/tracker-db-backup.c | 35 ++++++++++++++++++++--------
src/libtracker-db/tracker-db-backup.h | 2 +
src/libtracker-db/tracker-db-journal.c | 6 +++-
4 files changed, 34 insertions(+), 27 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-backup.c b/src/libtracker-data/tracker-data-backup.c
index bbc29a9..715f4da 100644
--- a/src/libtracker-data/tracker-data-backup.c
+++ b/src/libtracker-data/tracker-data-backup.c
@@ -150,8 +150,6 @@ tracker_data_backup_save (GFile *destination,
gpointer user_data,
GDestroyNotify destroy)
{
- const gchar *db_file = tracker_db_manager_get_file (TRACKER_DB_METADATA);
- GFile *file, *parent;
BackupSaveInfo *info;
info = g_new0 (BackupSaveInfo, 1);
@@ -160,12 +158,8 @@ tracker_data_backup_save (GFile *destination,
info->callback = callback;
info->user_data = user_data;
info->destroy = destroy;
-
- file = g_file_new_for_path (db_file);
- parent = g_file_get_parent (file);
- g_object_unref (file);
- info->file = g_file_get_child (parent, TRACKER_DB_BACKUP_META_FILENAME);
- g_object_unref (parent);
+
+ info->file = tracker_db_backup_file (NULL, TRACKER_DB_BACKUP_META_FILENAME);
if (g_file_query_exists (info->file, NULL)) {
save_copy_procedure (info);
@@ -232,8 +226,6 @@ tracker_data_backup_restore (GFile *backup,
gpointer user_data,
GDestroyNotify destroy)
{
- const gchar *db_file = tracker_db_manager_get_file (TRACKER_DB_METADATA);
- GFile *file, *parent;
BackupSaveInfo *info;
tracker_db_manager_disconnect ();
@@ -245,11 +237,7 @@ tracker_data_backup_restore (GFile *backup,
info->user_data = user_data;
info->destroy = destroy;
- file = g_file_new_for_path (db_file);
- parent = g_file_get_parent (file);
- g_object_unref (file);
- info->file = g_file_get_child (parent, TRACKER_DB_BACKUP_META_FILENAME);
- g_object_unref (parent);
+ info->file = tracker_db_backup_file (NULL, TRACKER_DB_BACKUP_META_FILENAME);
restore_copy_procedure (info);
diff --git a/src/libtracker-db/tracker-db-backup.c b/src/libtracker-db/tracker-db-backup.c
index deed8e8..b28a547 100644
--- a/src/libtracker-db/tracker-db-backup.c
+++ b/src/libtracker-db/tracker-db-backup.c
@@ -184,20 +184,43 @@ on_backup_temp_finished (gpointer user_data)
return;
}
+GFile *
+tracker_db_backup_file (GFile **parent_out, const gchar *type)
+{
+ const gchar *db_file = tracker_db_manager_get_file (TRACKER_DB_COMMON);
+ GFile *file, *parent;
+
+ file = g_file_new_for_path (db_file);
+ parent = g_file_get_parent (file);
+ g_object_unref (file);
+
+ file = g_file_get_child (parent, type);
+
+ if (parent_out) {
+ *parent_out = parent;
+ }
+
+ return file;
+}
+
void
tracker_db_backup_save (TrackerDBBackupFinished callback,
gpointer user_data,
GDestroyNotify destroy)
{
- BackupInfo *info = g_new0 (BackupInfo, 1);
const gchar *db_file = tracker_db_manager_get_file (TRACKER_DB_METADATA);
- GFile *file, *parent;
+ BackupInfo *info = g_new0 (BackupInfo, 1);
+ GFile *file;
info->callback = callback;
info->user_data = user_data;
info->destroy = destroy;
+ file = tracker_db_backup_file (&info->parent, TRACKER_DB_BACKUP_META_FILENAME_T);
+ info->backup_fname = g_file_get_path (file);
+ g_object_unref (file);
+
if (sqlite3_open_v2 (db_file, &info->db, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) {
g_set_error (&info->error, TRACKER_DB_BACKUP_ERROR, TRACKER_DB_BACKUP_ERROR_UNKNOWN,
"Could not open sqlite3 database:'%s'", db_file);
@@ -208,14 +231,6 @@ tracker_db_backup_save (TrackerDBBackupFinished callback,
return;
}
- file = g_file_new_for_path (db_file);
- parent = g_file_get_parent (file);
- g_object_unref (file);
- file = g_file_get_child (parent, TRACKER_DB_BACKUP_META_FILENAME_T);
- info->parent = parent;
- info->backup_fname = g_file_get_path (file);
- g_object_unref (file);
-
if (sqlite3_open (info->backup_fname, &info->backup_temp) != SQLITE_OK) {
g_set_error (&info->error, TRACKER_DB_BACKUP_ERROR, TRACKER_DB_BACKUP_ERROR_UNKNOWN,
"Could not open sqlite3 database:'%s'", info->backup_fname);
diff --git a/src/libtracker-db/tracker-db-backup.h b/src/libtracker-db/tracker-db-backup.h
index 91e4c36..1769f96 100644
--- a/src/libtracker-db/tracker-db-backup.h
+++ b/src/libtracker-db/tracker-db-backup.h
@@ -43,6 +43,8 @@ GQuark tracker_db_backup_error_quark (void);
void tracker_db_backup_save (TrackerDBBackupFinished callback,
gpointer user_data,
GDestroyNotify destroy);
+GFile * tracker_db_backup_file (GFile **parent_out,
+ const gchar *type);
G_END_DECLS
diff --git a/src/libtracker-db/tracker-db-journal.c b/src/libtracker-db/tracker-db-journal.c
index 2672dcb..408b2cb 100644
--- a/src/libtracker-db/tracker-db-journal.c
+++ b/src/libtracker-db/tracker-db-journal.c
@@ -37,8 +37,10 @@ static void
get_filename (void)
{
if (!filename) {
- filename = g_build_filename (g_get_tmp_dir (),
- TRACKER_DB_JOURNAL_LOG_FILENAME,
+ filename = g_build_filename (g_get_user_data_dir (),
+ "tracker",
+ "data",
+ TRACKER_DB_JOURNAL_LOG_FILENAME,
NULL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]