[gnome-panel] panel: Use new GTK bookmarks location if using GTK+ >= 3.5.1



commit 19a23e81967317705ffc2506750e19961575fbb0
Author: Vincent Untz <vuntz gnome org>
Date:   Mon May 14 15:52:11 2012 +0200

    panel: Use new GTK bookmarks location if using GTK+ >= 3.5.1
    
    This is a runtime check, obviously.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=675393

 gnome-panel/libpanel-util/panel-gtk.c |   11 +++++++++++
 gnome-panel/libpanel-util/panel-gtk.h |    3 ++-
 gnome-panel/panel-menu-items.c        |    8 +++-----
 3 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/gnome-panel/libpanel-util/panel-gtk.c b/gnome-panel/libpanel-util/panel-gtk.c
index 097367f..8bbb124 100644
--- a/gnome-panel/libpanel-util/panel-gtk.c
+++ b/gnome-panel/libpanel-util/panel-gtk.c
@@ -81,3 +81,14 @@ panel_gtk_file_chooser_add_image_preview (GtkFileChooser *chooser)
 /*
  * End of code coming from panel-properties-dialog.c
  */
+
+char *
+panel_gtk_get_bookmark_file (void)
+{
+	if (gtk_check_version (3, 5, 1))
+		return g_build_filename (g_get_user_config_dir (),
+					 "gtk-3.0", "bookmarks", NULL);
+	else
+		return g_build_filename (g_get_home_dir (),
+					 ".gtk-bookmarks", NULL);
+}
diff --git a/gnome-panel/libpanel-util/panel-gtk.h b/gnome-panel/libpanel-util/panel-gtk.h
index f0e5715..358c4c8 100644
--- a/gnome-panel/libpanel-util/panel-gtk.h
+++ b/gnome-panel/libpanel-util/panel-gtk.h
@@ -31,7 +31,8 @@ G_BEGIN_DECLS
 
 #define PANEL_GTK_BUILDER_GET(builder, name) GTK_WIDGET (gtk_builder_get_object (builder, name))
 
-void panel_gtk_file_chooser_add_image_preview (GtkFileChooser *chooser);
+void  panel_gtk_file_chooser_add_image_preview (GtkFileChooser *chooser);
+char *panel_gtk_get_bookmark_file (void);
 
 G_END_DECLS
 
diff --git a/gnome-panel/panel-menu-items.c b/gnome-panel/panel-menu-items.c
index 1882ad71..1364b69 100644
--- a/gnome-panel/panel-menu-items.c
+++ b/gnome-panel/panel-menu-items.c
@@ -46,6 +46,7 @@
 
 #include <libpanel-util/panel-error.h>
 #include <libpanel-util/panel-glib.h>
+#include <libpanel-util/panel-gtk.h>
 #include <libpanel-util/panel-keyfile.h>
 #include <libpanel-util/panel-launch.h>
 #include <libpanel-util/panel-session-manager.h>
@@ -62,7 +63,6 @@
 #include "panel-stock-icons.h"
 #include "panel-util.h"
 
-#define BOOKMARKS_FILENAME      ".gtk-bookmarks"
 #define DESKTOP_IS_HOME_DIR_DIR "/apps/nautilus/preferences"
 #define DESKTOP_IS_HOME_DIR_KEY "/apps/nautilus/preferences/desktop_is_home_dir"
 #define NAMES_DIR               "/apps/nautilus/desktop"
@@ -516,8 +516,7 @@ panel_place_menu_item_append_gtk_bookmarks (GtkWidget *menu)
 	GSList      *add_bookmarks, *l;
 	PanelBookmark *bookmark;
 
-	filename = g_build_filename (g_get_home_dir (),
-				     BOOKMARKS_FILENAME, NULL);
+	filename = panel_gtk_get_bookmark_file ();
 
 	io_channel = g_io_channel_new_file (filename, "r", NULL);
 	g_free (filename);
@@ -1518,8 +1517,7 @@ panel_place_menu_item_init (PanelPlaceMenuItem *menuitem)
 
 	menuitem->priv->recent_manager = gtk_recent_manager_get_default ();
 
-	bookmarks_filename = g_build_filename (g_get_home_dir (),
-					       BOOKMARKS_FILENAME, NULL);
+	bookmarks_filename = panel_gtk_get_bookmark_file ();
 	bookmark = g_file_new_for_path (bookmarks_filename);
 
 	error = NULL;



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