From 4da281d20b7a6086ee353d176566e2fa0967280a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 23 Oct 2014 23:39:39 -0400 Subject: [PATCH] Adapt the testpopover example We now use GtkPopoverMenu, and just add the model buttons directly to it. --- tests/Makefile.am | 6 +- tests/popover2.ui | 1138 ++++++++++++++++++++++--------------------- tests/testpopover.c | 34 -- 3 files changed, 575 insertions(+), 603 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index b54084b290..c94448c507 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -9,8 +9,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/gdk \ $(GTK_DEBUG_FLAGS) \ $(GTK_DEP_CFLAGS) \ - $(GDK_DEP_CFLAGS) \ - -pthread + $(GDK_DEP_CFLAGS) DEPS = \ $(top_builddir)/gtk/libgtk-3.la @@ -20,11 +19,8 @@ LDADD = \ $(top_builddir)/gdk/libgdk-3.la \ $(GTK_DEP_LIBS) \ $(GDK_DEP_LIBS) \ - -lgmodule-2.0 \ -lm -AM_LDFLAGS = -Wl,--export-dynamic -pthread - if USE_X11 testsocket_programs = testsocket testsocket_child diff --git a/tests/popover2.ui b/tests/popover2.ui index 64896bdcc2..21905f5944 100644 --- a/tests/popover2.ui +++ b/tests/popover2.ui @@ -1,574 +1,591 @@ - + - + True - False - slide-left-right + vertical + 12 + 12 + 6 + 3 - + True - vertical - fill - 10 - - - True - vertical - 12 - 12 - 6 - 3 - - - True - start - Edit - - - - - - True - horizontal - - - - - - - True - top.cut - Cut - - - - - True - top.copy - Copy - - - - - True - top.paste - Paste - - - - - True - horizontal - 12 - 12 - 3 - 3 - - - - - True - action1 - No action - - - - - True - top.action2 - check - Toggle - - - - - True - top.action2a - check - Another Toggle - - - - - True - vertical - 12 - 12 - 6 - 3 - - - True - start - Middle Section - - - - - - True - horizontal - - - - - - - True - top.action3 - 'three' - radio - Radio 1 - - - - - True - top.action3 - 'four' - radio - Radio 2 - - - - - True - Submenu 1 - True - - - - - - True - Submenu 2 - True - - - - - - True - vertical - 12 - 12 - 6 - 3 - - - True - start - End Section - - - - - - True - horizontal - - - - - - - True - top.action9 - Another Item 9 - icon9 - - - - - True - top.action10 - Another Item 10 - - + start + Edit + - - main - - - + True - vertical - 10 - - - - True - Submenu 1 - True - True - True - - - - - - True - vertical - 12 - 12 - 6 - 3 - - - True - start - 5555 - - - - - - True - horizontal - - - - - - - True - top.action5 - Item 5 - - - - - True - top.action5 - Item 5a - - - - - True - top.action5 - Item 5b - - - - - True - horizontal - fill - 10 - - - - True - List - top.set-view - 'list' - radio - True - True - icon-list - - - True - - - - - True - Grid - top.set-view - 'grid' - radio - True - True - icon-grid - - - True - - - - - - - True - top.action5 - Item 5c - - - - - True - top.action5 - Item 5d - - - - - True - vertical - 12 - 12 - 6 - 3 - - - True - start - Format - - - - - - True - horizontal - - - - - - - True - horizontal - fill - 10 - - - - True - Bold - top.bold - check - True - True - - - True - - - - - True - Italic - top.italic - check - True - True - icon-italic - - - True - - - - - True - Strikethrough - top.strikethrough - check - True - True - icon-strikethrough - - - True - - - - - True - Underline - top.underline - check - True - True - icon-underline - - - True - - - - - - - True - vertical - 12 - 12 - 6 - 3 - - - True - start - 6666 - - - - - - True - horizontal - - - - - - - True - top.action6 - Item 6 - - - - - True - top.action6 - Item 6a - - - - - True - top.action6 - Item 6b - - - - - True - top.action6 - Item 6c - - - - - True - top.action6 - Item 6d - - + horizontal - - submenu1 - - - - - True - vertical - 10 - - - True - Submenu 2 - True - True - True - - - - - - True - top.action7 - Item 7 - - - - - True - Subsubmenu - icon9 - True - - - - - - submenu2 - - - - - - True - vertical - 10 - - - - True - Subsubmenu - True - True - True - - - - - - True - action8 - Item 8 - - - - - True - horizontal - 12 - 12 - 3 - 3 - - - - - True - top.action9 - Item 9 - - - - - True - top.action10 - Item 10 - - - - - - subsubmenu - - - + + + True + top.cut + Cut + + + + + True + top.copy + Copy + + + + + True + top.paste + Paste + + + + + True + horizontal + 12 + 12 + 3 + 3 + + + + + True + action1 + No action + + + + + True + top.action2 + check + Toggle + + + + + True + top.action2a + check + Another Toggle + + + + + True + vertical + 12 + 12 + 6 + 3 + + + True + start + Middle Section + + + + + + True + horizontal + + + + + + + True + top.action3 + 'three' + radio + Radio 1 + + + + + True + top.action3 + 'four' + radio + Radio 2 + + + + + True + Submenu 1 + True + submenu1 + + + + + True + Submenu 2 + True + submenu2 + + + + + True + vertical + 12 + 12 + 6 + 3 + + + True + start + End Section + + + + + + True + horizontal + + + + + + + True + top.action9 + Another Item 9 + icon9 + + + + + True + top.action10 + Another Item 10 + + + + + True + Submenu 1 + True + True + True + main + + + submenu1 + + + + + True + vertical + 12 + 12 + 6 + 3 + + + True + start + 5555 + + + + + + True + horizontal + + + + + submenu1 + + + + + True + top.action5 + Item 5 + + + submenu1 + + + + + True + top.action5 + Item 5a + + + submenu1 + + + + + True + top.action5 + Item 5b + + + submenu1 + + + + + True + horizontal + fill + 10 + + + + True + List + top.set-view + 'list' + radio + True + True + icon-list + + + True + + + + + True + Grid + top.set-view + 'grid' + radio + True + True + icon-grid + + + True + + + + + submenu1 + + + + + True + top.action5 + Item 5c + + + submenu1 + + + + + True + top.action5 + Item 5d + + + submenu1 + + + + + True + vertical + 12 + 12 + 6 + 3 + + + True + start + Format + + + + + + True + horizontal + + + + + submenu1 + + + + + True + horizontal + fill + 10 + + + + True + Bold + top.bold + check + True + True + + + True + + + + + True + Italic + top.italic + check + True + True + icon-italic + + + True + + + + + True + Strikethrough + top.strikethrough + check + True + True + icon-strikethrough + + + True + + + + + True + Underline + top.underline + check + True + True + icon-underline + + + True + + + + + submenu1 + + + + + True + vertical + 12 + 12 + 6 + 3 + + + True + start + 6666 + + + + + + True + horizontal + + + + + submenu1 + + + + + True + top.action6 + Item 6 + + + submenu1 + + + + + True + top.action6 + Item 6a + + + submenu1 + + + + + True + top.action6 + Item 6b + + + submenu1 + + + + + True + top.action6 + Item 6c + + + submenu1 + + + + + True + top.action6 + Item 6d + + + submenu1 + + + + + True + Submenu 2 + True + True + True + main + + + submenu2 + + + + + True + top.action7 + Item 7 + + + submenu2 + + + + + True + Subsubmenu + icon9 + True + subsubmenu + + + submenu2 + + + + + True + Subsubmenu + True + True + True + submenu2 + + + subsubmenu + + + + + True + action8 + Item 8 + + + subsubmenu + + + + + True + horizontal + 12 + 12 + 3 + 3 + + + subsubmenu + + + + + True + top.action9 + Item 9 + + + subsubmenu + + + + + True + top.action10 + Item 10 + + + subsubmenu + + preferences-desktop-font @@ -588,11 +605,4 @@ format-text-underline-symbolic - - horizontal - - - - - diff --git a/tests/testpopover.c b/tests/testpopover.c index da6ae8cca7..306e7c9c28 100644 --- a/tests/testpopover.c +++ b/tests/testpopover.c @@ -30,39 +30,6 @@ static GActionEntry entries[] = { { "action10", activate, NULL, NULL, NULL } }; -static void -open_menu (GtkWidget *button, const gchar *name) -{ - GtkWidget *stack; - g_print ("open %s\n", name); - stack = gtk_widget_get_ancestor (button, GTK_TYPE_STACK); - gtk_stack_set_visible_child_name (GTK_STACK (stack), name); -} - -void -open_main (GtkWidget *button) -{ - open_menu (button, "main"); -} - -void -open_submenu1 (GtkWidget *button) -{ - open_menu (button, "submenu1"); -} - -void -open_submenu2 (GtkWidget *button) -{ - open_menu (button, "submenu2"); -} - -void -open_subsubmenu (GtkWidget *button) -{ - open_menu (button, "subsubmenu"); -} - int main (int argc, char *argv[]) { @@ -124,7 +91,6 @@ main (int argc, char *argv[]) popover = GTK_WIDGET (gtk_menu_button_get_popover (GTK_MENU_BUTTON (button))); builder = gtk_builder_new_from_file ("popover2.ui"); - gtk_builder_connect_signals (builder, NULL); popover2 = (GtkWidget *)gtk_builder_get_object (builder, "popover"); gtk_menu_button_set_popover (GTK_MENU_BUTTON (button2), popover2);