[nautilus/2202-specific-paths-in-path-bar-not-correctly-aligned-horizontally: 2/2] pathbar: Avoid excessive minimum label width
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/2202-specific-paths-in-path-bar-not-correctly-aligned-horizontally: 2/2] pathbar: Avoid excessive minimum label width
- Date: Thu, 31 Mar 2022 07:59:59 +0000 (UTC)
commit aa4a6a963d6bd0d27ce47bcecbd8160794586e51
Author: António Fernandes <antoniojpfernandes gmail com>
Date: Mon Mar 28 08:59:00 2022 +0000
pathbar: Avoid excessive minimum label width
We set a minimum width in characters for the labels in the pathbar not
to collapse into a single ellipsis. Labels under this threshold are
excluded because in that case we just set them not to ellipsize and let
GtkLabel take care of the sizing.
However, the width in characters metric fails for variable-width fonts,
such that in some cases we still set a wider label width than what the
label text occupies.
So, raise the ellipsizing threshold further, and do it proportionally.
Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2202
src/nautilus-pathbar.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 389274269..aeb909f47 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -742,9 +742,9 @@ nautilus_path_bar_update_button_appearance (ButtonData *button_data,
*
* Due to variable width fonts, labels can be shorter than the space
* that would be reserved by setting a minimum amount of characters.
- * Compensate for this with a tolerance of +1 characters.
+ * Compensate for this with a tolerance of +50% characters.
*/
- if (g_utf8_strlen (dir_name, -1) > min_chars + 1)
+ if (g_utf8_strlen (dir_name, -1) > min_chars * 1.5)
{
gtk_label_set_width_chars (GTK_LABEL (button_data->label), min_chars);
gtk_label_set_ellipsize (GTK_LABEL (button_data->label), PANGO_ELLIPSIZE_MIDDLE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]