Provide a fast path returning NULL when the limit is set to 0.
2006-11-16 Emmanuele Bassi <ebassi@gnome.org> * gtk/gtkrecentmanager.c: Provide a fast path returning NULL when the limit is set to 0. * gtk/gtkrecentchooserdefault.c: * gtk/gtkrecentchoosermenu.c: Add the same fast path inside the RecentChooser implementation; add a check in the list clamping code. (#373466 and duplicates)
This commit is contained in:
committed by
Emmanuele Bassi
parent
b99bea2489
commit
cbf6d898fb
@ -607,8 +607,10 @@ gtk_recent_chooser_menu_get_items (GtkRecentChooser *chooser)
|
||||
return NULL;
|
||||
|
||||
limit = gtk_recent_chooser_get_limit (chooser);
|
||||
sort_type = gtk_recent_chooser_get_sort_type (chooser);
|
||||
if (limit == 0)
|
||||
return NULL;
|
||||
|
||||
sort_type = gtk_recent_chooser_get_sort_type (chooser);
|
||||
switch (sort_type)
|
||||
{
|
||||
case GTK_RECENT_SORT_NONE:
|
||||
@ -641,6 +643,8 @@ gtk_recent_chooser_menu_get_items (GtkRecentChooser *chooser)
|
||||
GList *clamp, *l;
|
||||
|
||||
clamp = g_list_nth (items, limit - 1);
|
||||
if (!clamp)
|
||||
return items;
|
||||
|
||||
l = clamp->next;
|
||||
clamp->next = NULL;
|
||||
|
||||
Reference in New Issue
Block a user