[nautilus] Fix path bar changing size when navigating



commit 01dca52cbdb6978fa9bb759dcd7d126a497e8185
Author: Nikita Churaev <lamefun x0r gmail com>
Date:   Wed Mar 28 09:47:16 2018 +0300

    Fix path bar changing size when navigating
    
    This was due to size differences between bold and regular labels. The
    problems was that invisible widgets always return 0 when their size is
    requested and Nautilus tried to request the width a regular label would
    take from an invisible bold label with the same text. This patch fixes
    this by showing the label before measuring it and hiding it afterwards.

 src/nautilus-pathbar.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 630b8ed33..e6016b77c 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -480,7 +480,13 @@ set_label_size_request (ButtonData *button_data)
     }
 
     gtk_widget_get_preferred_size (button_data->label, NULL, &nat_req);
+
+    /* We need to show the bold label first before measuring it, because
+     * invisible widgets always return 0 when their size is requested.
+     */
+    gtk_widget_show (button_data->bold_label);
     gtk_widget_get_preferred_size (button_data->bold_label, &bold_req, NULL);
+    gtk_widget_hide (button_data->bold_label);
 
     width = MAX (nat_req.width, bold_req.width);
     width = MIN (width, NAUTILUS_PATH_BAR_BUTTON_MAX_WIDTH);


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