[gtk/gtk-4-4] GtkApplication: Call setlocale early
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-4-4] GtkApplication: Call setlocale early
- Date: Sun, 31 Oct 2021 21:52:13 +0000 (UTC)
commit 022b396a06967896c79715fc0b8db00556a37c20
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Sep 6 01:37:51 2021 -0400
GtkApplication: Call setlocale early
If we don't call setlocale early enough,
--help output may come out misformatted.
Fixes: #4234
gtk/gtkapplication.c | 3 +++
gtk/gtkmain.c | 2 +-
gtk/gtkprivate.h | 2 ++
3 files changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index c26e15cadb..1408c0d9d2 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -294,6 +294,9 @@ gtk_application_local_command_line (GApplication *application,
char ***arguments,
int *exit_status)
{
+ /* We need to call setlocale() here so --help output works */
+ setlocale_initialization ();
+
return G_APPLICATION_CLASS (gtk_application_parent_class)->local_command_line (application, arguments,
exit_status);
}
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index e498822212..6dd0f7e871 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -362,7 +362,7 @@ enum_locale_proc (LPTSTR locale)
#endif
-static void
+void
setlocale_initialization (void)
{
static gboolean initialized = FALSE;
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
index 8cb11c761c..3495e07efc 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -150,6 +150,8 @@ GBytes *get_emoji_data (void);
char * _gtk_elide_underscores (const char *original);
+void setlocale_initialization (void);
+
G_END_DECLS
#endif /* __GTK_PRIVATE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]