[gnome-session] Read and apply LC_* environment variables from GSettings
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] Read and apply LC_* environment variables from GSettings
- Date: Wed, 14 Oct 2015 15:11:15 +0000 (UTC)
commit 39f146e6c5727105a3c88c2290654c6ef83102c5
Author: Giovanni Campagna <gcampagn cs stanford edu>
Date: Fri Oct 9 14:49:04 2015 -0700
Read and apply LC_* environment variables from GSettings
Before anything else runs
https://bugzilla.gnome.org/show_bug.cgi?id=756324
configure.ac | 1 +
gnome-session/Makefile.am | 12 ++++++------
gnome-session/gnome-session.in | 15 +++++++++++++++
gnome-session/main.c | 29 +++++++++++++++++++++++++++++
4 files changed, 51 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5d512e3..38d7693 100644
--- a/configure.ac
+++ b/configure.ac
@@ -380,6 +380,7 @@ data/icons/48x48/Makefile
data/icons/scalable/Makefile
data/icons/symbolic/Makefile
gnome-session/Makefile
+gnome-session/gnome-session
tools/Makefile
po/Makefile.in
])
diff --git a/gnome-session/Makefile.am b/gnome-session/Makefile.am
index c70c542..fb53631 100644
--- a/gnome-session/Makefile.am
+++ b/gnome-session/Makefile.am
@@ -1,7 +1,7 @@
EXTRA_DIST =
NULL =
-bin_PROGRAMS = gnome-session
-libexec_PROGRAMS = gnome-session-failed
+bin_SCRIPTS = gnome-session
+libexec_PROGRAMS = gnome-session-binary gnome-session-failed
noinst_LTLIBRARIES = libgsmutil.la
noinst_PROGRAMS = \
test-client-dbus \
@@ -16,7 +16,7 @@ AM_CPPFLAGS = \
AM_CFLAGS = $(WARN_CFLAGS)
-gnome_session_SOURCES = \
+gnome_session_binary_SOURCES = \
$(BUILT_SOURCES) \
gsm-app.h \
gsm-app.c \
@@ -62,12 +62,12 @@ gnome_session_SOURCES = \
gsm-xsmp-server.h
if HAVE_CONSOLEKIT
-gnome_session_SOURCES += gsm-consolekit.c gsm-consolekit.h
+gnome_session_binary_SOURCES += gsm-consolekit.c gsm-consolekit.h
else
EXTRA_DIST += gsm-consolekit.c gsm-consolekit.h
endif
-gnome_session_CPPFLAGS = \
+gnome_session_binary_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(X11_CFLAGS) \
$(SM_CFLAGS) \
@@ -84,7 +84,7 @@ gnome_session_CPPFLAGS = \
-DGCONF_SANITY_CHECK=\""$(GCONF_SANITY_CHECK)"\" \
-DGCONFTOOL_CMD=\"$(GCONFTOOL)\"
-gnome_session_LDADD = \
+gnome_session_binary_LDADD = \
libgsmutil.la \
$(X11_LIBS) \
$(SM_LIBS) \
diff --git a/gnome-session/gnome-session.in b/gnome-session/gnome-session.in
new file mode 100644
index 0000000..fdf7163
--- /dev/null
+++ b/gnome-session/gnome-session.in
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+SETTING=$(gsettings get org.gnome.system.locale region)
+REGION=${SETTING#\'}
+REGION=${REGION%\'}
+
+if [ -n "$REGION" ]; then
+ export LC_TIME=$REGION
+ export LC_NUMERIC=$REGION
+ export LC_MONETARY=$REGION
+ export LC_MEASUREMENT=$REGION
+ export LC_PAPER=$REGION
+fi
+
+exec @libexecdir@/gnome-session-binary "$@"
diff --git a/gnome-session/main.c b/gnome-session/main.c
index b48cef4..1c17698 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -227,6 +227,15 @@ check_gl (GError **error)
return g_spawn_check_exit_status (status, error);
}
+static inline void
+maybe_push_env_var (const char* name)
+{
+ const char *value = g_getenv (name);
+
+ if (value)
+ gsm_util_setenv (name, value);
+}
+
int
main (int argc, char **argv)
{
@@ -340,6 +349,26 @@ main (int argc, char **argv)
if (g_getenv ("XDG_CURRENT_DESKTOP") == NULL)
gsm_util_setenv ("XDG_CURRENT_DESKTOP", "GNOME");
+ /* Push locale variables to dbus-daemon */
+ maybe_push_env_var ("LC_TIME");
+ maybe_push_env_var ("LC_NUMERIC");
+ maybe_push_env_var ("LC_MONETARY");
+ maybe_push_env_var ("LC_MEASUREMENT");
+ maybe_push_env_var ("LC_PAPER");
+
+ {
+ gchar *ibus_path;
+
+ ibus_path = g_find_program_in_path("ibus-daemon");
+
+ if (ibus_path) {
+ gsm_util_setenv ("QT_IM_MODULE", "ibus");
+ gsm_util_setenv ("XMODIFIERS", "@im=ibus");
+ }
+
+ g_free (ibus_path);
+ }
+
/* Some third-party programs rely on GNOME_DESKTOP_SESSION_ID to
* detect if GNOME is running. We keep this for compatibility reasons.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]