Accepting request 243221 from home:ftake:branches:M17N
- remove patches merged by upstream * add-libgnomekbd-and-load-preload-engines.patch * reload-preload-engines-until-users-customize-the-list.patch - obsoletes python-ibus when packaged for Python 3 OBS-URL: https://build.opensuse.org/request/show/243221 OBS-URL: https://build.opensuse.org/package/show/M17N/ibus?expand=0&rev=115
This commit is contained in:
parent
731b4f8ec2
commit
523f6d1e1e
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 31 12:07:24 UTC 2014 - ftake@geeko.jp
|
||||
|
||||
- remove patches merged by upstream
|
||||
* add-libgnomekbd-and-load-preload-engines.patch
|
||||
* reload-preload-engines-until-users-customize-the-list.patch
|
||||
- obsoletes python-ibus when packaged for Python 3
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Jul 27 15:15:28 UTC 2014 - i@marguerite.su
|
||||
|
||||
|
30
ibus.spec
30
ibus.spec
@ -16,7 +16,6 @@
|
||||
#
|
||||
|
||||
|
||||
%define with_automatic_config 1
|
||||
%define gtk_binary_version %(pkg-config --variable=gtk_binary_version gtk+-2.0)
|
||||
%define with_python3 1
|
||||
%if 0%{?suse_version} >= 1310
|
||||
@ -43,14 +42,6 @@ Source7: macros.ibus
|
||||
Source99: baselibs.conf
|
||||
# PATCH-FIX-OPENSUSE ibus-python-install-dir.patch ftake@geeko.jp
|
||||
Patch0: ibus-python-install-dir.patch
|
||||
|
||||
%if %{with_automatic_config}
|
||||
# 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
|
||||
# PATFH-FIX-SUSE ibus-xim-fix-re-focus-after-lock.patch bnc#874869 tiwa@suse.de -- Fix lost XIM input after screenlock
|
||||
@ -66,10 +57,6 @@ Patch5: ibus-force-python3.patch
|
||||
Patch6: ibus-vala-0.18.patch
|
||||
BuildRequires: dbus-1-glib-devel
|
||||
BuildRequires: dbus-1-python-devel >= 0.83.0
|
||||
%if %{with_automatic_config}
|
||||
BuildRequires: dbus-1-x11
|
||||
BuildRequires: libgnomekbd-devel
|
||||
%endif
|
||||
BuildRequires: dconf-devel >= 0.7.5
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: gconf2-devel
|
||||
@ -121,6 +108,9 @@ Supplements: packageand(libreoffice:libreoffice-gnome)
|
||||
Provides: locale(ja;ko;zh)
|
||||
Obsoletes: ibus-gnome-shell
|
||||
Obsoletes: libibus-1_0-0
|
||||
%if %{with_python3}
|
||||
Obsoletes: python-ibus
|
||||
%endif
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
%description
|
||||
@ -229,13 +219,6 @@ sed -i \
|
||||
%{SOURCE99}
|
||||
%endif
|
||||
|
||||
%if %{with_automatic_config}
|
||||
#%patch1 -p1
|
||||
#%patch2 -p1
|
||||
rm -f bindings/vala/ibus-1.0.vapi
|
||||
rm -f data/dconf/00-upstream-settings
|
||||
%endif
|
||||
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
|
||||
@ -262,17 +245,10 @@ intltoolize -f
|
||||
--enable-gtk-doc \
|
||||
%if %{with_wayland}
|
||||
--enable-wayland \
|
||||
%endif
|
||||
%if %{with_automatic_config}
|
||||
--enable-libgnomekbd \
|
||||
%endif
|
||||
--enable-surrounding-text \
|
||||
--libexecdir=%{_libdir}/ibus
|
||||
|
||||
%if %{with_automatic_config}
|
||||
make -C ui/gtk3 maintainer-clean-generic %{?_smp_mflags}
|
||||
%endif
|
||||
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
|
@ -1,353 +0,0 @@
|
||||
From 68a504f7ab44c4977d15e0bd83c7e76dd8d2b06e Mon Sep 17 00:00:00 2001
|
||||
From: fujiwarat <takao.fujiwara1@gmail.com>
|
||||
Date: Fri, 7 Mar 2014 16:43:49 +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 | 71 +++++++++++++++++++++++++++++++++++----
|
||||
setup/setup.ui | 22 +++++++++++--
|
||||
src/ibustypes.h | 10 ++++++
|
||||
ui/gtk3/panel.vala | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
5 files changed, 211 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
|
||||
index caec315..1f9b1eb 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..d70da6b 100644
|
||||
--- a/setup/main.py
|
||||
+++ b/setup/main.py
|
||||
@@ -190,16 +190,30 @@ def __init_general(self):
|
||||
'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 @@ 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")
|
||||
- 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 @@ def __get_engine_setup_exec_args(self, engine):
|
||||
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,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():
|
||||
+ 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(type = Gtk.MessageType.QUESTION,
|
||||
+ buttons = Gtk.ButtonsType.YES_NO,
|
||||
+ message_format = 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 ad5386b..68e0faa 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>
|
||||
@@ -868,7 +884,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>
|
||||
@@ -916,7 +932,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 @@
|
||||
} 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.5
|
||||
|
Loading…
Reference in New Issue
Block a user