]> Pileus Git - ~andy/gtk/commitdiff
Enable "/" and "~" as bindings to activate the location entry again. Fixes
authorFederico Mena Quintero <federico@novell.com>
Thu, 17 Aug 2006 21:31:08 +0000 (21:31 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Thu, 17 Aug 2006 21:31:08 +0000 (21:31 +0000)
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.

ChangeLog
ChangeLog.pre-2-10
gtk/gtkfilechooserdefault.c
tests/autotestfilechooser.c

index e75713e8b6c50fd52688fddef0683fb72297bd84..b20dd0d934a481b3380718fad26e5c42095b505e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index e75713e8b6c50fd52688fddef0683fb72297bd84..b20dd0d934a481b3380718fad26e5c42095b505e 100644 (file)
@@ -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
index 03f740df583c476f624e0968f1ebbb0be6e8a97f..e5b6e906025e3618c303da112c3f752a99541089 100644 (file)
@@ -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",
@@ -560,7 +559,6 @@ _gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
                                GDK_asciitilde, 0,
                                "location-popup",
                                1, G_TYPE_STRING, "~");
-#endif
 #endif
 
   gtk_binding_entry_add_signal (binding_set,
@@ -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)
 {
@@ -8381,6 +8374,14 @@ _gtk_file_chooser_default_new (const char *file_system)
                        NULL);
 }
 
+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 ();
 }
index 6d5f5f19a2d67e5565a38ee6df64b8a2d767be2d..e216fd358a9bcf9551e824082f7ddec052e668da 100644 (file)
@@ -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 */