+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.
+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.
+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.
+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.
+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.
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)
{
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)
{
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() */
/* 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;
}
/* Refresh controls */
shortcuts_unselect_all (impl);
- shortcuts_update_current_folder (impl);
g_signal_emit_by_name (impl, "current-folder-changed", 0);
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)
{
GtkWidget *prop_editor;
GtkFileFilter *filter;
GtkWidget *preview_vbox;
- GtkWidget *extra;
int i;
gtk_init (&argc, &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 */