[nautilus/wip/antoniof/properties-followup: 2/3] properties-window: Hide type if not homogeneous




commit f26f96a6b122ba24cd26c67f8a3784ce00db6c87
Author: António Fernandes <antoniof gnome org>
Date:   Wed Aug 3 13:43:20 2022 +0100

    properties-window: Hide type if not homogeneous
    
    Multi-file windows may have files of different types.

 src/nautilus-properties-window.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 97fa172fc..a31d48d23 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -2164,9 +2164,38 @@ should_show_custom_icon_buttons (NautilusPropertiesWindow *self)
     return TRUE;
 }
 
+static gboolean
+is_type_homogeneous (NautilusPropertiesWindow *self)
+{
+    if (is_multi_file_window (self))
+    {
+        g_autofree gchar *mime_type = NULL;
+        GList *l = self->original_files;
+
+        mime_type = nautilus_file_get_mime_type (NAUTILUS_FILE (l->data));
+        for (l = l->next; l != NULL; l = l->next)
+        {
+            g_autofree gchar *next_mime_type = NULL;
+
+            next_mime_type = nautilus_file_get_mime_type (NAUTILUS_FILE (l->data));
+            if (g_strcmp0 (next_mime_type, mime_type) != 0)
+            {
+                return FALSE;
+            }
+        }
+    }
+
+    return TRUE;
+}
+
 static gboolean
 should_show_file_type (NautilusPropertiesWindow *self)
 {
+    if (!is_type_homogeneous (self))
+    {
+        return FALSE;
+    }
+
     if (!is_multi_file_window (self)
         && (nautilus_file_is_in_trash (get_target_file (self)) ||
             is_network_directory (get_target_file (self)) ||


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