[gtk+/wip/matthiasc/filechooser] file chooser: Tweak bindings in save mode
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/filechooser] file chooser: Tweak bindings in save mode
- Date: Sat, 27 Jun 2015 20:02:47 +0000 (UTC)
commit 86be6f8d06715ff67fe46eca33d226094af3cec6
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jun 27 15:54:49 2015 -0400
file chooser: Tweak bindings in save mode
In save modes, the entry is really more for entering a name than
entering a full location, so don't go there eagerly when '.', '/'
or '~' are pressed. Make Ctrl-L work better in this mode too.
gtk/gtkfilechooserwidget.c | 44 ++++++++++++++++++++------------------------
1 files changed, 20 insertions(+), 24 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index e1f58e4..2efa069 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -1232,7 +1232,9 @@ browse_files_key_press_event_cb (GtkWidget *widget,
GtkFileChooserWidget *impl = (GtkFileChooserWidget *) data;
GtkFileChooserWidgetPrivate *priv = impl->priv;
- if (should_trigger_location_entry (widget, event))
+ if (should_trigger_location_entry (widget, event) &&
+ (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER))
{
location_popup_handler (impl, event->string);
return TRUE;
@@ -1285,11 +1287,14 @@ gtk_file_chooser_widget_key_press_event (GtkWidget *widget,
if (should_trigger_location_entry (widget, event))
{
- location_popup_handler (impl, event->string);
- return TRUE;
+ if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ {
+ location_popup_handler (impl, event->string);
+ return TRUE;
+ }
}
-
- if (gtk_search_entry_handle_event (GTK_SEARCH_ENTRY (priv->search_entry), (GdkEvent *)event))
+ else if (gtk_search_entry_handle_event (GTK_SEARCH_ENTRY (priv->search_entry), (GdkEvent *)event))
{
if (priv->operation_mode != OPERATION_MODE_SEARCH)
operation_mode_set (impl, OPERATION_MODE_SEARCH);
@@ -2329,10 +2334,17 @@ location_toggle_popup_handler (GtkFileChooserWidget *impl)
priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER))
operation_mode_set (impl, OPERATION_MODE_BROWSE);
- /* If the file entry is not visible, show it.
- * If it is visible, turn it off only if it is focused. Otherwise, switch to the entry.
+ /* If the file entry is not visible, show it (it is _always_
+ * visible in save modes, handle these first).
+ * If it is visible, turn it off only if it is focused.
+ * Otherwise, switch to the entry.
*/
- if (priv->location_mode == LOCATION_MODE_PATH_BAR)
+ if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ {
+ gtk_widget_grab_focus (priv->location_entry);
+ }
+ else if (priv->location_mode == LOCATION_MODE_PATH_BAR)
{
location_mode_set (impl, LOCATION_MODE_FILENAME_ENTRY);
}
@@ -7634,22 +7646,6 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
0);
gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_slash, 0,
- "location-popup",
- 1, G_TYPE_STRING, "/");
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_KP_Divide, 0,
- "location-popup",
- 1, G_TYPE_STRING, "/");
-
-#ifdef G_OS_UNIX
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_asciitilde, 0,
- "location-popup",
- 1, G_TYPE_STRING, "~");
-#endif
-
- gtk_binding_entry_add_signal (binding_set,
GDK_KEY_v, GDK_CONTROL_MASK,
"location-popup-on-paste",
0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]