[tracker/wip/carlosg/domain-ontologies: 24/124] libtracker-data: Use GFile for cache/journal arguments



commit 009ebfe9aab71bf6f18083ed555f2fcb3a8acbdc
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed May 31 13:08:01 2017 +0200

    libtracker-data: Use GFile for cache/journal arguments
    
    Deal with those from tracker_data_manager_init() on as GFiles,
    those are still required to be local though. This is more for
    consistency.

 src/libtracker-data/libtracker-data.vapi   |    2 +-
 src/libtracker-data/tracker-data-backup.c  |   77 +++++---------------
 src/libtracker-data/tracker-data-backup.h  |    4 +-
 src/libtracker-data/tracker-data-manager.c |   77 +++++++++++---------
 src/libtracker-data/tracker-data-manager.h |    9 ++-
 src/libtracker-data/tracker-data-update.c  |    8 ++-
 src/libtracker-data/tracker-db-journal.c   |   14 +++--
 src/libtracker-data/tracker-db-journal.h   |    4 +-
 src/libtracker-data/tracker-db-manager.c   |  109 ++++++----------------------
 src/libtracker-data/tracker-db-manager.h   |    8 +-
 src/libtracker-direct/tracker-direct.vala  |    4 +-
 src/tracker-store/tracker-main.vala        |    4 +-
 12 files changed, 118 insertions(+), 202 deletions(-)
---
diff --git a/src/libtracker-data/libtracker-data.vapi b/src/libtracker-data/libtracker-data.vapi
index e286612..9d9c06e 100644
--- a/src/libtracker-data/libtracker-data.vapi
+++ b/src/libtracker-data/libtracker-data.vapi
@@ -229,7 +229,7 @@ namespace Tracker {
 
        [CCode (cheader_filename = "libtracker-data/tracker-data-manager.h")]
        namespace Data.Manager {
-               public bool init (DBManagerFlags flags, string? cache_location, string? data_location, 
GLib.File? ontology_location, out bool first_time, bool journal_check, bool restoring_backup, uint 
select_cache_size, uint update_cache_size, BusyCallback? busy_callback, string? busy_status) throws 
DBInterfaceError, DBJournalError;
+               public bool init (DBManagerFlags flags, GLib.File? cache_location, GLib.File? data_location, 
GLib.File? ontology_location, out bool first_time, bool journal_check, bool restoring_backup, uint 
select_cache_size, uint update_cache_size, BusyCallback? busy_callback, string? busy_status) throws 
DBInterfaceError, DBJournalError;
                public void shutdown ();
        }
 
diff --git a/src/libtracker-data/tracker-data-backup.c b/src/libtracker-data/tracker-data-backup.c
index 70f4bcf..640bdc0 100644
--- a/src/libtracker-data/tracker-data-backup.c
+++ b/src/libtracker-data/tracker-data-backup.c
@@ -343,28 +343,15 @@ dir_move_from_temp (const gchar *path)
 }
 
 static void
-move_to_temp (const gchar* cache_location, const gchar* data_location)
+move_to_temp (GFile *cache_location,
+              GFile *data_location)
 {
        gchar *data_dir, *cache_dir;
 
        g_message ("Moving all database files to temporary location");
 
-       if (data_location == NULL) {
-               data_dir = g_build_filename (g_get_user_data_dir (),
-                                            "tracker",
-                                            "data",
-                                            NULL);
-       } else {
-               data_dir = g_strdup (data_location);
-       }
-       
-       if (cache_location == NULL) {
-               cache_dir = g_build_filename (g_get_user_cache_dir (),
-                                             "tracker",
-                                             NULL);
-       } else {
-               cache_dir = g_strdup(cache_location);
-       }
+       data_dir = g_file_get_path (data_location);
+       cache_dir = g_file_get_path (cache_location);
 
        dir_move_to_temp (data_dir);
        dir_move_to_temp (cache_dir);
@@ -374,34 +361,21 @@ move_to_temp (const gchar* cache_location, const gchar* data_location)
 }
 
 static void
