[gthumb] read system bookmarks from XDG_CONFIG_HOME/gtk-3.0/bookmarks



commit defe6f70cad0c60ea9662bf64c56467e899a083e
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat May 5 12:36:40 2012 +0200

    read system bookmarks from XDG_CONFIG_HOME/gtk-3.0/bookmarks
    
    fallback to ~/.gtk-bookmarks if the new file is not found
    
    [bug #675401]

 extensions/bookmarks/callbacks.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/extensions/bookmarks/callbacks.c b/extensions/bookmarks/callbacks.c
index a5e07ff..3a44244 100644
--- a/extensions/bookmarks/callbacks.c
+++ b/extensions/bookmarks/callbacks.c
@@ -213,9 +213,17 @@ _gth_browser_update_system_bookmark_list (GthBrowser *browser)
 	GFileInputStream    *input_stream;
 	UpdateBookmarksData *data;
 
-	bookmark_file_path = g_build_filename (g_get_home_dir (), ".gtk-bookmarks", NULL);
+	/* give priority to XDG_CONFIG_HOME/gtk-3.0/bookmarks if not found
+	 * try the old ~/.gtk-bookmarks */
+	bookmark_file_path = gth_user_dir_get_file (GTH_DIR_CONFIG, "gtk-3.0", "bookmarks", NULL);
 	bookmark_file = g_file_new_for_path (bookmark_file_path);
 	g_free (bookmark_file_path);
+	if (! g_file_query_exists (bookmark_file, NULL)) {
+		g_object_unref (bookmark_file);
+		bookmark_file_path = g_build_filename (g_get_home_dir (), ".gtk-bookmarks", NULL);
+		bookmark_file = g_file_new_for_path (bookmark_file_path);
+		g_free (bookmark_file_path);
+	}
 
 	input_stream = g_file_read (bookmark_file, NULL, NULL);
 	g_object_unref (bookmark_file);



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