]> Pileus Git - ~andy/gtk/commitdiff
Add _gtk_path_bar_up()/ _gtk_path_bar_down().
authorOwen Taylor <otaylor@redhat.com>
Mon, 15 Mar 2004 02:12:08 +0000 (02:12 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Mon, 15 Mar 2004 02:12:08 +0000 (02:12 +0000)
Sun Mar 14 21:03:15 2004  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkpathbar.[ch]: Add _gtk_path_bar_up()/
        _gtk_path_bar_down().

        * gtk/gtkfilechooserdefault.c: Use _gtk_path_bar_up()/
        _gtk_path_bar_down() as bindings for Alt-Up
        and new Alt-Down. (Partly based on a patch by
        Mark McLoughlin, #136987)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfilechooserdefault.c
gtk/gtkpathbar.c

index 9430c0c368685a965d8c7d370d47df17173a55a5..8d4d9c5b7790e8b052023f24de952917c818a2fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Sun Mar 14 21:03:15 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkpathbar.[ch]: Add _gtk_path_bar_up()/
+       _gtk_path_bar_down().
+
+       * gtk/gtkfilechooserdefault.c: Use _gtk_path_bar_up()/
+       _gtk_path_bar_down() as bindings for Alt-Up
+       and new Alt-Down. (Partly based on a patch by
+       Mark McLoughlin, #136987)
+
 2004-03-14  Federico Mena Quintero  <federico@ximian.com>
 
        Fixes #136185, patch by Morten Welinder, with some changes.
index 9430c0c368685a965d8c7d370d47df17173a55a5..8d4d9c5b7790e8b052023f24de952917c818a2fc 100644 (file)
@@ -1,3 +1,13 @@
+Sun Mar 14 21:03:15 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkpathbar.[ch]: Add _gtk_path_bar_up()/
+       _gtk_path_bar_down().
+
+       * gtk/gtkfilechooserdefault.c: Use _gtk_path_bar_up()/
+       _gtk_path_bar_down() as bindings for Alt-Up
+       and new Alt-Down. (Partly based on a patch by
+       Mark McLoughlin, #136987)
+
 2004-03-14  Federico Mena Quintero  <federico@ximian.com>
 
        Fixes #136185, patch by Morten Welinder, with some changes.
index 9430c0c368685a965d8c7d370d47df17173a55a5..8d4d9c5b7790e8b052023f24de952917c818a2fc 100644 (file)
@@ -1,3 +1,13 @@
+Sun Mar 14 21:03:15 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkpathbar.[ch]: Add _gtk_path_bar_up()/
+       _gtk_path_bar_down().
+
+       * gtk/gtkfilechooserdefault.c: Use _gtk_path_bar_up()/
+       _gtk_path_bar_down() as bindings for Alt-Up
+       and new Alt-Down. (Partly based on a patch by
+       Mark McLoughlin, #136987)
+
 2004-03-14  Federico Mena Quintero  <federico@ximian.com>
 
        Fixes #136185, patch by Morten Welinder, with some changes.
index 9430c0c368685a965d8c7d370d47df17173a55a5..8d4d9c5b7790e8b052023f24de952917c818a2fc 100644 (file)
@@ -1,3 +1,13 @@
+Sun Mar 14 21:03:15 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkpathbar.[ch]: Add _gtk_path_bar_up()/
+       _gtk_path_bar_down().
+
+       * gtk/gtkfilechooserdefault.c: Use _gtk_path_bar_up()/
+       _gtk_path_bar_down() as bindings for Alt-Up
+       and new Alt-Down. (Partly based on a patch by
+       Mark McLoughlin, #136987)
+
 2004-03-14  Federico Mena Quintero  <federico@ximian.com>
 
        Fixes #136185, patch by Morten Welinder, with some changes.
index 9430c0c368685a965d8c7d370d47df17173a55a5..8d4d9c5b7790e8b052023f24de952917c818a2fc 100644 (file)
@@ -1,3 +1,13 @@
+Sun Mar 14 21:03:15 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkpathbar.[ch]: Add _gtk_path_bar_up()/
+       _gtk_path_bar_down().
+
+       * gtk/gtkfilechooserdefault.c: Use _gtk_path_bar_up()/
+       _gtk_path_bar_down() as bindings for Alt-Up
+       and new Alt-Down. (Partly based on a patch by
+       Mark McLoughlin, #136987)
+
 2004-03-14  Federico Mena Quintero  <federico@ximian.com>
 
        Fixes #136185, patch by Morten Welinder, with some changes.
index a2d301724cfbdfe2ea2782424590d67df4f2db42..73a97ae3d37907bd025b3e460bf65a66c10239a9 100644 (file)
@@ -138,6 +138,7 @@ struct _GtkFileChooserDefault
 
   GtkFilePath *current_volume_path;
   GtkFilePath *current_folder;
+  GtkFilePath *lowest_folder;
   GtkFilePath *preview_path;
   char *preview_display_name;
 
@@ -168,6 +169,7 @@ struct _GtkFileChooserDefault
 enum {
   LOCATION_POPUP,
   UP_FOLDER,
+  DOWN_FOLDER,
   HOME_FOLDER,
   LAST_SIGNAL
 };
@@ -306,6 +308,7 @@ static void           gtk_file_chooser_default_initial_focus          (GtkFileCh
 
 static void location_popup_handler (GtkFileChooserDefault *impl);
 static void up_folder_handler      (GtkFileChooserDefault *impl);
+static void down_folder_handler    (GtkFileChooserDefault *impl);
 static void home_folder_handler    (GtkFileChooserDefault *impl);
 static void update_appearance      (GtkFileChooserDefault *impl);
 
@@ -486,6 +489,14 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
                             NULL, NULL,
                             _gtk_marshal_VOID__VOID,
                             G_TYPE_NONE, 0);
+  signals[DOWN_FOLDER] =
+    _gtk_binding_signal_new ("down-folder",
+                            G_OBJECT_CLASS_TYPE (class),
+                            G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                            G_CALLBACK (down_folder_handler),
+                            NULL, NULL,
+                            _gtk_marshal_VOID__VOID,
+                            G_TYPE_NONE, 0);
   signals[HOME_FOLDER] =
     _gtk_binding_signal_new ("home-folder",
                             G_OBJECT_CLASS_TYPE (class),
@@ -511,6 +522,15 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
                                "up-folder",
                                0);
 
+  gtk_binding_entry_add_signal (binding_set,
+                               GDK_Down, GDK_MOD1_MASK,
+                               "down-folder",
+                               0);
+  gtk_binding_entry_add_signal (binding_set,
+                               GDK_KP_Down, GDK_MOD1_MASK,
+                               "down-folder",
+                               0);
+
   gtk_binding_entry_add_signal (binding_set,
                                GDK_Home, GDK_MOD1_MASK,
                                "home-folder",
@@ -4941,24 +4961,14 @@ location_popup_handler (GtkFileChooserDefault *impl)
 static void
 up_folder_handler (GtkFileChooserDefault *impl)
 {
-  GtkFilePath *parent_path;
-  GError *error;
+  _gtk_path_bar_up (GTK_PATH_BAR (impl->browse_path_bar));
+}
 
-  error = NULL;
-  if (gtk_file_system_get_parent (impl->file_system, impl->current_folder, &parent_path, &error))
-    {
-      if (parent_path) /* If we were on a root, parent_path will be NULL */
-       {
-         change_folder_and_display_error (impl, parent_path);
-         gtk_file_path_free (parent_path);
-       }
-    }
-  else
-    {
-      error_dialog (impl,
-                   _("Could not go to the parent folder of %s:\n%s"),
-                   impl->current_folder, error);
-    }
+/* Handler for the "down-folder" keybinding signal */
+static void
+down_folder_handler (GtkFileChooserDefault *impl)
+{
+  _gtk_path_bar_down (GTK_PATH_BAR (impl->browse_path_bar));
 }
 
 /* Handler for the "home-folder" keybinding signal */
index 9963648153bade9530a561b094bd822f76739ace..770309ea1f873905438d32c0a3e44fbfa01c09db 100644 (file)
@@ -1073,3 +1073,57 @@ _gtk_path_bar_set_file_system (GtkPathBar    *path_bar,
   path_bar->root_path = gtk_file_system_filename_to_path (path_bar->file_system, "/");
   g_free (desktop);
 }
+
+/**
+ * _gtk_path_bar_up:
+ * @path_bar: a #GtkPathBar
+ * 
+ * If the selected button in the pathbar is not the furthest button "up" (in the
+ * root direction), act as if the user clicked on the next button up.
+ **/
+void
+_gtk_path_bar_up (GtkPathBar *path_bar)
+{
+  GList *l;
+
+  for (l = path_bar->button_list; l; l = l->next)
+    {
+      GtkWidget *button = BUTTON_DATA (l->data)->button;
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
+       {
+         if (l->next)
+           {
+             GtkWidget *next_button = BUTTON_DATA (l->next->data)->button;
+             button_clicked_cb (next_button, l->next->data);
+           }
+         break;
+       }
+    }
+}
+
+/**
+ * _gtk_path_bar_down:
+ * @path_bar: a #GtkPathBar
+ * 
+ * If the selected button in the pathbar is not the furthest button "down" (in the
+ * leaf direction), act as if the user clicked on the next button down.
+ **/
+void
+_gtk_path_bar_down (GtkPathBar *path_bar)
+{
+  GList *l;
+
+  for (l = path_bar->button_list; l; l = l->next)
+    {
+      GtkWidget *button = BUTTON_DATA (l->data)->button;
+      if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
+       {
+         if (l->prev)
+           {
+             GtkWidget *prev_button = BUTTON_DATA (l->prev->data)->button;
+             button_clicked_cb (prev_button, l->prev->data);
+           }
+         break;
+       }
+    }
+}