From e38ade92998a47e3a9e191cb1b9e59726394d405 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Thu, 25 Mar 2004 21:52:04 +0000 Subject: [PATCH] Just use the file under the cursor; we don't need the logic from 2004-03-25 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (check_preview_change): Just use the file under the cursor; we don't need the logic from GtkFileSelection after all. Fixes #132255. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtkfilechooserdefault.c | 37 ++++++++++++++++--------------------- 6 files changed, 46 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index f96283ed17..b284d0598a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-03-25 Federico Mena Quintero + + * gtk/gtkfilechooserdefault.c (check_preview_change): Just use the + file under the cursor; we don't need the logic from + GtkFileSelection after all. Fixes #132255. + 2004-03-25 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (location_entry_create): Fill the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index f96283ed17..b284d0598a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2004-03-25 Federico Mena Quintero + + * gtk/gtkfilechooserdefault.c (check_preview_change): Just use the + file under the cursor; we don't need the logic from + GtkFileSelection after all. Fixes #132255. + 2004-03-25 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (location_entry_create): Fill the diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index f96283ed17..b284d0598a 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +2004-03-25 Federico Mena Quintero + + * gtk/gtkfilechooserdefault.c (check_preview_change): Just use the + file under the cursor; we don't need the logic from + GtkFileSelection after all. Fixes #132255. + 2004-03-25 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (location_entry_create): Fill the diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index f96283ed17..b284d0598a 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +2004-03-25 Federico Mena Quintero + + * gtk/gtkfilechooserdefault.c (check_preview_change): Just use the + file under the cursor; we don't need the logic from + GtkFileSelection after all. Fixes #132255. + 2004-03-25 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (location_entry_create): Fill the diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index f96283ed17..b284d0598a 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +2004-03-25 Federico Mena Quintero + + * gtk/gtkfilechooserdefault.c (check_preview_change): Just use the + file under the cursor; we don't need the logic from + GtkFileSelection after all. Fixes #132255. + 2004-03-25 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (location_entry_create): Fill the diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 0a74308caf..6d7800bafb 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -1452,8 +1452,6 @@ new_folder_button_clicked (GtkButton *button, GtkTreeIter iter; GtkTreePath *path; - /* FIXME: this doesn't work for folder mode, just for file mode */ - _gtk_file_system_model_add_editable (impl->browse_files_model, &iter); path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->browse_files_model), &iter); @@ -3028,7 +3026,6 @@ set_select_multiple (GtkFileChooserDefault *impl, impl->select_multiple = select_multiple; g_object_notify (G_OBJECT (impl), "select-multiple"); - /* FIXME #132255: See note in check_preview_change() */ check_preview_change (impl); } @@ -4462,30 +4459,28 @@ filter_combo_changed (GtkComboBox *combo_box, static void check_preview_change (GtkFileChooserDefault *impl) { - const GtkFilePath *new_path = NULL; - const GtkFileInfo *new_info = NULL; + GtkTreePath *cursor_path; + const GtkFilePath *new_path; + const GtkFileInfo *new_info; - /* FIXME #132255: Fixing preview for multiple selection involves getting the - * full selection and diffing to find out what the most recently selected file - * is; there is logic in GtkFileSelection that probably can be - * copied. - */ - if (impl->sort_model && !impl->select_multiple) + gtk_tree_view_get_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view), &cursor_path, NULL); + if (cursor_path) { - GtkTreeSelection *selection; GtkTreeIter iter; + GtkTreeIter child_iter; - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); - if (gtk_tree_selection_get_selected (selection, NULL, &iter)) - { - GtkTreeIter child_iter; + gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->sort_model), &iter, cursor_path); + gtk_tree_path_free (cursor_path); - gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, - &child_iter, &iter); + gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, &child_iter, &iter); - new_path = _gtk_file_system_model_get_path (impl->browse_files_model, &child_iter); - new_info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter); - } + new_path = _gtk_file_system_model_get_path (impl->browse_files_model, &child_iter); + new_info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter); + } + else + { + new_path = NULL; + new_info = NULL; } if (new_path != impl->preview_path &&