[gtk+/bgo593793-filechooser-recent-folders] Load and populate the recent-items in a single pass
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/bgo593793-filechooser-recent-folders] Load and populate the recent-items in a single pass
- Date: Fri, 26 Aug 2011 17:43:44 +0000 (UTC)
commit 0cb9ca38bbf0078d97dbdcce4b9376a3db5e9abb
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Aug 26 11:38:11 2011 -0500
Load and populate the recent-items in a single pass
There's no real asynchronicity going on, anyway, so let's do both within
a single iteration of the idle handler.
Signed-off-by: Federico Mena Quintero <federico gnome org>
gtk/gtkfilechooserdefault.c | 32 +++++++++-----------------------
1 files changed, 9 insertions(+), 23 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index a7fc10d..c32ebef 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -9291,7 +9291,6 @@ typedef struct
{
GtkFileChooserDefault *impl;
GList *items;
- guint needs_sorting : 1;
} RecentLoadData;
static void
@@ -9386,30 +9385,18 @@ recent_idle_load (gpointer data)
if (!impl->recent_manager)
return FALSE;
- /* first iteration: load all the items */
+ load_data->items = gtk_recent_manager_get_items (impl->recent_manager);
if (!load_data->items)
- {
- load_data->items = gtk_recent_manager_get_items (impl->recent_manager);
- if (!load_data->items)
- return FALSE;
-
- load_data->needs_sorting = TRUE;
+ return FALSE;
- return TRUE;
- }
-
- /* second iteration: MRU sorting and clamping, and populating the model */
- if (load_data->needs_sorting)
- {
- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
- populate_model_with_recent_items (impl, load_data->items);
- else
- populate_model_with_folders (impl, load_data->items);
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
+ populate_model_with_recent_items (impl, load_data->items);
+ else
+ populate_model_with_folders (impl, load_data->items);
- g_list_foreach (load_data->items, (GFunc) gtk_recent_info_unref, NULL);
- g_list_free (load_data->items);
- load_data->items = NULL;
- }
+ g_list_foreach (load_data->items, (GFunc) gtk_recent_info_unref, NULL);
+ g_list_free (load_data->items);
+ load_data->items = NULL;
return FALSE;
}
@@ -9429,7 +9416,6 @@ recent_start_loading (GtkFileChooserDefault *impl)
load_data = g_new (RecentLoadData, 1);
load_data->impl = impl;
load_data->items = NULL;
- load_data->needs_sorting = TRUE;
/* begin lazy loading the recent files into the model */
impl->load_recent_id = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE + 30,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]