From 01dca52cbdb6978fa9bb759dcd7d126a497e8185 Mon Sep 17 00:00:00 2001 From: Nikita Churaev Date: Wed, 28 Mar 2018 09:47:16 +0300 Subject: [PATCH] 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 630b8ed33a..e6016b77c8 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); -- GitLab