summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIkey Doherty <michael.i.doherty@intel.com>2014-08-23 17:38:42 +0100
committerMatthias Clasen <mclasen@redhat.com>2014-10-01 00:44:46 -0400
commitcdd2651db054ecd6cd92c9d1ad728fff7cd7ff33 (patch)
treece1487a7ac87c399581be1b30d4fe80759a92f22 /tests
parent3b08ba24b31702bd85901c8141d43d90fc6a2df4 (diff)
downloadgtk+-cdd2651db054ecd6cd92c9d1ad728fff7cd7ff33.tar.gz
Add GtkSidebar
GtkSidebar behaves internally much like GtkStackSwitcher, providing a vertical sidebar like widget. It is virtually identical in appearance to the widget currently used in GNOME Tweak Tool. This widget is connected to a GtkStack, and builds its own contents as a GtkListBox subclass, using the "title" child property to provide a consistent navigatable widget. Being a subclass of GtkListBox it benefits immediately from strong keyboard navigation, and minimal changes are required for theming. https://bugzilla.gnome.org/show_bug.cgi?id=735293 Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/teststack.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/teststack.c b/tests/teststack.c
index 35c7abcc0a..2c9e5fa030 100644
--- a/tests/teststack.c
+++ b/tests/teststack.c
@@ -2,6 +2,7 @@
GtkWidget *stack;
GtkWidget *switcher;
+GtkWidget *sidebar;
GtkWidget *w1;
static void
@@ -99,7 +100,7 @@ gint
main (gint argc,
gchar ** argv)
{
- GtkWidget *window, *box, *button, *hbox, *combo;
+ GtkWidget *window, *box, *button, *hbox, *combo, *layout;
GtkWidget *w2, *w3;
GtkListStore* store;
GtkWidget *tree_view;
@@ -127,7 +128,15 @@ main (gint argc,
gtk_stack_set_transition_duration (GTK_STACK (stack), 1500);
gtk_widget_set_halign (stack, GTK_ALIGN_START);
- gtk_container_add (GTK_CONTAINER (box), stack);
+
+ /* Add sidebar before stack */
+ sidebar = gtk_sidebar_new ();
+ gtk_sidebar_set_stack (GTK_SIDEBAR (sidebar), GTK_STACK (stack));
+ layout = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_box_pack_start (GTK_BOX (layout), sidebar, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (layout), stack, TRUE, TRUE, 0);
+
+ gtk_container_add (GTK_CONTAINER (box), layout);
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (stack));