[nautilus/wip/antoniof/properties-followup: 1/3] properties-window: Hide type if not homogeneous
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/properties-followup: 1/3] properties-window: Hide type if not homogeneous
- Date: Thu, 4 Aug 2022 06:20:31 +0000 (UTC)
commit 483b15e49735a93eccd574d80d4aac94b1e157f8
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 | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 97fa172fc..7dced1c3d 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -2164,9 +2164,43 @@ should_show_custom_icon_buttons (NautilusPropertiesWindow *self)
return TRUE;
}
+static gboolean
+is_single_file_type (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;
+
+ if (nautilus_file_is_gone (NAUTILUS_FILE (l->data)))
+ {
+ continue;
+ }
+
+ 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_single_file_type (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]