summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/caja-bookmark-list.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/caja-bookmark-list.c b/src/caja-bookmark-list.c
index 8aac12da..d39b2b98 100644
--- a/src/caja-bookmark-list.c
+++ b/src/caja-bookmark-list.c
@@ -115,7 +115,7 @@ new_bookmark_from_uri (const char *uri, const char *label)
}
static GFile *
-caja_bookmark_list_get_file (void)
+caja_bookmark_list_get_legacy_file (void)
{
char *filename;
GFile *file;
@@ -130,6 +130,23 @@ caja_bookmark_list_get_file (void)
return file;
}
+static GFile *
+caja_bookmark_list_get_file (void)
+{
+ char *filename;
+ GFile *file;
+
+ filename = g_build_filename (g_get_user_config_dir (),
+ "gtk-3.0",
+ "bookmarks",
+ NULL);
+ file = g_file_new_for_path (filename);
+
+ g_free (filename);
+
+ return file;
+}
+
/* Initialization. */
static void
@@ -559,6 +576,9 @@ load_file_async (CajaBookmarkList *self,
GFile *file;
file = caja_bookmark_list_get_file ();
+ if (!g_file_query_exists (file, NULL)) {
+ file = caja_bookmark_list_get_legacy_file ();
+ }
/* Wipe out old list. */
clear (self);
@@ -606,6 +626,8 @@ save_file_async (CajaBookmarkList *bookmarks,
GFile *file;
GList *l;
GString *bookmark_string;
+ GFile *parent;
+ char *path;
/* temporarily disable bookmark file monitoring when writing file */
if (bookmarks->monitor != NULL)
@@ -645,6 +667,13 @@ save_file_async (CajaBookmarkList *bookmarks,
/* keep the bookmark list alive */
g_object_ref (bookmarks);
+
+ parent = g_file_get_parent (file);
+ path = g_file_get_path (parent);
+ g_mkdir_with_parents (path, 0700);
+ g_free (path);
+ g_object_unref (parent);
+
g_file_replace_contents_async (file, bookmark_string->str,
bookmark_string->len, NULL,
FALSE, 0, NULL, callback,