From a35bd52a96ed93fcbd60a1bcf48be348c53233bc Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 23 Aug 2007 10:48:28 +0000 Subject: [PATCH] Check if we are still holding the model before updating it; removes a set 2007-08-23 Emmanuele Bassi * gtkfilechooserdefault.c: (search_hit_get_info_cb), (recent_item_get_info_cb): Check if we are still holding the model before updating it; removes a set of critical warnings when switching to the browse mode from a loading search or recent files list. (recent_clear_model), (recent_sort_model), (recent_idle_cleanup): When in recent files mode, set the model for the files list view when we have completed the loading of the recently used files list. This makes switching between modes fast again and reduces the amount of redraws needed to display the list. (#469214) svn path=/trunk/; revision=18677 --- ChangeLog | 15 +++++++++++++++ gtk/gtkfilechooserdefault.c | 18 ++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 300328bf5a..7164e3b5a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2007-08-23 Emmanuele Bassi + + * gtkfilechooserdefault.c: + (search_hit_get_info_cb), (recent_item_get_info_cb): Check if + we are still holding the model before updating it; removes a + set of critical warnings when switching to the browse mode from + a loading search or recent files list. + + (recent_clear_model), (recent_sort_model), + (recent_idle_cleanup): When in recent files mode, set the + model for the files list view when we have completed the loading + of the recently used files list. This makes switching between + modes fast again and reduces the amount of redraws needed + to display the list. (#469214) + 2007-08-22 Emmanuele Bassi * configure.in: Remove oc (Occitane) from LINGUAS and unbreak diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 2f8bce643a..eb26f515a5 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -8728,6 +8728,9 @@ search_hit_get_info_cb (GtkFileSystemHandle *handle, char *display_name; struct SearchHitInsertRequest *request = data; + if (!request->impl->search_model) + goto out; + path = gtk_tree_row_reference_get_path (request->row_ref); if (!path) goto out; @@ -9440,6 +9443,9 @@ recent_clear_model (GtkFileChooserDefault *impl, return; model = GTK_TREE_MODEL (impl->recent_model); + + if (remove_from_treeview) + gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL); if (gtk_tree_model_get_iter_first (model, &iter)) { @@ -9475,9 +9481,6 @@ recent_clear_model (GtkFileChooserDefault *impl, g_object_unref (impl->recent_model_sort); impl->recent_model_sort = NULL; - - if (remove_from_treeview) - gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL); } /* Stops any ongoing loading of the recent files list; does @@ -9730,9 +9733,6 @@ recent_setup_model (GtkFileChooserDefault *impl) gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (impl->recent_model_sort), RECENT_MODEL_COL_INFO, GTK_SORT_DESCENDING); - - gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), - GTK_TREE_MODEL (impl->recent_model_sort)); } typedef struct @@ -9750,6 +9750,9 @@ recent_idle_cleanup (gpointer data) RecentLoadData *load_data = data; GtkFileChooserDefault *impl = load_data->impl; + gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), + GTK_TREE_MODEL (impl->recent_model_sort)); + set_busy_cursor (impl, FALSE); impl->load_recent_id = 0; @@ -9783,6 +9786,9 @@ recent_item_get_info_cb (GtkFileSystemHandle *handle, gboolean is_folder = FALSE; struct RecentItemInsertRequest *request = data; + if (!request->impl->recent_model) + goto out; + path = gtk_tree_row_reference_get_path (request->row_ref); if (!path) goto out;