[gtk+] Add GtkSwitch to the widget gallery



commit 99aa90b0bcab50bc3dce888ddffc5753ca643928
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Nov 29 11:23:07 2010 -0500

    Add GtkSwitch to the widget gallery

 docs/reference/gtk/Makefile.am       |    3 ++-
 docs/reference/gtk/images/switch.png |  Bin 0 -> 1875 bytes
 docs/reference/gtk/visual_index.xml  |    3 +++
 docs/tools/widgets.c                 |   22 ++++++++++++++++++++++
 4 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/docs/reference/gtk/Makefile.am b/docs/reference/gtk/Makefile.am
index 9b065dd..1de3259 100644
--- a/docs/reference/gtk/Makefile.am
+++ b/docs/reference/gtk/Makefile.am
@@ -322,7 +322,8 @@ HTML_IMAGES = \
 	$(srcdir)/images/layout-tblr.png				\
 	$(srcdir)/images/layout-tbrl.png				\
 	$(srcdir)/images/window-default.png				\
-	$(srcdir)/images/hello-world.png
+	$(srcdir)/images/hello-world.png				\
+	$(srcdir)/images/switch.png
 
 # Extra options to supply to gtkdoc-fixref
 FIXXREF_OPTIONS=--extra-dir=../gdk/html \
diff --git a/docs/reference/gtk/images/switch.png b/docs/reference/gtk/images/switch.png
new file mode 100644
index 0000000..2fba3eb
Binary files /dev/null and b/docs/reference/gtk/images/switch.png differ
diff --git a/docs/reference/gtk/visual_index.xml b/docs/reference/gtk/visual_index.xml
index 4bdc546..7a11071 100644
--- a/docs/reference/gtk/visual_index.xml
+++ b/docs/reference/gtk/visual_index.xml
@@ -123,4 +123,7 @@
   <link linkend="GtkFileChooserDialog">
     <inlinegraphic fileref="filechooser.png" format="PNG"></inlinegraphic>
   </link>
+  <link linkend="GtkSwitch">
+    <inlinegraphic fileref="switch.png" format="PNG"></inlinegraphic>
+  </link>
 </para>
diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
index 312d064..7308103 100644
--- a/docs/tools/widgets.c
+++ b/docs/tools/widgets.c
@@ -115,6 +115,7 @@ new_widget_info (const char *name,
   else
     {
       info->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+      gtk_window_set_has_resize_grip (GTK_WINDOW (info->window), FALSE);
       info->include_decorations = FALSE;
       gtk_widget_show_all (widget);
       gtk_container_add (GTK_CONTAINER (info->window), widget);
@@ -160,6 +161,26 @@ create_button (void)
 }
 
 static WidgetInfo *
+create_switch (void)
+{
+  GtkWidget *widget;
+  GtkWidget *align;
+  GtkWidget *sw;
+
+  widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
+  sw = gtk_switch_new ();
+  gtk_switch_set_active (GTK_SWITCH (sw), TRUE);
+  gtk_box_pack_start (GTK_BOX (widget), sw, TRUE, TRUE, 0);
+  sw = gtk_switch_new ();
+  gtk_box_pack_start (GTK_BOX (widget), sw, TRUE, TRUE, 0);
+
+  align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+  gtk_container_add (GTK_CONTAINER (align), widget);
+
+  return new_widget_info ("switch", align, SMALL);
+}
+
+static WidgetInfo *
 create_toggle_button (void)
 {
   GtkWidget *widget;
@@ -1095,6 +1116,7 @@ get_all_widgets (void)
   retval = g_list_prepend (retval, create_page_setup_dialog ());
   retval = g_list_prepend (retval, create_print_dialog ());
   retval = g_list_prepend (retval, create_volume_button ());
+  retval = g_list_prepend (retval, create_switch ());
 
   return retval;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]