From dbd5fb43abcd8f20814d84289ac86ac875028189 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 3 Nov 2016 08:32:31 -0400 Subject: [PATCH] Add a testcase for stacked headerbars This currently has some theming issues. This example is for Lapo to work those out. --- tests/Makefile.am | 2 + tests/teststackedheaders.c | 43 +++++++++++++ tests/teststackedheaders.ui | 123 ++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 tests/teststackedheaders.c create mode 100644 tests/teststackedheaders.ui diff --git a/tests/Makefile.am b/tests/Makefile.am index 649981f6d8..52d93e0356 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -166,6 +166,7 @@ noinst_PROGRAMS = $(TEST_PROGS) \ testrevealer2 \ testtitlebar \ testsplitheaders \ + teststackedheaders \ testactionbar \ testwindowsize \ testpopover \ @@ -561,6 +562,7 @@ EXTRA_DIST += \ merge-3.ui \ gnome-textfile.png \ testsplitheaders.ui \ + teststackedheaders.ui \ makefile.msc \ mydialog.ui \ mydialog2.ui \ diff --git a/tests/teststackedheaders.c b/tests/teststackedheaders.c new file mode 100644 index 0000000000..53470db8a6 --- /dev/null +++ b/tests/teststackedheaders.c @@ -0,0 +1,43 @@ +#include + +static GtkWidget *header_stack; +static GtkWidget *page_stack; + +static void +back_to_main (GtkButton *button) +{ + gtk_stack_set_visible_child_name (GTK_STACK (header_stack), "main"); + gtk_stack_set_visible_child_name (GTK_STACK (page_stack), "page1"); +} + +static void +go_to_secondary (GtkButton *button) +{ + gtk_stack_set_visible_child_name (GTK_STACK (header_stack), "secondary"); + gtk_stack_set_visible_child_name (GTK_STACK (page_stack), "secondary"); +} + +int +main (int argc, char *argv[]) +{ + GtkBuilder *builder; + GtkWidget *win; + + gtk_init (NULL, NULL); + + builder = gtk_builder_new (); + gtk_builder_add_callback_symbol (builder, "back_to_main", G_CALLBACK (back_to_main)); + gtk_builder_add_callback_symbol (builder, "go_to_secondary", G_CALLBACK (go_to_secondary)); + gtk_builder_add_from_file (builder, "teststackedheaders.ui", NULL); + gtk_builder_connect_signals (builder, NULL); + + win = (GtkWidget *)gtk_builder_get_object (builder, "window"); + header_stack = (GtkWidget *)gtk_builder_get_object (builder, "header_stack"); + page_stack = (GtkWidget *)gtk_builder_get_object (builder, "page_stack"); + + gtk_window_present (GTK_WINDOW (win)); + + gtk_main (); + + return 0; +} diff --git a/tests/teststackedheaders.ui b/tests/teststackedheaders.ui new file mode 100644 index 0000000000..4168be3357 --- /dev/null +++ b/tests/teststackedheaders.ui @@ -0,0 +1,123 @@ + + + 600 + 400 + preferences-desktop-font + + + True + + + True + + + True + New + center + + + + start + + + + + True + page_stack + + + + + main + + + + + True + + + True + < + center + + + + start + + + + + secondary + + + + + + + True + + + True + True + True + always + always + + + True + center + center + Page 1 + + + + + page1 + Page 1 + + + + + True + True + True + always + always + + + True + center + center + Page 2 + + + + + page2 + Page 2 + + + + + True + True + True + always + always + + + True + center + center + Secondary + + + + + secondary + + + + + +