diff options
author | Matthias Clasen <mclasen@redhat.com> | 2016-03-11 08:50:38 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2016-03-11 08:51:50 -0500 |
commit | 4c3e4d3ea1134b92b70cbb632f07f3a049ced589 (patch) | |
tree | 509b35b661808cb2125042e8762d7aaedd8e5a6e /gtk/gtkfilechooserbutton.c | |
parent | e8c5db0425bb58a965a7d46f1d40d16fec2de40b (diff) | |
download | gtk+-4c3e4d3ea1134b92b70cbb632f07f3a049ced589.tar.gz |
filechooserbutton: Fix drag highlight problems
This widget is a bit unusual in that it is a box that acts as
the drop target, while the visible content is a child of the box.
Propagate :drop(active) to the child to make the highlight visible.
Diffstat (limited to 'gtk/gtkfilechooserbutton.c')
-rw-r--r-- | gtk/gtkfilechooserbutton.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index dd631bbc33..e9e81471b9 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -278,6 +278,8 @@ static gboolean gtk_file_chooser_button_mnemonic_activate (GtkWidget *wi static void gtk_file_chooser_button_style_updated (GtkWidget *widget); static void gtk_file_chooser_button_screen_changed (GtkWidget *widget, GdkScreen *old_screen); +static void gtk_file_chooser_button_state_flags_changed (GtkWidget *widget, + GtkStateFlags previous_state); /* Utility Functions */ static GtkIconTheme *get_icon_theme (GtkWidget *widget); @@ -386,6 +388,7 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class) widget_class->style_updated = gtk_file_chooser_button_style_updated; widget_class->screen_changed = gtk_file_chooser_button_screen_changed; widget_class->mnemonic_activate = gtk_file_chooser_button_mnemonic_activate; + widget_class->state_flags_changed = gtk_file_chooser_button_state_flags_changed; /** * GtkFileChooserButton::file-set: @@ -996,6 +999,27 @@ gtk_file_chooser_button_finalize (GObject *object) * ********************* */ static void +gtk_file_chooser_button_state_flags_changed (GtkWidget *widget, + GtkStateFlags previous_state) +{ + GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget); + GtkFileChooserButtonPrivate *priv = button->priv; + GtkWidget *child; + + if (gtk_widget_get_visible (priv->button)) + child = priv->button; + else + child = priv->combo_box; + + if (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_DROP_ACTIVE) + gtk_widget_set_state_flags (child, GTK_STATE_FLAG_DROP_ACTIVE, FALSE); + else + gtk_widget_unset_state_flags (child, GTK_STATE_FLAG_DROP_ACTIVE); + + GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->state_flags_changed (widget, previous_state); +} + +static void gtk_file_chooser_button_destroy (GtkWidget *widget) { GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget); |