[gnome-settings-daemon/gnome-3-6] main: Set locale envvars on startup



commit 2635375ffe4dece4cbb61de1cf0645b30bd3fff1
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Feb 11 09:53:52 2013 +0100

    main: Set locale envvars on startup
    
    When starting up, we tell gnome-session to set the environment variables
    for new starting programs, but we don't set the environment for our
    own children. Do this on start up, as soon as possible.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693381

 gnome-settings-daemon/main.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gnome-settings-daemon/main.c b/gnome-settings-daemon/main.c
index 092cf05..db7b4b1 100644
--- a/gnome-settings-daemon/main.c
+++ b/gnome-settings-daemon/main.c
@@ -220,6 +220,27 @@ set_locale (GDBusProxy *proxy)
         g_object_unref (locale_settings);
 }
 
+/* Keep synchronised with set_locale() above */
+static void
+set_locale_env (void)
+{
+        GSettings *locale_settings;
+        gchar *region;
+
+        /* Set locale environment */
+        locale_settings = g_settings_new ("org.gnome.system.locale");
+        region = g_settings_get_string (locale_settings, "region");
+        if (region[0]) {
+                g_setenv ("LC_TIME", region, TRUE);
+                g_setenv ("LC_NUMERIC", region, TRUE);
+                g_setenv ("LC_MONETARY", region, TRUE);
+                g_setenv ("LC_MEASUREMENT", region, TRUE);
+                g_setenv ("LC_PAPER", region, TRUE);
+        }
+        g_free (region);
+        g_object_unref (locale_settings);
+}
+
 static void
 register_with_gnome_session (GDBusProxy *proxy)
 {
@@ -515,6 +536,8 @@ main (int argc, char *argv[])
 
         g_log_set_default_handler (gsd_log_default_handler, NULL);
 
+        set_locale_env ();
+
         notify_init ("gnome-settings-daemon");
 
         bus_register ();


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