diff options
author | Matthias Clasen <maclas@gmx.de> | 2004-01-08 23:37:34 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2004-01-08 23:37:34 +0000 |
commit | f2bb20cc15438e6b8d1d7c979681de3cbefac4f6 (patch) | |
tree | 2215b4d866071dabb083aeb8b5647d96a0fcc356 /tests | |
parent | ecceb20a8b13df9af33a052b75fab4fa3ae189ea (diff) | |
download | gtk+-f2bb20cc15438e6b8d1d7c979681de3cbefac4f6.tar.gz |
New function to obtain a list of toplevel widgets constructed by the ui
Fri Jan 9 00:34:57 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.h:
* gtk/gtkuimanager.c (gtk_ui_manager_get_toplevels): New function to
obtain a list of toplevel widgets constructed by the ui manager.
* gtk/gtkuimanager.h (GtkUIManagerItemType): Change to flags, so that
the values can be combined for gtk_ui_manager_get_toplevels().
* tests/testmerge.c: Add a "Dump toplevels" button to test
gtk_ui_manager_get_toplevels().
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testmerge.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/testmerge.c b/tests/testmerge.c index 09f190e89b..75d94de5ad 100644 --- a/tests/testmerge.c +++ b/tests/testmerge.c @@ -35,6 +35,27 @@ dump_accels (void) } static void +print_toplevel (GtkWidget *widget, gpointer user_data) +{ + g_print ("%s\n", G_OBJECT_TYPE_NAME (widget)); +} + +static void +dump_toplevels (GtkWidget *button, + GtkUIManager *merge) +{ + GSList *toplevels; + + toplevels = gtk_ui_manager_get_toplevels (merge, + GTK_UI_MANAGER_MENUBAR | + GTK_UI_MANAGER_TOOLBAR | + GTK_UI_MANAGER_POPUP); + + g_slist_foreach (toplevels, print_toplevel, NULL); + g_slist_free (toplevels); +} + +static void toggle_tearoffs (GtkWidget *button, GtkUIManager *merge) { @@ -652,6 +673,10 @@ main (int argc, char **argv) g_signal_connect (button, "clicked", G_CALLBACK (dump_tree), merge); gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0); + button = gtk_button_new_with_label ("Dump Toplevels"); + g_signal_connect (button, "clicked", G_CALLBACK (dump_toplevels), merge); + gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0); + button = gtk_button_new_with_label ("Dump Accels"); g_signal_connect (button, "clicked", G_CALLBACK (dump_accels), NULL); gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0); |