diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-07-16 23:36:51 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-07-16 23:38:47 -0400 |
commit | 1fb075dbca911d4a61e7ebbf9fc040cd697f4d83 (patch) | |
tree | 10fc3608e1e0df4f652c746705ea3cadc6d88d69 /gtk/gtkfilechooserwidget.c | |
parent | c53bed3b391f42c85fb62c029005d086d43686b0 (diff) | |
download | gtk+-1fb075dbca911d4a61e7ebbf9fc040cd697f4d83.tar.gz |
file chooser: Make bindings work in save entry
With the name entry being in the header bar now, we no longer
get bindings working by just letting the key event bubble up,
we have to explicitly apply them on key events that the save
entry is not handling.
Diffstat (limited to 'gtk/gtkfilechooserwidget.c')
-rw-r--r-- | gtk/gtkfilechooserwidget.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index ddadbab038..30db0351a8 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -2556,6 +2556,17 @@ location_entry_create (GtkFileChooserWidget *impl) } } +static gboolean +external_entry_key_press (GtkWidget *entry, + GdkEventKey *event, + GtkFileChooserWidget *impl) +{ + /* Since the entry is not a descendent of the file chooser widget + * in this case, we need to manually make our bindings apply. + */ + return gtk_bindings_activate_event (G_OBJECT (impl), event); +} + /* Creates the widgets specific to Save mode */ static void save_widgets_create (GtkFileChooserWidget *impl) @@ -2576,6 +2587,9 @@ save_widgets_create (GtkFileChooserWidget *impl) location_entry_disconnect (impl); priv->location_entry = priv->external_entry; location_entry_setup (impl); + + g_signal_connect_after (priv->external_entry, "key-press-event", + G_CALLBACK (external_entry_key_press), impl); return; } @@ -2621,6 +2635,8 @@ save_widgets_destroy (GtkFileChooserWidget *impl) if (priv->external_entry && priv->external_entry == priv->location_entry) { + g_signal_handlers_disconnect_by_func (priv->external_entry, external_entry_key_press, impl); + location_entry_disconnect (impl); priv->location_entry = NULL; } |