Merge lp:~attente/indicator-keyboard/1291962-2 into lp:indicator-keyboard
- 1291962-2
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 337 |
Proposed branch: | lp:~attente/indicator-keyboard/1291962-2 |
Merge into: | lp:indicator-keyboard |
Diff against target: |
591 lines (+205/-127) 9 files modified
.bzrignore (+3/-1) data/Makefile.am (+2/-2) lib/Makefile.am (+7/-6) lib/ibus-menu.vala (+22/-23) lib/indicator-menu.vala (+128/-0) lib/main.vala (+36/-90) 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-2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Sebastien Bacher | Needs Fixing | ||
Ted Gould (community) | Approve | ||
Review via email: mp+213346@code.launchpad.net |
Commit message
Export separate menus for desktop and greeter.
Description of the change
Export separate menus for desktop and greeter.
(Re-submission of https:/
PS Jenkins bot (ps-jenkins) wrote : | # |
Ted Gould (ted) wrote : | # |
Small thing, need to change the "..." to a "…" in "Text Entry Settings..." Marking approved on the review but not top-approving.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:322
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Sebastien Bacher (seb128) wrote : | # |
While Ted's comment makes sense, could you revert it? That's a string change which would invalidate the translations, the i18n team said that would be better be done next cycle to avoid regression on some locales for the release.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:323
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Sebastien Bacher (seb128) wrote : | # |
trying to put that under CI train the build failed with
" VALAC indicator_
main.vala:
if (sources_menu != null) {
main.vala:
update_
- 324. By William Hua
-
Merge trunk fixing conflicts.
William Hua (attente) wrote : | # |
Sorry... it's the same bad merge.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:324
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2013-08-08 22:15:00 +0000 | |||
3 | +++ .bzrignore 2014-04-08 19:41:04 +0000 | |||
4 | @@ -29,6 +29,8 @@ | |||
5 | 29 | po/POTFILES | 29 | po/POTFILES |
6 | 30 | po/stamp-it | 30 | po/stamp-it |
7 | 31 | tests/config.vala | 31 | tests/config.vala |
8 | 32 | tests/dconf-service | ||
9 | 33 | tests/gvfs | ||
10 | 32 | tests/indicator-keyboard-test | 34 | tests/indicator-keyboard-test |
11 | 33 | tests/indicator-keyboard-test.trs | 35 | tests/indicator-keyboard-test.trs |
12 | 34 | tests/indicator-keyboard-tests | 36 | tests/indicator-keyboard-tests |
13 | @@ -39,4 +41,4 @@ | |||
14 | 39 | m4/lt~obsolete.m4 | 41 | m4/lt~obsolete.m4 |
15 | 40 | m4/ltoptions.m4 | 42 | m4/ltoptions.m4 |
16 | 41 | m4/ltsugar.m4 | 43 | m4/ltsugar.m4 |
17 | 42 | m4/ltversion.m4 | ||
18 | 43 | \ No newline at end of file | 44 | \ No newline at end of file |
19 | 45 | m4/ltversion.m4 | ||
20 | 44 | 46 | ||
21 | === modified file 'data/Makefile.am' | |||
22 | --- data/Makefile.am 2014-03-11 13:25:54 +0000 | |||
23 | +++ data/Makefile.am 2014-04-08 19:41:04 +0000 | |||
24 | @@ -54,10 +54,10 @@ | |||
25 | 54 | echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop'; \ | 54 | echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop'; \ |
26 | 55 | echo ''; \ | 55 | echo ''; \ |
27 | 56 | echo '[desktop_greeter]'; \ | 56 | echo '[desktop_greeter]'; \ |
29 | 57 | echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop'; \ | 57 | echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop_greeter'; \ |
30 | 58 | echo ''; \ | 58 | echo ''; \ |
31 | 59 | echo '[desktop_lockscreen]'; \ | 59 | echo '[desktop_lockscreen]'; \ |
33 | 60 | echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop'; \ | 60 | echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop_greeter'; \ |
34 | 61 | echo ''; \ | 61 | echo ''; \ |
35 | 62 | echo '[ubiquity]'; \ | 62 | echo '[ubiquity]'; \ |
36 | 63 | echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop') > $@.tmp && \ | 63 | echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop') > $@.tmp && \ |
37 | 64 | 64 | ||
38 | === modified file 'lib/Makefile.am' | |||
39 | --- lib/Makefile.am 2014-03-19 03:32:18 +0000 | |||
40 | +++ lib/Makefile.am 2014-04-08 19:41:04 +0000 | |||
41 | @@ -6,12 +6,13 @@ | |||
42 | 6 | --metadatadir $(top_srcdir)/deps \ | 6 | --metadatadir $(top_srcdir)/deps \ |
43 | 7 | --vapidir $(top_srcdir)/deps | 7 | --vapidir $(top_srcdir)/deps |
44 | 8 | 8 | ||
51 | 9 | indicator_keyboard_service_SOURCES = main.vala \ | 9 | indicator_keyboard_service_SOURCES = main.vala \ |
52 | 10 | source.vala \ | 10 | source.vala \ |
53 | 11 | common.vala \ | 11 | common.vala \ |
54 | 12 | ibus-menu.vala \ | 12 | ibus-menu.vala \ |
55 | 13 | ibus-panel.vala \ | 13 | ibus-panel.vala \ |
56 | 14 | window-stack.vala \ | 14 | indicator-menu.vala \ |
57 | 15 | window-stack.vala \ | ||
58 | 15 | unity-greeter.vala | 16 | unity-greeter.vala |
59 | 16 | indicator_keyboard_service_VALAFLAGS = $(AM_VALAFLAGS) \ | 17 | indicator_keyboard_service_VALAFLAGS = $(AM_VALAFLAGS) \ |
60 | 17 | --pkg gee-1.0 \ | 18 | --pkg gee-1.0 \ |
61 | 18 | 19 | ||
62 | === modified file 'lib/ibus-menu.vala' | |||
63 | --- lib/ibus-menu.vala 2014-02-20 03:59:24 +0000 | |||
64 | +++ lib/ibus-menu.vala 2014-04-08 19:41:04 +0000 | |||
65 | @@ -23,16 +23,16 @@ | |||
66 | 23 | private IBus.PropList? properties; | 23 | private IBus.PropList? properties; |
67 | 24 | 24 | ||
68 | 25 | private Menu menu; | 25 | private Menu menu; |
70 | 26 | private SimpleActionGroup? action_group; | 26 | private ActionMap? action_map; |
71 | 27 | 27 | ||
72 | 28 | private string? radio_name; | 28 | private string? radio_name; |
73 | 29 | private SimpleAction? radio_action; | 29 | private SimpleAction? radio_action; |
74 | 30 | private Gee.HashMap<string, IBus.Property> radio_properties; | 30 | private Gee.HashMap<string, IBus.Property> radio_properties; |
75 | 31 | 31 | ||
77 | 32 | // A list of the action names this menu registers | 32 | /* A list of the action names this menu registers. */ |
78 | 33 | private Gee.LinkedList<string> names; | 33 | private Gee.LinkedList<string> names; |
79 | 34 | 34 | ||
81 | 35 | public IBusMenu (SimpleActionGroup? action_group = null, IBus.PropList? properties = null) { | 35 | public IBusMenu (ActionMap? action_map = null, IBus.PropList? properties = null) { |
82 | 36 | menu = new Menu (); | 36 | menu = new Menu (); |
83 | 37 | 37 | ||
84 | 38 | menu.items_changed.connect ((position, removed, added) => { | 38 | menu.items_changed.connect ((position, removed, added) => { |
85 | @@ -40,7 +40,7 @@ | |||
86 | 40 | }); | 40 | }); |
87 | 41 | 41 | ||
88 | 42 | names = new Gee.LinkedList<string> (); | 42 | names = new Gee.LinkedList<string> (); |
90 | 43 | set_action_group (action_group); | 43 | set_action_map (action_map); |
91 | 44 | set_properties (properties); | 44 | set_properties (properties); |
92 | 45 | } | 45 | } |
93 | 46 | 46 | ||
94 | @@ -72,12 +72,12 @@ | |||
95 | 72 | name = @"ibus-$key"; | 72 | name = @"ibus-$key"; |
96 | 73 | } | 73 | } |
97 | 74 | 74 | ||
100 | 75 | // Find an unused action name using a counter | 75 | /* Find an unused action name using a counter. */ |
101 | 76 | if (action_group != null && (Action?) ((!) action_group).lookup_action (name) != null) { | 76 | if (action_map != null && (Action?) ((!) action_map).lookup_action (name) != null) { |
102 | 77 | var i = 0; | 77 | var i = 0; |
103 | 78 | var unique_name = @"$name-$i"; | 78 | var unique_name = @"$name-$i"; |
104 | 79 | 79 | ||
106 | 80 | while ((Action?) ((!) action_group).lookup_action (unique_name) != null) { | 80 | while ((Action?) ((!) action_map).lookup_action (unique_name) != null) { |
107 | 81 | i++; | 81 | i++; |
108 | 82 | unique_name = @"$name-$i"; | 82 | unique_name = @"$name-$i"; |
109 | 83 | } | 83 | } |
110 | @@ -107,10 +107,10 @@ | |||
111 | 107 | if ((string?) property.key != null) { | 107 | if ((string?) property.key != null) { |
112 | 108 | var name = get_action_name (property.key); | 108 | var name = get_action_name (property.key); |
113 | 109 | 109 | ||
115 | 110 | if (action_group != null) { | 110 | if (action_map != null) { |
116 | 111 | var action = new SimpleAction (name, null); | 111 | var action = new SimpleAction (name, null); |
117 | 112 | action.activate.connect ((parameter) => { activate (property, property.state); }); | 112 | action.activate.connect ((parameter) => { activate (property, property.state); }); |
119 | 113 | ((!) action_group).add_action (action); | 113 | ((!) action_map).add_action (action); |
120 | 114 | names.add (name); | 114 | names.add (name); |
121 | 115 | } | 115 | } |
122 | 116 | 116 | ||
123 | @@ -124,7 +124,7 @@ | |||
124 | 124 | if ((string?) property.key != null) { | 124 | if ((string?) property.key != null) { |
125 | 125 | var name = get_action_name (property.key); | 125 | var name = get_action_name (property.key); |
126 | 126 | 126 | ||
128 | 127 | if (action_group != null) { | 127 | if (action_map != null) { |
129 | 128 | var state = new Variant.boolean (property.state == IBus.PropState.CHECKED); | 128 | var state = new Variant.boolean (property.state == IBus.PropState.CHECKED); |
130 | 129 | var action = new SimpleAction.stateful (name, null, state); | 129 | var action = new SimpleAction.stateful (name, null, state); |
131 | 130 | 130 | ||
132 | @@ -139,7 +139,7 @@ | |||
133 | 139 | } | 139 | } |
134 | 140 | }); | 140 | }); |
135 | 141 | 141 | ||
137 | 142 | ((!) action_group).add_action (action); | 142 | ((!) action_map).add_action (action); |
138 | 143 | names.add (name); | 143 | names.add (name); |
139 | 144 | } | 144 | } |
140 | 145 | 145 | ||
141 | @@ -151,8 +151,8 @@ | |||
142 | 151 | private void append_radio_property (IBus.Property property) { | 151 | private void append_radio_property (IBus.Property property) { |
143 | 152 | if (property.prop_type == IBus.PropType.RADIO) { | 152 | if (property.prop_type == IBus.PropType.RADIO) { |
144 | 153 | if ((string?) property.key != null) { | 153 | if ((string?) property.key != null) { |
147 | 154 | // Create a single action for all radio properties. | 154 | /* Create a single action for all radio properties. */ |
148 | 155 | if (action_group != null && radio_name == null) { | 155 | if (action_map != null && radio_name == null) { |
149 | 156 | radio_counter++; | 156 | radio_counter++; |
150 | 157 | radio_name = @"-private-radio-$radio_counter"; | 157 | radio_name = @"-private-radio-$radio_counter"; |
151 | 158 | radio_action = new SimpleAction.stateful ((!) radio_name, VariantType.STRING, new Variant.string ("")); | 158 | radio_action = new SimpleAction.stateful ((!) radio_name, VariantType.STRING, new Variant.string ("")); |
152 | @@ -172,7 +172,7 @@ | |||
153 | 172 | } | 172 | } |
154 | 173 | }); | 173 | }); |
155 | 174 | 174 | ||
157 | 175 | ((!) action_group).add_action ((!) radio_action); | 175 | ((!) action_map).add_action ((!) radio_action); |
158 | 176 | names.add ((!) radio_name); | 176 | names.add ((!) radio_name); |
159 | 177 | } | 177 | } |
160 | 178 | 178 | ||
161 | @@ -195,7 +195,7 @@ | |||
162 | 195 | 195 | ||
163 | 196 | private void append_menu_property (IBus.Property property) { | 196 | private void append_menu_property (IBus.Property property) { |
164 | 197 | if (property.prop_type == IBus.PropType.MENU) { | 197 | if (property.prop_type == IBus.PropType.MENU) { |
166 | 198 | var submenu = new IBusMenu (action_group, ((!) property).sub_props); | 198 | var submenu = new IBusMenu (action_map, ((!) property).sub_props); |
167 | 199 | submenu.activate.connect ((property, state) => { activate (property, state); }); | 199 | submenu.activate.connect ((property, state) => { activate (property, state); }); |
168 | 200 | menu.append_submenu (get_label (property), submenu); | 200 | menu.append_submenu (get_label (property), submenu); |
169 | 201 | } | 201 | } |
170 | @@ -227,8 +227,7 @@ | |||
171 | 227 | } | 227 | } |
172 | 228 | 228 | ||
173 | 229 | private void update_menu () { | 229 | private void update_menu () { |
176 | 230 | // There's a reference cycle between the action group and the submenus. | 230 | /* Break reference cycle between action map and submenus. */ |
175 | 231 | // We need to break it here so that those submenus aren't hanging around. | ||
177 | 232 | for (var i = 0; i < menu.get_n_items (); i++) { | 231 | for (var i = 0; i < menu.get_n_items (); i++) { |
178 | 233 | var submenu = menu.get_item_link (i, Menu.LINK_SUBMENU) as IBusMenu; | 232 | var submenu = menu.get_item_link (i, Menu.LINK_SUBMENU) as IBusMenu; |
179 | 234 | 233 | ||
180 | @@ -250,19 +249,19 @@ | |||
181 | 250 | radio_action = null; | 249 | radio_action = null; |
182 | 251 | radio_name = null; | 250 | radio_name = null; |
183 | 252 | 251 | ||
185 | 253 | if (action_group != null) { | 252 | if (action_map != null) { |
186 | 254 | foreach (var name in names) { | 253 | foreach (var name in names) { |
188 | 255 | ((!) action_group).remove_action (name); | 254 | ((!) action_map).remove_action (name); |
189 | 256 | } | 255 | } |
190 | 257 | } | 256 | } |
191 | 258 | 257 | ||
192 | 259 | names.clear (); | 258 | names.clear (); |
193 | 260 | } | 259 | } |
194 | 261 | 260 | ||
197 | 262 | public void set_action_group (SimpleActionGroup? action_group) { | 261 | public void set_action_map (ActionMap? action_map) { |
198 | 263 | if (action_group != this.action_group) { | 262 | if (action_map != this.action_map) { |
199 | 264 | remove_actions (); | 263 | remove_actions (); |
201 | 265 | this.action_group = action_group; | 264 | this.action_map = action_map; |
202 | 266 | update_menu (); | 265 | update_menu (); |
203 | 267 | } | 266 | } |
204 | 268 | } | 267 | } |
205 | @@ -282,7 +281,7 @@ | |||
206 | 282 | update_menu (); | 281 | update_menu (); |
207 | 283 | } | 282 | } |
208 | 284 | 283 | ||
210 | 285 | // Forward all menu model calls to our internal menu | 284 | /* Forward all menu model calls to our internal menu. */ |
211 | 286 | 285 | ||
212 | 287 | public override Variant get_item_attribute_value (int item_index, string attribute, VariantType? expected_type) { | 286 | public override Variant get_item_attribute_value (int item_index, string attribute, VariantType? expected_type) { |
213 | 288 | return menu.get_item_attribute_value (item_index, attribute, expected_type); | 287 | return menu.get_item_attribute_value (item_index, attribute, expected_type); |
214 | 289 | 288 | ||
215 | === added file 'lib/indicator-menu.vala' | |||
216 | --- lib/indicator-menu.vala 1970-01-01 00:00:00 +0000 | |||
217 | +++ lib/indicator-menu.vala 2014-04-08 19:41:04 +0000 | |||
218 | @@ -0,0 +1,128 @@ | |||
219 | 1 | /* | ||
220 | 2 | * Copyright 2014 Canonical Ltd. | ||
221 | 3 | * | ||
222 | 4 | * This program is free software: you can redistribute it and/or modify | ||
223 | 5 | * it under the terms of the GNU General Public License as published by | ||
224 | 6 | * the Free Software Foundation, version 3 of the License. | ||
225 | 7 | * | ||
226 | 8 | * This program is distributed in the hope that it will be useful, | ||
227 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
228 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
229 | 11 | * GNU General Public License for more details. | ||
230 | 12 | * | ||
231 | 13 | * You should have received a copy of the GNU General Public License | ||
232 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
233 | 15 | * | ||
234 | 16 | * Authors: William Hua <william.hua@canonical.com> | ||
235 | 17 | */ | ||
236 | 18 | |||
237 | 19 | public class Indicator.Keyboard.IndicatorMenu : MenuModel { | ||
238 | 20 | |||
239 | 21 | public enum Options { | ||
240 | 22 | NONE = 0x0, | ||
241 | 23 | IBUS = 0x1, | ||
242 | 24 | SETTINGS = 0x2 | ||
243 | 25 | } | ||
244 | 26 | |||
245 | 27 | private Options options; | ||
246 | 28 | |||
247 | 29 | private Menu indicator_menu; | ||
248 | 30 | private Menu sources_section; | ||
249 | 31 | private IBusMenu properties_section; | ||
250 | 32 | |||
251 | 33 | public IndicatorMenu (ActionMap? action_map = null, Options options = Options.IBUS | Options.SETTINGS) { | ||
252 | 34 | var submenu = new Menu (); | ||
253 | 35 | |||
254 | 36 | sources_section = new Menu (); | ||
255 | 37 | submenu.append_section (null, sources_section); | ||
256 | 38 | |||
257 | 39 | if ((options & Options.IBUS) != Options.NONE) { | ||
258 | 40 | properties_section = new IBusMenu (action_map); | ||
259 | 41 | properties_section.activate.connect ((property, state) => { activate (property, state); }); | ||
260 | 42 | submenu.append_section (null, properties_section); | ||
261 | 43 | } | ||
262 | 44 | |||
263 | 45 | if ((options & Options.SETTINGS) != Options.NONE) { | ||
264 | 46 | var settings_section = new Menu (); | ||
265 | 47 | settings_section.append (_ ("Character Map"), "indicator.map"); | ||
266 | 48 | settings_section.append (_ ("Keyboard Layout Chart"), "indicator.chart"); | ||
267 | 49 | settings_section.append (_ ("Text Entry Settings..."), "indicator.settings"); | ||
268 | 50 | submenu.append_section (null, settings_section); | ||
269 | 51 | } | ||
270 | 52 | |||
271 | 53 | var indicator = new MenuItem.submenu (null, submenu); | ||
272 | 54 | indicator.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root"); | ||
273 | 55 | indicator.set_attribute ("x-canonical-secondary-action", "s", "indicator.next"); | ||
274 | 56 | indicator.set_attribute ("x-canonical-scroll-action", "s", "indicator.scroll"); | ||
275 | 57 | indicator.set_detailed_action ("indicator.indicator"); | ||
276 | 58 | |||
277 | 59 | indicator_menu = new Menu (); | ||
278 | 60 | indicator_menu.append_item (indicator); | ||
279 | 61 | |||
280 | 62 | this.options = options; | ||
281 | 63 | } | ||
282 | 64 | |||
283 | 65 | public signal void activate (IBus.Property property, IBus.PropState state); | ||
284 | 66 | |||
285 | 67 | public void set_sources (Source[] sources) { | ||
286 | 68 | sources_section.remove_all (); | ||
287 | 69 | |||
288 | 70 | for (var i = 0; i < sources.length; i++) { | ||
289 | 71 | if (!sources[i].is_ibus || (options & Options.IBUS) != Options.NONE) { | ||
290 | 72 | var item = new MenuItem (sources[i].name, "indicator.current"); | ||
291 | 73 | |||
292 | 74 | item.set_attribute (Menu.ATTRIBUTE_TARGET, "u", i); | ||
293 | 75 | |||
294 | 76 | if (sources[i].icon != null) { | ||
295 | 77 | item.set_icon ((!) sources[i].icon); | ||
296 | 78 | } | ||
297 | 79 | |||
298 | 80 | sources_section.append_item (item); | ||
299 | 81 | } | ||
300 | 82 | } | ||
301 | 83 | } | ||
302 | 84 | |||
303 | 85 | public void set_properties (IBus.PropList properties) { | ||
304 | 86 | if ((options & Options.IBUS) != Options.NONE) { | ||
305 | 87 | properties_section.set_properties (properties); | ||
306 | 88 | } | ||
307 | 89 | } | ||
308 | 90 | |||
309 | 91 | public void update_property (IBus.Property property) { | ||
310 | 92 | if ((options & Options.IBUS) != Options.NONE) { | ||
311 | 93 | properties_section.update_property (property); | ||
312 | 94 | } | ||
313 | 95 | } | ||
314 | 96 | |||
315 | 97 | public override bool is_mutable () { | ||
316 | 98 | return indicator_menu.is_mutable (); | ||
317 | 99 | } | ||
318 | 100 | |||
319 | 101 | public override int get_n_items () { | ||
320 | 102 | return indicator_menu.get_n_items (); | ||
321 | 103 | } | ||
322 | 104 | |||
323 | 105 | public override void get_item_attributes (int item_index, out HashTable<string, Variant>? attributes) { | ||
324 | 106 | indicator_menu.get_item_attributes (item_index, out attributes); | ||
325 | 107 | } | ||
326 | 108 | |||
327 | 109 | public override void get_item_links (int item_index, out HashTable<string, MenuModel>? links) { | ||
328 | 110 | indicator_menu.get_item_links (item_index, out links); | ||
329 | 111 | } | ||
330 | 112 | |||
331 | 113 | public override Variant get_item_attribute_value (int item_index, string attribute, VariantType? expected_type) { | ||
332 | 114 | return indicator_menu.get_item_attribute_value (item_index, attribute, expected_type); | ||
333 | 115 | } | ||
334 | 116 | |||
335 | 117 | public override MenuModel get_item_link (int item_index, string link) { | ||
336 | 118 | return indicator_menu.get_item_link (item_index, link); | ||
337 | 119 | } | ||
338 | 120 | |||
339 | 121 | public override MenuAttributeIter iterate_item_attributes (int item_index) { | ||
340 | 122 | return indicator_menu.iterate_item_attributes (item_index); | ||
341 | 123 | } | ||
342 | 124 | |||
343 | 125 | public override MenuLinkIter iterate_item_links (int item_index) { | ||
344 | 126 | return indicator_menu.iterate_item_links (item_index); | ||
345 | 127 | } | ||
346 | 128 | } | ||
347 | 0 | 129 | ||
348 | === modified file 'lib/main.vala' | |||
349 | --- lib/main.vala 2014-04-01 21:42:22 +0000 | |||
350 | +++ lib/main.vala 2014-04-08 19:41:04 +0000 | |||
351 | @@ -45,9 +45,8 @@ | |||
352 | 45 | 45 | ||
353 | 46 | private SimpleActionGroup? action_group; | 46 | private SimpleActionGroup? action_group; |
354 | 47 | private SimpleAction? indicator_action; | 47 | private SimpleAction? indicator_action; |
358 | 48 | private MenuModel? menu_model; | 48 | private IndicatorMenu? desktop_menu; |
359 | 49 | private Menu? sources_menu; | 49 | private IndicatorMenu? desktop_greeter_menu; |
357 | 50 | private IBusMenu? ibus_menu; | ||
360 | 51 | 50 | ||
361 | 52 | private UnityGreeter? unity_greeter; | 51 | private UnityGreeter? unity_greeter; |
362 | 53 | private string? greeter_user; | 52 | private string? greeter_user; |
363 | @@ -71,8 +70,12 @@ | |||
364 | 71 | } | 70 | } |
365 | 72 | } | 71 | } |
366 | 73 | 72 | ||
369 | 74 | if (sources_menu != null) { | 73 | if (desktop_menu != null) { |
370 | 75 | update_sources_menu (); | 74 | get_desktop_menu ().set_sources (get_sources ()); |
371 | 75 | } | ||
372 | 76 | |||
373 | 77 | if (desktop_greeter_menu != null) { | ||
374 | 78 | get_desktop_greeter_menu ().set_sources (get_sources ()); | ||
375 | 76 | } | 79 | } |
376 | 77 | 80 | ||
377 | 78 | if (indicator_action != null) { | 81 | if (indicator_action != null) { |
378 | @@ -128,8 +131,12 @@ | |||
379 | 128 | IBus.init (); | 131 | IBus.init (); |
380 | 129 | ibus = new IBus.Bus (); | 132 | ibus = new IBus.Bus (); |
381 | 130 | ((!) ibus).connected.connect (() => { | 133 | ((!) ibus).connected.connect (() => { |
384 | 131 | if (sources_menu != null) { | 134 | if (desktop_menu != null) { |
385 | 132 | update_sources_menu (); | 135 | get_desktop_menu ().set_sources (get_sources ()); |
386 | 136 | } | ||
387 | 137 | |||
388 | 138 | if (desktop_greeter_menu != null) { | ||
389 | 139 | get_desktop_greeter_menu ().set_sources (get_sources ()); | ||
390 | 133 | } | 140 | } |
391 | 134 | 141 | ||
392 | 135 | if (indicator_action != null) { | 142 | if (indicator_action != null) { |
393 | @@ -645,7 +652,7 @@ | |||
394 | 645 | } | 652 | } |
395 | 646 | 653 | ||
396 | 647 | panel_timeout = Timeout.add (PROPERTIES_DELAY, () => { | 654 | panel_timeout = Timeout.add (PROPERTIES_DELAY, () => { |
398 | 648 | update_ibus_menu (list); | 655 | get_desktop_menu ().set_properties (list); |
399 | 649 | panel_timeout = 0; | 656 | panel_timeout = 0; |
400 | 650 | return false; | 657 | return false; |
401 | 651 | }); | 658 | }); |
402 | @@ -653,7 +660,7 @@ | |||
403 | 653 | 660 | ||
404 | 654 | [DBus (visible = false)] | 661 | [DBus (visible = false)] |
405 | 655 | private void handle_property_updated (IBus.Property property) { | 662 | private void handle_property_updated (IBus.Property property) { |
407 | 656 | get_ibus_menu ().update_property (property); | 663 | get_desktop_menu ().update_property (property); |
408 | 657 | } | 664 | } |
409 | 658 | 665 | ||
410 | 659 | [DBus (visible = false)] | 666 | [DBus (visible = false)] |
411 | @@ -753,48 +760,11 @@ | |||
412 | 753 | } | 760 | } |
413 | 754 | 761 | ||
414 | 755 | [DBus (visible = false)] | 762 | [DBus (visible = false)] |
457 | 756 | private void update_sources_menu () { | 763 | public IndicatorMenu get_desktop_menu () { |
458 | 757 | if (sources_menu != null) { | 764 | if (desktop_menu == null) { |
459 | 758 | var menu = get_sources_menu (); | 765 | desktop_menu = new IndicatorMenu (get_action_group ()); |
460 | 759 | menu.remove_all (); | 766 | ((!) desktop_menu).set_sources (get_sources ()); |
461 | 760 | 767 | ((!) desktop_menu).activate.connect ((property, state) => { | |
420 | 761 | var sources = get_sources (); | ||
421 | 762 | for (var i = 0; i < sources.length; i++) { | ||
422 | 763 | var item = new MenuItem (sources[i].name, "indicator.current"); | ||
423 | 764 | item.set_attribute (Menu.ATTRIBUTE_TARGET, "u", i); | ||
424 | 765 | |||
425 | 766 | var icon = sources[i].icon; | ||
426 | 767 | if (icon != null) { | ||
427 | 768 | item.set_icon ((!) icon); | ||
428 | 769 | } | ||
429 | 770 | |||
430 | 771 | menu.append_item (item); | ||
431 | 772 | } | ||
432 | 773 | } else { | ||
433 | 774 | get_sources_menu (); | ||
434 | 775 | } | ||
435 | 776 | } | ||
436 | 777 | |||
437 | 778 | [DBus (visible = false)] | ||
438 | 779 | private Menu get_sources_menu () { | ||
439 | 780 | if (sources_menu == null) { | ||
440 | 781 | sources_menu = new Menu (); | ||
441 | 782 | update_sources_menu (); | ||
442 | 783 | } | ||
443 | 784 | |||
444 | 785 | return (!) sources_menu; | ||
445 | 786 | } | ||
446 | 787 | |||
447 | 788 | [DBus (visible = false)] | ||
448 | 789 | private void update_ibus_menu (IBus.PropList list) { | ||
449 | 790 | get_ibus_menu ().set_properties (list); | ||
450 | 791 | } | ||
451 | 792 | |||
452 | 793 | [DBus (visible = false)] | ||
453 | 794 | private IBusMenu get_ibus_menu () { | ||
454 | 795 | if (ibus_menu == null) { | ||
455 | 796 | ibus_menu = new IBusMenu (get_action_group ()); | ||
456 | 797 | ((!) ibus_menu).activate.connect ((property, state) => { | ||
462 | 798 | var panel = get_ibus_panel (); | 768 | var panel = get_ibus_panel (); |
463 | 799 | 769 | ||
464 | 800 | if (panel != null) { | 770 | if (panel != null) { |
465 | @@ -807,43 +777,17 @@ | |||
466 | 807 | }); | 777 | }); |
467 | 808 | } | 778 | } |
468 | 809 | 779 | ||
506 | 810 | return (!) ibus_menu; | 780 | return (!) desktop_menu; |
507 | 811 | } | 781 | } |
508 | 812 | 782 | ||
509 | 813 | [DBus (visible = false)] | 783 | [DBus (visible = false)] |
510 | 814 | protected virtual MenuModel create_menu_model (MenuModel sources_menu, MenuModel ibus_menu) { | 784 | public IndicatorMenu get_desktop_greeter_menu () { |
511 | 815 | var menu = new Menu (); | 785 | if (desktop_greeter_menu == null) { |
512 | 816 | 786 | desktop_greeter_menu = new IndicatorMenu (get_action_group (), IndicatorMenu.Options.NONE); | |
513 | 817 | var submenu = new Menu (); | 787 | ((!) desktop_greeter_menu).set_sources (get_sources ()); |
514 | 818 | 788 | } | |
515 | 819 | submenu.append_section (null, sources_menu); | 789 | |
516 | 820 | submenu.append_section (null, ibus_menu); | 790 | return (!) desktop_greeter_menu; |
480 | 821 | |||
481 | 822 | if (!is_login_user ()) { | ||
482 | 823 | var section = new Menu (); | ||
483 | 824 | section.append (_ ("Character Map"), "indicator.map"); | ||
484 | 825 | section.append (_ ("Keyboard Layout Chart"), "indicator.chart"); | ||
485 | 826 | section.append (_ ("Text Entry Settings..."), "indicator.settings"); | ||
486 | 827 | submenu.append_section (null, section); | ||
487 | 828 | } | ||
488 | 829 | |||
489 | 830 | var indicator = new MenuItem.submenu ("x", submenu); | ||
490 | 831 | indicator.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root"); | ||
491 | 832 | indicator.set_attribute ("x-canonical-secondary-action", "s", "indicator.next"); | ||
492 | 833 | indicator.set_attribute ("x-canonical-scroll-action", "s", "indicator.scroll"); | ||
493 | 834 | indicator.set_detailed_action ("indicator.indicator"); | ||
494 | 835 | menu.append_item (indicator); | ||
495 | 836 | |||
496 | 837 | return menu; | ||
497 | 838 | } | ||
498 | 839 | |||
499 | 840 | [DBus (visible = false)] | ||
500 | 841 | public MenuModel get_menu_model () { | ||
501 | 842 | if (menu_model == null) { | ||
502 | 843 | menu_model = create_menu_model (get_sources_menu (), get_ibus_menu ()); | ||
503 | 844 | } | ||
504 | 845 | |||
505 | 846 | return (!) menu_model; | ||
517 | 847 | } | 791 | } |
518 | 848 | 792 | ||
519 | 849 | [DBus (visible = false)] | 793 | [DBus (visible = false)] |
520 | @@ -861,7 +805,8 @@ | |||
521 | 861 | private void handle_changed_sources (string key) { | 805 | private void handle_changed_sources (string key) { |
522 | 862 | sources = null; | 806 | sources = null; |
523 | 863 | 807 | ||
525 | 864 | update_sources_menu (); | 808 | get_desktop_menu ().set_sources (get_sources ()); |
526 | 809 | get_desktop_greeter_menu ().set_sources (get_sources ()); | ||
527 | 865 | update_indicator_action (); | 810 | update_indicator_action (); |
528 | 866 | update_login_layout (); | 811 | update_login_layout (); |
529 | 867 | } | 812 | } |
530 | @@ -951,7 +896,8 @@ | |||
531 | 951 | private void handle_bus_acquired (DBusConnection connection, string name) { | 896 | private void handle_bus_acquired (DBusConnection connection, string name) { |
532 | 952 | try { | 897 | try { |
533 | 953 | connection.export_action_group ("/com/canonical/indicator/keyboard", get_action_group ()); | 898 | connection.export_action_group ("/com/canonical/indicator/keyboard", get_action_group ()); |
535 | 954 | connection.export_menu_model ("/com/canonical/indicator/keyboard/desktop", get_menu_model ()); | 899 | connection.export_menu_model ("/com/canonical/indicator/keyboard/desktop", get_desktop_menu ()); |
536 | 900 | connection.export_menu_model ("/com/canonical/indicator/keyboard/desktop_greeter", get_desktop_greeter_menu ()); | ||
537 | 955 | } catch (Error error) { | 901 | } catch (Error error) { |
538 | 956 | warning ("error: %s", error.message); | 902 | warning ("error: %s", error.message); |
539 | 957 | } | 903 | } |
540 | 958 | 904 | ||
541 | === modified file 'po/POTFILES.in' | |||
542 | --- po/POTFILES.in 2013-09-27 15:10:19 +0000 | |||
543 | +++ po/POTFILES.in 2014-04-08 19:41:04 +0000 | |||
544 | @@ -1,2 +1,3 @@ | |||
545 | 1 | # List of source files which contain translatable strings. | 1 | # List of source files which contain translatable strings. |
546 | 2 | lib/main.vala | 2 | lib/main.vala |
547 | 3 | lib/indicator-menu.vala | ||
548 | 3 | 4 | ||
549 | === modified file 'po/POTFILES.skip' | |||
550 | --- po/POTFILES.skip 2013-09-27 15:10:19 +0000 | |||
551 | +++ po/POTFILES.skip 2014-04-08 19:41:04 +0000 | |||
552 | @@ -1,1 +1,2 @@ | |||
553 | 1 | lib/main.c | 1 | lib/main.c |
554 | 2 | lib/indicator-menu.c | ||
555 | 2 | 3 | ||
556 | === modified file 'po/indicator-keyboard.pot' | |||
557 | --- po/indicator-keyboard.pot 2014-03-19 23:25:34 +0000 | |||
558 | +++ po/indicator-keyboard.pot 2014-04-08 19:41:04 +0000 | |||
559 | @@ -8,7 +8,7 @@ | |||
560 | 8 | msgstr "" | 8 | msgstr "" |
561 | 9 | "Project-Id-Version: PACKAGE VERSION\n" | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
562 | 10 | "Report-Msgid-Bugs-To: \n" | 10 | "Report-Msgid-Bugs-To: \n" |
564 | 11 | "POT-Creation-Date: 2014-03-20 12:25+1300\n" | 11 | "POT-Creation-Date: 2014-03-27 23:39+1300\n" |
565 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
566 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
567 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
568 | @@ -17,19 +17,19 @@ | |||
569 | 17 | "Content-Type: text/plain; charset=CHARSET\n" | 17 | "Content-Type: text/plain; charset=CHARSET\n" |
570 | 18 | "Content-Transfer-Encoding: 8bit\n" | 18 | "Content-Transfer-Encoding: 8bit\n" |
571 | 19 | 19 | ||
573 | 20 | #: ../lib/main.vala:667 | 20 | #: ../lib/main.vala:670 |
574 | 21 | #, c-format | 21 | #, c-format |
575 | 22 | msgid "%s input source" | 22 | msgid "%s input source" |
576 | 23 | msgstr "" | 23 | msgstr "" |
577 | 24 | 24 | ||
579 | 25 | #: ../lib/main.vala:815 | 25 | #: ../lib/indicator-menu.vala:47 |
580 | 26 | msgid "Character Map" | 26 | msgid "Character Map" |
581 | 27 | msgstr "" | 27 | msgstr "" |
582 | 28 | 28 | ||
584 | 29 | #: ../lib/main.vala:816 | 29 | #: ../lib/indicator-menu.vala:48 |
585 | 30 | msgid "Keyboard Layout Chart" | 30 | msgid "Keyboard Layout Chart" |
586 | 31 | msgstr "" | 31 | msgstr "" |
587 | 32 | 32 | ||
589 | 33 | #: ../lib/main.vala:817 | 33 | #: ../lib/indicator-menu.vala:49 |
590 | 34 | msgid "Text Entry Settings..." | 34 | msgid "Text Entry Settings..." |
591 | 35 | msgstr "" | 35 | msgstr "" |
PASSED: Continuous integration, rev:321 jenkins. qa.ubuntu. com/job/ indicator- keyboard- ci/55/ jenkins. qa.ubuntu. com/job/ indicator- keyboard- trusty- amd64-ci/ 22 jenkins. qa.ubuntu. com/job/ indicator- keyboard- trusty- armhf-ci/ 22 jenkins. qa.ubuntu. com/job/ indicator- keyboard- trusty- armhf-ci/ 22/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/55/rebuild
http://