Refine structure.
This commit is contained in:
Huang Peng 2008-07-28 11:44:09 +08:00
Родитель f2c7968945
Коммит 4ae2941be4
2 изменённых файлов: 36 добавлений и 38 удалений

Просмотреть файл

@ -2,49 +2,48 @@ import gconf
import ibus
from ibus import interface
class Config (ibus.Object):
def __init__ (self, proxy):
ibus.Object.__init__ (self)
self._proxy = proxy
self._client = gconf.Client ()
self._client.connect ("value-changed", self._value_changed_cb)
self._client.add_dir ("/", gconf.CLIENT_PRELOAD_NONE)
class Config(ibus.Object):
def __init__ (self, conn, path):
super(Config, self).__init__()
self.__proxy = ConfigProxy(self, conn, path)
self.__client = gconf.Client()
self.__client.connect("value-changed", self.__value_changed_cb)
self.__client.add_dir("/", gconf.CLIENT_PRELOAD_NONE)
def get_string (self, key):
def get_string(self, key):
pass
def get_int (self, key):
def get_int(self, key):
pass
def get_bool (self, key):
def get_bool(self, key):
pass
def set_string (self, key, value):
def set_string(self, key, value):
pass
def set_int (self, key, value):
def set_int(self, key, value):
pass
def set_bool (self, key, value):
def set_bool(self, key, value):
pass
def _value_changed_cb (self, gconf, key, value):
value = self._client.get_value (key)
print key, type (value), value
self._proxy.ValueChanged (key, value)
def __value_changed_cb(self, gconf, key, value):
value = self.__client.get_value(key)
print key, type(value), value
self.__proxy.ValueChanged(key, value)
class ConfigProxy (interface.IConfig):
def __init__ (self, dbusconn, object_path, _ibus):
interface.IConfig.__init__ (self, dbusconn, object_path)
self._dbusconn = dbusconn
self._config = Config (self)
class ConfigProxy(interface.IConfig):
def __init__ (self, config, conn, object_path):
super(ConfigProxy, self).__init__(conn, object_path)
self.__config = config
def GetString (self, key):
return self._config.get_string (key)
def GetInt (self, key):
return self._config.get_int (key)
def GetBool (self, key):
return self._config.get_bool (key)
def GetString(self, key):
return self.__config.get_string(key)
def GetInt(self, key):
return self.__config.get_int(key)
def GetBool(self, key):
return self.__config.get_bool(key)
def SetString (self, key, value):
self._config.set_string (key, value)
def SetInt (self, key, value):
self._config.set_int (key, value)
def SetBool (self, key, value):
self._config.set_bool (key, value)
def SetString(self, key, value):
self.__config.set_string(key, value)
def SetInt(self, key, value):
self.__config.set_int(key, value)
def SetBool(self, key, value):
self.__config.set_bool(key, value)

Просмотреть файл

@ -25,16 +25,15 @@ import getopt
import ibus
import config
import gtk
CONFIG_PATH = "/org/freedesktop/IBus/GConf"
class GconfApplication:
def __init__(self):
self.__conn = ibus.Connection()
self.__conn.call_on_disconnection(self.__disconnected_cb)
self.__ibus = self.__conn.get_ibus()
self.__config = config.ConfigProxy(self.__conn, "/org/freedesktop/IBus/GConf", self.__ibus)
self.__config = config.Config(self.__conn, CONFIG_PATH)
self.__ibus.RegisterConfig(self.__config, True)
self.__conn.get_ibus().RegisterConfig(CONFIG_PATH, True)
def run(self):
gtk.main()