-remove_temp (const gchar* cache_location, const gchar* data_location)
+remove_temp (GFile *cache_location,
+             GFile *data_location)
 {
        gchar *tmp_data_dir, *tmp_cache_dir;
+       GFile *child;
 
        g_message ("Removing all database files from temporary location");
 
-       if (data_location == NULL) {
-               tmp_data_dir = g_build_filename (g_get_user_data_dir (),
-                                                "tracker",
-                                                "data",
-                                                "tmp",
-                                                NULL);
-       } else {
-               tmp_data_dir = g_build_filename (data_location,
-                                                "tmp",
-                                                NULL);
-       }
+       child = g_file_get_child (data_location, "tmp");
+       tmp_data_dir = g_file_get_path (child);
+       g_object_unref (child);
 
-       if (cache_location == NULL) {
-               tmp_cache_dir = g_build_filename (g_get_user_cache_dir (),
-                                                 "tracker",
-                                                 "tmp",
-                                                 NULL);
-       } else {
-               tmp_cache_dir = g_build_filename (cache_location,
-                                                 "tmp",
-                                                 NULL);
-       }
+       child = g_file_get_child (cache_location, "tmp");
+       tmp_cache_dir = g_file_get_path (child);
+       g_object_unref (child);
 
        dir_remove_files (tmp_data_dir);
        dir_remove_files (tmp_cache_dir);
@@ -414,28 +388,15 @@ remove_temp (const gchar* cache_location, const gchar* data_location)
 }
 
 static void
