diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2007-02-09 14:24:19 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@src.gnome.org> | 2007-02-09 14:24:19 +0000 |
commit | 4a559d6ec8c1400b5d14913e2bd77621a86a0dc3 (patch) | |
tree | 98afd8f8ba6f08a71fc2b446acae7b72400ccd45 /tests/testrecentchoosermenu.c | |
parent | 661a6bc0211f5db1678e1892a4976f19bfbfa436 (diff) | |
download | gtk+-4a559d6ec8c1400b5d14913e2bd77621a86a0dc3.tar.gz |
Add support for both prepending and appending custom menu items.
2007-02-09 Emmanuele Bassi <ebassi@gnome.org>
* gtk/gtkrecentchoosermenu.c: Add support for both prepending
and appending custom menu items.
(gtk_recent_chooser_menu_constructor): Add a placeholder menu
item for the empty menu case, and for giving us a starting
point for the recent items populating process.
(gtk_recent_chooser_menu_insert_item),
(gtk_recent_chooser_menu_dispose_items): Insert an item at
the position following the placeholder (and find that position
if needed).
(idle_populate_func), (idle_populate_clean_up): Show the
placeholder menu item, instead of creating one each time.
(gtk_recent_chooser_menu_populate): Kill some indirections
and hide the placeholder before populating the menu.
(set_recent_manager): Remember to remove the idle population
source if the manager changes.
* tests/testrecentchoosermenu.c: Test the appending and
prepending of the menu items to the recent chooser menu
widget.
svn path=/trunk/; revision=17281
Diffstat (limited to 'tests/testrecentchoosermenu.c')
-rw-r--r-- | tests/testrecentchoosermenu.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/testrecentchoosermenu.c b/tests/testrecentchoosermenu.c index 765d4e5964..18bfb08b56 100644 --- a/tests/testrecentchoosermenu.c +++ b/tests/testrecentchoosermenu.c @@ -56,6 +56,8 @@ static GtkWidget * create_recent_chooser_menu (void) { GtkWidget *menu; + GtkRecentFilter *filter; + GtkWidget *menuitem; menu = gtk_recent_chooser_menu_new_for_manager (manager); @@ -66,12 +68,38 @@ create_recent_chooser_menu (void) gtk_recent_chooser_menu_set_show_numbers (GTK_RECENT_CHOOSER_MENU (menu), TRUE); + filter = gtk_recent_filter_new (); + gtk_recent_filter_set_name (filter, "Gedit files"); + gtk_recent_filter_add_application (filter, "gedit"); + gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu), filter); + gtk_recent_chooser_set_filter (GTK_RECENT_CHOOSER (menu), filter); + g_signal_connect (menu, "item-activated", G_CALLBACK (item_activated_cb), NULL); gtk_widget_show (menu); + menuitem = gtk_separator_menu_item_new (); + gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem = gtk_menu_item_new_with_label ("Test prepend"); + gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem = gtk_separator_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem = gtk_menu_item_new_with_label ("Test append"); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_CLEAR, NULL); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + return menu; } |