diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2012-10-22 16:56:19 -0400 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2012-10-22 16:56:19 -0400 |
commit | 71ad0d3adc2553ef5bcd06ec32600302e9169765 (patch) | |
tree | 0391df623c477d037bfd5320fb807ae7f165da36 /libnautilus-private | |
parent | 1dcd2d816a1278f7eec1d074ec5d9134af34a803 (diff) | |
download | nautilus-71ad0d3adc2553ef5bcd06ec32600302e9169765.tar.gz |
bookmark: add nautilus_bookmark_get_is_builtin()
Move the builtin check for bookmarks from the sidebar to a method on
NautilusBookmark itself, since we need to use the same check in the
bookmark window.
Diffstat (limited to 'libnautilus-private')
-rw-r--r-- | libnautilus-private/nautilus-bookmark.c | 20 | ||||
-rw-r--r-- | libnautilus-private/nautilus-bookmark.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/libnautilus-private/nautilus-bookmark.c b/libnautilus-private/nautilus-bookmark.c index 2cb8e9fee..4b3652d75 100644 --- a/libnautilus-private/nautilus-bookmark.c +++ b/libnautilus-private/nautilus-bookmark.c @@ -35,6 +35,7 @@ #include <libnautilus-private/nautilus-file.h> #include <libnautilus-private/nautilus-file-utilities.h> +#include <libnautilus-private/nautilus-global-preferences.h> #include <libnautilus-private/nautilus-icon-names.h> #define DEBUG_FLAG NAUTILUS_DEBUG_BOOKMARKS @@ -184,6 +185,25 @@ apply_warning_emblem (GIcon **base, } gboolean +nautilus_bookmark_get_is_builtin (NautilusBookmark *bookmark) +{ + GUserDirectory xdg_type; + + /* if this is not an XDG dir, it's never builtin */ + if (!nautilus_bookmark_get_xdg_type (bookmark, &xdg_type)) { + return FALSE; + } + + /* exclude XDG locations which are not in our builtin list */ + if (xdg_type == G_USER_DIRECTORY_DESKTOP && + !g_settings_get_boolean (gnome_background_preferences, NAUTILUS_PREFERENCES_SHOW_DESKTOP)) { + return FALSE; + } + + return (xdg_type != G_USER_DIRECTORY_TEMPLATES) && (xdg_type != G_USER_DIRECTORY_PUBLIC_SHARE); +} + +gboolean nautilus_bookmark_get_xdg_type (NautilusBookmark *bookmark, GUserDirectory *directory) { diff --git a/libnautilus-private/nautilus-bookmark.h b/libnautilus-private/nautilus-bookmark.h index aa62e35d9..736e41a31 100644 --- a/libnautilus-private/nautilus-bookmark.h +++ b/libnautilus-private/nautilus-bookmark.h @@ -74,6 +74,7 @@ GIcon * nautilus_bookmark_get_symbolic_icon (NautilusBookmark gboolean nautilus_bookmark_get_exists (NautilusBookmark *bookmark); gboolean nautilus_bookmark_get_xdg_type (NautilusBookmark *bookmark, GUserDirectory *directory); +gboolean nautilus_bookmark_get_is_builtin (NautilusBookmark *bookmark); gboolean nautilus_bookmark_get_has_custom_name (NautilusBookmark *bookmark); void nautilus_bookmark_set_custom_name (NautilusBookmark *bookmark, const char *new_name); |