From a54550db7b0a07ac66e4c9b130d94d94e0302d77 Mon Sep 17 00:00:00 2001 From: Daniel Boles Date: Wed, 11 Oct 2017 21:13:49 +0100 Subject: [PATCH] ToggleButton: Actually show buttons in new snippet Also, create a Window, instead of a Dialog without a transient parent, which is (noisily) discouraged. Then s/content_area/box/g to match. --- gtk/gtktogglebutton.c | 47 ++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index 5586bcde6b..f594d8ca73 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -72,35 +72,36 @@ * } * * void make_toggles (void) { - * GtkWidget *dialog, *toggle1, *toggle2; - * GtkWidget *content_area; - * const char *text; + * GtkWidget *window, *toggle1, *toggle2; + * GtkWidget *box; + * const char *text; * - * dialog = gtk_dialog_new (); - * content_area = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); + * window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + * box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); * - * text = "Hi, i’m a toggle button."; - * toggle1 = gtk_toggle_button_new_with_label (text); + * text = "Hi, I’m a toggle button."; + * toggle1 = gtk_toggle_button_new_with_label (text); * - * // Makes this toggle button invisible - * gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle1), - * TRUE); + * // Makes this toggle button invisible + * gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle1), + * TRUE); * - * g_signal_connect (toggle1, "toggled", - * G_CALLBACK (output_state), - * NULL); - * gtk_container_add (GTK_CONTAINER (content_area), toggle1); + * g_signal_connect (toggle1, "toggled", + * G_CALLBACK (output_state), + * NULL); + * gtk_container_add (GTK_CONTAINER (box), toggle1); * - * text = "Hi, i’m a toggle button."; - * toggle2 = gtk_toggle_button_new_with_label (text); - * gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle2), - * FALSE); - * g_signal_connect (toggle2, "toggled", - * G_CALLBACK (output_state), - * NULL); - * gtk_container_add (GTK_CONTAINER (content_area), toggle2); + * text = "Hi, I’m a toggle button."; + * toggle2 = gtk_toggle_button_new_with_label (text); + * gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle2), + * FALSE); + * g_signal_connect (toggle2, "toggled", + * G_CALLBACK (output_state), + * NULL); + * gtk_container_add (GTK_CONTAINER (box), toggle2); * - * gtk_widget_show_all (dialog); + * gtk_container_add (GTK_CONTAINER (window), box); + * gtk_widget_show_all (window); * } * ]| */