summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2012-01-11 00:10:51 -0500
committerMatthias Clasen <mclasen@redhat.com>2012-01-11 00:10:51 -0500
commitbec43213dab9a44464c4c6a0078be61ccfa6304e (patch)
treeb7cd8d424b148e502faa5744b9979145e965f536 /examples
parentfdc2e29d69a6c3435e3c5fd3f0c826553a786a99 (diff)
downloadgtk+-bec43213dab9a44464c4c6a0078be61ccfa6304e.tar.gz
Add a switch
Add a switch. This demonstrates: - that switches can be placed in toolbars - that GtkSwitch is actionable - that actions can be shared between multiple actionables
Diffstat (limited to 'examples')
-rw-r--r--examples/bloatpad.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/bloatpad.c b/examples/bloatpad.c
index 41326ababc..67c4efdeaa 100644
--- a/examples/bloatpad.c
+++ b/examples/bloatpad.c
@@ -104,6 +104,7 @@ new_window (GApplication *app,
GtkWidget *window, *grid, *scrolled, *view;
GtkWidget *toolbar;
GtkToolItem *button;
+ GtkWidget *sw, *box, *label;
window = gtk_application_window_new (GTK_APPLICATION (app));
gtk_window_set_default_size ((GtkWindow*)window, 640, 480);
@@ -126,6 +127,21 @@ new_window (GApplication *app,
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::right");
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
+ button = gtk_separator_tool_item_new ();
+ gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (button), FALSE);
+ gtk_tool_item_set_expand (GTK_TOOL_ITEM (button), TRUE);
+ gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
+
+ button = gtk_tool_item_new ();
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_container_add (GTK_CONTAINER (button), box);
+ label = gtk_label_new ("Fullscreen:");
+ gtk_container_add (GTK_CONTAINER (box), label);
+ sw = gtk_switch_new ();
+ gtk_actionable_set_action_name (GTK_ACTIONABLE (sw), "win.fullscreen");
+ gtk_container_add (GTK_CONTAINER (box), sw);
+ gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
+
gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 1, 1);
scrolled = gtk_scrolled_window_new (NULL, NULL);