Commit cbf6d898 authored by Emmanuele Bassi's avatar Emmanuele Bassi Committed by Emmanuele Bassi

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)
parent b99bea24
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)
2006-11-15 Matthias Clasen <mclasen@redhat.com>
* modules/printbackends/cups/gtkprintbackendcups.c (cups_printer_get_options):
......
......@@ -1302,8 +1302,10 @@ gtk_recent_chooser_default_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:
......@@ -1335,6 +1337,8 @@ gtk_recent_chooser_default_get_items (GtkRecentChooser *chooser)
GList *clamp, *l;
clamp = g_list_nth (items, limit - 1);
if (!clamp)
return items;
l = clamp->next;
clamp->next = NULL;
......
......@@ -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;
......
......@@ -1322,6 +1322,9 @@ gtk_recent_manager_get_items (GtkRecentManager *manager)
priv = manager->priv;
if (!priv->recent_items)
return NULL;
if (priv->limit == 0)
return NULL;
uris = g_bookmark_file_get_uris (priv->recent_items, &uris_len);
for (i = 0; i < uris_len; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment