summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@novell.com>2006-04-17 18:16:01 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2006-04-17 18:16:01 +0000
commit2d311154a121b2b39b459feadbd8ee6de7a88722 (patch)
treea574197259e07ce8ef4aebba55f3bb99b74b4194
parenteedae6fe91179c9e3bc2ef5b4ba1e70763ea8d81 (diff)
downloadgtk+-federico-filename-entry.tar.gz
Oops, we *do* need to check that we are in OPEN mode before selecting thefederico-filename-entry
2006-04-17 Federico Mena Quintero <federico@novell.com> * gtk/gtkfilechooserdefault.c (pending_select_paths_process): Oops, we *do* need to check that we are in OPEN mode before selecting the first row in the file list. See https://bugzilla.novell.com/show_bug.cgi?id=166906 (gtk_file_chooser_default_get_paths): If we are in the case for the file list, and the list has no selected rows, jump to the case for the filename entry. This is so that 1. The user types a filename in the SAVE filename entry ("foo.txt"). 2. He then double-clicks on a folder ("bar") in the file list. will yield the expected "bar/foo.txt" selection.
-rw-r--r--ChangeLog18
-rw-r--r--ChangeLog.pre-2-1018
-rw-r--r--gtk/gtkfilechooserdefault.c19
3 files changed, 54 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 0888c4800f..0698fa990b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2006-04-17 Federico Mena Quintero <federico@novell.com>
+
+ * gtk/gtkfilechooserdefault.c (pending_select_paths_process):
+ Oops, we *do* need to check that we are in OPEN mode before
+ selecting the first row in the file list. See
+ https://bugzilla.novell.com/show_bug.cgi?id=166906
+ (gtk_file_chooser_default_get_paths): If we are in the case for
+ the file list, and the list has no selected rows, jump to the case
+ for the filename entry. This is so that
+
+ 1. The user types a filename in the SAVE filename entry
+ ("foo.txt").
+
+ 2. He then double-clicks on a folder ("bar") in the file
+ list.
+
+ will yield the expected "bar/foo.txt" selection.
+
2006-03-29 Federico Mena Quintero <federico@novell.com>
* gtk/gtkpathbar.c (gtk_path_bar_init): Reduce the inter-button
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 0888c4800f..0698fa990b 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,21 @@
+2006-04-17 Federico Mena Quintero <federico@novell.com>
+
+ * gtk/gtkfilechooserdefault.c (pending_select_paths_process):
+ Oops, we *do* need to check that we are in OPEN mode before
+ selecting the first row in the file list. See
+ https://bugzilla.novell.com/show_bug.cgi?id=166906
+ (gtk_file_chooser_default_get_paths): If we are in the case for
+ the file list, and the list has no selected rows, jump to the case
+ for the filename entry. This is so that
+
+ 1. The user types a filename in the SAVE filename entry
+ ("foo.txt").
+
+ 2. He then double-clicks on a folder ("bar") in the file
+ list.
+
+ will yield the expected "bar/foo.txt" selection.
+
2006-03-29 Federico Mena Quintero <federico@novell.com>
* gtk/gtkpathbar.c (gtk_path_bar_init): Reduce the inter-button
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 5f21cd0976..4286ae330d 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -5464,8 +5464,14 @@ pending_select_paths_process (GtkFileChooserDefault *impl)
* but rather on behalf of something else like GtkFileChooserButton. In
* that case, the chooser's selection should be what the caller expects,
* as the user can't see that something else got selected. See bug #165264.
+ *
+ * Also, we don't select the first file if we are not in OPEN mode. Doing
+ * so would change the contents of the filename entry for SAVE or
+ * CREATE_FOLDER, which is undesired; in SELECT_FOLDER, we don't want to
+ * select a *different* folder from the one into which the user just
+ * navigated.
*/
- if (GTK_WIDGET_MAPPED (impl))
+ if (GTK_WIDGET_MAPPED (impl) && impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
browse_files_select_first_row (impl);
}
@@ -6052,6 +6058,17 @@ gtk_file_chooser_default_get_paths (GtkFileChooser *chooser)
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, get_paths_foreach, &info);
+
+ /* If there is no selection in the file list, we probably have this situation:
+ *
+ * 1. The user typed a filename in the SAVE filename entry ("foo.txt").
+ * 2. He then double-clicked on a folder ("bar") in the file list
+ *
+ * So we want the selection to be "bar/foo.txt". Jump to the case for the
+ * filename entry to see if that is the case.
+ */
+ if (info.result == NULL && impl->location_entry)
+ goto file_entry;
}
else if (impl->location_entry && current_focus == impl->location_entry)
{