]> Pileus Git - ~andy/gtk/commitdiff
Improve navigation to parent folders. (#318444, Andrei Yurkevich)
authorMatthias Clasen <mclasen@redhat.com>
Thu, 10 Nov 2005 15:17:40 +0000 (15:17 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 10 Nov 2005 15:17:40 +0000 (15:17 +0000)
2005-11-10  Matthias Clasen  <mclasen@redhat.com>

Improve navigation to parent folders.  (#318444, Andrei Yurkevich)

* gtk/gtkpathbar.[hc]: Add a child_path argument to
the path_clicked signal.
* gtk/gtkfilechooserdefault.c (path_bar_clicked): Select the
child_path, if it is provided.
* gtk/marshalers.list (path_bar_clicked): Add the necessary
glue.

ChangeLog
ChangeLog.pre-2-10
gtk/gtkfilechooserdefault.c
gtk/gtkmarshalers.list
gtk/gtkpathbar.c
gtk/gtkpathbar.h

index a624108933d72dad6777bac6642fa317b97774d2..a6ea6f5ad3f9b85e126470fe66e76bdf294055fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2005-11-10  Matthias Clasen  <mclasen@redhat.com>
 
+       Improve navigation to parent folders.  (#318444, Andrei Yurkevich)
+       
+       * gtk/gtkpathbar.[hc]: Add a child_path argument to
+       the path_clicked signal.
+       * gtk/gtkfilechooserdefault.c (path_bar_clicked): Select the
+       child_path, if it is provided.
+       * gtk/marshalers.list (path_bar_clicked): Add the necessary
+       glue.
+
        * gtk/gtkmenu.c: Fix some compiler warnings. (#321141,
        Kjartan Maraas)
        
index a624108933d72dad6777bac6642fa317b97774d2..a6ea6f5ad3f9b85e126470fe66e76bdf294055fe 100644 (file)
@@ -1,5 +1,14 @@
 2005-11-10  Matthias Clasen  <mclasen@redhat.com>
 
+       Improve navigation to parent folders.  (#318444, Andrei Yurkevich)
+       
+       * gtk/gtkpathbar.[hc]: Add a child_path argument to
+       the path_clicked signal.
+       * gtk/gtkfilechooserdefault.c (path_bar_clicked): Select the
+       child_path, if it is provided.
+       * gtk/marshalers.list (path_bar_clicked): Add the necessary
+       glue.
+
        * gtk/gtkmenu.c: Fix some compiler warnings. (#321141,
        Kjartan Maraas)
        
index 7dfe4255e7e5f093863ee4181e69565fd1e17ca5..a9db44675ee2e474b93b64de4bad8f77b7007ef6 100644 (file)
@@ -371,6 +371,7 @@ static void select_func (GtkFileSystemModel *model,
 
 static void path_bar_clicked           (GtkPathBar            *path_bar,
                                        GtkFilePath           *file_path,
+                                       GtkFilePath           *child_path,
                                        gboolean               child_is_hidden,
                                        GtkFileChooserDefault *impl);
 
@@ -6903,6 +6904,7 @@ list_row_activated (GtkTreeView           *tree_view,
 static void
 path_bar_clicked (GtkPathBar            *path_bar,
                  GtkFilePath           *file_path,
+                 GtkFilePath           *child_path,
                  gboolean               child_is_hidden,
                  GtkFileChooserDefault *impl)
 {
@@ -6916,7 +6918,17 @@ path_bar_clicked (GtkPathBar            *path_bar,
   if (child_is_hidden)
     g_object_set (impl, "show-hidden", TRUE, NULL);
 
-  //gtk_widget_grab_focus (impl->browse_files_tree_view);
+  /* Say we have "/foo/bar/baz" and the user clicks on "bar". We should then
+   * focus the "baz" entry in the files list - the reason for this is that
+   * if user furst changed to /foo/bar/baz from /foo/bar unintentionally 
+   * instead of /foo/bar/baz1, it will take quite some time to scroll to baz1 
+   * in the file list, especially if this directory contains lots of folders
+   */
+  if (child_path != NULL)
+    {
+      gtk_file_chooser_default_select_path (impl, child_path, NULL);
+      browse_files_center_selected_row (impl);
+    }
 }
 
 static const GtkFileInfo *
index 2c3a007bc7f37e034675360da9dcffa7f0c7138e..c18388f8e083ec84a06e52b760230458845aaee2 100644 (file)
@@ -88,6 +88,7 @@ VOID:OBJECT,STRING
 VOID:POINTER
 VOID:POINTER,INT
 VOID:POINTER,BOOLEAN
+VOID:POINTER,POINTER,BOOLEAN
 VOID:POINTER,POINTER,POINTER
 VOID:POINTER,UINT
 VOID:STRING
index ade55d219752ae242a343d606845e240d3a4cf4e..ff99f52b43f45d5f1029ed61a347e8865ba05644 100644 (file)
@@ -191,8 +191,9 @@ gtk_path_bar_class_init (GtkPathBarClass *path_bar_class)
                  G_SIGNAL_RUN_FIRST,
                  G_STRUCT_OFFSET (GtkPathBarClass, path_clicked),
                  NULL, NULL,
-                 _gtk_marshal_VOID__POINTER_BOOLEAN,
-                 G_TYPE_NONE, 2,
+                 _gtk_marshal_VOID__POINTER_POINTER_BOOLEAN,
+                 G_TYPE_NONE, 3,
+                 G_TYPE_POINTER,
                  G_TYPE_POINTER,
                  G_TYPE_BOOLEAN);
 }
@@ -942,17 +943,23 @@ button_clicked_cb (GtkWidget *button,
 
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
 
+  GtkFilePath *child_path;
   if (button_list->prev)
     {
       ButtonData *child_data;
 
       child_data = BUTTON_DATA (button_list->prev->data);
+      child_path = child_data->path;
       child_is_hidden = child_data->file_is_hidden;
     }
   else
-    child_is_hidden = FALSE;
+    {
+      child_path = NULL;
+      child_is_hidden = FALSE;
+    }
 
-  g_signal_emit (path_bar, path_bar_signals [PATH_CLICKED], 0, button_data->path, child_is_hidden);
+  g_signal_emit (path_bar, path_bar_signals [PATH_CLICKED], 0,
+                button_data->path, child_path, child_is_hidden);
 }
 
 static GdkPixbuf *
index 349e1fcbd3081a008e56858286b38c3dac4b73e0..2dca06b6f4042534aa443e87470155082a40033b 100644 (file)
@@ -72,6 +72,7 @@ struct _GtkPathBarClass
 
   void (* path_clicked) (GtkPathBar  *path_bar,
                         GtkFilePath *file_path,
+                        GtkFilePath *child_path,
                         gboolean     child_is_hidden);
 };