After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 752509 - GtkFileChooserButton causes layout jumps
GtkFileChooserButton causes layout jumps
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
3.17.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2015-07-16 20:05 UTC by Timm Bäder
Modified: 2015-07-17 03:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkFileChooserButton: Don't update icon/label so often (1.76 KB, patch)
2015-07-16 20:06 UTC, Timm Bäder
accepted-commit_now Details | Review

Description Timm Bäder 2015-07-16 20:05:05 UTC
GtkFileChooserButton updates its label and icon on every style-updated emission, which e.g. happens when (un)focusing the window (like when closing/opening the filechooserdialog).

I'll attach a patch that only updates icon/label when the icontheme actually changed, which is the only case where this should happend (I hope, the commit that added this case isn't very meaningful...).
Comment 1 Timm Bäder 2015-07-16 20:06:39 UTC
Created attachment 307586 [details] [review]
GtkFileChooserButton: Don't update icon/label so often

They were updated in style-changed, causing the label to get set to
(None), then to the actual file name again a frame later, both of the
updates cause the GtkFileChooserButton to resize, possibly to the
minimal width, causing the layout to jump. Fix this by only updating
icon/label in style-updated when the icon theme actually changed, which
is the only case we care about here.
Comment 2 Matthias Clasen 2015-07-17 00:18:39 UTC
Review of attachment 307586 [details] [review]:

this was already ok'ed on irc, believe.

::: gtk/gtkfilechooserbutton.c
@@ +1477,3 @@
+    {
+      /* We need to update the icon surface, but only in case
+         the icon theme really changed. */

Pet peeve: 

/* I prefer my comments lined up
 * like this
 */
Comment 3 Timm Bäder 2015-07-17 03:37:41 UTC
Ok pushed, thanks.