Merge lp:~attente/indicator-keyboard/1290881 into lp:indicator-keyboard

Proposed by William Hua
Status: Superseded
Proposed branch: lp:~attente/indicator-keyboard/1290881
Merge into: lp:indicator-keyboard
Diff against target: 202 lines (+88/-15)
5 files modified
debian/control (+1/-0)
lib/Makefile.am (+1/-0)
lib/ibus-panel.vala (+26/-0)
lib/main.vala (+55/-10)
po/indicator-keyboard.pot (+5/-5)
To merge this branch: bzr merge lp:~attente/indicator-keyboard/1290881
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
PS Jenkins bot (community) continuous-integration Approve
Charles Kerr (community) Approve
Review via email: mp+211666@code.launchpad.net

This proposal has been superseded by a proposal from 2014-03-28.

Commit message

Use Ubuntu-specific IBus D-Bus API so that we don't have to replace the old IBus panel service in order to inspect and activate IBus engine properties.

Description of the change

Use Ubuntu-specific IBus D-Bus API so that we don't have to replace the old IBus panel service in order to inspect and activate IBus engine properties.

This branch depends on the IBus patch attached at https://bugs.launchpad.net/indicator-keyboard/+bug/1290881.

To post a comment you must log in.
310. By William Hua

Breaks IBus << 1.5.5-1ubuntu3.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
311. By William Hua

Check if IBus is connected before checking engine properties.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

LGTM.

review: Approve
312. By William Hua

IBus panel is only available while IBus is running.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks! The new ibus got uploaded (still in the unapproved queue due to beta freeze though), we can land that one next

