[gtk+] filechooserbutton: Fix drag highlight problems
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] filechooserbutton: Fix drag highlight problems
- Date: Fri, 11 Mar 2016 13:51:58 +0000 (UTC)
commit 4c3e4d3ea1134b92b70cbb632f07f3a049ced589
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Mar 11 08:50:38 2016 -0500
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.
gtk/gtkfilechooserbutton.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index dd631bb..e9e8147 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]