[nautilus] bookmark: include icons for XDG special directories in NautilusBookmark
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] bookmark: include icons for XDG special directories in NautilusBookmark
- Date: Wed, 26 Sep 2012 17:53:26 +0000 (UTC)
commit 6f1e24dfe88261ea8d6d80707bab11c95c8486fb
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Sep 26 13:12:42 2012 -0400
bookmark: include icons for XDG special directories in NautilusBookmark
This ensures we also return the right icon in the shell search provider
when an XDG directory is in the results.
libnautilus-private/nautilus-bookmark.c | 41 +++++++++++++++++++++++++++++-
1 files changed, 39 insertions(+), 2 deletions(-)
---
diff --git a/libnautilus-private/nautilus-bookmark.c b/libnautilus-private/nautilus-bookmark.c
index 3e15b79..f5995c4 100644
--- a/libnautilus-private/nautilus-bookmark.c
+++ b/libnautilus-private/nautilus-bookmark.c
@@ -179,6 +179,43 @@ apply_warning_emblem (GIcon **base,
*base = emblemed_icon;
}
+static GIcon *
+get_native_icon (NautilusBookmark *bookmark,
+ gboolean symbolic)
+{
+ gint idx;
+ GIcon *icon = NULL;
+
+ if (bookmark->details->file == NULL) {
+ goto out;
+ }
+
+ for (idx = 0; idx < G_USER_N_DIRECTORIES; idx++) {
+ if (nautilus_file_is_user_special_directory (bookmark->details->file, idx)) {
+ break;
+ }
+ }
+
+ if (idx < G_USER_N_DIRECTORIES) {
+ if (symbolic) {
+ icon = nautilus_special_directory_get_symbolic_icon (idx);
+ } else {
+ icon = nautilus_special_directory_get_icon (idx);
+ }
+ }
+
+ out:
+ if (icon == NULL) {
+ if (symbolic) {
+ icon = g_themed_icon_new (NAUTILUS_ICON_FOLDER);
+ } else {
+ icon = g_themed_icon_new (NAUTILUS_ICON_FULLCOLOR_FOLDER);
+ }
+ }
+
+ return icon;
+}
+
static void
nautilus_bookmark_set_icon_to_default (NautilusBookmark *bookmark)
{
@@ -186,8 +223,8 @@ nautilus_bookmark_set_icon_to_default (NautilusBookmark *bookmark)
char *uri;
if (g_file_is_native (bookmark->details->location)) {
- symbolic_icon = g_themed_icon_new (NAUTILUS_ICON_FOLDER);
- icon = g_themed_icon_new (NAUTILUS_ICON_FULLCOLOR_FOLDER);
+ symbolic_icon = get_native_icon (bookmark, TRUE);
+ icon = get_native_icon (bookmark, FALSE);
} else {
uri = nautilus_bookmark_get_uri (bookmark);
if (g_str_has_prefix (uri, EEL_SEARCH_URI)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]