[nautilus] file: apply emblems to all gicons



commit 9f49a745fa1097ddddae9c9fbcdbb0c73925d108
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Sep 9 14:23:09 2014 -0700

    file: apply emblems to all gicons
    
    Including the default icons.

 libnautilus-private/nautilus-file.c |   32 +++++++++++++++++++-------------
 1 files changed, 19 insertions(+), 13 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 9f4e04f..9d313eb 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -4015,6 +4015,17 @@ get_custom_icon (NautilusFile *file)
        return icon;
 }
 
+static GIcon *
+get_default_file_icon (void)
+{
+       static GIcon *fallback_icon = NULL;
+       if (fallback_icon == NULL) {
+               fallback_icon = g_themed_icon_new ("text-x-generic");
+       }
+
+       return fallback_icon;
+}
+
 GFilesystemPreviewType
 nautilus_file_get_filesystem_use_preview (NautilusFile *file)
 {
@@ -4304,6 +4315,8 @@ nautilus_file_get_gicon (NautilusFile *file,
        int i;
        gboolean is_folder = FALSE, is_inode_directory = FALSE;
 
+       icon = NULL;
+
        if (file == NULL) {
                return NULL;
        }
@@ -4324,7 +4337,7 @@ nautilus_file_get_gicon (NautilusFile *file,
                icon = get_mount_icon (file);
 
                if (icon != NULL) {
-                       return icon;
+                       goto out;
                }
        }
 
@@ -4388,24 +4401,17 @@ nautilus_file_get_gicon (NautilusFile *file,
        }
 
  out:
+       if (icon == NULL) {
+               icon = g_object_ref (get_default_file_icon ());
+       }
+
        if (flags & NAUTILUS_FILE_ICON_FLAGS_USE_EMBLEMS) {
                emblemed_icon = apply_emblems_to_icon (file, icon, flags);
                g_object_unref (icon);
                icon = emblemed_icon;
        }
        
-       return g_themed_icon_new ("text-x-generic");
-}
-
-static GIcon *
-get_default_file_icon (void)
-{
-       static GIcon *fallback_icon = NULL;
-       if (fallback_icon == NULL) {
-               fallback_icon = g_themed_icon_new ("text-x-generic");
-       }
-
-       return fallback_icon;
+       return icon;
 }
 
 char *


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