review: Approve

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2013-11-22 16:44:45 +0000
+++ debian/control 2014-03-19 23:26:13 +0000
@@ -30,6 +30,7 @@
30Architecture: any30Architecture: any
31Depends: ${misc:Depends},31Depends: ${misc:Depends},
32 ${shlibs:Depends},32 ${shlibs:Depends},
33Breaks: ibus (<< 1.5.5-1ubuntu3),
33Description: Keyboard indicator34Description: Keyboard indicator
34 This package contains the keyboard indicator, which should show as an icon in35 This package contains the keyboard indicator, which should show as an icon in
35 the top panel when using the Unity environment. It can be used to switch36 the top panel when using the Unity environment. It can be used to switch
3637
=== modified file 'lib/Makefile.am'
--- lib/Makefile.am 2014-02-19 16:10:54 +0000
+++ lib/Makefile.am 2014-03-19 23:26:13 +0000
@@ -10,6 +10,7 @@
10 source.vala \10 source.vala \
11 common.vala \11 common.vala \
12 ibus-menu.vala \12 ibus-menu.vala \
13 ibus-panel.vala \
13 window-stack.vala \14 window-stack.vala \
14 unity-greeter.vala15 unity-greeter.vala
15indicator_keyboard_service_VALAFLAGS = $(AM_VALAFLAGS) \16indicator_keyboard_service_VALAFLAGS = $(AM_VALAFLAGS) \
1617
=== added file 'lib/ibus-panel.vala'
--- lib/ibus-panel.vala 1970-01-01 00:00:00 +0000
+++ lib/ibus-panel.vala 2014-03-19 23:26:13 +0000
@@ -0,0 +1,26 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, version 3 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors: William Hua <william.hua@canonical.com>
17 */
18
19[DBus (name="com.canonical.IBus.Panel.Private")]
20public interface IBusPanel : Object {
21
22 public abstract void activate_property (string name, uint state) throws IOError;
23
24 public signal void properties_registered (Variant variant);
25 public signal void property_updated (Variant variant);
26}
027
=== modified file 'lib/main.vala'
--- lib/main.vala 2014-02-27 19:37:55 +0000
+++ lib/main.vala 2014-03-19 23:26:13 +0000
@@ -37,7 +37,8 @@
37 private uint focused_window_id;37 private uint focused_window_id;
3838
39 private IBus.Bus? ibus;39 private IBus.Bus? ibus;
40 private IBus.PanelService? panel_service;40 private IBusPanel? ibus_panel;
41 private ulong ibus_connected_id;
41 private uint panel_timeout;42 private uint panel_timeout;
4243
43 private Source[]? sources;44 private Source[]? sources;
@@ -132,6 +133,43 @@
132 }133 }
133134
134 [DBus (visible = false)]135 [DBus (visible = false)]
136 private IBusPanel? get_ibus_panel () {
137 if (ibus_panel == null && get_ibus ().is_connected ()) {
138 var connection = get_ibus ().get_connection ();
139 var name = "org.freedesktop.IBus.Panel";
140 var path = "/org/freedesktop/IBus/Panel";
141
142 try {
143 ibus_panel = connection.get_proxy_sync (name, path);
144
145 ((!) ibus_panel).properties_registered.connect ((variant) => {
146 var properties = new IBus.PropList ();
147 properties.deserialize (variant);
148
149 if (properties is IBus.PropList) {
150 handle_properties_registered ((!) (properties as IBus.PropList));
151 }
152 });
153 ((!) ibus_panel).property_updated.connect ((variant) => {
154 var type = IBus.PropType.NORMAL;
155 var state = IBus.PropState.INCONSISTENT;
156 var text = new IBus.Text.from_static_string ("");
157 var property = new IBus.Property ("", type, text, null, text, false, false, state, null);
158 property.deserialize (variant);
159
160 if (property is IBus.Property) {
161 handle_property_updated ((!) (property as IBus.Property));
162 }
163 });
164 } catch (IOError error) {
165 warning ("error: %s", error.message);
166 }
167 }
168
169 return ibus_panel;
170 }
171
172 [DBus (visible = false)]
135 public void up () {173 public void up () {
136 if (loop == null) {174 if (loop == null) {
137 loop = new MainLoop ();175 loop = new MainLoop ();
@@ -576,11 +614,12 @@
576 }614 }
577 }615 }
578616
579 if (panel_service == null && sources[i].is_ibus) {617 if (ibus_connected_id == 0 && sources[i].is_ibus) {
580 if (get_ibus ().request_name (IBus.SERVICE_PANEL, IBus.BusNameFlag.REPLACE_EXISTING) > 0) {618 ibus_connected_id = get_ibus ().connected.connect (() => { get_ibus_panel (); });
581 panel_service = new IBus.PanelService (get_ibus ().get_connection ());619 get_ibus ().disconnected.connect (() => { ibus_panel = null; });
582 ((!) panel_service).register_properties.connect (handle_registered_properties);620
583 ((!) panel_service).update_property.connect (handle_updated_property);621 if (get_ibus ().is_connected ()) {
622 get_ibus_panel ();
584 }623 }
585 }624 }
586 }625 }
@@ -590,7 +629,7 @@
590 }629 }
591630
592 [DBus (visible = false)]631 [DBus (visible = false)]
593 private void handle_registered_properties (IBus.PropList list) {632 private void handle_properties_registered (IBus.PropList list) {
594 if (panel_timeout > 0) {633 if (panel_timeout > 0) {
595 GLib.Source.remove (panel_timeout);634 GLib.Source.remove (panel_timeout);
596 panel_timeout = 0;635 panel_timeout = 0;
@@ -604,7 +643,7 @@
604 }643 }
605644
606 [DBus (visible = false)]645 [DBus (visible = false)]
607 private void handle_updated_property (IBus.Property property) {646 private void handle_property_updated (IBus.Property property) {
608 get_ibus_menu ().update_property (property);647 get_ibus_menu ().update_property (property);
609 }648 }
610649
@@ -747,8 +786,14 @@
747 if (ibus_menu == null) {786 if (ibus_menu == null) {
748 ibus_menu = new IBusMenu (get_action_group ());787 ibus_menu = new IBusMenu (get_action_group ());
749 ((!) ibus_menu).activate.connect ((property, state) => {788 ((!) ibus_menu).activate.connect ((property, state) => {
750 if (panel_service != null) {789 var panel = get_ibus_panel ();
751 ((!) panel_service).property_activate (property.key, state);790
791 if (panel != null) {
792 try {
793 ((!) panel).activate_property (property.key, state);
794 } catch (IOError error) {
795 warning ("error: %s", error.message);
796 }
752 }797 }
753 });798 });
754 }799 }
755800
=== modified file 'po/indicator-keyboard.pot'
--- po/indicator-keyboard.pot 2013-09-27 15:10:19 +0000
+++ po/indicator-keyboard.pot 2014-03-19 23:26:13 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: PACKAGE VERSION\n"9"Project-Id-Version: PACKAGE VERSION\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2013-09-27 16:28+0200\n"11"POT-Creation-Date: 2014-03-20 12:25+1300\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,19 +17,19 @@
17"Content-Type: text/plain; charset=CHARSET\n"17"Content-Type: text/plain; charset=CHARSET\n"
18"Content-Transfer-Encoding: 8bit\n"18"Content-Transfer-Encoding: 8bit\n"
1919
20#: ../lib/main.vala:42720#: ../lib/main.vala:667
21#, c-format21#, c-format
22msgid "%s input source"22msgid "%s input source"
23msgstr ""23msgstr ""
2424
25#: ../lib/main.vala:52525#: ../lib/main.vala:815
26msgid "Character Map"26msgid "Character Map"
27msgstr ""27msgstr ""
2828
29#: ../lib/main.vala:52629#: ../lib/main.vala:816
30msgid "Keyboard Layout Chart"30msgid "Keyboard Layout Chart"
31msgstr ""31msgstr ""
3232
33#: ../lib/main.vala:52733#: ../lib/main.vala:817
34msgid "Text Entry Settings..."34msgid "Text Entry Settings..."
35msgstr ""35msgstr ""

Subscribers

People subscribed via source and target branches

to all changes: