Accepting request 202437 from home:ftake:branches:M17N

Please pick this package for 13.1.

Update to 1.5.4 which includes bug fix and re-implementation of feature that was in openSUSE 12.3.

This update also contains a patch for usability improvement for 13.1.

OBS-URL: https://build.opensuse.org/request/show/202437
OBS-URL: https://build.opensuse.org/package/show/M17N/ibus?expand=0&rev=76
This commit is contained in:
Fuminobu Takeyama 2013-10-06 18:30:30 +00:00 committed by Git OBS Bridge
parent 7e4f26e7ac
commit 521e2d454a
7 changed files with 259 additions and 258 deletions

View File

@ -1,6 +1,6 @@
From 69171c9c9446a60da1979c88478055c9df35136f Mon Sep 17 00:00:00 2001
From 5c8ce9720f607512c2734f08d3e7141d8f5b9e99 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 5 Jun 2013 11:48:54 +0900
Date: Fri, 20 Sep 2013 17:16:56 +0900
Subject: [PATCH] Add libgnomekbd and load preload engines.
This patch was generated by ftake@geeko.jp from a git repository maintained by
@ -29,9 +29,9 @@ version is not sufficient with regard to distribution integration.
ui/gtk3/Makefile.am | 36 ++++
ui/gtk3/gkbdlayout.vala.false | 63 ++++++
ui/gtk3/gkbdlayout.vala.true | 108 ++++++++++
ui/gtk3/panel.vala | 216 ++++++++++++++++++-
ui/gtk3/xkblayout.vala | 431 +++++++++++++++++++++++++++++++++++++
17 files changed, 1645 insertions(+), 4 deletions(-)
ui/gtk3/panel.vala | 196 ++++++++++++++++-
ui/gtk3/xkblayout.vala | 429 ++++++++++++++++++++++++++++++++++++
17 files changed, 1623 insertions(+), 4 deletions(-)
create mode 100644 bindings/vala/Gkbd-3.0.metadata
create mode 100644 bindings/vala/Xkl-1.0.metadata
create mode 100644 bindings/vala/gkbd.deps
@ -49,7 +49,7 @@ index 0000000..661e6fd
@@ -0,0 +1 @@
+Configuration cheader_filename="libgnomekbd/gkbd-configuration.h"
diff --git a/bindings/vala/Makefile.am b/bindings/vala/Makefile.am
index be45e41..44b3e61 100644
index 84aa1b4..4d8aae4 100644
--- a/bindings/vala/Makefile.am
+++ b/bindings/vala/Makefile.am
@@ -28,8 +28,6 @@ vapi_deps = \
@ -115,11 +115,11 @@ index 0000000..172632c
+glib-2.0
+gmodule-2.0
diff --git a/configure.ac b/configure.ac
index 781bbf5..f576f46 100644
index e8fde49..d084c8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -237,6 +237,45 @@ else
enable_xim="no (disabled, use --enable-xim to enable)"
@@ -261,6 +261,45 @@ else
enable_wayland="no (disabled, use --enable-wayland to enable)"
fi
+# Option for XKB command.
@ -164,7 +164,7 @@ index 781bbf5..f576f46 100644
# GObject introspection
GOBJECT_INTROSPECTION_CHECK([0.6.8])
@@ -590,6 +629,7 @@ Build options:
@@ -619,6 +658,7 @@ Build options:
Panel icon "$IBUS_ICON_KEYBOARD"
Enable surrounding-text $enable_surrounding_text
Enable libnotify $enable_libnotify
@ -173,7 +173,7 @@ index 781bbf5..f576f46 100644
])
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
index 9cfe83b..d0b3db8 100644
index 2779139..88a287f 100644
--- a/data/ibus.schemas.in
+++ b/data/ibus.schemas.in
@@ -56,6 +56,52 @@
@ -262,7 +262,7 @@ index 9f593ab..c93a0ed 100644
Name: IBus
Description: IBus Library
diff --git a/ibus.spec.in b/ibus.spec.in
index 7989949..5391538 100644
index 334f37e..2017af9 100644
--- a/ibus.spec.in
+++ b/ibus.spec.in
@@ -5,6 +5,7 @@
@ -284,7 +284,7 @@ index 7989949..5391538 100644
Requires: %{name}-libs = %{version}-%{release}
Requires: %{name}-gtk2 = %{version}-%{release}
@@ -53,6 +58,9 @@ Requires: dbus-python >= %{dbus_python_version}
@@ -52,6 +57,9 @@ Requires: dbus-python >= %{dbus_python_version}
Requires: im-chooser >= %{im_chooser_version}
Requires: notify-python
Requires: librsvg2
@ -294,7 +294,7 @@ index 7989949..5391538 100644
Requires(post): desktop-file-utils
Requires(postun): desktop-file-utils
@@ -153,6 +161,10 @@ OPTIONS="$OPTIONS --enable-python-library"
@@ -152,6 +160,10 @@ OPTIONS="$OPTIONS --enable-python-library"
OPTIONS="$OPTIONS --disable-python-library"
%endif
@ -306,10 +306,10 @@ index 7989949..5391538 100644
# make -C po update-gmo
diff --git a/src/Makefile.am b/src/Makefile.am
index 7ee5df8..8fa954e 100644
index 811d097..912b75c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -197,6 +197,9 @@ typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
@@ -201,6 +201,9 @@ typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += $(dist_gir_DATA) $(typelibs_DATA)
endif
@ -320,7 +320,7 @@ index 7ee5df8..8fa954e 100644
ibusenumtypes.h: $(ibus_headers) ibusenumtypes.h.template
$(AM_V_GEN) ( top_builddir=`cd $(top_builddir) && pwd`; \
diff --git a/src/ibus.h b/src/ibus.h
index ef811a4..f82a162 100644
index d8e226e..f0a9456 100644
--- a/src/ibus.h
+++ b/src/ibus.h
@@ -47,6 +47,7 @@
@ -997,10 +997,10 @@ index 0000000..5aa486d
+G_END_DECLS
+#endif
diff --git a/ui/gtk3/Makefile.am b/ui/gtk3/Makefile.am
index 2038814..aa79eee 100644
index 547ef53..4b32d7e 100644
--- a/ui/gtk3/Makefile.am
+++ b/ui/gtk3/Makefile.am
@@ -45,6 +45,8 @@ USE_SYMBOL_ICON = FALSE
@@ -44,6 +44,8 @@ AM_CPPFLAGS = \
USE_SYMBOL_ICON = FALSE
@ -1009,7 +1009,7 @@ index 2038814..aa79eee 100644
AM_CFLAGS = \
@GLIB2_CFLAGS@ \
@GIO2_CFLAGS@ \
@@ -56,6 +58,8 @@ AM_CFLAGS = \
@@ -54,6 +56,8 @@ AM_CFLAGS = \
-DBINDIR=\"$(bindir)\" \
-DIBUS_DISABLE_DEPRECATED \
-DSWITCHER_USE_SYMBOL_ICON=$(USE_SYMBOL_ICON) \
@ -1018,7 +1018,7 @@ index 2038814..aa79eee 100644
-Wno-unused-variable \
-Wno-unused-but-set-variable \
-Wno-unused-function \
@@ -98,12 +102,40 @@ AM_VALAFLAGS += \
@@ -97,12 +101,40 @@ AM_VALAFLAGS += \
$(NULL)
endif
@ -1059,7 +1059,7 @@ index 2038814..aa79eee 100644
handle.vala \
iconwidget.vala \
keybindingmanager.vala \
@@ -112,6 +144,7 @@ ibus_ui_gtk3_SOURCES = \
@@ -111,6 +143,7 @@ ibus_ui_gtk3_SOURCES = \
property.vala \
separator.vala \
switcher.vala \
@ -1067,7 +1067,7 @@ index 2038814..aa79eee 100644
$(NULL)
ibus_ui_gtk3_LDADD = \
@@ -120,9 +153,12 @@ ibus_ui_gtk3_LDADD = \
@@ -119,9 +152,12 @@ ibus_ui_gtk3_LDADD = \
CLEANFILES = \
gtkpanel.xml \
@ -1264,10 +1264,10 @@ index 0000000..a6e0f8d
+ */
+}
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index 39aca08..fb012c3 100644
index 82b9ee5..c08f6f4 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -49,6 +49,13 @@ class Panel : IBus.PanelService {
@@ -57,6 +57,13 @@ class Panel : IBus.PanelService {
private Gtk.CssProvider m_css_provider;
private int m_switcher_delay_time = 400;
private bool m_use_system_keyboard_layout = false;
@ -1278,10 +1278,10 @@ index 39aca08..fb012c3 100644
+ private int m_fallback_lock_id = -1;
+ private bool m_changed_xkb_option = false;
+ private GLib.Timer m_changed_layout_timer;
private const string ACCELERATOR_SWITCH_IME_FOREWARD = "<Super>space";
private GLib.List<Keybinding> m_keybindings = new GLib.List<Keybinding>();
@@ -91,6 +98,14 @@ class Panel : IBus.PanelService {
@@ -102,6 +109,14 @@ class Panel : IBus.PanelService {
~Panel() {
unbind_switch_shortcut();
@ -1295,17 +1295,17 @@ index 39aca08..fb012c3 100644
+ m_xkblayout = null;
}
private void keybinding_manager_bind(KeybindingManager keybinding_manager,
@@ -405,6 +420,7 @@ class Panel : IBus.PanelService {
m_config.watch("general/hotkey", "triggers");
m_config.watch("panel", "custom_font");
m_config.watch("panel", "use_custom_font");
+ init_engines_order();
// Update m_use_system_keyboard_layout before update_engines()
// is called.
set_use_system_keyboard_layout(null);
@@ -422,6 +438,204 @@ class Panel : IBus.PanelService {
}
private void init_settings() {
@@ -399,6 +414,7 @@ class Panel : IBus.PanelService {
}
public void load_settings() {
+ init_engines_order();
// Update m_use_system_keyboard_layout before update_engines()
// is called.
set_use_system_keyboard_layout();
@@ -415,6 +431,184 @@ class Panel : IBus.PanelService {
set_version();
}
+ private void gkbdlayout_changed_cb() {
@ -1344,11 +1344,7 @@ index 39aca08..fb012c3 100644
+ }
+
+ private void init_engines_order() {
+ if (m_config == null) {
+ return;
+ }
+
+ m_xkblayout = new XKBLayout(m_config);
+ m_xkblayout = new XKBLayout();
+ string session = Environment.get_variable("DESKTOP_SESSION");
+
+ if (HAVE_IBUS_GKBD &&
@ -1399,15 +1395,10 @@ index 39aca08..fb012c3 100644
+ var_xkb_engine_names += "%s:%s:%s".printf("xkb", name, lang);
+ }
+
+ GLib.Variant var_engines =
+ m_config.get_value("general", "preload_engines");
+ string[] engine_names = {};
+ string[] engine_names =
+ m_settings_general.get_strv("preload-engines");
+ bool updated_engine_names = false;
+
+ if (var_engines != null) {
+ engine_names = var_engines.dup_strv();
+ }
+
+ foreach (string name in var_xkb_engine_names) {
+ if (name in engine_names)
+ continue;
@ -1415,21 +1406,13 @@ index 39aca08..fb012c3 100644
+ engine_names += name;
+ }
+
+ if (updated_engine_names) {
+ m_config.set_value("general",
+ "preload_engines",
+ new GLib.Variant.strv(engine_names));
+ }
+ if (updated_engine_names)
+ m_settings_general.set_strv("preload-engines", engine_names);
+
+ GLib.Variant var_order =
+ m_config.get_value("general", "engines_order");
+ string[] order_names = {};
+ string[] order_names =
+ m_settings_general.get_strv("engines-order");
+ bool updated_order_names = false;
+
+ if (var_order != null) {
+ order_names = var_order.dup_strv();
+ }
+
+ foreach (var name in var_xkb_engine_names) {
+ if (name in order_names)
+ continue;
@ -1437,11 +1420,8 @@ index 39aca08..fb012c3 100644
+ updated_order_names = true;
+ }
+
+ if (updated_order_names) {
+ m_config.set_value("general",
+ "engines_order",
+ new GLib.Variant.strv(order_names));
+ }
+ if (updated_order_names)
+ m_settings_general.set_strv("engines-order", order_names);
+ }
+
+ private void set_xkb_group_layout(IBus.EngineDesc engine) {
@ -1509,21 +1489,21 @@ index 39aca08..fb012c3 100644
private void exec_setxkbmap(IBus.EngineDesc engine) {
string layout = engine.get_layout();
string variant = engine.get_layout_variant();
@@ -482,7 +696,7 @@ class Panel : IBus.PanelService {
}
@@ -480,7 +674,7 @@ class Panel : IBus.PanelService {
// set xkb layout
if (!m_use_system_keyboard_layout) {
if (!m_use_system_keyboard_layout)
- exec_setxkbmap(engine);
+ set_layout(engine);
}
}
engine_contexts_insert(engine);
}
diff --git a/ui/gtk3/xkblayout.vala b/ui/gtk3/xkblayout.vala
new file mode 100644
index 0000000..b4b54ff
index 0000000..b7dfb3e
--- /dev/null
+++ b/ui/gtk3/xkblayout.vala
@@ -0,0 +1,431 @@
@@ -0,0 +1,429 @@
+/* vim:set et sts=4 sw=4:
+ *
+ * ibus - The Input Bus
@ -1554,7 +1534,7 @@ index 0000000..b4b54ff
+class XKBLayout
+{
+ string m_xkb_command = "setxkbmap";
+ IBus.Config m_config = null;
+ GLib.Settings m_settings_general;
+ string[] m_xkb_latin_layouts = {};
+ GLib.Pid m_xkb_pid = -1;
+ GLib.Pid m_xmodmap_pid = -1;
@ -1566,18 +1546,16 @@ index 0000000..b4b54ff
+ string m_default_variant = "";
+ string m_default_option = "";
+
+ public XKBLayout(IBus.Config? config) {
+ m_config = config;
+ public XKBLayout() {
+ m_settings_general = new GLib.Settings("org.freedesktop.ibus.general");
+
+ if (config != null) {
+ var value = config.get_value("general", "xkb_latin_layouts");
+ for (int i = 0; value != null && i < value.n_children(); i++) {
+ m_xkb_latin_layouts +=
+ value.get_child_value(i).dup_string();
+ }
+ if (m_use_xmodmap) {
+ m_use_xmodmap = config.get_value("general", "use_xmodmap").get_boolean();
+ }
+ var value = m_settings_general.get_value("xkb-latin-layouts");
+ for (int i = 0; value != null && i < value.n_children(); i++) {
+ m_xkb_latin_layouts +=
+ value.get_child_value(i).dup_string();
+ }
+ if (m_use_xmodmap) {
+ m_use_xmodmap = m_settings_general.get_boolean("use-xmodmap");
+ }
+ }
+
@ -1956,5 +1934,5 @@ index 0000000..b4b54ff
+ */
+}
--
1.8.1.6
1.8.4

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2afc6371c24873f0e37554ef07effd022042f8eca6cb649d1bb02d8c57528b8c
size 1976957

3
ibus-1.5.4.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:703ebaba3f01b54a86119fb6161d85b9d1ccdb4edb79782d0d23ccde64d214fd
size 2026656

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Sun Oct 6 13:43:39 UTC 2013 - ftake@geeko.jp
- Update to 1.5.4
* Add "address" command to command line interface
* Support content-type of input context
* Replace ibus-config with gsettings
* Supprt using a different IM engine state for each window
* Support show-icon-on-systray in ibus-ui-gtk3
* Fix no output when ibus-daemon is runnin on another display
* Update translations and fix build errors
- Add show-input-mode-icon.patch
* workaround for the current input mode is not shown on DEs
other than GNOME
- Rename and refresh patches
* add-libgnomekbd-and-load-preload-engines.patch
* reload-preload-engines-until-users-customize-the-list.patch
- Fix ibus-lang is not installed
- Fix warning by "touch /etc/dconf/db/ibus" for 12.3 and later
-------------------------------------------------------------------
Fri Sep 13 13:49:44 UTC 2013 - ftake@geeko.jp

View File

@ -19,7 +19,7 @@
%define with_automatic_config 1
Name: ibus
Version: 1.5.3
Version: 1.5.4
Release: 0
Url: http://code.google.com/p/ibus/
Summary: Intelligent Input Bus for Linux OS
@ -32,11 +32,13 @@ Source3: xim.ibus.suse.template
Source4: xim.d-ibus-121
%if %{with_automatic_config}
Patch0: ibus-python-install-dir.patch
# PATCH-FEATURE-UPSTREAM add-libgnomekbd-and-load-preload-engines-69171c9c.patch Issue 1641 ftake@geeko.jp
Patch1: add-libgnomekbd-and-load-preload-engines-69171c9c.patch
# PATCH-FEATURE-UPSTREAM reload-preload-engines-until-users-customize-the-list-95fd937e.patch Issue 1641 ftake@geeko.jp
Patch2: reload-preload-engines-until-users-customize-the-list-95fd937e.patch
# PATCH-FEATURE-UPSTREAM add-libgnomekbd-and-load-preload-engines.patch Issue 1641 ftake@geeko.jp
Patch1: add-libgnomekbd-and-load-preload-engines.patch
# PATCH-FEATURE-UPSTREAM reload-preload-engines-until-users-customize-the-list.patch Issue 1641 ftake@geeko.jp
Patch2: reload-preload-engines-until-users-customize-the-list.patch
%endif
# PATCH-FIX-OPENSUSE reload-preload-engines-until-users-customize-the-list.patch ftake@geeko.jp
Patch3: show-input-mode-icon.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: /usr/bin/touch
Provides: locale(ja;ko;zh)
@ -78,6 +80,7 @@ Requires: typelib-1_0-Gtk-2_0
Requires: typelib-1_0-Gtk-3_0
%endif
Obsoletes: ibus-gnome-shell
Recommends: %{name}-lang
#Fix cursor following problem in KDE4 for libreoffice, libreoffice-kde and libreoffice-kde4 can destroy cursor following, please don't install them with ibus.
Supplements: packageand(libreoffice:libreoffice-gnome)
@ -164,6 +167,8 @@ rm -f bindings/vala/ibus-1.0.vapi
rm -f data/dconf/00-upstream-settings
%endif
%patch3 -p1
%build
autoreconf -fi
intltoolize -f
@ -216,10 +221,8 @@ mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
ln -sf %{_datadir}/icons/hicolor/48x48/apps/ibus-keyboard.png \
$RPM_BUILD_ROOT%{_datadir}/pixmaps/ibus-keyboard.png
%if 0%{suse_version} <= 1220
# touch for %%ghost
touch $RPM_BUILD_ROOT/%{_sysconfdir}/dconf/db/ibus
%endif
%suse_update_desktop_file %name-setup System Utility settings

View File

@ -1,6 +1,6 @@
From 95fd937e14ec2d2f1de0f5fa0e186cfdf996c921 Mon Sep 17 00:00:00 2001
From d566bc83a4672b88a38fa5de25741b99ebaeae62 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 1 May 2013 13:35:01 +0900
Date: Fri, 20 Sep 2013 17:20:09 +0900
Subject: [PATCH] Reload preload engines until users customize the list.
This patch was generated by ftake@geeko.jp from a git repository maintained by
@ -11,27 +11,27 @@ The following description is from the original commit:
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
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,
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.
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
on ibus-setup, ibus-setup sets 'preload-engine-mode' as
IBUS_PRELOAD_ENGINE_MODE_USER and users can customize the value
'preload_engines'.
'preload-engines'.
---
data/ibus.schemas.in | 24 +++++++++
setup/main.py | 73 ++++++++++++++++++++++++---
setup/setup.ui | 22 +++++++--
src/ibustypes.h | 10 ++++
ui/gtk3/panel.vala | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 254 insertions(+), 11 deletions(-)
data/ibus.schemas.in | 24 ++++++++++++++
setup/main.py | 70 +++++++++++++++++++++++++++++++++++----
setup/setup.ui | 22 +++++++++++--
src/ibustypes.h | 10 ++++++
ui/gtk3/panel.vala | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 210 insertions(+), 9 deletions(-)
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
index d0b3db8..52ece27 100644
index 88a287f..b6709fd 100644
--- a/data/ibus.schemas.in
+++ b/data/ibus.schemas.in
@@ -2,6 +2,30 @@
@ -66,26 +66,29 @@ index d0b3db8..52ece27 100644
<applyto>/desktop/ibus/general/preload_engines</applyto>
<owner>ibus</owner>
diff --git a/setup/main.py b/setup/main.py
index 0281ac7..ba78eeb 100644
index d3f4414..235ef9c 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -190,16 +190,27 @@ def __init_general(self):
self.__checkbutton_use_global_engine.connect("toggled",
self.__checkbutton_use_global_engine_toggled_cb)
@@ -187,16 +187,30 @@ def __init_general(self):
'active',
Gio.SettingsBindFlags.DEFAULT)
+ # 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()
+ 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)
+ self.__builder.get_object("hbox_customize_active_input_methods").set_sensitive(True)
+ hbox.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)
+ 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()
@ -95,21 +98,13 @@ index 0281ac7..ba78eeb 100644
- tmp_dict = {}
- for e in self.__engines:
- tmp_dict[e.get_name()] = e
engine_names = values.get("preload_engines", [])
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)
@@ -243,6 +254,7 @@ def __init_ui(self):
self.__checkbutton_auto_start_toggled_cb)
self.__config = self.__bus.get_config()
+ self.__config.connect("value-changed", self.__config_value_changed_cb)
self.__init_hotkey()
self.__init_panel()
@@ -251,8 +263,8 @@ def __init_ui(self):
@@ -246,8 +260,8 @@ def __init_ui(self):
def __combobox_notify_active_engine_cb(self, combobox, property):
engine = self.__combobox.get_active_engine()
button = self.__builder.get_object("button_engine_add")
@ -120,7 +115,7 @@ index 0281ac7..ba78eeb 100644
def __get_engine_setup_exec_args(self, engine):
args = []
@@ -272,6 +284,13 @@ def __get_engine_setup_exec_args(self, engine):
@@ -267,6 +281,13 @@ def __get_engine_setup_exec_args(self, engine):
args.append(path.basename(setup_path))
return args
@ -134,18 +129,17 @@ index 0281ac7..ba78eeb 100644
def __treeview_notify_cb(self, treeview, prop):
if prop.name not in ("active-engine", "engines"):
return
@@ -324,6 +343,34 @@ def __button_engine_preferences_cb(self, button):
@@ -318,6 +339,43 @@ def __button_engine_preferences_cb(self, button):
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():
+ variant = GLib.Variant.new_int32(IBus.PreloadEngineMode.USER)
+ self.__config.set_value("general",
+ "preload_engine_mode",
+ variant)
+ self.__builder.get_object("hbox_customize_active_input_methods").set_sensitive(True)
+ self.__treeview.notify("engines")
+ 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 " \
@ -160,38 +154,27 @@ index 0281ac7..ba78eeb 100644
+ if id != Gtk.ResponseType.YES:
+ button.set_active(True)
+ return
+ variant = GLib.Variant.new_int32(IBus.PreloadEngineMode.LANG_RELATIVE)
+ self.__config.set_value("general",
+ "preload_engine_mode",
+ variant)
+ self.__builder.get_object("hbox_customize_active_input_methods").set_sensitive(False)
+ 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(',', 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:
+ self.__treeview.set_engines(engines)
+
def __init_bus(self):
self.__bus = IBus.Bus()
if self.__bus.is_connected():
@@ -538,8 +585,18 @@ def __checkbutton_use_global_engine_toggled_cb(self, button):
value = GLib.Variant.new_boolean(value)
self.__config.set_value("general", "use_global_engine", value)
- def __config_value_changed_cb(self, bus, section, name, value):
- pass
+ def __config_value_changed_cb(self, bus, section, name, variant):
+ if section == 'general' and name == 'preload_engines':
+ value = []
+ if variant != None:
+ value = variant.unpack()
+ engines = self.__get_engine_descs_from_names(value)
+ current_engines = self.__treeview.get_engines()
+ 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:
+ self.__treeview.set_engines(engines)
def __config_reloaded_cb(self, bus):
pass
diff --git a/setup/setup.ui b/setup/setup.ui
index e56e917..b3165aa 100644
index 1638abb..72a5d57 100644
--- a/setup/setup.ui
+++ b/setup/setup.ui
@@ -669,7 +669,23 @@
@ -238,7 +221,7 @@ index e56e917..b3165aa 100644
</child>
</object>
diff --git a/src/ibustypes.h b/src/ibustypes.h
index 737b3e2..8ce5a16 100644
index 6d30a86..dac7f8f 100644
--- a/src/ibustypes.h
+++ b/src/ibustypes.h
@@ -204,6 +204,16 @@
@ -259,73 +242,55 @@ index 737b3e2..8ce5a16 100644
* @x: x coordinate.
* @y: y coordinate.
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index fb012c3..54251e7 100644
index c08f6f4..9c1fef5 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -413,6 +413,8 @@ class Panel : IBus.PanelService {
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", "embed_preedit_text");
m_config.watch("general", "engines_order");
m_config.watch("general", "switcher_delay_time");
@@ -487,7 +489,136 @@ class Panel : IBus.PanelService {
@@ -130,6 +130,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();
});
@@ -476,7 +480,96 @@ class Panel : IBus.PanelService {
init_gkbd();
}
+ GLib.Variant var_engines =
+ m_config.get_value("general", "preload_engines");
+ string[] preload_engines = {};
+ string[] preload_engines =
+ m_settings_general.get_strv("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();
+ }
+ 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_config.set_value("general",
+ "preload_engines_inited",
+ new GLib.Variant.boolean(true));
+ m_settings_general.set_boolean("preload-engines-inited", 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);
+ }
+ // 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_config.set_value("general",
+ "preload_engines_inited",
+ new GLib.Variant.boolean(true));
+ }
+ 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) {
+ if (locale == null)
+ locale = "C";
+ }
+
+ string lang = locale.split(".")[0];
+ GLib.List<IBus.EngineDesc> engines = m_bus.list_engines();
@ -335,10 +300,8 @@ index fb012c3..54251e7 100644
+ p != null;
+ p = p.next) {
+ unowned IBus.EngineDesc engine = p.data;
+ if (engine.get_language() == lang &&
+ engine.get_rank() > 0) {
+ if (engine.get_language() == lang && engine.get_rank() > 0)
+ im_engines += engine.get_name();
+ }
+ }
+
+ lang = lang.split("_")[0];
@ -347,79 +310,49 @@ index fb012c3..54251e7 100644
+ p != null;
+ p = p.next) {
+ unowned IBus.EngineDesc engine = p.data;
+ if (engine.get_language() == lang &&
+ engine.get_rank() > 0) {
+ if (engine.get_language() == lang && engine.get_rank() > 0)
+ im_engines += engine.get_name();
+ }
+ }
+ }
+
+ if (im_engines.length == 0) {
+ if (im_engines.length == 0)
+ return false;
+ }
+
+ GLib.Variant var_engines =
+ m_config.get_value("general", "preload_engines");
+ string[] orig_preload_engines = {};
+ string[] orig_preload_engines =
+ m_settings_general.get_strv("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) {
+ if (name.ascii_ncasecmp("xkb:", 4) != 0)
+ continue;
+ }
+
+ preload_engines += name;
+ }
+
+ foreach (string name in im_engines) {
+ if (!(name in preload_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));
+ }
+ "".joinv(",", preload_engines))
+ m_settings_general.set_strv("preload-engines", 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");
+ int preload_engine_mode =
+ m_settings_general.get_int("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) {
+ if (preload_engine_mode == IBus.PreloadEngineMode.USER)
+ return;
+ }
+
+ set_lang_relative_preload_engines();
}
private void update_xkb_engines() {
@@ -704,6 +835,11 @@ class Panel : IBus.PanelService {
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;
--
1.8.1.6
1.8.4

View File

@ -0,0 +1,67 @@
From f671355e97f7de3e866f942e5c69f72b0c97fddb Mon Sep 17 00:00:00 2001
From: Fuminobu TAKEYAMA <ftake@geeko.jp>
Date: Sun, 6 Oct 2013 15:29:43 +0900
Subject: [PATCH] If icons for input modes are available, use those icons
instead of engine's icons.
---
ui/gtk3/panel.vala | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala
index 9c1fef5..51864c4 100644
--- a/ui/gtk3/panel.vala
+++ b/ui/gtk3/panel.vala
@@ -1098,10 +1098,49 @@ class Panel : IBus.PanelService {
public override void register_properties(IBus.PropList props) {
m_property_manager.set_properties(props);
+ int i = 0;
+ while (true) {
+ IBus.Property prop = props.get(i);
+ if (prop == null)
+ break;
+ if (prop.key == "InputMode") {
+ update_input_mode_icon(prop.icon);
+ break;
+ }
+ }
}
public override void update_property(IBus.Property prop) {
m_property_manager.update_property(prop);
+ if (prop.key == "InputMode") {
+ update_input_mode_icon(prop.icon);
+ }
+ }
+
+ // If InputMode has an icon, use it instead of engine's icon.
+ public void update_input_mode_icon(string icon) {
+ var icon_name = icon;
+ if (icon == "") {
+ var engine = m_bus.get_global_engine();
+ icon_name = engine.get_icon();
+ }
+
+ if (icon_name[0] == '/') {
+ try {
+ // resize icon because icons were desinged for ibus tool bar of 1.4.x
+ var icon_img = new Gdk.Pixbuf.from_file_at_size(icon_name, m_status_icon.size, m_status_icon.size);
+ m_status_icon.set_from_pixbuf(icon_img);
+ } catch (Error e) {
+ warning("could not load icon: %s", icon_name);
+ }
+ } else {
+ var theme = Gtk.IconTheme.get_default();
+ if (theme.lookup_icon(icon_name, 48, 0) != null) {
+ m_status_icon.set_from_icon_name(icon_name);
+ } else {
+ m_status_icon.set_from_icon_name("ibus-engine");
+ }
+ }
}
public override void update_preedit_text(IBus.Text text,
--
1.8.4