[nautilus/wip/antoniof/max-width-chars-for-conflict-dialog] properties-window: Truncate name in window title



commit ed3f08c57421336b90b4b82d29ce2ab8ee247089
Author: António Fernandes <antoniof gnome org>
Date:   Wed Jan 6 10:33:07 2021 +0000

    properties-window: Truncate name in window title
    
    We display the a file's basename in the properties window title.
    
        exmaple.txt Properties
    
    If a file has a really long name, this makes the dialog way too wide.
    
        example_of_a_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_name.txt 
Properties
    
    Yes, that went past the 72 characters limit for a commit message lines,
    which proves the point.
    
    Instead, let's truncate the basename to a reasonable limit.
    The full name is available in the Basic tab of properties dialog anyway.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=754388

 src/nautilus-properties-window.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 738b6f566..d21d6a56c 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -886,17 +886,22 @@ update_properties_window_title (NautilusPropertiesWindow *self)
         if (file != NULL)
         {
             g_autofree gchar *name = NULL;
+            g_autofree gchar *truncated_name = NULL;
 
             name = nautilus_file_get_display_name (file);
+            truncated_name = eel_str_middle_truncate (name, 30);
+
             if (nautilus_file_is_directory (file))
             {
                 /* To translators: %s is the name of the folder. */
-                title = g_strdup_printf (C_("folder", "%s Properties"), name);
+                title = g_strdup_printf (C_("folder", "%s Properties"),
+                                         truncated_name);
             }
             else
             {
                 /* To translators: %s is the name of the file. */
-                title = g_strdup_printf (C_("file", "%s Properties"), name);
+                title = g_strdup_printf (C_("file", "%s Properties"),
+                                         truncated_name);
             }
         }
     }


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