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
This commit is contained in:
António Fernandes 2021-01-06 10:33:07 +00:00
parent d2be38db90
commit ee77cd41c4

View file

@ -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);
}
}
}