[nautilus/wip/antoniof/hidpi-and-icons-cleanup: 1/5] file: Drop "spacial file manager" leftovers




commit 5103cfcc929c3f383ee694095111fa563714d062
Author: António Fernandes <antoniof gnome org>
Date:   Mon Aug 8 00:28:28 2022 +0100

    file: Drop "spacial file manager" leftovers
    
    These flags were relevant when each folder opened in its own window,
    such that the open folders would have a different icon. Also, we would
    ignore that icon in properties.
    
    Spacial nautilus has been gone for maybe 15 years now.

 src/nautilus-file.c              | 64 +---------------------------------------
 src/nautilus-file.h              |  4 +--
 src/nautilus-properties-window.c | 19 ++----------
 3 files changed, 4 insertions(+), 83 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 62980f6c4..4ad2c83de 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -5027,23 +5027,11 @@ nautilus_file_get_emblem_icons (NautilusFile *file)
     return icons;
 }
 
-static void
-prepend_icon_name (const char  *name,
-                   GThemedIcon *icon)
-{
-    g_themed_icon_prepend_name (icon, name);
-}
-
 GIcon *
 nautilus_file_get_gicon (NautilusFile          *file,
                          NautilusFileIconFlags  flags)
 {
-    const char * const *names;
-    const char *name;
-    GPtrArray *prepend_array;
     GIcon *icon;
-    int i;
-    gboolean is_folder = FALSE, is_inode_directory = FALSE;
 
     if (file == NULL)
     {
@@ -5068,57 +5056,7 @@ nautilus_file_get_gicon (NautilusFile          *file,
 
     if (file->details->icon)
     {
-        icon = NULL;
-
-        if (((flags & NAUTILUS_FILE_ICON_FLAGS_FOR_OPEN_FOLDER) ||
-             (flags & NAUTILUS_FILE_ICON_FLAGS_USE_MOUNT_ICON)) &&
-            G_IS_THEMED_ICON (file->details->icon))
-        {
-            names = g_themed_icon_get_names (G_THEMED_ICON (file->details->icon));
-            prepend_array = g_ptr_array_new ();
-
-            for (i = 0; names[i] != NULL; i++)
-            {
-                name = names[i];
-
-                if (strcmp (name, "folder") == 0)
-                {
-                    is_folder = TRUE;
-                }
-                if (strcmp (name, "inode-directory") == 0)
-                {
-                    is_inode_directory = TRUE;
-                }
-            }
-
-            /* Here, we add icons in reverse order of precedence,
-             * because they are later prepended */
-
-            /* "folder" should override "inode-directory", not the other way around */
-            if (is_inode_directory)
-            {
-                g_ptr_array_add (prepend_array, "folder");
-            }
-            if (is_folder && (flags & NAUTILUS_FILE_ICON_FLAGS_FOR_OPEN_FOLDER))
-            {
-                g_ptr_array_add (prepend_array, "folder-open");
-            }
-
-            if (prepend_array->len)
-            {
-                /* When constructing GThemed Icon, pointers from the array
-                 * are reused, but not the array itself, so the cast is safe */
-                icon = g_themed_icon_new_from_names ((char **) names, -1);
-                g_ptr_array_foreach (prepend_array, (GFunc) prepend_icon_name, icon);
-            }
-
-            g_ptr_array_free (prepend_array, TRUE);
-        }
-
-        if (icon == NULL)
-        {
-            icon = g_object_ref (file->details->icon);
-        }
+        icon = g_object_ref (file->details->icon);
     }
 
 out:
diff --git a/src/nautilus-file.h b/src/nautilus-file.h
index 68c7ff931..0ad5b75f5 100644
--- a/src/nautilus-file.h
+++ b/src/nautilus-file.h
@@ -80,10 +80,8 @@ typedef enum {
 typedef enum {
        NAUTILUS_FILE_ICON_FLAGS_NONE = 0,
        NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS = (1<<0),
-       NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING = (1<<1),
-       NAUTILUS_FILE_ICON_FLAGS_FOR_OPEN_FOLDER = (1<<2),
        /* uses the icon of the mount if present */
-       NAUTILUS_FILE_ICON_FLAGS_USE_MOUNT_ICON = (1<<3),
+       NAUTILUS_FILE_ICON_FLAGS_USE_MOUNT_ICON = (1<<1),
 } NautilusFileIconFlags;       
 
 #define NAUTILUS_THUMBNAIL_MINIMUM_ICON_SIZE 32
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index af8c2d8bb..114daef95 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -577,13 +577,13 @@ get_image_for_properties_window (NautilusPropertiesWindow  *self,
         {
             icon = nautilus_file_get_icon (file, NAUTILUS_GRID_ICON_SIZE_MEDIUM, icon_scale,
                                            NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS |
-                                           NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING);
+                                           NAUTILUS_FILE_ICON_FLAGS_USE_MOUNT_ICON);
         }
         else
         {
             new_icon = nautilus_file_get_icon (file, NAUTILUS_GRID_ICON_SIZE_MEDIUM, icon_scale,
                                                NAUTILUS_FILE_ICON_FLAGS_USE_THUMBNAILS |
-                                               NAUTILUS_FILE_ICON_FLAGS_IGNORE_VISITING);
+                                               NAUTILUS_FILE_ICON_FLAGS_USE_MOUNT_ICON);
             if (!new_icon || new_icon != icon)
             {
                 g_object_unref (icon);
@@ -593,21 +593,6 @@ get_image_for_properties_window (NautilusPropertiesWindow  *self,
         }
     }
 
-    if (!is_multi_file_window (self))
-    {
-        g_autoptr (GMount) mount = NULL;
-        mount = nautilus_file_get_mount (get_original_file (self));
-        if (mount != NULL)
-        {
-            g_autoptr (GIcon) gicon = g_mount_get_icon (mount);
-            if (gicon != NULL)
-            {
-                g_clear_object (&icon);
-                icon = nautilus_icon_info_lookup (gicon, NAUTILUS_GRID_ICON_SIZE_MEDIUM, icon_scale);
-            }
-        }
-    }
-
     if (!icon)
     {
         g_autoptr (GIcon) gicon = g_themed_icon_new ("text-x-generic");


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