]> Pileus Git - ~andy/gtk/commitdiff
Don't update the save folder combo if we are already switching folders;
authorFederico Mena Quintero <federico@ximian.com>
Tue, 2 Mar 2004 20:05:08 +0000 (20:05 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Tue, 2 Mar 2004 20:05:08 +0000 (20:05 +0000)
2004-03-02  Federico Mena Quintero  <federico@ximian.com>

* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_set_current_folder): Don't update the
save folder combo if we are already switching folders; based on a
patch by Jonathan Blandford.

* gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder):
Handle failure to insert the path.  Based on a patch by Morten
Welinder attached to bug #135380.

* tests/testfilechooser.c (extra_widget_create): Add a bunch of
buttons to test various things.

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

index 77d7eb34e106ed81a82b324a4f053e5c8510e476..8f45ea8b47795affc4fe6b66a8ed3a3450022657 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2004-03-02  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_set_current_folder): Don't update the
+       save folder combo if we are already switching folders; based on a
+       patch by Jonathan Blandford.
+
+       * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder):
+       Handle failure to insert the path.  Based on a patch by Morten
+       Welinder attached to bug #135380.
+
+       * tests/testfilechooser.c (extra_widget_create): Add a bunch of
+       buttons to test various things.
+
 Tue Mar  2 20:59:23 2004  Matthias Clasen  <maclas@gmx.de>
 
        * tests/Makefile.am: Add testentrycompletion.
index 77d7eb34e106ed81a82b324a4f053e5c8510e476..8f45ea8b47795affc4fe6b66a8ed3a3450022657 100644 (file)
@@ -1,3 +1,17 @@
+2004-03-02  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_set_current_folder): Don't update the
+       save folder combo if we are already switching folders; based on a
+       patch by Jonathan Blandford.
+
+       * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder):
+       Handle failure to insert the path.  Based on a patch by Morten
+       Welinder attached to bug #135380.
+
+       * tests/testfilechooser.c (extra_widget_create): Add a bunch of
+       buttons to test various things.
+
 Tue Mar  2 20:59:23 2004  Matthias Clasen  <maclas@gmx.de>
 
        * tests/Makefile.am: Add testentrycompletion.
index 77d7eb34e106ed81a82b324a4f053e5c8510e476..8f45ea8b47795affc4fe6b66a8ed3a3450022657 100644 (file)
@@ -1,3 +1,17 @@
+2004-03-02  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_set_current_folder): Don't update the
+       save folder combo if we are already switching folders; based on a
+       patch by Jonathan Blandford.
+
+       * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder):
+       Handle failure to insert the path.  Based on a patch by Morten
+       Welinder attached to bug #135380.
+
+       * tests/testfilechooser.c (extra_widget_create): Add a bunch of
+       buttons to test various things.
+
 Tue Mar  2 20:59:23 2004  Matthias Clasen  <maclas@gmx.de>
 
        * tests/Makefile.am: Add testentrycompletion.
index 77d7eb34e106ed81a82b324a4f053e5c8510e476..8f45ea8b47795affc4fe6b66a8ed3a3450022657 100644 (file)
@@ -1,3 +1,17 @@
+2004-03-02  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_set_current_folder): Don't update the
+       save folder combo if we are already switching folders; based on a
+       patch by Jonathan Blandford.
+
+       * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder):
+       Handle failure to insert the path.  Based on a patch by Morten
+       Welinder attached to bug #135380.
+
+       * tests/testfilechooser.c (extra_widget_create): Add a bunch of
+       buttons to test various things.
+
 Tue Mar  2 20:59:23 2004  Matthias Clasen  <maclas@gmx.de>
 
        * tests/Makefile.am: Add testentrycompletion.
index 77d7eb34e106ed81a82b324a4f053e5c8510e476..8f45ea8b47795affc4fe6b66a8ed3a3450022657 100644 (file)
@@ -1,3 +1,17 @@
+2004-03-02  Federico Mena Quintero  <federico@ximian.com>
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_set_current_folder): Don't update the
+       save folder combo if we are already switching folders; based on a
+       patch by Jonathan Blandford.
+
+       * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder):
+       Handle failure to insert the path.  Based on a patch by Morten
+       Welinder attached to bug #135380.
+
+       * tests/testfilechooser.c (extra_widget_create): Add a bunch of
+       buttons to test various things.
+
 Tue Mar  2 20:59:23 2004  Matthias Clasen  <maclas@gmx.de>
 
        * tests/Makefile.am: Add testentrycompletion.
index 173830cf270564c96162759941bd0c4fe996cb5d..de7beb07d323a2aa88b395d89e8391c076f214e0 100644 (file)
@@ -958,7 +958,7 @@ shortcuts_remove_rows (GtkFileChooserDefault *impl,
   gtk_tree_path_free (path);
 }
 
