Bug 1074883

Summary: English layout is added every time ibus is restarted resulting in duplicate entries
Product: [Fedora] Fedora Reporter: Martin Sourada <martin.sourada>
Component: ibusAssignee: fujiwara <tfujiwar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: i18n-bugs, shawn.p.huang, tfujiwar
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ibus-1.5.6-2.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-07 03:23:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
iBus preferences, Xfce keyboard preferences and iBus layout switch list on top of each other none

Description Martin Sourada 2014-03-11 07:59:54 UTC
Created attachment 872993 [details]
iBus preferences, Xfce keyboard preferences and iBus layout switch list on top of each other

Description of problem:
I have system keyboard layouts (set via Xfce) English (US) and Czech (qwerty) which aren't picked up by ibus (see Bug 1074879
). In ibus I have set English (US), Czech (no qwerty available -- see Bug 1074879 again), Japanese - mozc and Russian - translit (m17n). Everytime I restart ibus (or is started by logging in) new English US layout is added. Only to the layout switch list. It does not appear in the settings so it cannot be removed. Currently I have 8 times more English US layouts in the list than set up. Happens both in fresh install as well as upgrade from F19.

Version-Release number of selected component (if applicable):
ibus-gtk2-1.5.5-2.fc20.i686

How reproducible:
Always

Steps to Reproduce:
1. Set up both system and ibus layouts
2. Restart ibus.

Actual results:
Two English layouts (and growing) present in layout switch list, only one in settings.

Expected results:
Same layouts in settings as in the layout switch list.

Additional info:
see the attachment

Comment 1 fujiwara 2014-03-12 02:35:26 UTC
Because cz(qwerty) is not available in ibus and it's fallen back to us layout.

Comment 2 fujiwara 2014-03-12 08:29:45 UTC
--- ibus-1.5.6/ui/gtk3/panel.vala.orig
+++ ibus-1.5.6/ui/gtk3/panel.vala
@@ -923,6 +923,39 @@ class Panel : IBus.PanelService {
         }
     }
 
+    /* IBus.Bus.get_engines_by_names() returns 'us' engine if the name 
+     * does not exist in simple.xml and 'us' engine could be duplicated.
+     */
+    private IBus.EngineDesc[] uniq_engines(IBus.EngineDesc[] engines) {
+        if (engines.length == 0)
+            return engines;
+
+        int i = 0;
+        IBus.EngineDesc[] retval = {};
+
+        for (; i < engines.length; i++) {
+            if (engines[i].get_name() == "xkb:us::eng")
+                break;
+        }
+
+        if (i == engines.length)
+            return engines;
+
+        for (int j = 0; j < engines.length; j++) {
+            if (j <= i) {
+                retval += engines[j];
+                continue;
+            }
+
+            if (engines[i].get_name() == engines[j].get_name())
+                continue;
+
+            retval += engines[j];
+        }
+
+        return retval;
+    }
+
     private void run_preload_engines(IBus.EngineDesc[] engines, int index) {
         string[] names = {};
 
@@ -955,6 +988,7 @@ class Panel : IBus.PanelService {
         }
 
         var engines = m_bus.get_engines_by_names(names);
+        engines = uniq_engines(engines);
 
         if (m_engines.length == 0) {
             m_engines = engines;

Comment 3 Martin Sourada 2014-03-12 15:24:30 UTC
Thanks for the quick reaction and fix to both of my bugs! I just tried to build patched (both changes) 1.5.6 and both this and bug 1074879 are fixed for me.

Martin

Comment 4 Fedora Update System 2014-03-28 14:26:46 UTC
ibus-1.5.6-2.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/ibus-1.5.6-2.fc19

Comment 5 Fedora Update System 2014-03-28 14:26:59 UTC
ibus-1.5.6-2.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/ibus-1.5.6-2.fc20

Comment 6 Fedora Update System 2014-03-30 06:06:49 UTC
Package ibus-1.5.6-2.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing ibus-1.5.6-2.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-4486/ibus-1.5.6-2.fc19
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2014-04-07 03:23:01 UTC
ibus-1.5.6-2.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2014-04-15 15:42:32 UTC
ibus-1.5.6-2.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.