From ef17fc5ab2dc679fd57760cee48138306f8393ab Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 18 Dec 2024 01:55:10 +0100 Subject: [PATCH] hello-c-gnome3: Make more robust. * gettext-tools/examples/hello-c-gnome3/hello.c (hello_application_window_init): Initialize label_id explicitly. --- gettext-tools/examples/hello-c-gnome3/hello.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gettext-tools/examples/hello-c-gnome3/hello.c b/gettext-tools/examples/hello-c-gnome3/hello.c index 5f8a315b1..c39192f67 100644 --- a/gettext-tools/examples/hello-c-gnome3/hello.c +++ b/gettext-tools/examples/hello-c-gnome3/hello.c @@ -76,19 +76,22 @@ hello_application_window_init (HelloApplicationWindow *window) gtk_widget_init_template (GTK_WIDGET (window)); window->settings = g_settings_new (GSETTINGS_SCHEMA); + /* Allow Pango markup in the label. */ g_settings_bind (window->settings, "use-markup", window->label, "use-markup", G_SETTINGS_BIND_DEFAULT); + /* Prepare various presentations of the label. */ + window->label_id = 0; gchar *line1 = g_strdup_printf ("%s", _("Hello world!")); gchar *line2 = g_strdup_printf (_("This program is running as process number %s."), g_strdup_printf ("%d", getpid ())); window->labels[0] = g_strdup_printf ("%s\n%s", line1, line2); - window->labels[1] - = g_strdup_printf ("%s", _("This is another text")); - window->labels[2] - = g_strdup_printf ("%s", _("This is yet another text")); + window->labels[1] = + g_strdup_printf ("%s", _("This is another text")); + window->labels[2] = + g_strdup_printf ("%s", _("This is yet another text")); update_content (window); } -- 2.47.3