summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2005-11-28 22:30:48 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2005-11-28 22:30:48 +0000
commit0d4a99ded574845e398e3bfb0d1bab819e1af545 (patch)
treea0bc07bdfd0ea94b3567b3ae147e7915ca067709
parent02cadc9196680ce39ae88b5c97f050a445ec7062 (diff)
downloadgdk-pixbuf-0d4a99ded574845e398e3bfb0d1bab819e1af545.tar.gz
Merged from HEAD:
2005-11-28 Federico Mena Quintero <federico@ximian.com> Merged from HEAD: Fix bug #321560, based on a patch by Bogdan Nicula (bogdanni@hotmail.com): * gtk/gtkfilechooserdefault.c (up_folder_handler): Don't add the current_folder to the pending select paths here; the path bar will give it to us now. (path_bar_clicked): Add the child_path to the pending select paths here. (show_and_select_paths): Don't filter out folders. (show_and_select_paths): Don't take separate arguments for only_one_path and multiple paths. * tests/autotestfilechooser.c (test_folder_switch_and_filters): New test about preserving the filters when we change folders.
-rw-r--r--ChangeLog18
-rw-r--r--ChangeLog.pre-2-1018
-rw-r--r--gtk/gtkfilechooserdefault.c101
3 files changed, 66 insertions, 71 deletions
diff --git a/ChangeLog b/ChangeLog
index 8632dc3f4..641704198 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2005-11-28 Federico Mena Quintero <federico@ximian.com>
+
+ Merged from HEAD:
+
+ Fix bug #321560, based on a patch by Bogdan Nicula (bogdanni@hotmail.com):
+
+ * gtk/gtkfilechooserdefault.c (up_folder_handler): Don't add the
+ current_folder to the pending select paths here; the path bar will
+ give it to us now.
+ (path_bar_clicked): Add the child_path to the pending select paths
+ here.
+ (show_and_select_paths): Don't filter out folders.
+ (show_and_select_paths): Don't take separate arguments for
+ only_one_path and multiple paths.
+
+ * tests/autotestfilechooser.c (test_folder_switch_and_filters):
+ New test about preserving the filters when we change folders.
+
2005-11-28 Matthias Clasen <mclasen@redhat.com>
* === Released 2.8.8 ===
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 8632dc3f4..641704198 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,21 @@
+2005-11-28 Federico Mena Quintero <federico@ximian.com>
+
+ Merged from HEAD:
+
+ Fix bug #321560, based on a patch by Bogdan Nicula (bogdanni@hotmail.com):
+
+ * gtk/gtkfilechooserdefault.c (up_folder_handler): Don't add the
+ current_folder to the pending select paths here; the path bar will
+ give it to us now.
+ (path_bar_clicked): Add the child_path to the pending select paths
+ here.
+ (show_and_select_paths): Don't filter out folders.
+ (show_and_select_paths): Don't take separate arguments for
+ only_one_path and multiple paths.
+
+ * tests/autotestfilechooser.c (test_folder_switch_and_filters):
+ New test about preserving the filters when we change folders.
+
2005-11-28 Matthias Clasen <mclasen@redhat.com>
* === Released 2.8.8 ===
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index e64d4ca08..330712985 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -5105,105 +5105,70 @@ browse_files_center_selected_row (GtkFileChooserDefault *impl)
static gboolean
show_and_select_paths (GtkFileChooserDefault *impl,
const GtkFilePath *parent_path,
- const GtkFilePath *only_one_path,
GSList *paths,
- GError **error)
+ GError **error)
{
GtkFileFolder *folder;
- gboolean success;
gboolean have_hidden;
gboolean have_filtered;
+ GSList *l;
profile_start ("start", NULL);
- if (!only_one_path && !paths)
+ if (!paths)
{
profile_end ("end", NULL);
return TRUE;
}
- folder = gtk_file_system_get_folder (impl->file_system, parent_path, GTK_FILE_INFO_IS_HIDDEN, error);
+ folder = gtk_file_system_get_folder (impl->file_system, parent_path, GTK_FILE_INFO_IS_FOLDER | GTK_FILE_INFO_IS_HIDDEN, error);
if (!folder)
{
profile_end ("end", NULL);
return FALSE;
}
- success = FALSE;
have_hidden = FALSE;
have_filtered = FALSE;
- if (only_one_path)
+ for (l = paths; l; l = l->next)
{
+ const GtkFilePath *path;
GtkFileInfo *info;
- info = gtk_file_folder_get_info (folder, only_one_path, error);
- if (info)
- {
- success = TRUE;
- have_hidden = gtk_file_info_get_is_hidden (info);
- have_filtered = get_is_file_filtered (impl, only_one_path, info);
- gtk_file_info_free (info);
- }
- }
- else
- {
- GSList *l;
+ path = l->data;
- for (l = paths; l; l = l->next)
+ /* NULL GError */
+ info = gtk_file_folder_get_info (folder, path, NULL);
+ if (info)
{
- const GtkFilePath *path;
- GtkFileInfo *info;
+ if (!have_hidden)
+ have_hidden = gtk_file_info_get_is_hidden (info);
- path = l->data;
+ if (!have_filtered)
+ have_filtered = !gtk_file_info_get_is_folder (info) && get_is_file_filtered (impl, path, info);
- /* NULL GError */
- info = gtk_file_folder_get_info (folder, path, NULL);
- if (info)
- {
- if (!have_hidden)
- have_hidden = gtk_file_info_get_is_hidden (info);
-
- if (!have_filtered)
- have_filtered = get_is_file_filtered (impl, path, info);
-
- gtk_file_info_free (info);
+ gtk_file_info_free (info);
- if (have_hidden && have_filtered)
- break; /* we now have all the information we need */
- }
+ if (have_hidden && have_filtered)
+ break; /* we now have all the information we need */
}
-
- success = TRUE;
}
g_object_unref (folder);
- if (!success)
- {
- profile_end ("end", NULL);
- return FALSE;
- }
-
if (have_hidden)
g_object_set (impl, "show-hidden", TRUE, NULL);
if (have_filtered)
set_current_filter (impl, NULL);
- if (only_one_path)
- _gtk_file_system_model_path_do (impl->browse_files_model, only_one_path, select_func, impl);
- else
+ for (l = paths; l; l = l->next)
{
- GSList *l;
-
- for (l = paths; l; l = l->next)
- {
- const GtkFilePath *path;
+ const GtkFilePath *path;
- path = l->data;
- _gtk_file_system_model_path_do (impl->browse_files_model, path, select_func, impl);
- }
+ path = l->data;
+ _gtk_file_system_model_path_do (impl->browse_files_model, path, select_func, impl);
}
profile_end ("end", NULL);
@@ -5221,7 +5186,7 @@ pending_select_paths_process (GtkFileChooserDefault *impl)
if (impl->pending_select_paths)
{
/* NULL GError */
- show_and_select_paths (impl, impl->current_folder, NULL, impl->pending_select_paths, NULL);
+ show_and_select_paths (impl, impl->current_folder, impl->pending_select_paths, NULL);
pending_select_paths_free (impl);
browse_files_center_selected_row (impl);
}
@@ -5550,8 +5515,12 @@ gtk_file_chooser_default_select_path (GtkFileChooser *chooser,
if (same_path && impl->load_state == LOAD_FINISHED)
{
gboolean result;
+ GSList paths;
+
+ paths.data = (gpointer) path;
+ paths.next = NULL;
- result = show_and_select_paths (impl, parent_path, path, NULL, error);
+ result = show_and_select_paths (impl, parent_path, &paths, error);
gtk_file_path_free (parent_path);
return result;
}
@@ -6953,6 +6922,9 @@ path_bar_clicked (GtkPathBar *path_bar,
gboolean child_is_hidden,
GtkFileChooserDefault *impl)
{
+ if (child_path)
+ pending_select_paths_add (impl, child_path);
+
if (!change_folder_and_display_error (impl, file_path))
return;
@@ -6962,18 +6934,6 @@ path_bar_clicked (GtkPathBar *path_bar,
*/
if (child_is_hidden)
g_object_set (impl, "show-hidden", TRUE, NULL);
-
- /* 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 *
@@ -7447,7 +7407,6 @@ location_popup_handler (GtkFileChooserDefault *impl,
static void
up_folder_handler (GtkFileChooserDefault *impl)
{
- pending_select_paths_add (impl, impl->current_folder);
_gtk_path_bar_up (GTK_PATH_BAR (impl->browse_path_bar));
}