-/* Used from shortcuts_remove_rows() */
+/* Used from shortcuts_remove_rows() in shortcuts_add_volumes() */
 static void
 volume_remove_cb (GtkFileChooserDefault *impl, gpointer data)
 {
@@ -1058,9 +1058,12 @@ static void
 shortcuts_add_current_folder (GtkFileChooserDefault *impl)
 {
   int pos;
+  gboolean success;
 
   g_assert (!impl->shortcuts_current_folder_active);
 
+  success = TRUE;
+
   pos = shortcut_find_position (impl, impl->current_folder);
   if (pos == -1)
     {
@@ -1080,22 +1083,26 @@ shortcuts_add_current_folder (GtkFileChooserDefault *impl)
 
       if (strcmp (gtk_file_path_get_string (base_path), gtk_file_path_get_string (impl->current_folder)) == 0)
        {
-         shortcuts_insert_path (impl, pos, TRUE, volume, NULL, NULL, FALSE, NULL);
+         success = shortcuts_insert_path (impl, pos, TRUE, volume, NULL, NULL, FALSE, NULL);
          impl->shortcuts_current_folder_is_volume = TRUE;
        }
       else
        {
          gtk_file_system_volume_free (impl->file_system, volume);
-         shortcuts_insert_path (impl, pos, FALSE, NULL, impl->current_folder, NULL, FALSE, NULL);
+         success = shortcuts_insert_path (impl, pos, FALSE, NULL, impl->current_folder, NULL, FALSE, NULL);
          impl->shortcuts_current_folder_is_volume = FALSE;
        }
 
       gtk_file_path_free (base_path);
 
-      impl->shortcuts_current_folder_active = TRUE;
+      if (!success)
+       shortcuts_remove_rows (impl, pos - 1, 1, NULL); /* remove the separator */
+
+      impl->shortcuts_current_folder_active = success;
     }
 
-  gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), pos);
+  if (success)
+    gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), pos);
 }
 
 /* Used from shortcuts_remove_rows() in shortcuts_update_current_folder() */
@@ -2838,14 +2845,18 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser    *chooser,
   /* Change the current folder label */
   gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, impl->file_system, NULL);
 
-  /* Update the folder tree */
+  /* Update the widgets that may trigger a folder chnage themselves */
 
   if (!impl->changing_folder)
     {
       impl->changing_folder = TRUE;
+
       set_tree_model (impl, impl->current_folder);
       _gtk_file_system_model_path_do (GTK_FILE_SYSTEM_MODEL (impl->browse_directories_model),
                                      path, expand_and_select_func, impl);
+
+      shortcuts_update_current_folder (impl);
+
       impl->changing_folder = FALSE;
     }
 
@@ -2855,7 +2866,6 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser    *chooser,
   /* Refresh controls */
 
   shortcuts_unselect_all (impl);
-  shortcuts_update_current_folder (impl);
 
   g_signal_emit_by_name (impl, "current-folder-changed", 0);
 
index 0beb08cad9587acf474fab4ea10e43128125fa0d..3cccdc6779f722579c0f9ea12f065d26e363095a 100644 (file)
@@ -296,6 +296,66 @@ update_preview_cb (GtkFileChooser *chooser)
   gtk_file_chooser_set_preview_widget_active (chooser, have_preview);
 }
 
+static void
+set_folder_nonexistent_cb (GtkButton *button,
+                          GtkFileChooser *chooser)
+{
+  gtk_file_chooser_set_current_folder (chooser, "/nonexistent");
+}
+
+static void
+set_folder_existing_nonexistent_cb (GtkButton *button,
+                                   GtkFileChooser *chooser)
+{
+  gtk_file_chooser_set_current_folder (chooser, "/usr/nonexistent");
+}
+
+static void
+set_filename_nonexistent_cb (GtkButton *button,
+                            GtkFileChooser *chooser)
+{
+  gtk_file_chooser_set_filename (chooser, "/nonexistent");
+}
+
+static void
+set_filename_existing_nonexistent_cb (GtkButton *button,
+                                     GtkFileChooser *chooser)
+{
+  gtk_file_chooser_set_filename (chooser, "/usr/nonexistent");
+}
+
+static GtkWidget *
+extra_widget_create (GtkFileChooser *chooser)
+{
+  GtkWidget *box;
+  GtkWidget *widget;
+
+  box = gtk_vbox_new (FALSE, 6);
+
+  widget = gtk_button_new_with_label ("set_current_folder (\"/nonexistent\")");
+  g_signal_connect (widget, "clicked",
+                   G_CALLBACK (set_folder_nonexistent_cb), chooser);
+  gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0);
+
+  widget = gtk_button_new_with_label ("set_current_folder (\"/usr/nonexistent\"");
+  g_signal_connect (widget, "clicked",
+                   G_CALLBACK (set_folder_existing_nonexistent_cb), chooser);
+  gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0);
+
+  widget = gtk_button_new_with_label ("set_filename (\"/nonexistent\"");
+  g_signal_connect (widget, "clicked",
+                   G_CALLBACK (set_filename_nonexistent_cb), chooser);
+  gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0);
+
+  widget = gtk_button_new_with_label ("set_filename (\"/usr/nonexistent\"");
+  g_signal_connect (widget, "clicked",
+                   G_CALLBACK (set_filename_existing_nonexistent_cb), chooser);
+  gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0);
+
+  gtk_widget_show_all (box);
+  return box;
+}
+
 int
 main (int argc, char **argv)
 {
@@ -306,7 +366,6 @@ main (int argc, char **argv)
   GtkWidget *prop_editor;
   GtkFileFilter *filter;
   GtkWidget *preview_vbox;
-  GtkWidget *extra;
   int i;
   
   gtk_init (&argc, &argv);
@@ -397,9 +456,8 @@ main (int argc, char **argv)
                    G_CALLBACK (update_preview_cb), NULL);
 
   /* Extra widget */
-  extra = gtk_check_button_new_with_mnemonic ("Lar_t whoever asks about this button");
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extra), TRUE);
-  //  gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), extra);
+
+  gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), extra_widget_create (GTK_FILE_CHOOSER (dialog)));
 
   /* Shortcuts */