Bumped to 1.5.8

This commit is contained in:
Takao Fujiwara 2014-07-24 15:16:16 +09:00
parent 24d74f76c4
commit 6ad2e121a8
10 changed files with 28 additions and 6893 deletions

1
.gitignore vendored
View File

@ -39,3 +39,4 @@ ibus-1.3.6.tar.gz
/ibus-1.5.5.tar.gz
/ibus-1.5.6.tar.gz
/ibus-1.5.7.tar.gz
/ibus-1.5.8.tar.gz

View File

@ -1,354 +0,0 @@
From 91f6d9f3d0fc854711c2ba151c0dc5105a0a9152 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Mon, 14 Jul 2014 16:20:21 +0900
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 gsettings value 'preload-engine-mode' is
IBUS_PRELOAD_ENGINE_MODE_USER by default but set
IBUS_PRELOAD_ENGINE_MODE_LANG_RELATIVE for the initial login.
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 gsettings 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'.
---
data/ibus.schemas.in | 24 ++++++++++++++
setup/main.py | 72 ++++++++++++++++++++++++++++++++++++----
setup/setup.ui | 22 +++++++++++--
src/ibustypes.h | 10 ++++++
ui/gtk3/panel.vala | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 212 insertions(+), 9 deletions(-)
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
index 1e4776b..9ee0b1a 100644
--- a/data/ibus.schemas.in
+++ b/data/ibus.schemas.in
@@ -2,6 +2,30 @@
<gconfschemafile>
<schemalist>
<schema>
+ <key>/schemas/desktop/ibus/general/preload_engine_mode</key>
+ <applyto>/desktop/ibus/general/preload_engine_mode</applyto>
+ <owner>ibus</owner>
+ <type>int</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Preload engine mode</short>
+ <long>Preload engines are loaded with this mode.
+ 0 = user customized engines.
+ 1 = language related engines.</long>
+ </locale>
+ </schema>
+ <schema>
+ <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>
<owner>ibus</owner>
diff --git a/setup/main.py b/setup/main.py
index dee7be4..a991438 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -190,16 +190,30 @@ class Setup(object):
'active',
Gio.SettingsBindFlags.DEFAULT)
+ # set preload mode
+ preload_engine_mode = \
+ self.__settings_general.get_int('preload-engine-mode')
+ button = self.__builder.get_object("checkbutton_preload_engine_mode")
+ hbox = self.__builder.get_object("hbox_customize_active_input_methods")
+ if preload_engine_mode == IBus.PreloadEngineMode.USER:
+ button.set_active(True)
+ hbox.set_sensitive(True)
+ else:
+ button.set_active(False)
+ hbox.set_sensitive(False)
+ button.connect('toggled',
+ self.__checkbutton_preload_engine_mode_toggled_cb)
+
+ self.__settings_general.connect('changed::preload-engines',
+ self.__settings_general_preload_engines_cb)
+
# init engine page
self.__engines = self.__bus.list_engines()
self.__combobox = self.__builder.get_object("combobox_engines")
self.__combobox.set_engines(self.__engines)
- tmp_dict = {}
- for e in self.__engines:
- tmp_dict[e.get_name()] = e
engine_names = self.__settings_general.get_strv('preload-engines')
- engines = [tmp_dict[name] for name in engine_names if name in tmp_dict]
+ engines = self.__get_engine_descs_from_names(engine_names)
self.__treeview = self.__builder.get_object("treeview_engines")
self.__treeview.set_engines(engines)
@@ -249,8 +263,9 @@ class Setup(object):
def __combobox_notify_active_engine_cb(self, combobox, property):
engine = self.__combobox.get_active_engine()
button = self.__builder.get_object("button_engine_add")
- button.set_sensitive(
- engine != None and engine not in self.__treeview.get_engines())
+ button.set_sensitive(engine != None and \
+ engine.get_name() not in [e.get_name() for e \
+ in self.__treeview.get_engines()])
def __get_engine_setup_exec_args(self, engine):
args = []
@@ -270,6 +285,13 @@ class Setup(object):
args.append(path.basename(setup_path))
return args
+ def __get_engine_descs_from_names(self, engine_names):
+ tmp_dict = {}
+ for e in self.__engines:
+ tmp_dict[e.get_name()] = e
+ engines = [tmp_dict[name] for name in engine_names if name in tmp_dict]
+ return engines
+
def __treeview_notify_cb(self, treeview, prop):
if prop.name not in ("active-engine", "engines"):
return
@@ -321,6 +343,44 @@ class Setup(object):
del self.__engine_setup_exec_list[name]
self.__engine_setup_exec_list[name] = os.spawnl(os.P_NOWAIT, *args)
+ def __checkbutton_preload_engine_mode_toggled_cb(self, button):
+ if button.get_active():
+ self.__settings_general.set_int('preload-engine-mode',
+ IBus.PreloadEngineMode.USER)
+ self.__builder.get_object(
+ "hbox_customize_active_input_methods").set_sensitive(True)
+ self.__treeview.notify('engines')
+ else:
+ 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?")
+ dlg = Gtk.MessageDialog(message_type = Gtk.MessageType.QUESTION,
+ transient_for = self.__window,
+ buttons = Gtk.ButtonsType.YES_NO,
+ text = message)
+ id = dlg.run()
+ dlg.destroy()
+ self.__flush_gtk_events()
+ if id != Gtk.ResponseType.YES:
+ button.set_active(True)
+ return
+ self.__settings_general.set_int(
+ 'preload-engine-mode',
+ IBus.PreloadEngineMode.LANG_RELATIVE)
+ self.__builder.get_object(
+ "hbox_customize_active_input_methods").set_sensitive(False)
+
+ def __settings_general_preload_engines_cb(self, settings, key):
+ engine_names = self.__settings_general.get_strv('preload-engines')
+ engines = self.__get_engine_descs_from_names(engine_names)
+ current_engines = self.__treeview.get_engines()
+ engines_csv = str.join(',', [e.get_name() for e in engines])
+ current_engines_csv = \
+ str.join(',', [e.get_name() for e in current_engines])
+ if engines_csv != current_engines_csv:
+ self.__treeview.set_engines(engines)
+
def __init_bus(self):
self.__bus = IBus.Bus()
if self.__bus.is_connected():
diff --git a/setup/setup.ui b/setup/setup.ui
index 5ffbe47..7c60b72 100644
--- a/setup/setup.ui
+++ b/setup/setup.ui
@@ -677,7 +677,23 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkBox" 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>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="hbox_customize_active_input_methods">
<property name="orientation">horizontal</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -869,7 +885,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -917,7 +933,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
diff --git a/src/ibustypes.h b/src/ibustypes.h
index 86fc2cc..cb9eb22 100644
--- a/src/ibustypes.h
+++ b/src/ibustypes.h
@@ -206,6 +206,16 @@ typedef enum {
} IBusError;
/**
+ * IBusPreloadEngineMode:
+ * @IBUS_PRELOAD_ENGINE_MODE_USER: user custimized engines
+ * @IBUS_PRELOAD_ENGINE_MODE_LANG_RELATIVE: language related engines.
+ */
+typedef enum {
+ IBUS_PRELOAD_ENGINE_MODE_USER = 0,
+ IBUS_PRELOAD_ENGINE_MODE_LANG_RELATIVE = 1,
+} IBusPreloadEngineMode;
+
+/**
* IBusRectangle:
* @x: x coordinate.
* @y: y coordinate.
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index 7a15049..e6c128a 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -141,6 +141,10 @@ class Panel : IBus.PanelService {
null);
});
+ m_settings_general.changed["preload-engine-mode"].connect((key) => {
+ update_im_engines();
+ });
+
m_settings_general.changed["switcher-delay-time"].connect((key) => {
set_switcher_delay_time();
});
@@ -569,7 +573,96 @@ class Panel : IBus.PanelService {
init_gkbd();
}
+ string[] preload_engines =
+ m_settings_general.get_strv("preload-engines");
+
+ bool preload_engines_inited =
+ m_settings_general.get_boolean("preload-engines-inited");
+
+ // Set preload_engines_inited = true for back compatibility
+ if (preload_engines.length != 0 && !preload_engines_inited) {
+ preload_engines_inited = true;
+ m_settings_general.set_boolean("preload-engines-inited", true);
+ }
+
update_xkb_engines();
+
+ // Before update preload_engine_mode, update_xkb_engines() is called
+ // because "preload-engine-mode" signal calls update_im_engines().
+ if (!preload_engines_inited)
+ m_settings_general.set_int("preload-engine-mode",
+ IBus.PreloadEngineMode.LANG_RELATIVE);
+
+ update_im_engines();
+
+ if (!preload_engines_inited)
+ m_settings_general.set_boolean("preload-engines-inited", 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;
+
+ string[] orig_preload_engines =
+ m_settings_general.get_strv("preload-engines");
+ string[] preload_engines = {};
+
+ // 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 (string.joinv(",", orig_preload_engines) !=
+ string.joinv(",", preload_engines))
+ m_settings_general.set_strv("preload-engines", preload_engines);
+
+ return true;
+ }
+
+ private void update_im_engines() {
+ int preload_engine_mode =
+ m_settings_general.get_int("preload-engine-mode");
+
+ if (preload_engine_mode == IBus.PreloadEngineMode.USER)
+ return;
+
+ set_lang_relative_preload_engines();
}
private void update_xkb_engines() {
--
1.8.5.3

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +0,0 @@
From d3bc903b487bb301395947f692ce0d8c130874e3 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Sat, 6 Oct 2012 17:54:27 +0900
Subject: [PATCH] Fix not to switch engines by non-trigger keys.
---
ui/gtk3/switcher.vala | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ui/gtk3/switcher.vala b/ui/gtk3/switcher.vala
index 4a02743..c606682 100644
--- a/ui/gtk3/switcher.vala
+++ b/ui/gtk3/switcher.vala
@@ -140,6 +140,7 @@ class Switcher : Gtk.Window {
/* Let gtk recalculate the window size. */
resize(1, 1);
+ m_result = 0;
m_selected_engine = index;
m_label.set_text(m_buttons[index].longname);
m_buttons[index].grab_focus();
@@ -378,6 +379,11 @@ class Switcher : Gtk.Window {
break;
default:
debug("0x%04x", pe.keyval);
+ if (m_loop != null) {
+ m_loop.quit();
+ m_loop = null;
+ }
+ retval = false;
break;
}
} while (false);
--
1.8.0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +0,0 @@
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
index eef062c..d644d69 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
@@ -845,6 +845,18 @@ ibus_im_context_focus_in (GtkIMContext *context)
return;
/* don't set focus on password entry */
+#if GTK_CHECK_VERSION (3, 6, 0)
+ {
+ GtkInputPurpose purpose;
+
+ g_object_get (G_OBJECT (context),
+ "input-purpose", &purpose,
+ NULL);
+
+ if (purpose == GTK_INPUT_PURPOSE_PASSWORD)
+ return;
+ }
+#endif
if (ibusimcontext->client_window != NULL) {
GtkWidget *widget;

View File

@ -1,413 +0,0 @@
From 79587f187998b6e89c478ac23c7dbcba56a91637 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Mon, 14 Jul 2014 16:21:19 +0900
Subject: [PATCH] Enable ibus-setup to show the frequently used languages
only in IME list.
---
data/ibus.schemas.in | 168 ++++++++++++++++++++++++++++++++++++++++++++++++
setup/enginecombobox.py | 148 +++++++++++++++++++++++++++++++++++-------
2 files changed, 292 insertions(+), 24 deletions(-)
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
index 9ee0b1a..c638e7d 100644
--- a/data/ibus.schemas.in
+++ b/data/ibus.schemas.in
@@ -384,6 +384,174 @@ se,si,sk,sy,sy(ku),th,tj,tr,ua,uz,vn
</locale>
</schema>
<schema>
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/group_list</key>
+ <applyto>/desktop/ibus/general/xkblayoutconfig/group_list</applyto>
+ <owner>ibus</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <default>[west_europe,south_europe,east_europe,north_europe,west_asia,center_asia,east_asia,india,australia]</default>
+ <locale name="C">
+ <short>List of system keyboard layout groups on ibus-setup</short>
+ <long>The group list is used not to show all the system
+ keyboard layouts by default. The list item will be
+ appended at the end of gconf key. e.g.
+ .../xkblayoutconfig/item1</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/west_europe</key>
+ <applyto>/desktop/ibus/general/xkblayoutconfig/west_europe</applyto>
+ <owner>ibus</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <!--
+ <default>[ad,be,br,de,ca,ch,cz,es,fr,gn,hu,ie,ie(CloGaelach),it,latam,nl,pt,si,sk]</default>
+ -->
+ <default>[ca,cs,de,en,es,fr,gd,hu,it,nl,pt,sk,sl]</default>
+ <locale name="C">
+ <short>List of European languages on ibus-setup</short>
+ <long>ibus-setup shows the languages only in input method list
+ when you run ibus-setup on one of the languages.
+ Other languages are hidden under an extended button.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/south_europe</key>
+ <applyto>/desktop/ibus/general/xkblayoutconfig/south_europe</applyto>
+ <owner>ibus</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <!--
+ <default>[al,ba,bg,gr,me,mk,mt,ro,rs]</default>
+ -->
+ <default>[bg,bs,el,mk,mt,ro,sq,sr]</default>
+ <locale name="C">
+ <short>List of European languages on ibus-setup</short>
+ <long>ibus-setup shows the languages only in input method list
+ when you run ibus-setup on one of the languages.
+ Other languages are hidden under an extended button.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/east_europe</key>
+ <applyto>/desktop/ibus/general/xkblayoutconfig/east_europe</applyto>
+ <owner>ibus</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <!--
+ <default>[by,ee,epo,ge,ge(dsb),ge(ru),ge(os),hr,kg,kz,lt,lv,pl,pl(csb),ru,ru(cv),ru(kom),ru(sah),ru(tt),ru(xal),ua,uz]</default>
+ -->
+ <default>[be,csb,cv,et,ka,kk,ky,lt,lv,pl,ru,tt,uk,uz]</default>
+ <locale name="C">
+ <short>List of European languages on ibus-setup</short>
+ <long>ibus-setup shows the languages only in input method list
+ when you run ibus-setup on one of the languages.
+ Other languages are hidden under an extended button.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/north_europe</key>
+ <applyto>/desktop/ibus/general/xkblayoutconfig/north_europe</applyto>
+ <owner>ibus</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <!--
+ <default>[dk,fi,fo,is,no,no(smi),se]</default>
+ -->
+ <default>[da,fi,fo,is,no,se,sv]</default>
+ <locale name="C">
+ <short>List of European languages on ibus-setup</short>
+ <long>ibus-setup shows the languages only in input method list
+ when you run ibus-setup on one of the languages.
+ Other languages are hidden under an extended button.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/west_asia</key>
+ <applyto>/desktop/ibus/general/xkblayoutconfig/west_asia</applyto>
+ <owner>ibus</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <!--
+ <default>[am,ara,az,et,gh,gh(akan),gh(ewe),gh(fula),gh(ga),gh(hausa),il,iq,iq(ku),ir,ir(ku),ma,ma(tifinagh),ng,ng(hausa),ng,ng(igbo),ng(yoruba),sy,sy(ku),tj,tr]</default>
+ -->
+ <default>[am,ar,az,ber,fa,ha,he,hy,ig,ku,tg,tr,yo]</default>
+ <locale name="C">
+ <short>List of Asian languages on ibus-setup</short>
+ <long>ibus-setup shows the languages only in input method list
+ when you run ibus-setup on one of the languages.
+ Other languages are hidden under an extended button.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/center_asia</key>
+ <applyto>/desktop/ibus/general/xkblayoutconfig/center_asia</applyto>
+ <owner>ibus</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <!--
+ <default>[cn(tib)]</default>
+ -->
+ <default>[bo,zh]</default>
+ <locale name="C">
+ <short>List of Asian languages on ibus-setup</short>
+ <long>ibus-setup shows the languages only in input method list
+ when you run ibus-setup on one of the languages.
+ Other languages are hidden under an extended button.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/east_asia</key>
+ <applyto>/desktop/ibus/general/xkblayoutconfig/east_asia</applyto>
+ <owner>ibus</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <!--
+ <default>[bt,kh,la,mal,mm,th,vn]</default>
+ -->
+ <default>[dz,km,lo,my,th,vi]</default>
+ <locale name="C">
+ <short>List of Asian languages on ibus-setup</short>
+ <long>ibus-setup shows the languages only in input method list
+ when you run ibus-setup on one of the languages.
+ Other languages are hidden under an extended button.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/india</key>
+ <applyto>/desktop/ibus/general/xkblayoutconfig/india</applyto>
+ <owner>ibus</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <!--
+ <default>[bd,in,in(ben),in(guj),in(guru),in(jhelum),in(kan),in(mal),in(ori),in(tam),in(tel),in(urd-phonetic),in(bolnagri),lk,lk(tam_unicode),mv,np,pk]</default>
+ -->
+ <default>[bn,dv,gu,hi,kn,ml,ne,or,pa,si,ta,te,ur]</default>
+ <locale name="C">
+ <short>List of Asian languages on ibus-setup</short>
+ <long>ibus-setup shows the languages only in input method list
+ when you run ibus-setup on one of the languages.
+ Other languages are hidden under an extended button.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/australia</key>
+ <applyto>/desktop/ibus/general/xkblayoutconfig/australia</applyto>
+ <owner>ibus</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <!--
+ <default>[mao]</default>
+ -->
+ <default>[mi]</default>
+ <locale name="C">
+ <short>List of Asian languages on ibus-setup</short>
+ <long>ibus-setup shows the languages only in input method list
+ when you run ibus-setup on one of the languages.
+ Other languages are hidden under an extended button.</long>
+ </locale>
+ </schema>
+ <schema>
<key>/schemas/desktop/ibus/panel/custom_font</key>
<applyto>/desktop/ibus/panel/custom_font</applyto>
<owner>ibus</owner>
diff --git a/setup/enginecombobox.py b/setup/enginecombobox.py
index 2a2a677..a203b25 100644
--- a/setup/enginecombobox.py
+++ b/setup/enginecombobox.py
@@ -24,6 +24,7 @@ import locale
import functools
import sys
+from gi.repository import Gio
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import IBus
@@ -47,6 +48,10 @@ class EngineComboBox(Gtk.ComboBox):
self.connect("notify::active", self.__notify_active_cb)
self.__model = None
+ self.__all_model = None
+ self.__show_sub_lang = False
+ self.__settings_xkblayoutconfig = Gio.Settings(
+ schema = "org.freedesktop.ibus.general.xkblayoutconfig");
renderer = Gtk.CellRendererPixbuf()
renderer.set_property("xalign", 0)
@@ -60,20 +65,45 @@ class EngineComboBox(Gtk.ComboBox):
self.pack_start(renderer, True)
self.set_cell_data_func(renderer, self.__name_cell_data_cb, None)
- def set_engines(self, engines):
- self.__model = Gtk.TreeStore(object)
+ def __gconf_get_lang_list_from_locale(self):
+ common_list = ['en', 'Other']
+ loc = None
+ try:
+ loc = locale.setlocale (locale.LC_ALL)
+ except:
+ pass
+ if loc == None:
+ return common_list
+ current_lang = IBus.get_language_name(loc)
+ if current_lang == None:
+ return common_list
+ group_list = self.__settings_xkblayoutconfig.get_strv('group-list')
+ if len(group_list) == 0:
+ return [loc] + common_list
+ lang_list = None
+ for group in group_list:
+ group = group.replace('_', '-')
+ langs = self.__settings_xkblayoutconfig.get_strv(group)
+ for lang in langs:
+ if current_lang == IBus.get_language_name(lang):
+ lang_list = langs
+ break
+ if lang_list != None:
+ break
+ if lang_list == None:
+ return [loc] + common_list
+ return lang_list + common_list
- iter1 = self.__model.append(None)
- self.__model.set(iter1, 0, 0)
- langs = {}
- for e in engines:
- l = IBus.get_language_name(e.get_language())
- if l == None:
- l = ""
- if l not in langs:
- langs[l] = []
- langs[l].append(e)
+ def __has_engine_in_lang_list(self, engine, lang_list):
+ retval = False
+ for lang in lang_list:
+ if IBus.get_language_name(lang) == \
+ IBus.get_language_name(engine.props.language):
+ retval = True
+ break
+ return retval
+ def __model_append_langs(self, model, langs, visible):
keys = list(langs.keys())
keys.sort(key=functools.cmp_to_key(locale.strcoll))
loc = locale.getlocale()[0]
@@ -91,22 +121,62 @@ class EngineComboBox(Gtk.ComboBox):
keys.remove(IBus.get_language_name("Other"))
keys += [IBus.get_language_name("Other")]
for l in keys:
- iter1 = self.__model.append(None)
- self.__model.set(iter1, 0, l)
+ iter1 = model.append(None)
+ model.set(iter1, 0, l)
def cmp_engine(a, b):
if a.get_rank() == b.get_rank():
return locale.strcoll(a.get_longname(), b.get_longname())
return int(b.get_rank() - a.get_rank())
langs[l].sort(key=functools.cmp_to_key(cmp_engine))
for e in langs[l]:
- iter2 = self.__model.append(iter1)
- self.__model.set(iter2, 0, e)
+ iter2 = model.append(iter1)
+ model.set(iter2, 0, e)
+
+ def set_engines(self, engines):
+ self.__model = Gtk.TreeStore(object)
- self.set_model(self.__model)
+ iter1 = self.__model.append(None)
+ self.__model.set(iter1, 0, 0)
+ lang_list = self.__gconf_get_lang_list_from_locale()
+ lang = {}
+ sub_lang = {}
+ for e in engines:
+ l = IBus.get_language_name(e.props.language)
+ if lang_list == None or \
+ self.__has_engine_in_lang_list(e, lang_list):
+ if l not in lang:
+ lang[l] = []
+ lang[l].append(e)
+ else:
+ if l not in sub_lang:
+ sub_lang[l] = []
+ sub_lang[l].append(e)
+
+ self.__model_append_langs(self.__model, lang, True)
+ iter1 = self.__model.append(None)
+ self.__model.set(iter1, 0, -1)
+
+ self.__all_model = Gtk.TreeStore(object)
+ iter1 = self.__all_model.append(None)
+ self.__all_model.set(iter1, 0, 0)
+ self.__model_append_langs(self.__all_model, lang, False)
+ iter1 = self.__all_model.append(None)
+ self.__all_model.set(iter1, 0, -1)
+ self.__model_append_langs(self.__all_model, sub_lang, False)
+
+ self.__toggle_sub_lang()
+
+ def __toggle_sub_lang(self):
+ self.set_model(None)
+ if self.__show_sub_lang:
+ self.set_model(self.__all_model)
+ else:
+ self.set_model(self.__model)
self.set_active(0)
def __icon_cell_data_cb(self, celllayout, renderer, model, iter, data):
- engine = self.__model.get_value(iter, 0)
+ model = self.get_model()
+ engine = model.get_value(iter, 0)
if isinstance(engine, str):
renderer.set_property("visible", False)
@@ -115,8 +185,25 @@ class EngineComboBox(Gtk.ComboBox):
renderer.set_property("visible", False)
renderer.set_property("sensitive", False)
elif isinstance(engine, int):
- renderer.set_property("visible", False)
- renderer.set_property("sensitive", False)
+ if engine == 0:
+ renderer.set_property("visible", False)
+ renderer.set_property("sensitive", False)
+ renderer.set_property("pixbuf", None)
+ elif engine < 0:
+ if not self.__show_sub_lang:
+ pixbuf = load_icon("go-bottom", Gtk.IconSize.LARGE_TOOLBAR)
+ else:
+ pixbuf = load_icon("go-up", Gtk.IconSize.LARGE_TOOLBAR)
+ if pixbuf == None:
+ pixbuf = load_icon("image-missing",
+ Gtk.IconSize.LARGE_TOOLBAR)
+ if pixbuf == None:
+ renderer.set_property("visible", False)
+ renderer.set_property("sensitive", False)
+ return
+ renderer.set_property("visible", True)
+ renderer.set_property("sensitive", True)
+ renderer.set_property("pixbuf", pixbuf)
else:
renderer.set_property("visible", True)
renderer.set_property("sensitive", True)
@@ -124,7 +211,8 @@ class EngineComboBox(Gtk.ComboBox):
renderer.set_property("pixbuf", pixbuf)
def __name_cell_data_cb(self, celllayout, renderer, model, iter, data):
- engine = self.__model.get_value(iter, 0)
+ model = self.get_model()
+ engine = model.get_value(iter, 0)
if isinstance (engine, str):
renderer.set_property("sensitive", False)
@@ -136,8 +224,15 @@ class EngineComboBox(Gtk.ComboBox):
renderer.set_property("weight", Pango.Weight.NORMAL)
elif isinstance(engine, int):
renderer.set_property("sensitive", True)
- renderer.set_property("text", _("Select an input method"))
- renderer.set_property("weight", Pango.Weight.NORMAL)
+ if engine == 0:
+ renderer.set_property("text", _("Select an input method"))
+ renderer.set_property("weight", Pango.Weight.NORMAL)
+ elif engine < 0:
+ if not self.__show_sub_lang:
+ renderer.set_property("text", _("Show all input methods"))
+ else:
+ renderer.set_property("text", _("Show only input methods for your region"))
+ renderer.set_property("weight", Pango.Weight.BOLD)
else:
renderer.set_property("sensitive", True)
renderer.set_property("text", engine.get_longname())
@@ -153,7 +248,12 @@ class EngineComboBox(Gtk.ComboBox):
if i == 0 or i == -1:
return None
iter = self.get_active_iter()
- return self.get_model()[iter][0]
+ model = self.get_model()
+ if model[iter][0] == -1:
+ self.__show_sub_lang = not self.__show_sub_lang
+ self.__toggle_sub_lang()
+ return None
+ return model[iter][0]
else:
raise AttributeError('unknown property %s' % property.name)
--
1.8.5.3

108
ibus.spec
View File

@ -1,15 +1,8 @@
%global with_preload_xkb_engine 1
%global with_pygobject2 1
%global with_pygobject3 1
%global with_pkg_config %(pkg-config --version >/dev/null 2>&1 && echo -n "1" || echo -n "0")
%if (0%{?fedora} > 19 || 0%{?rhel} > 7)
%global with_wayland 1
%else
%global with_wayland 0
%endif
%if (0%{?fedora} > 20 || 0%{?rhel} > 7)
%global with_python2_override_pkg 1
%else
@ -17,7 +10,6 @@
%endif
%global ibus_api_version 1.0
%global ibus_xkb_version 1.5.0.20140114
# for bytecompile in %%{_datadir}/ibus/setup
%global __python %{__python3}
@ -35,8 +27,8 @@
%global dbus_python_version 0.83.0
Name: ibus
Version: 1.5.7
Release: 7%{?dist}
Version: 1.5.8
Release: 1%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
Group: System Environment/Libraries
@ -44,26 +36,8 @@ URL: http://code.google.com/p/ibus/
Source0: https://github.com/ibus/ibus/releases/download/%{version}/%{name}-%{version}.tar.gz
Source1: %{name}-xinput
Source2: %{name}.conf.5
# Actual path is https://github.com/.../%%{ibus_xkb_version}.tar.gz
# Renamed %%{ibus_xkb_version}.tar.gz to ibus-xkb-%%{ibus_xkb_version}.tar.gz
Source3: https://github.com/ibus/ibus-xkb/archive/ibus-xkb-%{ibus_xkb_version}.tar.gz
# Upstreamed patches.
# Patch0: %%{name}-HEAD.patch
Patch0: %{name}-HEAD.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=810211
Patch1: %{name}-810211-no-switch-by-no-trigger.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=541492
Patch2: %{name}-541492-xkb.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=530711
Patch3: %{name}-530711-preload-sys.patch
# Hide minor input method engines on ibus-setup by locale
Patch4: %{name}-xx-setup-frequent-lang.patch
# Removed the target.
# Even if fedpkg srpm's target is rhel, it can run on fedora box.
# Disable IME on gnome-shell password for the back compatiblity.
Patch96: %{name}-xx-f19-password.patch
BuildRequires: gettext-devel
BuildRequires: libtool
@ -86,17 +60,13 @@ BuildRequires: GConf2-devel
BuildRequires: intltool
BuildRequires: iso-codes-devel
BuildRequires: libnotify-devel
%if %with_wayland
BuildRequires: libwayland-client-devel
%endif
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: %{name}-gtk2%{?_isa} = %{version}-%{release}
Requires: %{name}-gtk3%{?_isa} = %{version}-%{release}
Requires: %{name}-setup = %{version}-%{release}
%if %with_wayland
Requires: %{name}-wayland%{?_isa} = %{version}-%{release}
%endif
Requires: iso-codes
Requires: dbus-python >= %{dbus_python_version}
@ -113,8 +83,6 @@ Requires: python3-gobject
Requires: xorg-x11-xinit
# for setxkbmap
Requires: xorg-x11-xkb-utils
# The feature in ibus-gnome3 is provided by gnome-shell.
Obsoletes: ibus-gnome3 < %{version}-%{release}
Requires(post): desktop-file-utils
Requires(postun): desktop-file-utils
@ -142,7 +110,7 @@ Requires: gobject-introspection
This package contains the libraries for IBus
%package gtk2
Summary: IBus im module for gtk2
Summary: IBus IM module for GTK2
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
@ -152,17 +120,17 @@ Provides: ibus-gtk = %{version}-%{release}
Obsoletes: ibus-gtk < %{version}-%{release}
%description gtk2
This package contains ibus im module for gtk2
This package contains IBus IM module for GTK2
%package gtk3
Summary: IBus im module for gtk3
Summary: IBus IM module for GTK3
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires(post): glib2 >= %{glib_ver}
%description gtk3
This package contains ibus im module for gtk3
This package contains IBus IM module for GTK3
%if %with_pygobject3
%package setup
@ -181,40 +149,38 @@ This is a setup utility for IBus.
%if %with_pygobject2
%package pygtk2
Summary: IBus pygtk2 library
Summary: IBus PyGTK2 library
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}
Requires: pygtk2
BuildArch: noarch
%description pygtk2
This is a pygtk2 library for IBus. Now major IBus engines use pygobject3
This is a PyGTK2 library for IBus. Now major IBus engines use PyGObject3
and this package will be deprecated.
%endif
%if %with_python2_override_pkg
%package py2override
Summary: IBus python2 override library
Summary: IBus Python2 override library
Group: System Environment/Libraries
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
# Owner of %%python2_sitearch/gi/overrides
Requires: pygobject3-base
%description py2override
This is a python2 override library for IBus. The python files override
some functions in gobject-introspection.
This is a Python2 override library for IBus. The Python files override
some functions in GObject-Introspection.
%endif
%if %with_wayland
%package wayland
Summary: IBus im module for Wayland
Summary: IBus IM module for Wayland
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description wayland
This package contains IBus im module for Wayland
%endif
This package contains IBus IM module for Wayland
%package devel
Summary: Development tools for ibus
@ -233,7 +199,7 @@ The ibus-devel package contains the header files and developer
docs for ibus.
%package devel-docs
Summary: Developer documents for ibus
Summary: Developer documents for IBus
Group: Development/Libraries
%if (0%{?fedora} >= 19 || 0%{?rhel} >= 7)
Requires: %{name} = %{version}-%{release}
@ -243,39 +209,17 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%endif
%description devel-docs
The ibus-devel-docs package contains developer documentation for ibus
The ibus-devel-docs package contains developer documentation for IBus
%prep
%setup -q
# %%patch0 -p1
%patch0 -p1
%if (0%{?fedora} < 20 && 0%{?rhel} < 8)
%patch96 -p1 -b .passwd
%endif
cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c ||
%patch1 -p1 -b .noswitch
%if %with_preload_xkb_engine
%patch2 -p1 -b .preload-xkb
rm -f bindings/vala/ibus-1.0.vapi
rm -f data/dconf/00-upstream-settings
%endif
%patch3 -p1 -b .preload-sys
%patch4 -p1 -b .setup-frequent-lang
zcat %SOURCE3 | tar xf -
POS=`(cd ibus-xkb-%ibus_xkb_version/po; ls *.po)`
for PO in $POS
do
cp po/$PO po/$PO.orig
msgcat --use-first po/$PO ibus-xkb-%ibus_xkb_version/po/$PO -o po/$PO
done
# cp client/gtk2/ibusimcontext.c client/gtk3/ibusimcontext.c ||
%build
%if %with_preload_xkb_engine
autoreconf -f -i -v
%endif
#autoreconf -f -i -v
#make -C ui/gtk3 maintainer-clean-generic
%configure \
--disable-static \
--enable-gtk2 \
@ -288,15 +232,9 @@ autoreconf -f -i -v
%if %with_pygobject2
--enable-python-library \
%endif
%if %with_wayland
--enable-wayland \
%endif
--enable-introspection
%if %with_preload_xkb_engine
make -C ui/gtk3 maintainer-clean-generic
%endif
# make -C po update-gmo
make %{?_smp_mflags}
%install
@ -446,10 +384,8 @@ fi
%python2_sitearch/gi/overrides/IBus.py*
%endif
%if %with_wayland
%files wayland
%{_libexecdir}/ibus-wayland
%endif
%files devel
%{_libdir}/lib*.so
@ -466,6 +402,14 @@ fi
%{_datadir}/gtk-doc/html/*
%changelog
* Thu Jul 24 2014 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.8-1
- Bumped to 1.5.8
- Deleted ibus-810211-no-switch-by-no-trigger.patch
- Deleted ibus-541492-xkb.patch
- Deleted ibus-530711-preload-sys.patch
- Deleted ibus-xx-setup-frequent-lang.patch
- Deleted ibus-xx-f19-password.patch
* Tue Jul 22 2014 Kalev Lember <kalevlember@gmail.com> - 1.5.7-7
- Rebuilt for gobject-introspection 1.41.4

View File

@ -1,2 +1 @@
87f2269ef9523733a5693f0ed410ea71 ibus-1.5.7.tar.gz
c0bc5be7f0c068bea1e4785c5b60694b ibus-xkb-1.5.0.20140114.tar.gz
b9fcfa20bd7b555bb4b438f719c0f2fb ibus-1.5.8.tar.gz