summaryrefslogtreecommitdiff
path: root/gtk/gtkrecentchoosermenu.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2007-03-15 10:05:34 +0000
committerEmmanuele Bassi <ebassi@src.gnome.org>2007-03-15 10:05:34 +0000
commit4191ec6a027a48ff099d38bfcd6195b6cbc2fdaa (patch)
treea69fb4925d147a0f00483c1ba23ae2be77da63eb /gtk/gtkrecentchoosermenu.c
parentd953ce87750f5be9a851df22f2f21a100f964ec1 (diff)
downloadgtk+-4191ec6a027a48ff099d38bfcd6195b6cbc2fdaa.tar.gz
Move filtering of the recent files list into the shared implementation; do
2007-03-15 Emmanuele Bassi <ebassi@gnome.org> * gtk/gtkrecentchooserprivate.h: * gtk/gtkrecentchooserutils.c: Move filtering of the recent files list into the shared implementation; do the filtering before the sorting, so that we always clamp on the desired size. (#418219) * gtk/gtkrecentchoosermenu.c: Remove the filtering of the list, as it's already been done. * gtk/gtkrecentchooserdefault.c: Ditto; also remove the GtkTreeModelFilter: just reload the view if the sorting and filtering properties change. * gtk/testrecentchoosermenu.c: Exercise the limit property. svn path=/trunk/; revision=17516
Diffstat (limited to 'gtk/gtkrecentchoosermenu.c')
-rw-r--r--gtk/gtkrecentchoosermenu.c98
1 files changed, 3 insertions, 95 deletions
diff --git a/gtk/gtkrecentchoosermenu.c b/gtk/gtkrecentchoosermenu.c
index 99097fa8c8..cff079c071 100644
--- a/gtk/gtkrecentchoosermenu.c
+++ b/gtk/gtkrecentchoosermenu.c
@@ -625,6 +625,7 @@ gtk_recent_chooser_menu_get_items (GtkRecentChooser *chooser)
GtkRecentChooserMenuPrivate *priv = menu->priv;
return _gtk_recent_chooser_get_items (chooser,
+ priv->current_filter,
priv->sort_func,
priv->sort_data);
}
@@ -697,76 +698,10 @@ gtk_recent_chooser_menu_set_current_filter (GtkRecentChooserMenu *menu,
priv->current_filter = filter;
g_object_ref_sink (priv->current_filter);
}
-
- g_object_notify (G_OBJECT (menu), "filter");
-}
-
-static gboolean
-get_is_recent_filtered (GtkRecentChooserMenu *menu,
- GtkRecentInfo *info)
-{
- GtkRecentChooserMenuPrivate *priv;
- GtkRecentFilter *current_filter;
- GtkRecentFilterInfo filter_info;
- GtkRecentFilterFlags needed;
- gboolean retval;
-
- g_assert (info != NULL);
-
- priv = menu->priv;
-
- if (!priv->current_filter)
- return FALSE;
-
- current_filter = priv->current_filter;
- needed = gtk_recent_filter_get_needed (current_filter);
-
- filter_info.contains = GTK_RECENT_FILTER_URI | GTK_RECENT_FILTER_MIME_TYPE;
-
- filter_info.uri = gtk_recent_info_get_uri (info);
- filter_info.mime_type = gtk_recent_info_get_mime_type (info);
-
- if (needed & GTK_RECENT_FILTER_DISPLAY_NAME)
- {
- filter_info.display_name = gtk_recent_info_get_display_name (info);
- filter_info.contains |= GTK_RECENT_FILTER_DISPLAY_NAME;
- }
- else
- filter_info.uri = NULL;
-
- if (needed & GTK_RECENT_FILTER_APPLICATION)
- {
- filter_info.applications = (const gchar **) gtk_recent_info_get_applications (info, NULL);
- filter_info.contains |= GTK_RECENT_FILTER_APPLICATION;
- }
- else
- filter_info.applications = NULL;
- if (needed & GTK_RECENT_FILTER_GROUP)
- {
- filter_info.groups = (const gchar **) gtk_recent_info_get_groups (info, NULL);
- filter_info.contains |= GTK_RECENT_FILTER_GROUP;
- }
- else
- filter_info.groups = NULL;
-
- if (needed & GTK_RECENT_FILTER_AGE)
- {
- filter_info.age = gtk_recent_info_get_age (info);
- filter_info.contains |= GTK_RECENT_FILTER_AGE;
- }
- else
- filter_info.age = -1;
-
- retval = gtk_recent_filter_filter (current_filter, &filter_info);
-
- /* this we own */
- if (filter_info.applications)
- g_strfreev ((gchar **) filter_info.applications);
- if (filter_info.groups)
- g_strfreev ((gchar **) filter_info.groups);
+ gtk_recent_chooser_menu_populate (menu);
- return !retval;
+ g_object_notify (G_OBJECT (menu), "filter");
}
/* taken from libeel/eel-strings.c */
@@ -1021,33 +956,6 @@ idle_populate_func (gpointer data)
}
info = g_list_nth_data (pdata->items, pdata->loaded_items);
-
- /* skip non-local items on request */
- if (priv->local_only &&
- !gtk_recent_info_is_local (info))
- {
- goto check_and_return;
- }
-
- /* skip private items on request */
- if (!priv->show_private &&
- gtk_recent_info_get_private_hint (info))
- {
- goto check_and_return;
- }
-
- /* skip non-existing items on request */
- if (!priv->show_not_found &&
- !gtk_recent_info_exists (info))
- {
- goto check_and_return;
- }
- /* filter items based on the currently set filter object */
- if (get_is_recent_filtered (pdata->menu, info))
- {
- goto check_and_return;
- }
-
item = gtk_recent_chooser_menu_create_item (pdata->menu,
info,
pdata->displayed_items);