[gnome-settings-daemon] main: Don't set Input Methods envvar without IBus



commit a4503d3a22de528f3a912dd169d7c02374582dfb
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Oct 5 14:42:40 2012 +0200

    main: Don't set Input Methods envvar without IBus
    
    If IBus isn't installed, don't set the QT_IM_MODULE or XMODIFIERS
    envvars, as that breaks other Input Methods.
    
    As we advice people who don't want to use IBus to just uninstall
    ibus itself, we should handle being built with IBus support but run-time
    support not being there.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685514

 gnome-settings-daemon/main.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gnome-settings-daemon/main.c b/gnome-settings-daemon/main.c
index a7a97ee..62c5aa5 100644
--- a/gnome-settings-daemon/main.c
+++ b/gnome-settings-daemon/main.c
@@ -238,6 +238,18 @@ register_with_gnome_session (GDBusProxy *proxy)
 }
 
 #ifdef HAVE_IBUS
+static gboolean
+is_program_in_path (const char *binary)
+{
+	char *path;
+
+	path = g_find_program_in_path (binary);
+	if (path == NULL)
+		return FALSE;
+	g_free (path);
+	return TRUE;
+}
+
 static void
 got_session_name (GObject      *object,
                   GAsyncResult *res,
@@ -263,7 +275,8 @@ got_session_name (GObject      *object,
 
         g_variant_get (variant, "&s", &session_name);
 
-        if (g_strcmp0 (session_name, "gnome") == 0) {
+        if (g_strcmp0 (session_name, "gnome") == 0 &&
+            is_program_in_path ("ibus-daemon")) {
                 set_session_env (proxy, "QT_IM_MODULE", "ibus");
                 set_session_env (proxy, "XMODIFIERS", "@im=ibus");
         }



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