summaryrefslogtreecommitdiff
path: root/tests/testrecentchoosermenu.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2007-07-20 10:39:03 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2007-07-20 10:39:03 +0000
commit13277b42e28a987c0e26f4e0ecb458b73d7f06ff (patch)
tree7eac6762224e958e7215c5754c33a453ba2d05e3 /tests/testrecentchoosermenu.c
parent5a58d1ab187546908a81c1525e9bc435021ce2f1 (diff)
downloadgtk+-13277b42e28a987c0e26f4e0ecb458b73d7f06ff.tar.gz
Apply a patch by Emmanuele Bassi to limit the number of shown recent
2007-07-20 Matthias Clasen <mclasen@redhat.com> Apply a patch by Emmanuele Bassi to limit the number of shown recent files. (#439715) * gtk/gtksettings.c: Add a setting for the number of recent files to display by default. * gtk/gtkrecentchooserdefault.c: * gtk/gtkfilechooserdefault.c: Respect the limit. * gtk/gtkrecentmanager.c: Remove the poll timeout in dispose, and do not stat more often than every 5 seconds. * gtk/gtkrecentchooserutils.c: * gtk/gtkrecentchoosermenu.c: Cleanups * tests/testrecentchoosermenu.c: Test limits. svn path=/trunk/; revision=18510
Diffstat (limited to 'tests/testrecentchoosermenu.c')
-rw-r--r--tests/testrecentchoosermenu.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/testrecentchoosermenu.c b/tests/testrecentchoosermenu.c
index 3c760d0068..d1110ee1a1 100644
--- a/tests/testrecentchoosermenu.c
+++ b/tests/testrecentchoosermenu.c
@@ -53,7 +53,7 @@ item_activated_cb (GtkRecentChooser *chooser,
}
static GtkWidget *
-create_recent_chooser_menu (void)
+create_recent_chooser_menu (gint limit)
{
GtkWidget *menu;
GtkRecentFilter *filter;
@@ -61,7 +61,8 @@ create_recent_chooser_menu (void)
menu = gtk_recent_chooser_menu_new_for_manager (manager);
- gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (menu), 4);
+ if (limit > 0)
+ gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (menu), limit);
gtk_recent_chooser_set_local_only (GTK_RECENT_CHOOSER (menu), TRUE);
gtk_recent_chooser_set_show_icons (GTK_RECENT_CHOOSER (menu), TRUE);
gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (menu),
@@ -122,7 +123,7 @@ create_file_menu (GtkAccelGroup *accelgroup)
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_mnemonic ("_Open Recent");
- recentmenu = create_recent_chooser_menu ();
+ recentmenu = create_recent_chooser_menu (-1);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), recentmenu);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
@@ -176,7 +177,7 @@ main (int argc, char *argv[])
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_widget_show (menuitem);
- menu = create_recent_chooser_menu ();
+ menu = create_recent_chooser_menu (4);
menuitem = gtk_menu_item_new_with_mnemonic ("_Recently Used");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);