[gtk/subpop/docs-getting-started-hello-world] docs: match hello world code to description
- From: Link Dupont <link src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/subpop/docs-getting-started-hello-world] docs: match hello world code to description
- Date: Wed, 20 Oct 2021 02:41:42 +0000 (UTC)
commit 9e0494cf4d422bd8a19a468a5486db927e524e86
Author: Link Dupont <link sub-pop net>
Date: Wed Oct 20 02:36:12 2021 +0000
docs: match hello world code to description
Add the creation of a GtkBox to the hello-world sample code.
Fixes: #4358
docs/reference/gtk/getting_started.md | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/docs/reference/gtk/getting_started.md b/docs/reference/gtk/getting_started.md
index e1d3f2c8f2..761367a952 100644
--- a/docs/reference/gtk/getting_started.md
+++ b/docs/reference/gtk/getting_started.md
@@ -161,19 +161,24 @@ activate (GtkApplication *app,
{
GtkWidget *window;
GtkWidget *button;
+ GtkWidget *box;
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_widget_set_halign (box, GTK_ALIGN_CENTER);
+ gtk_widget_set_valign (box, GTK_ALIGN_CENTER);
+
+ gtk_window_set_child (GTK_WINDOW (window), box);
+
button = gtk_button_new_with_label ("Hello World");
- gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
- gtk_window_set_child (GTK_WINDOW (window), button);
+ gtk_box_append (GTK_BOX (box), button);
gtk_widget_show (window);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]