diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-08-15 16:36:31 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-08-15 16:36:31 +0000 |
commit | 24a55633ce7180ab51772bb11e05e5f0e9345f6e (patch) | |
tree | 8230ac3edc1fa52fa38ea9a388b879f72f152e47 /tests/testtoolbar.c | |
parent | c92959a4485fa1d09404fcc21a17672c565a69e1 (diff) | |
download | gtk+-24a55633ce7180ab51772bb11e05e5f0e9345f6e.tar.gz |
Add some more tests for menu placement.
2005-08-15 Matthias Clasen <mclasen@redhat.com>
* tests/testtoolbar.c: Add some more tests for menu placement.
* gtk/gtkmenutoolbutton.c (menu_position_func):
* gtk/gtktoolbar.c (menu_position_func): Improve positioning
of toolbutton menus and of the overflow menu. (#312937,
#153870, Christian Persch, Paolo Borelli)
Diffstat (limited to 'tests/testtoolbar.c')
-rw-r--r-- | tests/testtoolbar.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/tests/testtoolbar.c b/tests/testtoolbar.c index 9af5d92792..0818c5dcea 100644 --- a/tests/testtoolbar.c +++ b/tests/testtoolbar.c @@ -488,6 +488,15 @@ timeout_cb (GtkWidget *widget) return TRUE; } +static gboolean +timeout_cb1 (GtkWidget *widget) +{ + static gboolean sensitive = TRUE; + sensitive = !sensitive; + gtk_widget_set_sensitive (widget, sensitive); + return TRUE; +} + gint main (gint argc, gchar **argv) { @@ -603,17 +612,37 @@ main (gint argc, gchar **argv) gtk_tool_item_set_expand (item, TRUE); menu = gtk_menu_new (); - menuitem = gtk_menu_item_new_with_label ("foo.txt"); - gtk_widget_show (menuitem); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); - menuitem = gtk_menu_item_new_with_label ("bar.txt"); - gtk_widget_show (menuitem); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + for (i = 0; i < 20; i++) + { + char *text; + text = g_strdup_printf ("Menuitem %d", i); + menuitem = gtk_menu_item_new_with_label (text); + g_free (text); + gtk_widget_show (menuitem); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + } item = gtk_menu_tool_button_new_from_stock (GTK_STOCK_OPEN); gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (item), menu); add_item_to_list (store, item, "Open"); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); + g_timeout_add (3000, (GSourceFunc) timeout_cb1, item); + + menu = gtk_menu_new (); + for (i = 0; i < 20; i++) + { + char *text; + text = g_strdup_printf ("A%d", i); + menuitem = gtk_menu_item_new_with_label (text); + g_free (text); + gtk_widget_show (menuitem); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + } + + item = gtk_menu_tool_button_new_from_stock (GTK_STOCK_GO_BACK); + gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (item), menu); + add_item_to_list (store, item, "BackWithHistory"); + gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); item = gtk_separator_tool_item_new (); add_item_to_list (store, item, "-----"); |