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
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
||||
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++)
|
||||
|
||||
Reference in New Issue
Block a user