[gtk+] Add a switch
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add a switch
- Date: Wed, 11 Jan 2012 05:12:03 +0000 (UTC)
commit bec43213dab9a44464c4c6a0078be61ccfa6304e
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jan 11 00:10:51 2012 -0500
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
examples/bloatpad.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/examples/bloatpad.c b/examples/bloatpad.c
index 41326ab..67c4efd 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]