2012-12-10 07:59:35 +00:00
|
|
|
From dfe858f7ba476aa878c5d60a7480a03def558463 Mon Sep 17 00:00:00 2001
|
2010-11-12 09:51:00 +00:00
|
|
|
From: fujiwarat <takao.fujiwara1@gmail.com>
|
2012-11-27 07:08:35 +00:00
|
|
|
Date: Tue, 27 Nov 2012 15:53:27 +0900
|
2010-11-12 09:51:00 +00:00
|
|
|
Subject: [PATCH] Reload preload engines until users customize the list.
|
|
|
|
|
|
|
|
The idea is, if users don't customize the preload_engines with ibus-setup,
|
|
|
|
users would prefer to load the system default engines again by login.
|
|
|
|
The gconf value 'preload_engine_mode' is
|
2011-06-21 08:49:07 +00:00
|
|
|
IBUS_PRELOAD_ENGINE_MODE_USER by default but set
|
|
|
|
IBUS_PRELOAD_ENGINE_MODE_LANG_RELATIVE for the initial login.
|
2010-11-12 09:51:00 +00:00
|
|
|
If preload_engine_mode is IBUS_PRELOAD_ENGINE_MODE_LANG_RELATIVE,
|
|
|
|
ibus-daemon loads the system preload engines by langs.
|
|
|
|
If preload_engine_mode is IBUS_PRELOAD_ENGINE_MODE_USER,
|
|
|
|
ibus-daemon do not update the gconf value preload_engines.
|
|
|
|
On the other hand, if users enable the customized engine checkbutton
|
|
|
|
on ibus-setup, ibus-setup sets 'preload_engine_mode' as
|
|
|
|
IBUS_PRELOAD_ENGINE_MODE_USER and users can customize the value
|
|
|
|
'preload_engines'.
|
|
|
|
---
|
2012-11-14 03:41:29 +00:00
|
|
|
data/ibus.schemas.in | 24 +++++++++
|
|
|
|
setup/main.py | 61 +++++++++++++++++++++--
|
|
|
|
setup/setup.ui | 22 +++++++--
|
|
|
|
src/ibustypes.h | 10 ++++
|
|
|
|
ui/gtk3/panel.vala | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
2012-07-17 10:27:02 +00:00
|
|
|
5 files changed, 246 insertions(+), 7 deletions(-)
|
2010-11-12 09:51:00 +00:00
|
|
|
|
|
|
|
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
|
2012-11-14 03:41:29 +00:00
|
|
|
index 1a0e2d2..64f6f33 100644
|
2010-11-12 09:51:00 +00:00
|
|
|
--- a/data/ibus.schemas.in
|
|
|
|
+++ b/data/ibus.schemas.in
|
2012-03-18 09:41:41 +00:00
|
|
|
@@ -2,6 +2,30 @@
|
|
|
|
<gconfschemafile>
|
|
|
|
<schemalist>
|
2010-11-12 09:51:00 +00:00
|
|
|
<schema>
|
|
|
|
+ <key>/schemas/desktop/ibus/general/preload_engine_mode</key>
|
|
|
|
+ <applyto>/desktop/ibus/general/preload_engine_mode</applyto>
|
|
|
|
+ <owner>ibus</owner>
|
|
|
|
+ <type>int</type>
|
2011-06-21 08:49:07 +00:00
|
|
|
+ <default>0</default>
|
2010-11-12 09:51:00 +00:00
|
|
|
+ <locale name="C">
|
|
|
|
+ <short>Preload engine mode</short>
|
2012-03-18 09:41:41 +00:00
|
|
|
+ <long>Preload engines are loaded with this mode.
|
|
|
|
+ 0 = user customized engines.
|
|
|
|
+ 1 = language related engines.</long>
|
2010-11-12 09:51:00 +00:00
|
|
|
+ </locale>
|
|
|
|
+ </schema>
|
|
|
|
+ <schema>
|
2012-03-18 09:41:41 +00:00
|
|
|
+ <key>/schemas/desktop/ibus/general/preload_engines_inited</key>
|
|
|
|
+ <applyto>/desktop/ibus/general/preload_engines_inited</applyto>
|
|
|
|
+ <owner>ibus</owner>
|
|
|
|
+ <type>bool</type>
|
|
|
|
+ <default>false</default>
|
|
|
|
+ <locale name="C">
|
|
|
|
+ <short>The key preload_engines is initialized</short>
|
|
|
|
+ <long>The key preload_engines is initialized</long>
|
|
|
|
+ </locale>
|
|
|
|
+ </schema>
|
|
|
|
+ <schema>
|
|
|
|
<key>/schemas/desktop/ibus/general/preload_engines</key>
|
|
|
|
<applyto>/desktop/ibus/general/preload_engines</applyto>
|
2010-11-12 09:51:00 +00:00
|
|
|
<owner>ibus</owner>
|
|
|
|
diff --git a/setup/main.py b/setup/main.py
|
2012-11-14 03:41:29 +00:00
|
|
|
index c02229b..5da6340 100644
|
2010-11-12 09:51:00 +00:00
|
|
|
--- a/setup/main.py
|
|
|
|
+++ b/setup/main.py
|
2012-10-06 11:53:32 +00:00
|
|
|
@@ -196,6 +196,20 @@ class Setup(object):
|
2012-03-18 09:41:41 +00:00
|
|
|
self.__checkbutton_use_global_engine.connect("toggled",
|
|
|
|
self.__checkbutton_use_global_engine_toggled_cb)
|
2010-11-12 09:51:00 +00:00
|
|
|
|
2012-03-18 09:41:41 +00:00
|
|
|
+ # set preload mode
|
|
|
|
+ preload_engine_mode = IBus.PreloadEngineMode.USER
|
|
|
|
+ variant = self.__config.get_value("general", "preload_engine_mode")
|
|
|
|
+ if variant != None:
|
|
|
|
+ preload_engine_mode = variant.get_int32()
|
2010-11-12 09:51:00 +00:00
|
|
|
+ button = self.__builder.get_object("checkbutton_preload_engine_mode")
|
2012-03-18 09:41:41 +00:00
|
|
|
+ if preload_engine_mode == IBus.PreloadEngineMode.USER:
|
2010-11-12 09:51:00 +00:00
|
|
|
+ button.set_active(True)
|
|
|
|
+ self.__builder.get_object("hbox_customize_active_input_methods").set_sensitive(True)
|
|
|
|
+ else:
|
|
|
|
+ button.set_active(False)
|
|
|
|
+ self.__builder.get_object("hbox_customize_active_input_methods").set_sensitive(False)
|
|
|
|
+ button.connect("toggled", self.__checkbutton_preload_engine_mode_toggled_cb)
|
2012-03-18 09:41:41 +00:00
|
|
|
+
|
|
|
|
# init engine page
|
2010-11-12 09:51:00 +00:00
|
|
|
self.__engines = self.__bus.list_engines()
|
2012-03-18 09:41:41 +00:00
|
|
|
value = self.__config.get_value("general", "load_xkb_layouts")
|
2012-10-06 11:53:32 +00:00
|
|
|
@@ -257,6 +271,7 @@ class Setup(object):
|
2012-03-18 09:41:41 +00:00
|
|
|
self.__checkbutton_auto_start_toggled_cb)
|
2010-11-12 09:51:00 +00:00
|
|
|
|
2012-03-18 09:41:41 +00:00
|
|
|
self.__config = self.__bus.get_config()
|
|
|
|
+ self.__config.connect("value-changed", self.__config_value_changed_cb)
|
2010-11-12 09:51:00 +00:00
|
|
|
|
2012-03-18 09:41:41 +00:00
|
|
|
self.__init_hotkey()
|
|
|
|
self.__init_panel()
|
2012-10-06 11:53:32 +00:00
|
|
|
@@ -271,8 +286,8 @@ class Setup(object):
|
2011-09-28 10:24:13 +00:00
|
|
|
def __combobox_notify_active_engine_cb(self, combobox, property):
|
|
|
|
engine = self.__combobox.get_active_engine()
|
|
|
|
button = self.__builder.get_object("button_engine_add")
|
2012-03-18 09:41:41 +00:00
|
|
|
- button.set_sensitive(
|
|
|
|
- engine != None and engine not in self.__treeview.get_engines())
|
2011-09-28 10:24:13 +00:00
|
|
|
+ button.set_sensitive(engine != None and \
|
2012-03-18 09:41:41 +00:00
|
|
|
+ engine.get_name() not in map(lambda e: e.get_name(), self.__treeview.get_engines()))
|
2011-09-28 10:24:13 +00:00
|
|
|
|
2011-11-28 07:28:04 +00:00
|
|
|
def __get_engine_setup_exec_args(self, engine):
|
|
|
|
args = []
|
2012-10-06 11:53:32 +00:00
|
|
|
@@ -351,6 +366,34 @@ class Setup(object):
|
2011-11-28 07:28:04 +00:00
|
|
|
del self.__engine_setup_exec_list[name]
|
|
|
|
self.__engine_setup_exec_list[name] = os.spawnl(os.P_NOWAIT, *args)
|
2010-11-12 09:51:00 +00:00
|
|
|
|
|
|
|
+ def __checkbutton_preload_engine_mode_toggled_cb(self, button):
|
|
|
|
+ if button.get_active():
|
2012-03-18 09:41:41 +00:00
|
|
|
+ variant = GLib.Variant.new_int32(IBus.PreloadEngineMode.USER)
|
2010-11-12 09:51:00 +00:00
|
|
|
+ self.__config.set_value("general",
|
|
|
|
+ "preload_engine_mode",
|
2012-03-18 09:41:41 +00:00
|
|
|
+ variant)
|
2010-11-12 09:51:00 +00:00
|
|
|
+ self.__builder.get_object("hbox_customize_active_input_methods").set_sensitive(True)
|
2010-11-26 05:38:39 +00:00
|
|
|
+ self.__treeview.notify("engines")
|
2010-11-12 09:51:00 +00:00
|
|
|
+ else:
|
2011-06-21 08:49:07 +00:00
|
|
|
+ message = _("The list of your saved input methods will be " \
|
|
|
|
+ "cleared immediately and the list will be " \
|
|
|
|
+ "configured by the login language every time. " \
|
|
|
|
+ "Do you agree with this?")
|
2012-03-18 09:41:41 +00:00
|
|
|
+ dlg = Gtk.MessageDialog(type = Gtk.MessageType.QUESTION,
|
|
|
|
+ buttons = Gtk.ButtonsType.YES_NO,
|
2011-06-21 08:49:07 +00:00
|
|
|
+ message_format = message)
|
|
|
|
+ id = dlg.run()
|
|
|
|
+ dlg.destroy()
|
|
|
|
+ self.__flush_gtk_events()
|
2012-03-18 09:41:41 +00:00
|
|
|
+ if id != Gtk.ResponseType.YES:
|
2011-06-21 08:49:07 +00:00
|
|
|
+ button.set_active(True)
|
|
|
|
+ return
|
2012-03-18 09:41:41 +00:00
|
|
|
+ variant = GLib.Variant.new_int32(IBus.PreloadEngineMode.LANG_RELATIVE)
|
2010-11-12 09:51:00 +00:00
|
|
|
+ self.__config.set_value("general",
|
|
|
|
+ "preload_engine_mode",
|
2012-03-18 09:41:41 +00:00
|
|
|
+ variant)
|
2010-11-12 09:51:00 +00:00
|
|
|
+ self.__builder.get_object("hbox_customize_active_input_methods").set_sensitive(False)
|
|
|
|
+
|
|
|
|
def __init_bus(self):
|
2012-03-18 09:41:41 +00:00
|
|
|
self.__bus = IBus.Bus()
|
|
|
|
if self.__bus.is_connected():
|
2012-11-14 03:41:29 +00:00
|
|
|
@@ -562,8 +605,18 @@ class Setup(object):
|
2012-03-18 09:41:41 +00:00
|
|
|
value = GLib.Variant.new_boolean(value)
|
2011-06-21 08:49:07 +00:00
|
|
|
self.__config.set_value("general", "use_global_engine", value)
|
|
|
|
|
2012-03-18 09:41:41 +00:00
|
|
|
- def __config_value_changed_cb(self, bus, section, name, value):
|
2011-06-21 08:49:07 +00:00
|
|
|
- pass
|
2012-03-18 09:41:41 +00:00
|
|
|
+ def __config_value_changed_cb(self, bus, section, name, variant):
|
2011-06-21 08:49:07 +00:00
|
|
|
+ if section == 'general' and name == 'preload_engines':
|
2012-03-18 09:41:41 +00:00
|
|
|
+ value = []
|
|
|
|
+ if variant != None:
|
2012-09-14 11:24:18 +00:00
|
|
|
+ value = self.__variant_dup_strv(variant)
|
2011-06-21 08:49:07 +00:00
|
|
|
+ engines = self.__get_engine_descs_from_names(value)
|
|
|
|
+ current_engines = self.__treeview.get_engines()
|
2012-03-18 09:41:41 +00:00
|
|
|
+ engines_csv = str.join(',', map(lambda e: e.get_name(), engines))
|
|
|
|
+ current_engines_csv = \
|
|
|
|
+ str.join(',', map(lambda e: e.get_name(), current_engines))
|
|
|
|
+ if engines_csv != current_engines_csv:
|
2011-06-21 08:49:07 +00:00
|
|
|
+ self.__treeview.set_engines(engines)
|
|
|
|
|
|
|
|
def __config_reloaded_cb(self, bus):
|
|
|
|
pass
|
2010-11-12 09:51:00 +00:00
|
|
|
diff --git a/setup/setup.ui b/setup/setup.ui
|
2012-07-17 10:27:02 +00:00
|
|
|
index 8121d62..2026172 100644
|
2010-11-12 09:51:00 +00:00
|
|
|
--- a/setup/setup.ui
|
|
|
|
+++ b/setup/setup.ui
|
2012-07-17 10:27:02 +00:00
|
|
|
@@ -653,7 +653,23 @@
|
2010-11-12 09:51:00 +00:00
|
|
|
<property name="visible">True</property>
|
2012-07-17 10:27:02 +00:00
|
|
|
<property name="can_focus">False</property>
|
2010-11-12 09:51:00 +00:00
|
|
|
<child>
|
|
|
|
- <object class="GtkHBox" id="hbox1">
|
|
|
|
+ <object class="GtkCheckButton" id="checkbutton_preload_engine_mode">
|
|
|
|
+ <property name="visible">True</property>
|
|
|
|
+ <property name="label" translatable="yes">Customize active input _methods</property>
|
|
|
|
+ <property name="use_underline">True</property>
|
|
|
|
+ <property name="can_focus">True</property>
|
|
|
|
+ <property name="receives_default">False</property>
|
|
|
|
+ <property name="tooltip_text" translatable="yes">Customize active input methods</property>
|
|
|
|
+ <property name="draw_indicator">True</property>
|
|
|
|
+ </object>
|
|
|
|
+ <packing>
|
|
|
|
+ <property name="expand">False</property>
|
2012-07-17 10:27:02 +00:00
|
|
|
+ <property name="fill">True</property>
|
2010-11-12 09:51:00 +00:00
|
|
|
+ <property name="position">0</property>
|
|
|
|
+ </packing>
|
|
|
|
+ </child>
|
|
|
|
+ <child>
|
|
|
|
+ <object class="GtkHBox" id="hbox_customize_active_input_methods">
|
|
|
|
<property name="visible">True</property>
|
2012-07-17 10:27:02 +00:00
|
|
|
<property name="can_focus">False</property>
|
2010-11-12 09:51:00 +00:00
|
|
|
<child>
|
2012-07-17 10:27:02 +00:00
|
|
|
@@ -842,7 +858,7 @@
|
2010-11-12 09:51:00 +00:00
|
|
|
<packing>
|
2012-07-17 10:27:02 +00:00
|
|
|
<property name="expand">True</property>
|
|
|
|
<property name="fill">True</property>
|
2010-11-12 09:51:00 +00:00
|
|
|
- <property name="position">0</property>
|
|
|
|
+ <property name="position">1</property>
|
|
|
|
</packing>
|
|
|
|
</child>
|
|
|
|
<child>
|
2012-07-17 10:27:02 +00:00
|
|
|
@@ -889,7 +905,7 @@ You may use up/down buttons to change it.</i></small></property>
|
2010-11-12 09:51:00 +00:00
|
|
|
<packing>
|
|
|
|
<property name="expand">False</property>
|
2012-07-17 10:27:02 +00:00
|
|
|
<property name="fill">True</property>
|
2010-11-12 09:51:00 +00:00
|
|
|
- <property name="position">1</property>
|
|
|
|
+ <property name="position">2</property>
|
|
|
|
</packing>
|
|
|
|
</child>
|
|
|
|
</object>
|
|
|
|
diff --git a/src/ibustypes.h b/src/ibustypes.h
|
2012-08-22 08:11:55 +00:00
|
|
|
index 737b3e2..8ce5a16 100644
|
2010-11-12 09:51:00 +00:00
|
|
|
--- a/src/ibustypes.h
|
|
|
|
+++ b/src/ibustypes.h
|
2012-08-22 08:11:55 +00:00
|
|
|
@@ -204,6 +204,16 @@ typedef enum {
|
2011-06-21 08:49:07 +00:00
|
|
|
} IBusError;
|
2010-11-12 09:51:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
+ * IBusPreloadEngineMode:
|
|
|
|
+ * @IBUS_PRELOAD_ENGINE_MODE_USER: user custimized engines
|
2010-11-26 05:38:39 +00:00
|
|
|
+ * @IBUS_PRELOAD_ENGINE_MODE_LANG_RELATIVE: language related engines.
|
2010-11-12 09:51:00 +00:00
|
|
|
+ */
|
|
|
|
+typedef enum {
|
2010-11-26 05:38:39 +00:00
|
|
|
+ IBUS_PRELOAD_ENGINE_MODE_USER = 0,
|
|
|
|
+ IBUS_PRELOAD_ENGINE_MODE_LANG_RELATIVE = 1,
|
2010-11-12 09:51:00 +00:00
|
|
|
+} IBusPreloadEngineMode;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
* IBusRectangle:
|
|
|
|
* @x: x coordinate.
|
|
|
|
* @y: y coordinate.
|
2012-03-18 09:41:41 +00:00
|
|
|
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
|
2012-12-10 07:59:35 +00:00
|
|
|
index 63b0cde..c4c8f2c 100644
|
2012-03-18 09:41:41 +00:00
|
|
|
--- a/ui/gtk3/panel.vala
|
|
|
|
+++ b/ui/gtk3/panel.vala
|
2012-12-10 07:59:35 +00:00
|
|
|
@@ -313,6 +313,8 @@ class Panel : IBus.PanelService {
|
2012-03-18 09:41:41 +00:00
|
|
|
if (m_config != null) {
|
|
|
|
m_config.value_changed.connect(config_value_changed_cb);
|
|
|
|
m_config.watch("general", "preload_engines");
|
|
|
|
+ m_config.watch("general", "preload_engines_inited");
|
|
|
|
+ m_config.watch("general", "preload_engine_mode");
|
|
|
|
m_config.watch("general", "engines_order");
|
2012-11-14 03:41:29 +00:00
|
|
|
m_config.watch("general", "switcher_delay_time");
|
2012-08-22 08:11:55 +00:00
|
|
|
m_config.watch("general/hotkey", "trigger_accel");
|
2012-12-10 07:59:35 +00:00
|
|
|
@@ -425,7 +427,136 @@ class Panel : IBus.PanelService {
|
2012-03-18 09:41:41 +00:00
|
|
|
init_gkbd();
|
|
|
|
}
|
|
|
|
|
|
|
|
+ GLib.Variant var_engines =
|
|
|
|
+ m_config.get_value("general", "preload_engines");
|
|
|
|
+ string[] preload_engines = {};
|
|
|
|
+
|
|
|
|
+ if (var_engines != null) {
|
|
|
|
+ preload_engines = var_engines.dup_strv();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bool preload_engines_inited = false;
|
|
|
|
+ GLib.Variant var_preload_engines_inited =
|
|
|
|
+ m_config.get_value("general", "preload_engines_inited");
|
|
|
|
+
|
|
|
|
+ if (var_preload_engines_inited != null) {
|
|
|
|
+ preload_engines_inited = var_preload_engines_inited.get_boolean();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Set preload_engines_inited = true for back compatibility
|
|
|
|
+ if (preload_engines.length != 0 && !preload_engines_inited) {
|
|
|
|
+ preload_engines_inited = true;
|
|
|
|
+ m_config.set_value("general",
|
|
|
|
+ "preload_engines_inited",
|
|
|
|
+ new GLib.Variant.boolean(true));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
update_xkb_engines();
|
|
|
|
+
|
|
|
|
+ // Before update preload_engine_mode, update_xkb_engines() is called
|
|
|
|
+ // because config_value_changed_cb() calls update_im_engines().
|
|
|
|
+ if (!preload_engines_inited) {
|
|
|
|
+ GLib.Variant variant = new GLib.Variant.int32(
|
|
|
|
+ IBus.PreloadEngineMode.LANG_RELATIVE);
|
|
|
|
+ m_config.set_value("general",
|
|
|
|
+ "preload_engine_mode",
|
|
|
|
+ variant);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ update_im_engines();
|
|
|
|
+
|
|
|
|
+ if (!preload_engines_inited) {
|
|
|
|
+ m_config.set_value("general",
|
|
|
|
+ "preload_engines_inited",
|
|
|
|
+ new GLib.Variant.boolean(true));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private bool set_lang_relative_preload_engines() {
|
|
|
|
+ string locale = Intl.setlocale(LocaleCategory.CTYPE, null);
|
|
|
|
+
|
|
|
|
+ if (locale == null) {
|
|
|
|
+ locale = "C";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ string lang = locale.split(".")[0];
|
|
|
|
+ GLib.List<IBus.EngineDesc> engines = m_bus.list_engines();
|
|
|
|
+ string[] im_engines = {};
|
|
|
|
+
|
|
|
|
+ for (unowned GLib.List<IBus.EngineDesc> p = engines;
|
|
|
|
+ p != null;
|
|
|
|
+ p = p.next) {
|
|
|
|
+ unowned IBus.EngineDesc engine = p.data;
|
|
|
|
+ if (engine.get_language() == lang &&
|
|
|
|
+ engine.get_rank() > 0) {
|
|
|
|
+ im_engines += engine.get_name();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ lang = lang.split("_")[0];
|
|
|
|
+ if (im_engines.length == 0) {
|
|
|
|
+ for (unowned GLib.List<IBus.EngineDesc> p = engines;
|
|
|
|
+ p != null;
|
|
|
|
+ p = p.next) {
|
|
|
|
+ unowned IBus.EngineDesc engine = p.data;
|
|
|
|
+ if (engine.get_language() == lang &&
|
|
|
|
+ engine.get_rank() > 0) {
|
|
|
|
+ im_engines += engine.get_name();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (im_engines.length == 0) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ GLib.Variant var_engines =
|
|
|
|
+ m_config.get_value("general", "preload_engines");
|
|
|
|
+ string[] orig_preload_engines = {};
|
|
|
|
+ string[] preload_engines = {};
|
|
|
|
+
|
|
|
|
+ if (var_engines != null) {
|
|
|
|
+ orig_preload_engines = var_engines.dup_strv();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // clear input method engines
|
|
|
|
+ foreach (string name in orig_preload_engines) {
|
|
|
|
+ if (name.ascii_ncasecmp("xkb:", 4) != 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ preload_engines += name;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ foreach (string name in im_engines) {
|
|
|
|
+ if (!(name in preload_engines)) {
|
|
|
|
+ preload_engines += name;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("".joinv(",", orig_preload_engines) !=
|
|
|
|
+ "".joinv(",", preload_engines)) {
|
|
|
|
+ m_config.set_value("general",
|
|
|
|
+ "preload_engines",
|
|
|
|
+ new GLib.Variant.strv(preload_engines));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void update_im_engines() {
|
|
|
|
+ int preload_engine_mode = IBus.PreloadEngineMode.USER;
|
|
|
|
+ GLib.Variant var_preload_engine_mode =
|
|
|
|
+ m_config.get_value("general", "preload_engine_mode");
|
|
|
|
+
|
|
|
|
+ if (var_preload_engine_mode != null) {
|
|
|
|
+ preload_engine_mode = var_preload_engine_mode.get_int32();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (preload_engine_mode == IBus.PreloadEngineMode.USER) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ set_lang_relative_preload_engines();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void update_xkb_engines() {
|
2012-12-10 07:59:35 +00:00
|
|
|
@@ -591,6 +722,11 @@ class Panel : IBus.PanelService {
|
2012-03-18 09:41:41 +00:00
|
|
|
string section,
|
|
|
|
string name,
|
|
|
|
Variant variant) {
|
|
|
|
+ if (section == "general" && name == "preload_engine_mode") {
|
|
|
|
+ update_im_engines();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (section == "general" && name == "preload_engines") {
|
|
|
|
update_engines(variant, null);
|
|
|
|
return;
|
2010-11-12 09:51:00 +00:00
|
|
|
--
|
2012-11-14 03:41:29 +00:00
|
|
|
1.8.0
|
2010-11-12 09:51:00 +00:00
|
|
|
|