summaryrefslogtreecommitdiff
path: root/gnome-settings-daemon
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-06-08 14:10:41 -0400
committerMatthias Clasen <mclasen@redhat.com>2013-06-10 15:59:11 -0400
commit5cb44f6387de341ef254d33f76ec26e164a5ee0d (patch)
tree7162f9a06bd7ec0a5af20d8209ad22d7f77bdfef /gnome-settings-daemon
parentf33795869e2ef58b55b112ea9caa86c975265fcb (diff)
downloadgnome-settings-daemon-5cb44f6387de341ef254d33f76ec26e164a5ee0d.tar.gz
Avoid calling setenv after starting threads
In particular, we can't get the locale value out of GSettings in order to set LC_PAPER etc, since calling into GSettings initializes the dconf backend which in turn uses gdbus, which starts a worker thread. As a simple workaround, set up the locale environment in a small wrapper script that then exec's the g-s-d binary. https://bugzilla.gnome.org/show_bug.cgi?id=701322
Diffstat (limited to 'gnome-settings-daemon')
-rw-r--r--gnome-settings-daemon/Makefile.am9
-rwxr-xr-xgnome-settings-daemon/gnome-settings-daemon-localeexec.in19
-rw-r--r--gnome-settings-daemon/main.c33
3 files changed, 28 insertions, 33 deletions
diff --git a/gnome-settings-daemon/Makefile.am b/gnome-settings-daemon/Makefile.am
index 194a7cc7..94b38612 100644
--- a/gnome-settings-daemon/Makefile.am
+++ b/gnome-settings-daemon/Makefile.am
@@ -48,6 +48,15 @@ gsddir = $(libexecdir)
gsd_PROGRAMS = \
gnome-settings-daemon
+gsd_SCRIPTS = \
+ gnome-settings-daemon-localeexec
+
+EXTRA_DIST = \
+ gnome-settings-daemon-localeexec.in
+
+gnome-settings-daemon-localeexec: gnome-settings-daemon-localeexec.in
+ $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|" -e "s|\@prefix\@|$(prefix)|" $< > $@.tmp && mv $@.tmp $@
+
apidir = $(includedir)/gnome-settings-daemon-$(GSD_API_VERSION)/gnome-settings-daemon
api_DATA = \
gnome-settings-plugin.h
diff --git a/gnome-settings-daemon/gnome-settings-daemon-localeexec.in b/gnome-settings-daemon/gnome-settings-daemon-localeexec.in
new file mode 100755
index 00000000..1aca8439
--- /dev/null
+++ b/gnome-settings-daemon/gnome-settings-daemon-localeexec.in
@@ -0,0 +1,19 @@
+#! /bin/bash
+
+SETTING=$(gsettings get org.gnome.system.locale region)
+REGION=${SETTING//\,/}
+
+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
+
+if [ -x @prefix@/bin/ibus-daemon ]; then
+ export QT_IM_MODULE=ibus
+ export XMODIFIERS=@im=ibus
+fi
+
+exec @libexecdir@/gnome-settings-daemon
diff --git a/gnome-settings-daemon/main.c b/gnome-settings-daemon/main.c
index 24c15988..16017df8 100644
--- a/gnome-settings-daemon/main.c
+++ b/gnome-settings-daemon/main.c
@@ -279,37 +279,6 @@ set_legacy_ibus_env_vars (GDBusProxy *proxy)
}
#endif
-/* Keep synchronised with set_locale() and
- * set_legacy_ibus_env_vars() 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);
-
-#ifdef HAVE_IBUS
- /* Set IBus legacy environment */
- if (is_program_in_path ("ibus-daemon") &&
- keyboard_plugin_is_enabled ()) {
- g_setenv ("QT_IM_MODULE", "ibus", TRUE);
- g_setenv ("XMODIFIERS", "@im=ibus", TRUE);
- }
-#endif
-}
-
static void
register_with_gnome_session (GDBusProxy *proxy)
{
@@ -499,8 +468,6 @@ 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 ();