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)
This commit is contained in:
Dan Winship 2006-01-20 19:11:08 +00:00
parent 1b1f8aea52
commit 967aeb882b
3 changed files with 37 additions and 12 deletions

View File

@ -1,3 +1,11 @@
2006-01-20 Dan Winship <danw@novell.com>
* 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 <mclasen@redhat.com> 2006-01-19 Matthias Clasen <mclasen@redhat.com>
* configure.in: Explicitly link against Xrender. * configure.in: Explicitly link against Xrender.

View File

@ -1,3 +1,11 @@
2006-01-20 Dan Winship <danw@novell.com>
* 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 <mclasen@redhat.com> 2006-01-19 Matthias Clasen <mclasen@redhat.com>
* configure.in: Explicitly link against Xrender. * configure.in: Explicitly link against Xrender.

View File

@ -577,6 +577,13 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
"location-popup", "location-popup",
1, G_TYPE_STRING, "/"); 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, gtk_binding_entry_add_signal (binding_set,
GDK_Up, GDK_MOD1_MASK, GDK_Up, GDK_MOD1_MASK,
"up-folder", "up-folder",
@ -2930,10 +2937,13 @@ tree_view_keybinding_cb (GtkWidget *tree_view,
GdkEventKey *event, GdkEventKey *event,
GtkFileChooserDefault *impl) GtkFileChooserDefault *impl)
{ {
if (event->keyval == GDK_slash && if ((event->keyval == GDK_slash
! (event->state & (~GDK_SHIFT_MASK & gtk_accelerator_get_default_mod_mask ()))) #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; return TRUE;
} }
@ -3292,10 +3302,13 @@ trap_activate_cb (GtkWidget *widget,
modifiers = gtk_accelerator_get_default_mod_mask (); modifiers = gtk_accelerator_get_default_mod_mask ();
if (event->keyval == GDK_slash && if ((event->keyval == GDK_slash
! (event->state & (~GDK_SHIFT_MASK & modifiers))) #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; return TRUE;
} }
@ -7125,15 +7138,11 @@ location_entry_create (GtkFileChooserDefault *impl,
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); 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_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_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]) if (path[0])
{ gtk_entry_set_text (GTK_ENTRY (entry), path);
_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);
}
else else
{ {
_gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (entry), impl->current_folder);
if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
|| impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
_gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (entry), ""); _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (entry), "");