diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 14 | ||||
-rw-r--r-- | gtk/gtkfilechooserdefault.c | 43 | ||||
-rw-r--r-- | tests/autotestfilechooser.c | 5 |
4 files changed, 58 insertions, 18 deletions
@@ -1,3 +1,17 @@ +2006-08-17 Federico Mena Quintero <federico@novell.com> + + * gtk/gtkfilechooserdefault.c + (_gtk_file_chooser_default_class_init): Enable "/" and "~" as + bindings to activate the location entry again. Fixes bug #340856. + (tree_view_keybinding_cb): Likewise. + (trap_activate_cb): Likewise. + (location_popup_handler): Handle the "path" argument again; set it + as the text on the location entry. + (location_set_user_text): New helper function. + (load_setup_timer): Fix comment. + + * tests/autotestfilechooser.c (main): Oops, enable all the tests again. + 2006-08-17 Matthias Clasen <mclasen@redhat.com> * gtk/gtkmodules.c (find_module): Revert the local binding diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e75713e8b6..b20dd0d934 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,17 @@ +2006-08-17 Federico Mena Quintero <federico@novell.com> + + * gtk/gtkfilechooserdefault.c + (_gtk_file_chooser_default_class_init): Enable "/" and "~" as + bindings to activate the location entry again. Fixes bug #340856. + (tree_view_keybinding_cb): Likewise. + (trap_activate_cb): Likewise. + (location_popup_handler): Handle the "path" argument again; set it + as the text on the location entry. + (location_set_user_text): New helper function. + (load_setup_timer): Fix comment. + + * tests/autotestfilechooser.c (main): Oops, enable all the tests again. + 2006-08-17 Matthias Clasen <mclasen@redhat.com> * gtk/gtkmodules.c (find_module): Revert the local binding diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 03f740df58..e5b6e90602 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -544,8 +544,7 @@ _gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class) GDK_l, GDK_CONTROL_MASK, "location-popup", 1, G_TYPE_STRING, ""); - /* FMQ: remove this? */ -#if 0 + gtk_binding_entry_add_signal (binding_set, GDK_slash, 0, "location-popup", @@ -561,7 +560,6 @@ _gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class) "location-popup", 1, G_TYPE_STRING, "~"); #endif -#endif gtk_binding_entry_add_signal (binding_set, GDK_v, GDK_CONTROL_MASK, @@ -3160,8 +3158,6 @@ tree_view_keybinding_cb (GtkWidget *tree_view, GdkEventKey *event, GtkFileChooserDefault *impl) { - /* FMQ: remove this? */ -#if 0 if ((event->keyval == GDK_slash || event->keyval == GDK_KP_Divide #ifdef G_OS_UNIX @@ -3172,7 +3168,7 @@ tree_view_keybinding_cb (GtkWidget *tree_view, location_popup_handler (impl, event->string); return TRUE; } -#endif + return FALSE; } @@ -3544,8 +3540,6 @@ trap_activate_cb (GtkWidget *widget, modifiers = gtk_accelerator_get_default_mod_mask (); - /* FMQ: remove this? */ -#if 0 if ((event->keyval == GDK_slash || event->keyval == GDK_KP_Divide #ifdef G_OS_UNIX @@ -3556,7 +3550,6 @@ trap_activate_cb (GtkWidget *widget, location_popup_handler (impl, event->string); return TRUE; } -#endif if ((event->keyval == GDK_Return || event->keyval == GDK_ISO_Enter @@ -5644,7 +5637,7 @@ load_timeout_cb (gpointer data) return FALSE; } -/* Sets up a new load timer for the model and switches to the LOAD_LOADING state */ +/* Sets up a new load timer for the model and switches to the LOAD_PRELOAD state */ static void load_setup_timer (GtkFileChooserDefault *impl) { @@ -8382,6 +8375,14 @@ _gtk_file_chooser_default_new (const char *file_system) } static void +location_set_user_text (GtkFileChooserDefault *impl, + const gchar *path) +{ + _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), path); + gtk_editable_set_position (GTK_EDITABLE (impl->location_entry), -1); +} + +static void location_popup_handler (GtkFileChooserDefault *impl, const gchar *path) { @@ -8390,7 +8391,12 @@ location_popup_handler (GtkFileChooserDefault *impl, { LocationMode new_mode; - if (impl->location_mode == LOCATION_MODE_PATH_BAR) + if (path != NULL) + { + /* since the user typed something, we unconditionally want to turn on the entry */ + new_mode = LOCATION_MODE_FILENAME_ENTRY; + } + else if (impl->location_mode == LOCATION_MODE_PATH_BAR) new_mode = LOCATION_MODE_FILENAME_ENTRY; else if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY) new_mode = LOCATION_MODE_PATH_BAR; @@ -8403,13 +8409,22 @@ location_popup_handler (GtkFileChooserDefault *impl, location_mode_set (impl, new_mode, TRUE); if (new_mode == LOCATION_MODE_FILENAME_ENTRY) { - location_entry_set_initial_text (impl); - gtk_editable_select_region (GTK_EDITABLE (impl->location_entry), 0, -1); + if (path != NULL) + location_set_user_text (impl, path); + else + { + location_entry_set_initial_text (impl); + gtk_editable_select_region (GTK_EDITABLE (impl->location_entry), 0, -1); + } } } else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER) - gtk_widget_grab_focus (impl->location_entry); + { + gtk_widget_grab_focus (impl->location_entry); + if (path != NULL) + location_set_user_text (impl, path); + } else g_assert_not_reached (); } diff --git a/tests/autotestfilechooser.c b/tests/autotestfilechooser.c index 6d5f5f19a2..e216fd358a 100644 --- a/tests/autotestfilechooser.c +++ b/tests/autotestfilechooser.c @@ -977,16 +977,13 @@ main (int argc, char **argv) gtk_init (&argc, &argv); /* Start tests */ -#if 0 + passed = passed && test_black_box (); -#endif passed = passed && test_confirm_overwrite (); -#if 0 passed = passed && test_action_widgets (); passed = passed && test_reload (); passed = passed && test_button_folder_states (); passed = passed && test_folder_switch_and_filters (); -#endif log_test (passed, "main(): main tests"); /* Warnings and errors */ |