),
}
- def __init__(self, bus, path):
+ def __init__(self, bus, path, watch_signals=False):
super(InputContext, self).__init__()
self.__bus = bus
self.__context = bus.get_dbusconn().get_object(common.IBUS_SERVICE_IBUS, path)
self.__signal_matches = []
+ if not watch_signals:
+ return
+
m = self.__context.connect_to_signal("CommitText", self.__commit_text_cb)
self.__signal_matches.append(m)
m = self.__context.connect_to_signal("UpdatePreeditText", self.__update_preedit_text_cb)
caps = dbus.UInt32(caps)
return self.__context.SetCapabilities(caps)
+ def detach_signals(self):
+ for m in self.__signal_matchs:
+ m.remove()
+ del self.__signal_matchs[:]
+
def destroy(self):
+ self.detach_signals()
self.__context.Destroy()
super(InputContext, self).destroy()
return self.__context.Introspect()
+
def test():
import gtk
import gtk.gdk