[nautilus] places-sidebar: don't add non-existent XDG bookmarks



commit 17a85b78acc78b573c2e1776b348ed348e19adb7
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Oct 22 14:43:18 2012 -0400

    places-sidebar: don't add non-existent XDG bookmarks
    
    If an XDG bookmark has been removed from ~/.config/user-dirs.dirs, or if
    its entry there points to an invalid directory, don't add it to the
    places sidebar.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645054

 src/nautilus-places-sidebar.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index 55883e0..fec0e91 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -416,6 +416,7 @@ add_special_dirs (NautilusPlacesSidebar *sidebar)
 		char *name;
 		char *mount_uri;
 		char *tooltip;
+		NautilusBookmark *bookmark;
 
 		if (index == G_USER_DIRECTORY_DESKTOP ||
 		    index == G_USER_DIRECTORY_TEMPLATES ||
@@ -438,6 +439,16 @@ add_special_dirs (NautilusPlacesSidebar *sidebar)
 		root = g_file_new_for_path (path);
 		name = g_file_get_basename (root);
 		icon = nautilus_special_directory_get_symbolic_icon (index);
+
+		/* Don't add the bookmark to the sidebar if it was removed from
+		 * the user dir list, or if its location doesn't exist.
+		 */
+		bookmark = nautilus_bookmark_list_item_with_location (sidebar->bookmarks, root, &idx);
+		if (bookmark && !nautilus_bookmark_get_exists (bookmark)) {
+			g_object_unref (root);
+			continue;
+		}
+
 		mount_uri = g_file_get_uri (root);
 		tooltip = g_file_get_parse_name (root);
 



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