From 967aeb882b0204976a92c8d6ac0925553d583735 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 20 Jan 2006 19:11:08 +0000 Subject: [PATCH] On "unix", pop up the "Open Location" window on "~" as well as "/". * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_class_init, tree_view_keybinding_cb, trap_activate_cb): On "unix", pop up the "Open Location" window on "~" as well as "/". #153213 (location_entry_create): Fix this so autocompletion still works correctly in that case. (ok'ed by federico) --- ChangeLog | 8 ++++++++ ChangeLog.pre-2-10 | 8 ++++++++ gtk/gtkfilechooserdefault.c | 33 +++++++++++++++++++++------------ 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86e8bc4577..16f5ba6dda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-01-20 Dan Winship + + * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_class_init, + tree_view_keybinding_cb, trap_activate_cb): On "unix", pop up the + "Open Location" window on "~" as well as "/". #153213 + (location_entry_create): Fix this so autocompletion still works + correctly in that case. + 2006-01-19 Matthias Clasen * configure.in: Explicitly link against Xrender. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 86e8bc4577..16f5ba6dda 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +2006-01-20 Dan Winship + + * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_class_init, + tree_view_keybinding_cb, trap_activate_cb): On "unix", pop up the + "Open Location" window on "~" as well as "/". #153213 + (location_entry_create): Fix this so autocompletion still works + correctly in that case. + 2006-01-19 Matthias Clasen * configure.in: Explicitly link against Xrender. diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index cf1f8f733c..2aee3341b1 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -577,6 +577,13 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class) "location-popup", 1, G_TYPE_STRING, "/"); +#ifdef G_OS_UNIX + gtk_binding_entry_add_signal (binding_set, + GDK_asciitilde, 0, + "location-popup", + 1, G_TYPE_STRING, "~"); +#endif + gtk_binding_entry_add_signal (binding_set, GDK_Up, GDK_MOD1_MASK, "up-folder", @@ -2930,10 +2937,13 @@ tree_view_keybinding_cb (GtkWidget *tree_view, GdkEventKey *event, GtkFileChooserDefault *impl) { - if (event->keyval == GDK_slash && - ! (event->state & (~GDK_SHIFT_MASK & gtk_accelerator_get_default_mod_mask ()))) + if ((event->keyval == GDK_slash +#ifdef G_OS_UNIX + || event->keyval == GDK_asciitilde +#endif + ) && ! (event->state & (~GDK_SHIFT_MASK & gtk_accelerator_get_default_mod_mask ()))) { - location_popup_handler (impl, "/"); + location_popup_handler (impl, event->string); return TRUE; } @@ -3292,10 +3302,13 @@ trap_activate_cb (GtkWidget *widget, modifiers = gtk_accelerator_get_default_mod_mask (); - if (event->keyval == GDK_slash && - ! (event->state & (~GDK_SHIFT_MASK & modifiers))) + if ((event->keyval == GDK_slash +#ifdef G_OS_UNIX + || event->keyval == GDK_asciitilde +#endif + ) && ! (event->state & (~GDK_SHIFT_MASK & modifiers))) { - location_popup_handler (impl, "/"); + location_popup_handler (impl, event->string); return TRUE; } @@ -7125,15 +7138,11 @@ location_entry_create (GtkFileChooserDefault *impl, gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); _gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (entry), impl->file_system); _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (entry), impl->action); + _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (entry), impl->current_folder); if (path[0]) - { - _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (entry), - gtk_file_path_new_steal ((gchar *)path)); - _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (entry), path); - } + gtk_entry_set_text (GTK_ENTRY (entry), path); else { - _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (entry), impl->current_folder); if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (entry), "");