[Xfce4-commits] [panel-plugins/xfce4-places-plugin] 01/01: Use the new Gtk+-3.0 bookmarks location, with fallback to the legacy file.

noreply at xfce.org noreply at xfce.org
Sun Nov 30 23:06:25 CET 2014


This is an automated email from the git hooks/post-receive script.

andrzejr pushed a commit to branch master
in repository panel-plugins/xfce4-places-plugin.

commit d60ff39ea0f3cbb999780763967768650b311ce1
Author: Alistair Buxton <a.j.buxton at gmail.com>
Date:   Sun Jan 12 09:53:26 2014 +0000

    Use the new Gtk+-3.0 bookmarks location, with fallback to the legacy file.
---
 panel-plugin/model_user.c |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/panel-plugin/model_user.c b/panel-plugin/model_user.c
index 6d25fa1..47fd15a 100644
--- a/panel-plugin/model_user.c
+++ b/panel-plugin/model_user.c
@@ -119,6 +119,7 @@ pbuser_build_bookmarks(PlacesBookmarkGroup *bookmark_group)
     GList  *bookmarks = NULL;
     PlacesBookmark *bookmark;
     places_uri_scheme p_uri;
+    gchar  *legacy_filename;
     gchar  *name;
     gchar  *space;
     gchar  *uri;
@@ -133,9 +134,18 @@ pbuser_build_bookmarks(PlacesBookmarkGroup *bookmark_group)
     fp = fopen(pbg_priv(bookmark_group)->filename, "r");
 
     if(G_UNLIKELY(fp == NULL)){
-        DBG("Error opening gtk bookmarks file");
-        pbg_priv(bookmark_group)->loaded = 1;
-        return;
+        /* If opening the file failed, attempt to 
+           open the legacy file as a one-off. */
+
+        legacy_filename = g_build_filename (g_get_home_dir (), ".gtk-bookmarks", NULL);
+        fp = fopen(legacy_filename, "r");
+        g_free(legacy_filename);
+
+        if(G_UNLIKELY(fp == NULL)){
+            DBG("Error opening gtk bookmarks file");
+            pbg_priv(bookmark_group)->loaded = 1;
+            return;
+        }
     }
 
     while( fgets(line, sizeof(line), fp) != NULL )
@@ -388,7 +398,7 @@ places_bookmarks_user_create(void)
     bookmark_group->finalize            = pbuser_finalize;
     bookmark_group->priv                = g_new0(PBUserData, 1);
 
-    pbg_priv(bookmark_group)->filename = xfce_get_homefile(".gtk-bookmarks", NULL);
+    pbg_priv(bookmark_group)->filename = g_build_filename (g_get_user_config_dir (), "gtk-3.0", "bookmarks", NULL);
     
     return bookmark_group;
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list