diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c index 1b9026a2420341ad455e963596e69b8a68d57151..369c1f4698a81a23531327d0d83c9cef3ed4104a 100644 --- a/thunar/thunar-gio-extensions.c +++ b/thunar/thunar-gio-extensions.c @@ -77,7 +77,7 @@ thunar_g_file_new_for_bookmarks (void) gchar *filename; GFile *bookmarks; - filename = g_build_filename (xfce_get_homedir (), ".gtk-bookmarks", NULL); + filename = g_build_filename (g_get_user_config_dir (), "gtk-3.0", "bookmarks", NULL); bookmarks = g_file_new_for_path (filename); g_free (filename); diff --git a/thunar/thunar-shortcuts-model.c b/thunar/thunar-shortcuts-model.c index ab4c74d3f2c9fbed9a7887efeca15b92ea011e56..c215c544eedd1cd0af1ce4d292eba27cf6be58b3 100644 --- a/thunar/thunar-shortcuts-model.c +++ b/thunar/thunar-shortcuts-model.c @@ -1364,6 +1364,7 @@ thunar_shortcuts_model_save (ThunarShortcutsModel *model) gchar *uri; GList *lp; GError *err = NULL; + GFile *parent = NULL; _thunar_return_if_fail (THUNAR_IS_SHORTCUTS_MODEL (model)); @@ -1389,6 +1390,22 @@ thunar_shortcuts_model_save (ThunarShortcutsModel *model) } } + /* create folder if it does not exist */ + parent = g_file_get_parent (model->bookmarks_file); + if (!g_file_make_directory_with_parents (parent, NULL, &err)) + { + if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_EXISTS)) + { + g_clear_error (&err); + } + else + { + g_warning ("Failed to create bookmarks folder: %s", err->message); + g_error_free (err); + } + } + g_clear_object (&parent); + /* write data to the disk */ bookmarks_path = g_file_get_path (model->bookmarks_file); if (!g_file_set_contents (bookmarks_path, contents->str, contents->len, &err)) diff --git a/thunar/thunar-util.c b/thunar/thunar-util.c index 22ffcce6d023754a10ae21fe189b48d652697718..3cb764e94c6633903866e87c3a2a3d2e1c78a722 100644 --- a/thunar/thunar-util.c +++ b/thunar/thunar-util.c @@ -196,6 +196,15 @@ thunar_util_load_bookmarks (GFile *bookmarks_file, /* append the GTK+ bookmarks (if any) */ fp = fopen (bookmarks_path, "r"); + g_free (bookmarks_path); + + if (G_UNLIKELY (fp == NULL)) + { + bookmarks_path = g_build_filename (g_get_home_dir (), ".gtk-bookmarks", NULL); + fp = fopen(bookmarks_path, "r"); + g_free(bookmarks_path); + } + if (G_LIKELY (fp != NULL)) { while (fgets (line, sizeof (line), fp) != NULL) @@ -231,7 +240,6 @@ thunar_util_load_bookmarks (GFile *bookmarks_file, fclose (fp); } - g_free (bookmarks_path); }