Merge lp:~attente/indicator-keyboard/1291962 into lp:indicator-keyboard
- 1291962
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | William Hua |
Proposed branch: | lp:~attente/indicator-keyboard/1291962 |
Merge into: | lp:indicator-keyboard |
Diff against target: |
705 lines (+281/-134) 11 files modified
.bzrignore (+3/-1) data/Makefile.am (+2/-2) debian/control (+1/-0) lib/Makefile.am (+7/-5) lib/ibus-menu.vala (+22/-23) lib/ibus-panel.vala (+26/-0) lib/indicator-menu.vala (+128/-0) lib/main.vala (+85/-98) po/POTFILES.in (+1/-0) po/POTFILES.skip (+1/-0) po/indicator-keyboard.pot (+5/-5) |
To merge this branch: | bzr merge lp:~attente/indicator-keyboard/1291962 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ted Gould (community) | Needs Information | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+212967@code.launchpad.net |
Commit message
Export separate menus for desktop and greeter.
Description of the change
Export separate menus for desktop and greeter.
PS Jenkins bot (ps-jenkins) wrote : | # |
- 320. By William Hua
-
Merge 1290881.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:320
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Ted Gould (ted) wrote : | # |
I think that this is wrong:
+Breaks: ibus (<< 1.5.5-1ubuntu3),
Will Ibus be broken or do we need a version of Ibus newer than that?
William Hua (attente) wrote : | # |
IBus won't be broken, but we want to prevent this version of indicator-keyboard to be unpacked if the IBus on the user's system doesn't have the patch introduced by 1.5.5-1ubuntu3. I think that's what the Breaks relationship does based on https:/
Sebastien Bacher (seb128) wrote : | # |
The other branch your merged in r320 landed to trunk, you might want to redo those changes based on trunk to have a diff easier to read (seems like some of the current one is from the other changes). One way to avoid that issue is to list the vcs you are based on/include as a prerequire (needs to resubmit the change though)
William Hua (attente) wrote : | # |
Ok, I can re-submit a new branch. I only merged those in because I expected there to be merge conflicts with those other branches.
William Hua (attente) wrote : | # |
Unmerged revisions
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2013-08-08 22:15:00 +0000 |
3 | +++ .bzrignore 2014-03-27 10:43:37 +0000 |
4 | @@ -29,6 +29,8 @@ |
5 | po/POTFILES |
6 | po/stamp-it |
7 | tests/config.vala |
8 | +tests/dconf-service |
9 | +tests/gvfs |
10 | tests/indicator-keyboard-test |
11 | tests/indicator-keyboard-test.trs |
12 | tests/indicator-keyboard-tests |
13 | @@ -39,4 +41,4 @@ |
14 | m4/lt~obsolete.m4 |
15 | m4/ltoptions.m4 |
16 | m4/ltsugar.m4 |
17 | -m4/ltversion.m4 |
18 | \ No newline at end of file |
19 | +m4/ltversion.m4 |
20 | |
21 | === modified file 'data/Makefile.am' |
22 | --- data/Makefile.am 2014-03-11 13:25:54 +0000 |
23 | +++ data/Makefile.am 2014-03-27 10:43:37 +0000 |
24 | @@ -54,10 +54,10 @@ |
25 | echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop'; \ |
26 | echo ''; \ |
27 | echo '[desktop_greeter]'; \ |
28 | - echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop'; \ |
29 | + echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop_greeter'; \ |
30 | echo ''; \ |
31 | echo '[desktop_lockscreen]'; \ |
32 | - echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop'; \ |
33 | + echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop_greeter'; \ |
34 | echo ''; \ |
35 | echo '[ubiquity]'; \ |
36 | echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop') > $@.tmp && \ |
37 | |
38 | === modified file 'debian/control' |
39 | --- debian/control 2013-11-22 16:44:45 +0000 |
40 | +++ debian/control 2014-03-27 10:43:37 +0000 |
41 | @@ -30,6 +30,7 @@ |
42 | Architecture: any |
43 | Depends: ${misc:Depends}, |
44 | ${shlibs:Depends}, |
45 | +Breaks: ibus (<< 1.5.5-1ubuntu3), |
46 | Description: Keyboard indicator |
47 | This package contains the keyboard indicator, which should show as an icon in |
48 | the top panel when using the Unity environment. It can be used to switch |
49 | |
50 | === modified file 'lib/Makefile.am' |
51 | --- lib/Makefile.am 2014-02-19 16:10:54 +0000 |
52 | +++ lib/Makefile.am 2014-03-27 10:43:37 +0000 |
53 | @@ -6,11 +6,13 @@ |
54 | --metadatadir $(top_srcdir)/deps \ |
55 | --vapidir $(top_srcdir)/deps |
56 | |
57 | -indicator_keyboard_service_SOURCES = main.vala \ |
58 | - source.vala \ |
59 | - common.vala \ |
60 | - ibus-menu.vala \ |
61 | - window-stack.vala \ |
62 | +indicator_keyboard_service_SOURCES = main.vala \ |
63 | + source.vala \ |
64 | + common.vala \ |
65 | + ibus-menu.vala \ |
66 | + ibus-panel.vala \ |
67 | + indicator-menu.vala \ |
68 | + window-stack.vala \ |
69 | unity-greeter.vala |
70 | indicator_keyboard_service_VALAFLAGS = $(AM_VALAFLAGS) \ |
71 | --pkg gee-1.0 \ |
72 | |
73 | === modified file 'lib/ibus-menu.vala' |
74 | --- lib/ibus-menu.vala 2014-02-20 03:59:24 +0000 |
75 | +++ lib/ibus-menu.vala 2014-03-27 10:43:37 +0000 |
76 | @@ -23,16 +23,16 @@ |
77 | private IBus.PropList? properties; |
78 | |
79 | private Menu menu; |
80 | - private SimpleActionGroup? action_group; |
81 | + private ActionMap? action_map; |
82 | |
83 | private string? radio_name; |
84 | private SimpleAction? radio_action; |
85 | private Gee.HashMap<string, IBus.Property> radio_properties; |
86 | |
87 | - // A list of the action names this menu registers |
88 | + /* A list of the action names this menu registers. */ |
89 | private Gee.LinkedList<string> names; |
90 | |
91 | - public IBusMenu (SimpleActionGroup? action_group = null, IBus.PropList? properties = null) { |
92 | + public IBusMenu (ActionMap? action_map = null, IBus.PropList? properties = null) { |
93 | menu = new Menu (); |
94 | |
95 | menu.items_changed.connect ((position, removed, added) => { |
96 | @@ -40,7 +40,7 @@ |
97 | }); |
98 | |
99 | names = new Gee.LinkedList<string> (); |
100 | - set_action_group (action_group); |
101 | + set_action_map (action_map); |
102 | set_properties (properties); |
103 | } |
104 | |
105 | @@ -72,12 +72,12 @@ |
106 | name = @"ibus-$key"; |
107 | } |
108 | |
109 | - // Find an unused action name using a counter |
110 | - if (action_group != null && (Action?) ((!) action_group).lookup_action (name) != null) { |
111 | + /* Find an unused action name using a counter. */ |
112 | + if (action_map != null && (Action?) ((!) action_map).lookup_action (name) != null) { |
113 | var i = 0; |
114 | var unique_name = @"$name-$i"; |
115 | |
116 | - while ((Action?) ((!) action_group).lookup_action (unique_name) != null) { |
117 | + while ((Action?) ((!) action_map).lookup_action (unique_name) != null) { |
118 | i++; |
119 | unique_name = @"$name-$i"; |
120 | } |
121 | @@ -107,10 +107,10 @@ |
122 | if ((string?) property.key != null) { |
123 | var name = get_action_name (property.key); |
124 | |
125 | - if (action_group != null) { |
126 | + if (action_map != null) { |
127 | var action = new SimpleAction (name, null); |
128 | action.activate.connect ((parameter) => { activate (property, property.state); }); |
129 | - ((!) action_group).add_action (action); |
130 | + ((!) action_map).add_action (action); |
131 | names.add (name); |
132 | } |
133 | |
134 | @@ -124,7 +124,7 @@ |
135 | if ((string?) property.key != null) { |
136 | var name = get_action_name (property.key); |
137 | |
138 | - if (action_group != null) { |
139 | + if (action_map != null) { |
140 | var state = new Variant.boolean (property.state == IBus.PropState.CHECKED); |
141 | var action = new SimpleAction.stateful (name, null, state); |
142 | |
143 | @@ -139,7 +139,7 @@ |
144 | } |
145 | }); |
146 | |
147 | - ((!) action_group).add_action (action); |
148 | + ((!) action_map).add_action (action); |
149 | names.add (name); |
150 | } |
151 | |
152 | @@ -151,8 +151,8 @@ |
153 | private void append_radio_property (IBus.Property property) { |
154 | if (property.prop_type == IBus.PropType.RADIO) { |
155 | if ((string?) property.key != null) { |
156 | - // Create a single action for all radio properties. |
157 | - if (action_group != null && radio_name == null) { |
158 | + /* Create a single action for all radio properties. */ |
159 | + if (action_map != null && radio_name == null) { |
160 | radio_counter++; |
161 | radio_name = @"-private-radio-$radio_counter"; |
162 | radio_action = new SimpleAction.stateful ((!) radio_name, VariantType.STRING, new Variant.string ("")); |
163 | @@ -172,7 +172,7 @@ |
164 | } |
165 | }); |
166 | |
167 | - ((!) action_group).add_action ((!) radio_action); |
168 | + ((!) action_map).add_action ((!) radio_action); |
169 | names.add ((!) radio_name); |
170 | } |
171 | |
172 | @@ -195,7 +195,7 @@ |
173 | |
174 | private void append_menu_property (IBus.Property property) { |
175 | if (property.prop_type == IBus.PropType.MENU) { |
176 | - var submenu = new IBusMenu (action_group, ((!) property).sub_props); |
177 | + var submenu = new IBusMenu (action_map, ((!) property).sub_props); |
178 | submenu.activate.connect ((property, state) => { activate (property, state); }); |
179 | menu.append_submenu (get_label (property), submenu); |
180 | } |
181 | @@ -227,8 +227,7 @@ |
182 | } |
183 | |
184 | private void update_menu () { |
185 | - // There's a reference cycle between the action group and the submenus. |
186 | - // We need to break it here so that those submenus aren't hanging around. |
187 | + /* Break reference cycle between action map and submenus. */ |
188 | for (var i = 0; i < menu.get_n_items (); i++) { |
189 | var submenu = menu.get_item_link (i, Menu.LINK_SUBMENU) as IBusMenu; |
190 | |
191 | @@ -250,19 +249,19 @@ |
192 | radio_action = null; |
193 | radio_name = null; |
194 | |
195 | - if (action_group != null) { |
196 | + if (action_map != null) { |
197 | foreach (var name in names) { |
198 | - ((!) action_group).remove_action (name); |
199 | + ((!) action_map).remove_action (name); |
200 | } |
201 | } |
202 | |
203 | names.clear (); |
204 | } |
205 | |
206 | - public void set_action_group (SimpleActionGroup? action_group) { |
207 | - if (action_group != this.action_group) { |
208 | + public void set_action_map (ActionMap? action_map) { |
209 | + if (action_map != this.action_map) { |
210 | remove_actions (); |
211 | - this.action_group = action_group; |
212 | + this.action_map = action_map; |
213 | update_menu (); |
214 | } |
215 | } |
216 | @@ -282,7 +281,7 @@ |
217 | update_menu (); |
218 | } |
219 | |
220 | - // Forward all menu model calls to our internal menu |
221 | + /* Forward all menu model calls to our internal menu. */ |
222 | |
223 | public override Variant get_item_attribute_value (int item_index, string attribute, VariantType? expected_type) { |
224 | return menu.get_item_attribute_value (item_index, attribute, expected_type); |
225 | |
226 | === added file 'lib/ibus-panel.vala' |
227 | --- lib/ibus-panel.vala 1970-01-01 00:00:00 +0000 |
228 | +++ lib/ibus-panel.vala 2014-03-27 10:43:37 +0000 |
229 | @@ -0,0 +1,26 @@ |
230 | +/* |
231 | + * Copyright 2014 Canonical Ltd. |
232 | + * |
233 | + * This program is free software: you can redistribute it and/or modify |
234 | + * it under the terms of the GNU General Public License as published by |
235 | + * the Free Software Foundation, version 3 of the License. |
236 | + * |
237 | + * This program is distributed in the hope that it will be useful, |
238 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
239 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
240 | + * GNU General Public License for more details. |
241 | + * |
242 | + * You should have received a copy of the GNU General Public License |
243 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
244 | + * |
245 | + * Authors: William Hua <william.hua@canonical.com> |
246 | + */ |
247 | + |
248 | +[DBus (name="com.canonical.IBus.Panel.Private")] |
249 | +public interface IBusPanel : Object { |
250 | + |
251 | + public abstract void activate_property (string name, uint state) throws IOError; |
252 | + |
253 | + public signal void properties_registered (Variant variant); |
254 | + public signal void property_updated (Variant variant); |
255 | +} |
256 | |
257 | === added file 'lib/indicator-menu.vala' |
258 | --- lib/indicator-menu.vala 1970-01-01 00:00:00 +0000 |
259 | +++ lib/indicator-menu.vala 2014-03-27 10:43:37 +0000 |
260 | @@ -0,0 +1,128 @@ |
261 | +/* |
262 | + * Copyright 2014 Canonical Ltd. |
263 | + * |
264 | + * This program is free software: you can redistribute it and/or modify |
265 | + * it under the terms of the GNU General Public License as published by |
266 | + * the Free Software Foundation, version 3 of the License. |
267 | + * |
268 | + * This program is distributed in the hope that it will be useful, |
269 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
270 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
271 | + * GNU General Public License for more details. |
272 | + * |
273 | + * You should have received a copy of the GNU General Public License |
274 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
275 | + * |
276 | + * Authors: William Hua <william.hua@canonical.com> |
277 | + */ |
278 | + |
279 | +public class Indicator.Keyboard.IndicatorMenu : MenuModel { |
280 | + |
281 | + public enum Options { |
282 | + NONE = 0x0, |
283 | + IBUS = 0x1, |
284 | + SETTINGS = 0x2 |
285 | + } |
286 | + |
287 | + private Options options; |
288 | + |
289 | + private Menu indicator_menu; |
290 | + private Menu sources_section; |
291 | + private IBusMenu properties_section; |
292 | + |
293 | + public IndicatorMenu (ActionMap? action_map = null, Options options = Options.IBUS | Options.SETTINGS) { |
294 | + var submenu = new Menu (); |
295 | + |
296 | + sources_section = new Menu (); |
297 | + submenu.append_section (null, sources_section); |
298 | + |
299 | + if ((options & Options.IBUS) != Options.NONE) { |
300 | + properties_section = new IBusMenu (action_map); |
301 | + properties_section.activate.connect ((property, state) => { activate (property, state); }); |
302 | + submenu.append_section (null, properties_section); |
303 | + } |
304 | + |
305 | + if ((options & Options.SETTINGS) != Options.NONE) { |
306 | + var settings_section = new Menu (); |
307 | + settings_section.append (_ ("Character Map"), "indicator.map"); |
308 | + settings_section.append (_ ("Keyboard Layout Chart"), "indicator.chart"); |
309 | + settings_section.append (_ ("Text Entry Settings..."), "indicator.settings"); |
310 | + submenu.append_section (null, settings_section); |
311 | + } |
312 | + |
313 | + var indicator = new MenuItem.submenu (null, submenu); |
314 | + indicator.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root"); |
315 | + indicator.set_attribute ("x-canonical-secondary-action", "s", "indicator.next"); |
316 | + indicator.set_attribute ("x-canonical-scroll-action", "s", "indicator.scroll"); |
317 | + indicator.set_detailed_action ("indicator.indicator"); |
318 | + |
319 | + indicator_menu = new Menu (); |
320 | + indicator_menu.append_item (indicator); |
321 | + |
322 | + this.options = options; |
323 | + } |
324 | + |
325 | + public signal void activate (IBus.Property property, IBus.PropState state); |
326 | + |
327 | + public void set_sources (Source[] sources) { |
328 | + sources_section.remove_all (); |
329 | + |
330 | + for (var i = 0; i < sources.length; i++) { |
331 | + if (!sources[i].is_ibus || (options & Options.IBUS) != Options.NONE) { |
332 | + var item = new MenuItem (sources[i].name, "indicator.current"); |
333 | + |
334 | + item.set_attribute (Menu.ATTRIBUTE_TARGET, "u", i); |
335 | + |
336 | + if (sources[i].icon != null) { |
337 | + item.set_icon ((!) sources[i].icon); |
338 | + } |
339 | + |
340 | + sources_section.append_item (item); |
341 | + } |
342 | + } |
343 | + } |
344 | + |
345 | + public void set_properties (IBus.PropList properties) { |
346 | + if ((options & Options.IBUS) != Options.NONE) { |
347 | + properties_section.set_properties (properties); |
348 | + } |
349 | + } |
350 | + |
351 | + public void update_property (IBus.Property property) { |
352 | + if ((options & Options.IBUS) != Options.NONE) { |
353 | + properties_section.update_property (property); |
354 | + } |
355 | + } |
356 | + |
357 | + public override bool is_mutable () { |
358 | + return indicator_menu.is_mutable (); |
359 | + } |
360 | + |
361 | + public override int get_n_items () { |
362 | + return indicator_menu.get_n_items (); |
363 | + } |
364 | + |
365 | + public override void get_item_attributes (int item_index, out HashTable<string, Variant>? attributes) { |
366 | + indicator_menu.get_item_attributes (item_index, out attributes); |
367 | + } |
368 | + |
369 | + public override void get_item_links (int item_index, out HashTable<string, MenuModel>? links) { |
370 | + indicator_menu.get_item_links (item_index, out links); |
371 | + } |
372 | + |
373 | + public override Variant get_item_attribute_value (int item_index, string attribute, VariantType? expected_type) { |
374 | + return indicator_menu.get_item_attribute_value (item_index, attribute, expected_type); |
375 | + } |
376 | + |
377 | + public override MenuModel get_item_link (int item_index, string link) { |
378 | + return indicator_menu.get_item_link (item_index, link); |
379 | + } |
380 | + |
381 | + public override MenuAttributeIter iterate_item_attributes (int item_index) { |
382 | + return indicator_menu.iterate_item_attributes (item_index); |
383 | + } |
384 | + |
385 | + public override MenuLinkIter iterate_item_links (int item_index) { |
386 | + return indicator_menu.iterate_item_links (item_index); |
387 | + } |
388 | +} |
389 | |
390 | === modified file 'lib/main.vala' |
391 | --- lib/main.vala 2014-02-27 19:37:55 +0000 |
392 | +++ lib/main.vala 2014-03-27 10:43:37 +0000 |
393 | @@ -37,16 +37,16 @@ |
394 | private uint focused_window_id; |
395 | |
396 | private IBus.Bus? ibus; |
397 | - private IBus.PanelService? panel_service; |
398 | + private IBusPanel? ibus_panel; |
399 | + private ulong ibus_connected_id; |
400 | private uint panel_timeout; |
401 | |
402 | private Source[]? sources; |
403 | |
404 | private SimpleActionGroup? action_group; |
405 | private SimpleAction? indicator_action; |
406 | - private MenuModel? menu_model; |
407 | - private Menu? sources_menu; |
408 | - private IBusMenu? ibus_menu; |
409 | + private IndicatorMenu? desktop_menu; |
410 | + private IndicatorMenu? desktop_greeter_menu; |
411 | |
412 | private UnityGreeter? unity_greeter; |
413 | private string? greeter_user; |
414 | @@ -70,8 +70,12 @@ |
415 | } |
416 | } |
417 | |
418 | - if (sources_menu != null) { |
419 | - update_sources_menu (); |
420 | + if (desktop_menu != null) { |
421 | + get_desktop_menu ().set_sources (get_sources ()); |
422 | + } |
423 | + |
424 | + if (desktop_greeter_menu != null) { |
425 | + get_desktop_greeter_menu ().set_sources (get_sources ()); |
426 | } |
427 | |
428 | if (indicator_action != null) { |
429 | @@ -132,6 +136,43 @@ |
430 | } |
431 | |
432 | [DBus (visible = false)] |
433 | + private IBusPanel? get_ibus_panel () { |
434 | + if (ibus_panel == null && get_ibus ().is_connected ()) { |
435 | + var connection = get_ibus ().get_connection (); |
436 | + var name = "org.freedesktop.IBus.Panel"; |
437 | + var path = "/org/freedesktop/IBus/Panel"; |
438 | + |
439 | + try { |
440 | + ibus_panel = connection.get_proxy_sync (name, path); |
441 | + |
442 | + ((!) ibus_panel).properties_registered.connect ((variant) => { |
443 | + var properties = new IBus.PropList (); |
444 | + properties.deserialize (variant); |
445 | + |
446 | + if (properties is IBus.PropList) { |
447 | + handle_properties_registered ((!) (properties as IBus.PropList)); |
448 | + } |
449 | + }); |
450 | + ((!) ibus_panel).property_updated.connect ((variant) => { |
451 | + var type = IBus.PropType.NORMAL; |
452 | + var state = IBus.PropState.INCONSISTENT; |
453 | + var text = new IBus.Text.from_static_string (""); |
454 | + var property = new IBus.Property ("", type, text, null, text, false, false, state, null); |
455 | + property.deserialize (variant); |
456 | + |
457 | + if (property is IBus.Property) { |
458 | + handle_property_updated ((!) (property as IBus.Property)); |
459 | + } |
460 | + }); |
461 | + } catch (IOError error) { |
462 | + warning ("error: %s", error.message); |
463 | + } |
464 | + } |
465 | + |
466 | + return ibus_panel; |
467 | + } |
468 | + |
469 | + [DBus (visible = false)] |
470 | public void up () { |
471 | if (loop == null) { |
472 | loop = new MainLoop (); |
473 | @@ -576,11 +617,12 @@ |
474 | } |
475 | } |
476 | |
477 | - if (panel_service == null && sources[i].is_ibus) { |
478 | - if (get_ibus ().request_name (IBus.SERVICE_PANEL, IBus.BusNameFlag.REPLACE_EXISTING) > 0) { |
479 | - panel_service = new IBus.PanelService (get_ibus ().get_connection ()); |
480 | - ((!) panel_service).register_properties.connect (handle_registered_properties); |
481 | - ((!) panel_service).update_property.connect (handle_updated_property); |
482 | + if (ibus_connected_id == 0 && sources[i].is_ibus) { |
483 | + ibus_connected_id = get_ibus ().connected.connect (() => { get_ibus_panel (); }); |
484 | + get_ibus ().disconnected.connect (() => { ibus_panel = null; }); |
485 | + |
486 | + if (get_ibus ().is_connected ()) { |
487 | + get_ibus_panel (); |
488 | } |
489 | } |
490 | } |
491 | @@ -590,22 +632,22 @@ |
492 | } |
493 | |
494 | [DBus (visible = false)] |
495 | - private void handle_registered_properties (IBus.PropList list) { |
496 | + private void handle_properties_registered (IBus.PropList list) { |
497 | if (panel_timeout > 0) { |
498 | GLib.Source.remove (panel_timeout); |
499 | panel_timeout = 0; |
500 | } |
501 | |
502 | panel_timeout = Timeout.add (PROPERTIES_DELAY, () => { |
503 | - update_ibus_menu (list); |
504 | + get_desktop_menu ().set_properties (list); |
505 | panel_timeout = 0; |
506 | return false; |
507 | }); |
508 | } |
509 | |
510 | [DBus (visible = false)] |
511 | - private void handle_updated_property (IBus.Property property) { |
512 | - get_ibus_menu ().update_property (property); |
513 | + private void handle_property_updated (IBus.Property property) { |
514 | + get_desktop_menu ().update_property (property); |
515 | } |
516 | |
517 | [DBus (visible = false)] |
518 | @@ -705,91 +747,34 @@ |
519 | } |
520 | |
521 | [DBus (visible = false)] |
522 | - private void update_sources_menu () { |
523 | - if (sources_menu != null) { |
524 | - var menu = get_sources_menu (); |
525 | - menu.remove_all (); |
526 | - |
527 | - var sources = get_sources (); |
528 | - for (var i = 0; i < sources.length; i++) { |
529 | - var item = new MenuItem (sources[i].name, "indicator.current"); |
530 | - item.set_attribute (Menu.ATTRIBUTE_TARGET, "u", i); |
531 | - |
532 | - var icon = sources[i].icon; |
533 | - if (icon != null) { |
534 | - item.set_icon ((!) icon); |
535 | - } |
536 | - |
537 | - menu.append_item (item); |
538 | - } |
539 | - } else { |
540 | - get_sources_menu (); |
541 | - } |
542 | - } |
543 | - |
544 | - [DBus (visible = false)] |
545 | - private Menu get_sources_menu () { |
546 | - if (sources_menu == null) { |
547 | - sources_menu = new Menu (); |
548 | - update_sources_menu (); |
549 | - } |
550 | - |
551 | - return (!) sources_menu; |
552 | - } |
553 | - |
554 | - [DBus (visible = false)] |
555 | - private void update_ibus_menu (IBus.PropList list) { |
556 | - get_ibus_menu ().set_properties (list); |
557 | - } |
558 | - |
559 | - [DBus (visible = false)] |
560 | - private IBusMenu get_ibus_menu () { |
561 | - if (ibus_menu == null) { |
562 | - ibus_menu = new IBusMenu (get_action_group ()); |
563 | - ((!) ibus_menu).activate.connect ((property, state) => { |
564 | - if (panel_service != null) { |
565 | - ((!) panel_service).property_activate (property.key, state); |
566 | + public IndicatorMenu get_desktop_menu () { |
567 | + if (desktop_menu == null) { |
568 | + desktop_menu = new IndicatorMenu (get_action_group ()); |
569 | + ((!) desktop_menu).set_sources (get_sources ()); |
570 | + ((!) desktop_menu).activate.connect ((property, state) => { |
571 | + var panel = get_ibus_panel (); |
572 | + |
573 | + if (panel != null) { |
574 | + try { |
575 | + ((!) panel).activate_property (property.key, state); |
576 | + } catch (IOError error) { |
577 | + warning ("error: %s", error.message); |
578 | + } |
579 | } |
580 | }); |
581 | } |
582 | |
583 | - return (!) ibus_menu; |
584 | - } |
585 | - |
586 | - [DBus (visible = false)] |
587 | - protected virtual MenuModel create_menu_model (MenuModel sources_menu, MenuModel ibus_menu) { |
588 | - var menu = new Menu (); |
589 | - |
590 | - var submenu = new Menu (); |
591 | - |
592 | - submenu.append_section (null, sources_menu); |
593 | - submenu.append_section (null, ibus_menu); |
594 | - |
595 | - if (!is_login_user ()) { |
596 | - var section = new Menu (); |
597 | - section.append (_ ("Character Map"), "indicator.map"); |
598 | - section.append (_ ("Keyboard Layout Chart"), "indicator.chart"); |
599 | - section.append (_ ("Text Entry Settings..."), "indicator.settings"); |
600 | - submenu.append_section (null, section); |
601 | - } |
602 | - |
603 | - var indicator = new MenuItem.submenu ("x", submenu); |
604 | - indicator.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root"); |
605 | - indicator.set_attribute ("x-canonical-secondary-action", "s", "indicator.next"); |
606 | - indicator.set_attribute ("x-canonical-scroll-action", "s", "indicator.scroll"); |
607 | - indicator.set_detailed_action ("indicator.indicator"); |
608 | - menu.append_item (indicator); |
609 | - |
610 | - return menu; |
611 | - } |
612 | - |
613 | - [DBus (visible = false)] |
614 | - public MenuModel get_menu_model () { |
615 | - if (menu_model == null) { |
616 | - menu_model = create_menu_model (get_sources_menu (), get_ibus_menu ()); |
617 | - } |
618 | - |
619 | - return (!) menu_model; |
620 | + return (!) desktop_menu; |
621 | + } |
622 | + |
623 | + [DBus (visible = false)] |
624 | + public IndicatorMenu get_desktop_greeter_menu () { |
625 | + if (desktop_greeter_menu == null) { |
626 | + desktop_greeter_menu = new IndicatorMenu (get_action_group (), IndicatorMenu.Options.NONE); |
627 | + ((!) desktop_greeter_menu).set_sources (get_sources ()); |
628 | + } |
629 | + |
630 | + return (!) desktop_greeter_menu; |
631 | } |
632 | |
633 | [DBus (visible = false)] |
634 | @@ -807,7 +792,8 @@ |
635 | private void handle_changed_sources (string key) { |
636 | sources = null; |
637 | |
638 | - update_sources_menu (); |
639 | + get_desktop_menu ().set_sources (get_sources ()); |
640 | + get_desktop_greeter_menu ().set_sources (get_sources ()); |
641 | update_indicator_action (); |
642 | update_login_layout (); |
643 | } |
644 | @@ -897,7 +883,8 @@ |
645 | private void handle_bus_acquired (DBusConnection connection, string name) { |
646 | try { |
647 | connection.export_action_group ("/com/canonical/indicator/keyboard", get_action_group ()); |
648 | - connection.export_menu_model ("/com/canonical/indicator/keyboard/desktop", get_menu_model ()); |
649 | + connection.export_menu_model ("/com/canonical/indicator/keyboard/desktop", get_desktop_menu ()); |
650 | + connection.export_menu_model ("/com/canonical/indicator/keyboard/desktop_greeter", get_desktop_greeter_menu ()); |
651 | } catch (Error error) { |
652 | warning ("error: %s", error.message); |
653 | } |
654 | |
655 | === modified file 'po/POTFILES.in' |
656 | --- po/POTFILES.in 2013-09-27 15:10:19 +0000 |
657 | +++ po/POTFILES.in 2014-03-27 10:43:37 +0000 |
658 | @@ -1,2 +1,3 @@ |
659 | # List of source files which contain translatable strings. |
660 | lib/main.vala |
661 | +lib/indicator-menu.vala |
662 | |
663 | === modified file 'po/POTFILES.skip' |
664 | --- po/POTFILES.skip 2013-09-27 15:10:19 +0000 |
665 | +++ po/POTFILES.skip 2014-03-27 10:43:37 +0000 |
666 | @@ -1,1 +1,2 @@ |
667 | lib/main.c |
668 | +lib/indicator-menu.c |
669 | |
670 | === modified file 'po/indicator-keyboard.pot' |
671 | --- po/indicator-keyboard.pot 2013-09-27 15:10:19 +0000 |
672 | +++ po/indicator-keyboard.pot 2014-03-27 10:43:37 +0000 |
673 | @@ -8,7 +8,7 @@ |
674 | msgstr "" |
675 | "Project-Id-Version: PACKAGE VERSION\n" |
676 | "Report-Msgid-Bugs-To: \n" |
677 | -"POT-Creation-Date: 2013-09-27 16:28+0200\n" |
678 | +"POT-Creation-Date: 2014-03-27 23:39+1300\n" |
679 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
680 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
681 | "Language-Team: LANGUAGE <LL@li.org>\n" |
682 | @@ -17,19 +17,19 @@ |
683 | "Content-Type: text/plain; charset=CHARSET\n" |
684 | "Content-Transfer-Encoding: 8bit\n" |
685 | |
686 | -#: ../lib/main.vala:427 |
687 | +#: ../lib/main.vala:670 |
688 | #, c-format |
689 | msgid "%s input source" |
690 | msgstr "" |
691 | |
692 | -#: ../lib/main.vala:525 |
693 | +#: ../lib/indicator-menu.vala:47 |
694 | msgid "Character Map" |
695 | msgstr "" |
696 | |
697 | -#: ../lib/main.vala:526 |
698 | +#: ../lib/indicator-menu.vala:48 |
699 | msgid "Keyboard Layout Chart" |
700 | msgstr "" |
701 | |
702 | -#: ../lib/main.vala:527 |
703 | +#: ../lib/indicator-menu.vala:49 |
704 | msgid "Text Entry Settings..." |
705 | msgstr "" |
PASSED: Continuous integration, rev:319 jenkins. qa.ubuntu. com/job/ indicator- keyboard- ci/53/ jenkins. qa.ubuntu. com/job/ indicator- keyboard- trusty- amd64-ci/ 20 jenkins. qa.ubuntu. com/job/ indicator- keyboard- trusty- armhf-ci/ 20 jenkins. qa.ubuntu. com/job/ indicator- keyboard- trusty- armhf-ci/ 20/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/indicator- keyboard- ci/53/rebuild
http://