-restore_from_temp (const gchar* cache_location, const gchar* data_location)
+restore_from_temp (GFile *cache_location,
+                   GFile *data_location)
 {
        gchar *data_dir, *cache_dir;
 
        g_message ("Restoring all database files from temporary location");
 
-       if (data_location == NULL) {
-               data_dir = g_build_filename (g_get_user_data_dir (),
-                                            "tracker",
-                                            "data",
-                                            NULL);
-       } else {
-               data_dir = g_strdup (data_location);
-       }
-
-       if (cache_location == NULL) {
-               cache_dir = g_build_filename (g_get_user_cache_dir (),
-                                             "tracker",
-                                             NULL);
-       } else {
-               cache_dir = g_strdup (cache_location);
-       }
+       data_dir = g_file_get_path (data_location);
+       cache_dir = g_file_get_path (cache_location);
 
        dir_move_from_temp (data_dir);
        dir_move_from_temp (cache_dir);
@@ -583,8 +544,8 @@ tracker_data_backup_save (GFile                     *destination,
 
 void
 tracker_data_backup_restore (GFile                *journal,
-                             const gchar          *cache_location,
-                             const gchar          *data_location,
+                             GFile                *cache_location,
+                             GFile                *data_location,
                              GFile                *ontology_location,
                              TrackerBusyCallback   busy_callback,
                              gpointer              busy_user_data,
diff --git a/src/libtracker-data/tracker-data-backup.h b/src/libtracker-data/tracker-data-backup.h
index d0c2276..4bfc361 100644
--- a/src/libtracker-data/tracker-data-backup.h
+++ b/src/libtracker-data/tracker-data-backup.h
@@ -48,8 +48,8 @@ void   tracker_data_backup_save        (GFile                     *destination,
                                         gpointer                   user_data,
                                         GDestroyNotify             destroy);
 void   tracker_data_backup_restore     (GFile                     *journal,
-                                        const gchar               *cache_location,
-                                        const gchar               *data_location,
+                                        GFile                     *cache_location,
+                                        GFile                     *data_location,
                                         GFile                     *ontology_location,
                                         TrackerBusyCallback        busy_callback,
                                         gpointer                   busy_user_data,
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 2f93fd4..7891e63 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -67,8 +67,8 @@
 
 static GFile    *ontologies_dir = NULL;
 static GFile    *ontology_location_stored = NULL;
-static gchar    *cache_location_stored;
-static gchar    *data_location_stored;
+static GFile    *cache_location_stored = NULL;
+static GFile    *data_location_stored = NULL;
 static gboolean  initialized;
 static gboolean  reloading = FALSE;
 #ifndef DISABLE_JOURNAL
@@ -3711,20 +3711,20 @@ tracker_data_manager_init_fts (TrackerDBInterface *iface,
 #endif
 }
 
-const gchar * tracker_data_manager_get_cache_location()
+GFile * tracker_data_manager_get_cache_location()
 {
-       return cache_location_stored;
+       return cache_location_stored ? g_object_ref (cache_location_stored) : NULL;
 }
 
-const gchar * tracker_data_manager_get_data_location ()
+GFile * tracker_data_manager_get_data_location ()
 {
-       return data_location_stored;
+       return data_location_stored ? g_object_ref (data_location_stored) : NULL;
 }
 
 gboolean
 tracker_data_manager_init (TrackerDBManagerFlags   flags,
-                           const gchar            *cache_location,
-                           const gchar            *data_location,
+                           GFile                  *cache_location,
+                           GFile                  *data_location,
                            GFile                  *ontology_location,
                            gboolean               *first_time,
                            gboolean                journal_check,
@@ -3752,6 +3752,39 @@ tracker_data_manager_init (TrackerDBManagerFlags   flags,
        gboolean read_journal;
 #endif
 
+       if ((cache_location && !g_file_is_native (cache_location)) ||
+           (data_location && !g_file_is_native (data_location))) {
+               g_set_error (error,
+                            TRACKER_DATA_ONTOLOGY_ERROR,
+                            TRACKER_DATA_UNSUPPORTED_LOCATION,
+                            "Cache and data locations must be local");
+               return FALSE;
+       }
+
+       if (!cache_location) {
+               gchar *dir = g_build_filename (g_get_user_cache_dir (),
+                                              "tracker",
+                                              NULL);
+               cache_location = g_file_new_for_path (dir);
+               g_free (dir);
+       }
+
+       if (!data_location) {
+               gchar *dir = g_build_filename (g_get_user_data_dir (),
+                                              "tracker",
+                                              "data",
+                                              NULL);
+               data_location = g_file_new_for_path (dir);
+               g_free (dir);
+       }
+
+       if (!ontology_location) {
+               gchar *dir = g_build_filename (SHAREDIR, "tracker",
+                                              "ontologies", NULL);
+               ontology_location = g_file_new_for_path (dir);
+               g_free (dir);
+       }
+
        read_only = (flags & TRACKER_DB_MANAGER_READONLY) ? TRUE : FALSE;
 
        tracker_data_update_init ();
@@ -3854,34 +3887,12 @@ tracker_data_manager_init (TrackerDBManagerFlags   flags,
 
        env_path = g_getenv ("TRACKER_DB_ONTOLOGIES_DIR");
 
-       g_free (cache_location_stored);
-       if (cache_location != NULL)
-               cache_location_stored = g_strdup(cache_location);
-       else
-               cache_location_stored = NULL;
-
+       g_set_object (&cache_location_stored, cache_location);
        g_set_object (&ontology_location_stored, ontology_location);
-
-       g_free (data_location_stored);
-       if (data_location != NULL)
-               data_location_stored = g_strdup(data_location);
-       else
-               data_location_stored = NULL;
-
+       g_set_object (&data_location_stored, data_location);
 
        if (G_LIKELY (!env_path)) {
-               if (ontology_location == NULL) {
-                       gchar *file_path;
-
-                       /* SHAREDIR/tracker/ontologies */
-                       file_path = g_build_filename (SHAREDIR, "tracker",
-                                                     "ontologies", NULL);
-                       ontologies_dir = g_file_new_for_path (file_path);
-                       g_free (file_path);
-               } else {
-                       /* Typically SHAREDIR/tracker/domain-ontologies/domain/ontology-name */
-                       ontologies_dir = g_object_ref (ontology_location);
-               }
+               ontologies_dir = g_object_ref (ontology_location);
 
                if (g_file_query_file_type (ontologies_dir, G_FILE_QUERY_INFO_NONE, NULL) != 
G_FILE_TYPE_DIRECTORY) {
                        gchar *uri;
diff --git a/src/libtracker-data/tracker-data-manager.h b/src/libtracker-data/tracker-data-manager.h
index 38776dd..da7abfc 100644
--- a/src/libtracker-data/tracker-data-manager.h
+++ b/src/libtracker-data/tracker-data-manager.h
@@ -43,12 +43,13 @@ G_BEGIN_DECLS
 typedef enum {
        TRACKER_DATA_UNSUPPORTED_ONTOLOGY_CHANGE,
        TRACKER_DATA_ONTOLOGY_NOT_FOUND,
+       TRACKER_DATA_UNSUPPORTED_LOCATION
 } TrackerDataOntologyError;
 
 GQuark   tracker_data_ontology_error_quark           (void);
 gboolean tracker_data_manager_init                   (TrackerDBManagerFlags   flags,
-                                                      const gchar            *cache_location,
-                                                      const gchar            *data_location,
+                                                      GFile                  *cache_location,
+                                                      GFile                  *data_location,
                                                       GFile                  *ontology_location,
                                                       gboolean               *first_time,
                                                       gboolean                journal_check,
@@ -66,8 +67,8 @@ gboolean tracker_data_manager_reload                 (TrackerBusyCallback     bu
                                                       const gchar            *busy_operation,
                                                       GError                **error);
 
-const gchar * tracker_data_manager_get_cache_location();
-const gchar * tracker_data_manager_get_data_location ();
+GFile * tracker_data_manager_get_cache_location();
+GFile * tracker_data_manager_get_data_location ();
 
 gboolean tracker_data_manager_init_fts               (TrackerDBInterface     *interface,
                                                      gboolean                create);
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 68ef1f3..62758cd 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -3829,14 +3829,18 @@ tracker_data_replay_journal (TrackerBusyCallback   busy_callback,
        if (journal_error) {
                GError *n_error = NULL;
                gsize size;
+               GFile *cache_location, *data_location;
 
                size = tracker_db_journal_reader_get_size_of_correct ();
                tracker_db_journal_reader_shutdown ();
 
-               const gchar *cache_location = tracker_data_manager_get_cache_location();
-               const gchar *data_location = tracker_data_manager_get_data_location();
+               cache_location = tracker_data_manager_get_cache_location();
+               data_location = tracker_data_manager_get_data_location();
 
                tracker_db_journal_init (NULL, cache_location, data_location, FALSE, &n_error);
+               g_object_unref (cache_location);
+               g_object_unref (data_location);
+
                if (n_error) {
                        g_clear_error (&journal_error);
                        /* This is fatal (journal file not writable, etc) */
diff --git a/src/libtracker-data/tracker-db-journal.c b/src/libtracker-data/tracker-db-journal.c
index d7e4fc3..433eb29 100644
--- a/src/libtracker-data/tracker-db-journal.c
+++ b/src/libtracker-data/tracker-db-journal.c
@@ -564,8 +564,8 @@ db_journal_writer_init (JournalWriter  *jwriter,
 
 gboolean
 tracker_db_journal_init (const gchar  *filename,
-                         const gchar  *cache_location,
-                         const gchar  *data_location,
+                         GFile        *cache_location,
+                         GFile        *data_location,
                          gboolean      truncate,
                          GError      **error)
 {
@@ -584,9 +584,13 @@ tracker_db_journal_init (const gchar  *filename,
                                                         TRACKER_DB_JOURNAL_FILENAME,
                                                         NULL);
                } else {
-                       filename_use = g_build_filename (data_location,
-                                                        TRACKER_DB_JOURNAL_FILENAME,
-                                                        NULL);
+                       GFile *child;
+
+                       child = g_file_get_child (data_location, TRACKER_DB_JOURNAL_FILENAME);
+                       filename_use = g_file_get_path (child);
+                       g_object_unref (child);
+
+                       g_assert (filename_use != NULL);
                }
                filename_free = (gchar *) filename_use;
        } else {
diff --git a/src/libtracker-data/tracker-db-journal.h b/src/libtracker-data/tracker-db-journal.h
index f016409..789e14e 100644
--- a/src/libtracker-data/tracker-db-journal.h
+++ b/src/libtracker-data/tracker-db-journal.h
@@ -60,8 +60,8 @@ GQuark       tracker_db_journal_error_quark                  (void);
  * Writer API
  */
 gboolean     tracker_db_journal_init                         (const gchar  *filename,
-                                                              const gchar  *cache_location,
-                                                              const gchar   *data_location,
+                                                              GFile        *cache_location,
+                                                              GFile        *data_location,
                                                               gboolean      truncate,
                                                               GError      **error);
 gboolean     tracker_db_journal_shutdown                     (GError      **error);
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index 4f87172..0c24951 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -156,8 +156,8 @@ static gboolean              locations_initialized;
 static gchar                *data_dir = NULL;
 static gchar                *user_data_dir = NULL;
 static gchar                *in_use_filename = NULL;
-static gchar                *in_use_cache_location = NULL;
-static gchar                *in_use_data_location = NULL;
+static GFile                *in_use_cache_location = NULL;
+static GFile                *in_use_data_location = NULL;
 static gpointer              db_type_enum_class_pointer;
 static TrackerDBManagerFlags old_flags = 0;
 static guint                 s_cache_size;
@@ -794,7 +794,8 @@ db_recreate_all (GError **error)
 }
 
 void
-tracker_db_manager_init_locations (const char *cache_location, const gchar *data_location)
+tracker_db_manager_init_locations (GFile *cache_location,
+                                   GFile *data_location)
 {
        const gchar *dir;
        guint i;
@@ -803,26 +804,11 @@ tracker_db_manager_init_locations (const char *cache_location, const gchar *data
                return;
        }
 
-       if (data_location == NULL) {
-               user_data_dir = g_build_filename (g_get_user_data_dir (),
-                                                 "tracker",
-                                                 "data",
-                                                 NULL);
-
-       } else {
-               user_data_dir = g_strdup (data_location);
-       }
+       data_dir = g_file_get_path (cache_location);
 
        /* For DISABLE_JOURNAL case we should use g_get_user_data_dir here. For now
         * keeping this as-is */
-
-       if (cache_location == NULL) {
-               data_dir = g_build_filename (g_get_user_cache_dir (),
-                                            "tracker",
-                                            NULL);
-       } else {
-               data_dir = g_strdup (cache_location);
-       }
+       user_data_dir = g_file_get_path (data_location);
 
        for (i = 1; i < G_N_ELEMENTS (dbs); i++) {
                dir = location_to_directory (dbs[i].location);
@@ -866,8 +852,8 @@ perform_recreate (gboolean *first_time, GError **error)
 
 static gboolean
 db_manager_init_unlocked (TrackerDBManagerFlags   flags,
-                          const gchar            *cache_location,
-                          const gchar            *data_location,
+                          GFile                  *cache_location,
+                          GFile                  *data_location,
                           gboolean               *first_time,
                           gboolean                restoring_backup,
                           gboolean                shared_cache,
@@ -915,34 +901,15 @@ db_manager_init_unlocked (TrackerDBManagerFlags   flags,
 
        old_flags = flags;
 
-       g_free (in_use_cache_location);
-       if (cache_location == NULL)
-               in_use_cache_location = NULL;
-       else
-               in_use_cache_location = g_strdup (cache_location);
-
-       g_free (in_use_data_location);
-       if (data_location == NULL)
-               in_use_data_location = NULL;
-       else
-               in_use_data_location = g_strdup (data_location);
+       g_set_object (&in_use_cache_location, cache_location);
+       g_set_object (&in_use_data_location, data_location);
 
        tracker_db_manager_init_locations (cache_location, data_location);
 
        g_free (in_use_filename);
-       if (data_location == NULL) {
-               /* ~/.cache/tracker/data/ */
-               in_use_filename = g_build_filename (g_get_user_data_dir (),
-                                                   "tracker",
-                                                   "data",
-                                                   IN_USE_FILENAME,
-                                                   NULL);
-       } else {
-               /* ~/.cache/cache_location/ontology-name/data/ */
-               in_use_filename = g_build_filename (data_location,
-                                                   IN_USE_FILENAME,
-                                                   NULL);
-       }
+       in_use_filename = g_build_filename (user_data_dir,
+                                           IN_USE_FILENAME,
+                                           NULL);
 
        /* Don't do need_reindex checks for readonly (direct-access) */
        if ((flags & TRACKER_DB_MANAGER_READONLY) == 0) {
@@ -1068,17 +1035,9 @@ db_manager_init_unlocked (TrackerDBManagerFlags   flags,
                g_message ("Loading databases files...");
 
 #ifndef DISABLE_JOURNAL
-               if (data_location == NULL) {
-                       journal_filename = g_build_filename (g_get_user_data_dir (),
-                                                            "tracker",
-                                                            "data",
-                                                            TRACKER_DB_JOURNAL_FILENAME,
-                                                            NULL);
-               } else {
-                       journal_filename = g_build_filename (data_location,
-                                                            TRACKER_DB_JOURNAL_FILENAME,
-                                                            NULL);
-               }
+               journal_filename = g_build_filename (user_data_dir,
+                                                    TRACKER_DB_JOURNAL_FILENAME,
+                                                    NULL);
                must_recreate = !tracker_db_journal_reader_verify_last (journal_filename,
                                                                        NULL);
 
@@ -1285,8 +1244,8 @@ db_manager_init_unlocked (TrackerDBManagerFlags   flags,
 
 gboolean
 tracker_db_manager_init (TrackerDBManagerFlags   flags,
-                         const gchar            *cache_location,
-                         const gchar            *data_location,
+                         GFile                  *cache_location,
+                         GFile                  *data_location,
                          gboolean               *first_time,
                          gboolean                restoring_backup,
                          gboolean                shared_cache,
@@ -1556,13 +1515,7 @@ tracker_db_manager_has_enough_space  (void)
 inline static gchar *
 get_first_index_filename (void)
 {
-       if (in_use_cache_location == NULL) {
-               return g_build_filename (g_get_user_cache_dir (),
-                                        "tracker",
-                                        FIRST_INDEX_FILENAME,
-                                        NULL);
-       }
-       return g_build_filename (in_use_cache_location,
+       return g_build_filename (data_dir,
                                 FIRST_INDEX_FILENAME,
                                 NULL);
 }
@@ -1633,13 +1586,7 @@ tracker_db_manager_set_first_index_done (gboolean done)
 inline static gchar *
 get_last_crawl_filename (void)
 {
-       if (in_use_cache_location == NULL) {
-               return g_build_filename (g_get_user_cache_dir (),
-                                        "tracker",
-                                        LAST_CRAWL_FILENAME,
-                                        NULL);
-       }
-       return g_build_filename (in_use_cache_location,
+       return g_build_filename (data_dir,
                                 LAST_CRAWL_FILENAME,
                                 NULL);
 }
@@ -1722,13 +1669,7 @@ tracker_db_manager_set_last_crawl_done (gboolean done)
 inline static gchar *
 get_need_mtime_check_filename (void)
 {
-       if (in_use_cache_location == NULL) {
-               return g_build_filename (g_get_user_cache_dir (),
-                                        "tracker",
-                                        NEED_MTIME_CHECK_FILENAME,
-                                        NULL);
-       }
-       return g_build_filename (in_use_cache_location,
+       return g_build_filename (data_dir,
                                 NEED_MTIME_CHECK_FILENAME,
                                 NULL);
 }
@@ -1817,13 +1758,7 @@ tracker_db_manager_set_need_mtime_check (gboolean needed)
 inline static gchar *
 get_parser_sha1_filename (void)
 {
-       if (in_use_cache_location == NULL) {
-               return g_build_filename (g_get_user_cache_dir (),
-                                        "tracker",
-                                        PARSER_SHA1_FILENAME,
-                                        NULL);
-       }
-       return g_build_filename (in_use_cache_location,
+       return g_build_filename (data_dir,
                                 PARSER_SHA1_FILENAME,
                                 NULL);
 }
diff --git a/src/libtracker-data/tracker-db-manager.h b/src/libtracker-data/tracker-db-manager.h
index a992773..7911e13 100644
--- a/src/libtracker-data/tracker-db-manager.h
+++ b/src/libtracker-data/tracker-db-manager.h
@@ -53,8 +53,8 @@ typedef enum {
 
 GType               tracker_db_get_type                       (void) G_GNUC_CONST;
 gboolean            tracker_db_manager_init                   (TrackerDBManagerFlags   flags,
-                                                               const gchar            *cache_location,
-                                                               const gchar            *data_location,
+                                                               GFile                  *cache_location,
+                                                               GFile                  *data_location,
                                                                gboolean               *first_time,
                                                                gboolean                restoring_backup,
                                                                gboolean                shared_cache,
@@ -69,8 +69,8 @@ void                tracker_db_manager_remove_all             (gboolean
 void                tracker_db_manager_optimize               (void);
 const gchar *       tracker_db_manager_get_file               (TrackerDB              db);
 TrackerDBInterface *tracker_db_manager_get_db_interface       (void);
-void                tracker_db_manager_init_locations         (const gchar           *cache_location,
-                                                               const gchar           *data_location);
+void                tracker_db_manager_init_locations         (GFile                 *cache_location,
+                                                               GFile                 *data_location);
 gboolean            tracker_db_manager_has_enough_space       (void);
 void                tracker_db_manager_create_version_file    (void);
 void                tracker_db_manager_remove_version_file    (void);
diff --git a/src/libtracker-direct/tracker-direct.vala b/src/libtracker-direct/tracker-direct.vala
index 260fb23..da9feaa 100644
--- a/src/libtracker-direct/tracker-direct.vala
+++ b/src/libtracker-direct/tracker-direct.vala
@@ -49,7 +49,7 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
                }
        }
 
-        public Connection.custom_ontology (string? loc, string? domain, File? ontology_loc) throws 
Sparql.Error, IOError, DBusError {
+        public Connection.custom_ontology (File loc, File? journal_loc, File? ontology_loc) throws 
Sparql.Error, IOError, DBusError {
                try {
                        if (use_count == 0) {
                                // make sure that current locale vs db locale are the same,
@@ -65,7 +65,7 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
                                }
 
                                Data.Manager.init (DBManagerFlags.READONLY | DBManagerFlags.ENABLE_MUTEXES,
-                                                  loc, domain, ontology_loc,
+                                                  loc, journal_loc, ontology_loc,
                                                   null, false, false, select_cache_size, 0, null, null);
                        }
 
diff --git a/src/tracker-store/tracker-main.vala b/src/tracker-store/tracker-main.vala
index d662833..e385da4 100644
--- a/src/tracker-store/tracker-main.vala
+++ b/src/tracker-store/tracker-main.vala
@@ -345,8 +345,8 @@ License which can be viewed at:
                bool is_first_time_index;
 
                try {
-                       string final_cache_location = cache_location != null ? cache_location.replace 
("%HOME%", Environment.get_home_dir()).replace("%SHAREDIR%", SHAREDIR) : null;
-                       string final_data_location = data_location != null ? data_location.replace ("%HOME%", 
Environment.get_home_dir()).replace("%SHAREDIR%", SHAREDIR) : null;
+                       File final_cache_location = cache_location != null ? File.new_for_path 
(cache_location.replace ("%HOME%", Environment.get_home_dir()).replace("%SHAREDIR%", SHAREDIR)) : null;
+                       File final_data_location = data_location != null ? File.new_for_path 
(data_location.replace ("%HOME%", Environment.get_home_dir()).replace("%SHAREDIR%", SHAREDIR)) : null;
                        File final_ontology_location = ontology_location != null ? File.new_for_path 
(ontology_location.replace ("%HOME%", Environment.get_home_dir()).replace("%SHAREDIR%", SHAREDIR)) : null;
 
                        Tracker.Data.Manager.init (flags,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]