tdawson / rpms / ibus

Forked from rpms/ibus 3 years ago
Clone
Blob Blame History Raw
diff --git a/bus/inputcontext.c b/bus/inputcontext.c
index 8c9805d..b26797f 100644
--- a/bus/inputcontext.c
+++ b/bus/inputcontext.c
@@ -97,8 +97,6 @@ struct _BusInputContextPrivate {
     IBusLookupTable *lookup_table;
     gboolean lookup_table_visible;
 
-    /* properties */
-    IBusPropList *props;
 };
 
 typedef struct _BusInputContextPrivate BusInputContextPrivate;
@@ -557,7 +555,6 @@ bus_input_context_init (BusInputContext *context)
     priv->lookup_table_visible = FALSE;
 
     g_object_ref (props_empty);
-    priv->props = props_empty;
 }
 
 static void
@@ -590,11 +587,6 @@ bus_input_context_destroy (BusInputContext *context)
         priv->lookup_table = NULL;
     }
 
-    if (priv->props) {
-        g_object_unref (priv->props);
-        priv->props = NULL;
-    }
-
     if (priv->connection) {
         g_signal_handlers_disconnect_by_func (priv->connection,
                                          (GCallback) _connection_destroy_cb,
@@ -1156,12 +1148,6 @@ bus_input_context_focus_in (BusInputContext *context)
     if (priv->capabilities & IBUS_CAP_FOCUS) {
         g_signal_emit (context, context_signals[FOCUS_IN], 0);
 
-        if ((priv->capabilities & IBUS_CAP_PROPERTY) == 0) {
-            g_signal_emit (context,
-                           context_signals[REGISTER_PROPERTIES],
-                           0,
-                           priv->props);
-        }
         if (priv->preedit_visible && (priv->capabilities & IBUS_CAP_PREEDIT_TEXT) == 0) {
             g_signal_emit (context,
                            context_signals[UPDATE_PREEDIT_TEXT],
@@ -1650,23 +1636,17 @@ bus_input_context_register_properties (BusInputContext *context,
     BusInputContextPrivate *priv;
     priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
 
-    if (priv->props) {
-        g_object_unref (priv->props);
-    }
-
-    priv->props = (IBusPropList *) g_object_ref (props ? props : props_empty);
-
     if (priv->capabilities & IBUS_CAP_PROPERTY) {
         bus_input_context_send_signal (context,
                                        "RegisterProperties",
-                                       IBUS_TYPE_PROP_LIST, &(priv->props),
+                                       IBUS_TYPE_PROP_LIST, &props,
                                        G_TYPE_INVALID);
     }
     else {
         g_signal_emit (context,
                        context_signals[REGISTER_PROPERTIES],
                        0,
-                       priv->props);
+                       props);
     }
 }
 
@@ -1680,14 +1660,6 @@ bus_input_context_update_property (BusInputContext *context,
     BusInputContextPrivate *priv;
     priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context);
 
-    if (priv->props == props_empty) {
-        return;
-    }
-
-    if (!ibus_prop_list_update_property (priv->props, prop)) {
-        return;
-    }
-
     if (priv->capabilities & IBUS_CAP_PROPERTY) {
         bus_input_context_send_signal (context,
                                        "UpdateProperty",
diff --git a/setup/enginetreeview.py b/setup/enginetreeview.py
index 0f971dd..4ee403d 100644
--- a/setup/enginetreeview.py
+++ b/setup/enginetreeview.py
@@ -22,6 +22,7 @@
 import gtk
 import glib
 import gobject
+import pango
 import ibus
 
 from icon import load_icon
@@ -96,6 +97,12 @@ class EngineTreeView(gtk.TreeView):
         renderer.set_property("sensitive", True)
         language = ibus.get_language_name(engine.language)
         renderer.set_property("text", "%s - %s" % (language, engine.longname))
+        if self.__model.get_path(iter)[0] == 0:
+            #default engine
+            renderer.set_property("weight", pango.WEIGHT_BOLD)
+        else:
+            renderer.set_property("weight", pango.WEIGHT_NORMAL)
+
 
     def set_engines(self, engines):
         self.__model.clear()
@@ -132,6 +139,14 @@ class EngineTreeView(gtk.TreeView):
         self.__engines.add(engine)
         self.scroll_to_cell(self.__model[0].path, None)
 
+    def append_engine(self, engine):
+        if engine == None or engine in self.__engines:
+            return
+        iter = self.__model.append(None)
+        self.__model.set(iter, 0, engine)
+        self.__engines.add(engine)
+        self.scroll_to_cell(self.__model[-1].path, None)
+
     def remove_engine(self):
         iter = self.get_selected_iter()
         if iter == None:
diff --git a/setup/main.py b/setup/main.py
index 3e6db39..8aea11b 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -22,6 +22,7 @@
 import locale
 import gettext
 import os
+import signal
 import sys
 import time
 import gtk
@@ -177,7 +178,7 @@ class Setup(object):
 
         button = self.__xml.get_widget("button_engine_add")
         button.connect("clicked",
-                       lambda *args:self.__treeview.prepend_engine(self.__combobox.get_active_engine()))
+                       lambda *args:self.__treeview.append_engine(self.__combobox.get_active_engine()))
         button = self.__xml.get_widget("button_engine_remove")
         button.connect("clicked", lambda *args:self.__treeview.remove_engine())
         button = self.__xml.get_widget("button_engine_up")
@@ -361,9 +362,14 @@ class Setup(object):
     def __config_reloaded_cb(self, bus):
         pass
 
+    def __sigusr1_cb(self, *args):
+        self.__window.present()
+
     def run(self):
         self.__window.show_all()
+        signal.signal(signal.SIGUSR1, self.__sigusr1_cb)
         gtk.main()
 
 if __name__ == "__main__":
-    Setup().run()
+    setup = Setup()
+    setup.run()
diff --git a/ui/gtk/panel.py b/ui/gtk/panel.py
index 2640c65..534a394 100644
--- a/ui/gtk/panel.py
+++ b/ui/gtk/panel.py
@@ -404,6 +404,7 @@ class Panel(ibus.PanelBase):
         if self.__setup_pid != 0:
             pid, state = os.waitpid(self.__setup_pid, os.P_NOWAIT)
             if pid != self.__setup_pid:
+                os.kill(self.__setup_pid, signal.SIGUSR1)
                 return
             self.__setup_pid = 0
         self.__setup_pid = os.spawnl(os.P_NOWAIT, self.__setup_cmd, "ibus-setup")