Fixed ibus-setup on C locale

- Fixed to show no registered engines from g-c-c.
- Enabled Alt_R keybinding on ko locales for ibus gtk only.
This commit is contained in:
Takao Fujiwara 2012-02-07 20:42:14 +09:00
parent db6c98183c
commit 7bcb691d27
4 changed files with 132 additions and 41 deletions

View File

@ -1,6 +1,6 @@
From 2aea99b5872c741c413e995a50f9ac0842f3af96 Mon Sep 17 00:00:00 2001
From 629d0a5383b3d42d7cad980bc5efe01867a01359 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 3 Feb 2012 12:12:29 +0900
Date: Tue, 7 Feb 2012 20:13:59 +0900
Subject: [PATCH] Add ibus-xkb and libgnomekbd.
---
@ -15,7 +15,8 @@ Subject: [PATCH] Add ibus-xkb and libgnomekbd.
engine/xkblib.c | 327 ++++++++++++++++++++++
engine/xkblib.h | 41 +++
ibus-1.0.pc.in | 4 +
setup/main.py | 29 ++-
setup/enginecombobox.py | 6 +-
setup/main.py | 31 ++-
src/Makefile.am | 5 +
src/ibus.h | 1 +
src/ibusxkbxml.c | 454 ++++++++++++++++++++++++++++++
@ -24,9 +25,9 @@ Subject: [PATCH] Add ibus-xkb and libgnomekbd.
ui/gtk3/Makefile.am | 47 ++++
ui/gtk3/gkbdlayout.vala.false | 63 +++++
ui/gtk3/gkbdlayout.vala.true | 111 ++++++++
ui/gtk3/panel.vala | 211 ++++++++++++++-
ui/gtk3/panel.vala | 274 +++++++++++++++++--
ui/gtk3/xkblayout.vala | 466 +++++++++++++++++++++++++++++++
22 files changed, 2321 insertions(+), 547 deletions(-)
23 files changed, 2381 insertions(+), 558 deletions(-)
create mode 100644 engine/ibus-xkb-main.c
create mode 100644 engine/xkblib.c
create mode 100644 engine/xkblib.h
@ -1464,11 +1465,28 @@ index 9f593ab..66b902a 100644
Name: IBus
Description: IBus Library
diff --git a/setup/enginecombobox.py b/setup/enginecombobox.py
index 8d1424b..0ac7368 100644
--- a/setup/enginecombobox.py
+++ b/setup/enginecombobox.py
@@ -75,7 +75,11 @@ class EngineComboBox(Gtk.ComboBox):
keys = langs.keys()
keys.sort(locale.strcoll)
- current_lang = IBus.get_language_name(locale.getlocale()[0])
+ loc = locale.getlocale()[0]
+ # None on C locale
+ if loc == None:
+ loc = 'en_US'
+ current_lang = IBus.get_language_name(loc)
# move current language to the first place
if current_lang in keys:
keys.remove(current_lang)
diff --git a/setup/main.py b/setup/main.py
index 7cd3e37..47a34e3 100644
index 7cd3e37..bbc5422 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -182,7 +182,20 @@ class Setup(object):
@@ -182,12 +182,25 @@ class Setup(object):
self.__checkbutton_use_global_engine_toggled_cb)
# init engine page
@ -1490,6 +1508,12 @@ index 7cd3e37..47a34e3 100644
self.__combobox = self.__builder.get_object("combobox_engines")
self.__combobox.set_engines(self.__engines)
tmp_dict = {}
- for e in self.__engines:
+ for e in self.__bus.list_engines():
tmp_dict[e.get_name()] = e
engine_names = values.get("preload_engines", [])
engines = [tmp_dict[name] for name in engine_names if name in tmp_dict]
@@ -254,7 +267,7 @@ class Setup(object):
args = setup.split()
args.insert(1, path.basename(args[0]))
@ -2491,10 +2515,10 @@ index 0000000..adacd81
+ */
+}
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index e851b24..5847fd0 100644
index e851b24..7c5b4ed 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -40,6 +40,13 @@ class Panel : IBus.PanelService {
@@ -40,8 +40,16 @@ class Panel : IBus.PanelService {
private PropertyManager m_property_manager;
private GLib.Pid m_setup_pid = 0;
private Gtk.AboutDialog m_about_dialog;
@ -2507,11 +2531,36 @@ index e851b24..5847fd0 100644
+ private GLib.Timer m_changed_layout_timer;
private const string ACCELERATOR_SWITCH_IME_FOREWARD = "<Control>space";
private const string ACCELERATOR_SWITCH_IME_BACKWARD = "<Control><Shift>space";
+ private string[] ACCELERATOR_IME_HOTKEYS = {};
@@ -82,6 +89,14 @@ class Panel : IBus.PanelService {
public Panel(IBus.Bus bus) {
GLib.assert(bus.is_connected());
@@ -63,13 +71,6 @@ class Panel : IBus.PanelService {
m_switcher = new Switcher();
- var keybinding_manager = KeybindingManager.get_instance();
- keybinding_manager.bind(ACCELERATOR_SWITCH_IME_FOREWARD,
- (e) => handle_engine_switch(e, false));
-
- keybinding_manager.bind(ACCELERATOR_SWITCH_IME_BACKWARD,
- (e) => handle_engine_switch(e, true));
-
m_property_manager = new PropertyManager();
m_property_manager.property_activate.connect((k, s) => {
property_activate(k, s);
@@ -80,8 +81,66 @@ class Panel : IBus.PanelService {
~Panel() {
var keybinding_manager = KeybindingManager.get_instance();
keybinding_manager.unbind(ACCELERATOR_SWITCH_IME_FOREWARD);
keybinding_manager.unbind(ACCELERATOR_SWITCH_IME_BACKWARD);
- keybinding_manager.unbind(ACCELERATOR_SWITCH_IME_FOREWARD);
- keybinding_manager.unbind(ACCELERATOR_SWITCH_IME_BACKWARD);
+ foreach (string keybinding in ACCELERATOR_IME_HOTKEYS) {
+ keybinding_manager.unbind(keybinding);
+ if (keybinding == ACCELERATOR_SWITCH_IME_FOREWARD) {
+ keybinding_manager.unbind(ACCELERATOR_SWITCH_IME_BACKWARD);
+ }
+ }
+
+ if (HAVE_IBUS_GKBD && m_gkbdlayout != null) {
+ m_gkbdlayout.changed.disconnect(gkbdlayout_changed_cb);
@ -2520,18 +2569,67 @@ index e851b24..5847fd0 100644
+ }
+
+ m_xkblayout = null;
+ }
+
+ // ToDo: Customize the input method with ibus-setup
+ private void set_keybinding() {
+ string locale = GLib.Intl.setlocale(GLib.LocaleCategory.ALL,
+ null);
+ if (locale == null) {
+ locale = "C";
+ }
+
+ ACCELERATOR_IME_HOTKEYS += ACCELERATOR_SWITCH_IME_FOREWARD;
+
+ if (m_config != null) {
+ GLib.Variant variant = m_config.get_value("general/hotkey",
+ "trigger_accel");
+ if (variant != null) {
+ ACCELERATOR_IME_HOTKEYS = {};
+ for (int i = 0; i < variant.n_children(); i++) {
+ ACCELERATOR_IME_HOTKEYS += variant.get_child_value(i).dup_string();
+ }
+ }
+ }
+
+ if (ACCELERATOR_IME_HOTKEYS.length == 1 &&
+ ACCELERATOR_IME_HOTKEYS[0] == ACCELERATOR_SWITCH_IME_FOREWARD) {
+ // FIXME: When us keyboard is used, Zenkaku_Hankaku does not work.
+ /*
+ if (locale[0:2] == "ja") {
+ ACCELERATOR_IME_HOTKEYS += "Zenkaku_Hankaku";
+ }
+ */
+ if (locale[0:2] == "ko") {
+ ACCELERATOR_IME_HOTKEYS += "Hangul";
+ ACCELERATOR_IME_HOTKEYS += "Alt_R";
+ }
+ }
+
+ var keybinding_manager = KeybindingManager.get_instance();
+ foreach (string keybinding in ACCELERATOR_IME_HOTKEYS) {
+ keybinding_manager.bind(keybinding,
+ (e) => handle_engine_switch(e, false));
+ if (keybinding == ACCELERATOR_SWITCH_IME_FOREWARD) {
+ keybinding_manager.bind(ACCELERATOR_SWITCH_IME_BACKWARD,
+ (e) => handle_engine_switch(e, true));
+ }
+ }
}
public void set_config(IBus.Config config) {
@@ -93,6 +108,7 @@ class Panel : IBus.PanelService {
@@ -91,8 +150,10 @@ class Panel : IBus.PanelService {
}
m_config = config;
+ set_keybinding();
if (m_config != null) {
m_config.value_changed.connect(config_value_changed_cb);
+ init_engines_order();
update_engines(m_config.get_value("general", "preload_engines"),
m_config.get_value("general", "engines_order"));
} else {
@@ -100,6 +116,191 @@ class Panel : IBus.PanelService {
@@ -100,6 +161,191 @@ class Panel : IBus.PanelService {
}
}
@ -2723,7 +2821,7 @@ index e851b24..5847fd0 100644
private void switch_engine(int i, bool force = false) {
GLib.assert(i >= 0 && i < m_engines.length);
@@ -119,15 +320,7 @@ class Panel : IBus.PanelService {
@@ -119,15 +365,7 @@ class Panel : IBus.PanelService {
return;
}
// set xkb layout

View File

@ -1,6 +1,6 @@
From 6e9cdc7d5b10cb043e8709670ea5ad487ab3d937 Mon Sep 17 00:00:00 2001
From 723721bd15eb80da9f735ac4feba4f25306ba965 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 3 Feb 2012 19:20:27 +0900
Date: Tue, 7 Feb 2012 20:15:18 +0900
Subject: [PATCH] Enable ibus-setup to show the frequently used languages only
in IME list.
@ -190,7 +190,7 @@ index 34de9b4..bf50645 100644
<applyto>/desktop/ibus/panel/custom_font</applyto>
<owner>ibus</owner>
diff --git a/setup/enginecombobox.py b/setup/enginecombobox.py
index 8d1424b..9fbe476 100644
index 0ac7368..9af2651 100644
--- a/setup/enginecombobox.py
+++ b/setup/enginecombobox.py
@@ -45,6 +45,9 @@ class EngineComboBox(Gtk.ComboBox):
@ -267,8 +267,8 @@ index 8d1424b..9fbe476 100644
+ def __model_append_langs(self, model, langs, visible):
keys = langs.keys()
keys.sort(locale.strcoll)
current_lang = IBus.get_language_name(locale.getlocale()[0])
@@ -86,29 +119,86 @@ class EngineComboBox(Gtk.ComboBox):
loc = locale.getlocale()[0]
@@ -90,29 +123,86 @@ class EngineComboBox(Gtk.ComboBox):
keys.remove(IBus.get_language_name("Other"))
keys += [IBus.get_language_name("Other")]
for l in keys:
@ -310,8 +310,7 @@ index 8d1424b..9fbe476 100644
+ self.__model_append_langs(self.__model, lang, True)
+ iter1 = self.__model.append(None)
+ self.__model.set(iter1, 0, -1)
- self.set_model(self.__model)
+
+ self.__all_model = Gtk.TreeStore(object)
+ iter1 = self.__all_model.append(None)
+ self.__all_model.set(iter1, 0, 0)
@ -321,7 +320,8 @@ index 8d1424b..9fbe476 100644
+ self.__model_append_langs(self.__all_model, sub_lang, False)
+
+ self.__toggle_sub_lang()
+
- self.set_model(self.__model)
+ def __toggle_sub_lang(self):
+ self.set_model(None)
+ if self.__show_sub_lang:
@ -363,7 +363,7 @@ index 8d1424b..9fbe476 100644
else:
renderer.set_property("visible", True)
renderer.set_property("sensitive", True)
@@ -121,7 +211,8 @@ class EngineComboBox(Gtk.ComboBox):
@@ -125,7 +215,8 @@ class EngineComboBox(Gtk.ComboBox):
renderer.set_property("pixbuf", pixbuf)
def __name_cell_data_cb(self, celllayout, renderer, model, iter, data):
@ -373,7 +373,7 @@ index 8d1424b..9fbe476 100644
if isinstance (engine, str) or isinstance (engine, unicode):
renderer.set_property("sensitive", False)
@@ -129,8 +220,15 @@ class EngineComboBox(Gtk.ComboBox):
@@ -133,8 +224,15 @@ class EngineComboBox(Gtk.ComboBox):
renderer.set_property("weight", Pango.Weight.NORMAL)
elif isinstance(engine, int):
renderer.set_property("sensitive", True)
@ -391,7 +391,7 @@ index 8d1424b..9fbe476 100644
else:
renderer.set_property("sensitive", True)
renderer.set_property("text", engine.get_longname())
@@ -146,10 +244,18 @@ class EngineComboBox(Gtk.ComboBox):
@@ -150,10 +248,18 @@ class EngineComboBox(Gtk.ComboBox):
if i == 0 or i == -1:
return None
iter = self.get_active_iter()
@ -412,7 +412,7 @@ index 8d1424b..9fbe476 100644
return self.get_property("active-engine")
diff --git a/setup/main.py b/setup/main.py
index 47a34e3..16bfeea 100644
index bbc5422..9456e01 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -197,6 +197,7 @@ class Setup(object):

View File

@ -23,7 +23,7 @@
Name: ibus
Version: 1.4.99.20120203
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
Group: System Environment/Libraries
@ -33,9 +33,6 @@ Source0: http://fujiwara.fedorapeople.org/ibus/gnome-shell/%{name}-%{version}
Source1: xinput-ibus
%if %have_gjsfile
Source2: http://fujiwara.fedorapeople.org/ibus/gnome-shell/ibus-gjs-%{ibus_gjs_version}.tar.gz
# Workaround for glib2 bug:
# https://bugzilla.gnome.org/show_bug.cgi?id=669253
Source3: ibus-gsettings-db
%endif
Patch0: ibus-HEAD.patch
Patch1: ibus-541492-xkb.patch
@ -252,14 +249,6 @@ automake -a -c -f
--enable-python-library \
--enable-introspection
# Workaround for glib2 bug:
# https://bugzilla.gnome.org/show_bug.cgi?id=669253
cd data/dconf
make org.freedesktop.ibus.gschema.valid
mkdir db
cp %SOURCE3 db/ibus
cd ../..
# make -C po update-gmo
make %{?_smp_mflags} \
PKG_CONFIG_PATH=..:/usr/lib64/pkgconfig:/usr/lib/pkgconfig
@ -457,7 +446,12 @@ fi
%{_datadir}/gtk-doc/html/*
%changelog
* Fri Feb 03 2021 Takao Fujiwara <tfujiwar@redhat.com> - 1.4.99.20120203-1
* Tue Feb 07 2012 Takao Fujiwara <tfujiwar@redhat.com> - 1.4.99.20120203-2
- Fixed ibus-setup on C locale
- Fixed to show no registered engines from g-c-c.
- Enabled Alt_R keybinding on ko locales for ibus gtk only.
* Fri Feb 03 2012 Takao Fujiwara <tfujiwar@redhat.com> - 1.4.99.20120203-1
- Updated to 1.4.99.20120203
- Removed ibus-xx-bridge-hotkey.patch
- Updated ibus-541492-xkb.patch to use libgnomekbd.

View File

@ -1,4 +1,3 @@
675136bba0b04c922cca44eecd0bc421 ibus-1.4.99.20120203.tar.gz
8c713e47d403482cdd8b851dda3d0713 ibus-gjs-3.3.3.20120203.tar.gz
2d2ad58e3e41429dbd883ba7e501c9b2 ibus-gjs-3.2.1.20111230.tar.gz
dbdf603f6897df8b894960249cf21909 ibus-gsettings-db