diff options
author | Timm Bäder <mail@baedert.org> | 2015-07-16 21:47:13 +0200 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2015-07-17 05:36:44 +0200 |
commit | c53bed3b391f42c85fb62c029005d086d43686b0 (patch) | |
tree | a7b7be4501431d2e1d8daf8984470ee741c29a8d /gtk/gtkfilechooserbutton.c | |
parent | 2902585518e0c175e75ec4d9657594a904e2eb0a (diff) | |
download | gtk+-c53bed3b391f42c85fb62c029005d086d43686b0.tar.gz |
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.
https://bugzilla.gnome.org/show_bug.cgi?id=752509
Diffstat (limited to 'gtk/gtkfilechooserbutton.c')
-rw-r--r-- | gtk/gtkfilechooserbutton.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index b81e076e52..ad3d136bed 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -55,7 +55,8 @@ #include "gtktypebuiltins.h" #include "gtkprivate.h" #include "gtksettings.h" - +#include "gtkstylecontextprivate.h" +#include "gtkbitmaskprivate.h" /** * SECTION:gtkfilechooserbutton @@ -1473,7 +1474,14 @@ gtk_file_chooser_button_style_updated (GtkWidget *widget) GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->style_updated (widget); if (gtk_widget_has_screen (widget)) - change_icon_theme (GTK_FILE_CHOOSER_BUTTON (widget)); + { + /* We need to update the icon surface, but only in case + * the icon theme really changed. */ + GtkStyleContext *context = gtk_widget_get_style_context (widget); + const GtkBitmask *changes = _gtk_style_context_get_changes (context); + if (!changes || _gtk_bitmask_get (changes, GTK_CSS_PROPERTY_ICON_THEME)) + change_icon_theme (GTK_FILE_CHOOSER_BUTTON (widget)); + } } static void |