[gtk+] togglebutton: Fix code snippet



commit 236098f89b40b2e3499f4c4b7f4f54cb0430970f
Author: Timm Bäder <mail baedert org>
Date:   Wed Oct 11 12:35:55 2017 +0200

    togglebutton: Fix code snippet
    
    Remove gtk_box_pack_start usage, gtk_dialog_get_content_area, fix wrong
    gtk_dialog_new parameters and actually add a output_state callback.

 gtk/gtktogglebutton.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index 14fca8e..66cffe0 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -65,13 +65,17 @@
  * ## Creating two #GtkToggleButton widgets.
  *
  * |[<!-- language="C" -->
+ * static void output_state (GtkToggleButton *source, gpointer user_data) {
+ *   printf ("Active: %d\n", gtk_toggle_button_get_active (source));
+ * }
+ *
  * void make_toggles (void) {
  *    GtkWidget *dialog, *toggle1, *toggle2;
  *    GtkWidget *content_area;
  *    const char *text;
  *
- *    dialog = gtk_dialog_new (text);
- *    content_area = gtk_dialog_get_content_area ();
+ *    dialog = gtk_dialog_new ();
+ *    content_area = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
  *
  *    text = "Hi, i’m a toggle button.";
  *    toggle1 = gtk_toggle_button_new_with_label (text);
@@ -79,16 +83,14 @@
  *    g_signal_connect (toggle1, "toggled",
  *                      G_CALLBACK (output_state),
  *                      NULL);
- *    gtk_box_pack_start (GTK_BOX (content_area),
- *                        toggle1, FALSE, FALSE, 2);
+ *    gtk_container_add (GTK_CONTAINER (content_area), toggle1);
  *
  *    text = "Hi, i’m a toggle button.";
  *    toggle2 = gtk_toggle_button_new_with_label (text);
  *    g_signal_connect (toggle2, "toggled",
  *                      G_CALLBACK (output_state),
  *                      NULL);
- *    gtk_box_pack_start (GTK_BOX (content_area),
- *                        toggle2, FALSE, FALSE, 2);
+ *    gtk_container_add (GTK_CONTAINER (content_area), toggle2);
  *
  *    gtk_widget_show (dialog);
  * }


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