[nautilus/wip/corey/properties: 38/44] properties: Set icon for root filesystem to the harddisk icon




commit 6ba03b1bcab9303ef127a42d09da4f65323651f9
Author: Corey Berla <corey berla me>
Date:   Tue Aug 23 09:48:49 2022 -0700

    properties: Set icon for root filesystem to the harddisk icon
    
    We have a special case to set the icons for mounts, but the root
    filesystem doesn't return a mount from g_file_find_enclosing_mount()
    so set the icon for / separately.

 src/nautilus-properties-window.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 8c2c21152..e8b5816ea 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -468,6 +468,7 @@ static void remove_pending (StartupData *data,
                             gboolean     cancel_call_when_ready,
                             gboolean     cancel_timed_wait);
 static void refresh_extension_model_pages (NautilusPropertiesWindow *self);
+static gboolean is_root_directory (NautilusFile *file);
 
 G_DEFINE_TYPE (NautilusPropertiesWindow, nautilus_properties_window, ADW_TYPE_WINDOW);
 
@@ -595,16 +596,22 @@ get_image_for_properties_window (NautilusPropertiesWindow  *self,
 
     if (!is_multi_file_window (self))
     {
+        g_autoptr (GIcon) gicon = NULL;
         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);
-            }
+            gicon = g_mount_get_icon (mount);
+        }
+        else if (is_root_directory (get_original_file (self)))
+        {
+            gicon = g_themed_icon_new_with_default_fallbacks ("drive-harddisk");
+        }
+
+        if (gicon != NULL)
+        {
+            g_clear_object (&icon);
+            icon = nautilus_icon_info_lookup (gicon, NAUTILUS_GRID_ICON_SIZE_MEDIUM, icon_scale);
         }
     }
 


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