summaryrefslogtreecommitdiff
path: root/gtk/gtkfilechooserdefault.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2006-01-20 19:11:08 +0000
committerDan Winship <danw@src.gnome.org>2006-01-20 19:11:08 +0000
commit967aeb882b0204976a92c8d6ac0925553d583735 (patch)
tree715605ecb162aacfcef1391721342845eb5772c0 /gtk/gtkfilechooserdefault.c
parent1b1f8aea52877a7dacd4ae57979092bec10ae388 (diff)
downloadgtk+-967aeb882b0204976a92c8d6ac0925553d583735.tar.gz
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)
Diffstat (limited to 'gtk/gtkfilechooserdefault.c')
-rw-r--r--gtk/gtkfilechooserdefault.c33
1 files changed, 21 insertions, 12 deletions
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), "");