Merge lp:~attente/indicator-keyboard/accountsservice into lp:indicator-keyboard
- accountsservice
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Sebastien Bacher |
Approved revision: | 100 |
Merged at revision: | 106 |
Proposed branch: | lp:~attente/indicator-keyboard/accountsservice |
Merge into: | lp:indicator-keyboard |
Diff against target: |
405 lines (+220/-78) 5 files modified
configure.ac (+8/-0) data/Makefile.am (+3/-0) debian/control (+2/-0) lib/Makefile.am (+32/-26) lib/main.vala (+175/-52) |
To merge this branch: | bzr merge lp:~attente/indicator-keyboard/accountsservice |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Sebastien Bacher | Approve | ||
Review via email: mp+179050@code.launchpad.net |
Commit message
Use accountsservice and make work under unity-greeter.
Description of the change
Use accountsservice and make work under unity-greeter.
This branch depends on the debdiff from https:/
PS Jenkins bot (ps-jenkins) wrote : | # |
Sebastien Bacher (seb128) wrote : | # |
seems fine to me and we have the accountsservice patch in now
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
- 100. By William Hua
-
Merge trunk.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:100
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'configure.ac' |
2 | --- configure.ac 2013-08-08 18:41:27 +0000 |
3 | +++ configure.ac 2013-08-22 10:36:45 +0000 |
4 | @@ -70,6 +70,14 @@ |
5 | AC_SUBST([IBUS_CFLAGS]) |
6 | AC_SUBST([IBUS_LIBS]) |
7 | |
8 | +PKG_CHECK_MODULES([ACCOUNTSSERVICE], [accountsservice]) |
9 | +AC_SUBST([ACCOUNTSSERVICE_CFLAGS]) |
10 | +AC_SUBST([ACCOUNTSSERVICE_LIBS]) |
11 | + |
12 | +PKG_CHECK_MODULES([LIGHTDM], [liblightdm-gobject-1]) |
13 | +AC_SUBST([LIGHTDM_CFLAGS]) |
14 | +AC_SUBST([LIGHTDM_LIBS]) |
15 | + |
16 | PKG_CHECK_MODULES([BAMF], [libbamf3]) |
17 | AC_SUBST([BAMF_CFLAGS]) |
18 | AC_SUBST([BAMF_LIBS]) |
19 | |
20 | === modified file 'data/Makefile.am' |
21 | --- data/Makefile.am 2013-07-18 22:01:28 +0000 |
22 | +++ data/Makefile.am 2013-08-22 10:36:45 +0000 |
23 | @@ -48,6 +48,9 @@ |
24 | echo 'ObjectPath=/com/canonical/indicator/keyboard'; \ |
25 | echo ''; \ |
26 | echo '[desktop]'; \ |
27 | + echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop'; \ |
28 | + echo ''; \ |
29 | + echo '[desktop_greeter]'; \ |
30 | echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop') > $@.tmp && \ |
31 | mv $@.tmp $@ |
32 | |
33 | |
34 | === modified file 'debian/control' |
35 | --- debian/control 2013-08-07 15:20:47 +0000 |
36 | +++ debian/control 2013-08-22 10:36:45 +0000 |
37 | @@ -8,6 +8,7 @@ |
38 | dh-autoreconf, |
39 | dh-translations, |
40 | dbus, |
41 | + libaccountsservice-dev, |
42 | libbamf3-dev, |
43 | libgee-dev, |
44 | libgirepository1.0-dev, |
45 | @@ -15,6 +16,7 @@ |
46 | libgnomekbd-dev, |
47 | libgtk-3-dev, |
48 | libibus-1.0-dev (>= 1.5.0), |
49 | + liblightdm-gobject-1-dev, |
50 | valac, |
51 | xauth, |
52 | xvfb, |
53 | |
54 | === modified file 'lib/Makefile.am' |
55 | --- lib/Makefile.am 2013-08-07 19:11:32 +0000 |
56 | +++ lib/Makefile.am 2013-08-22 10:36:45 +0000 |
57 | @@ -9,32 +9,38 @@ |
58 | indicator_keyboard_service_SOURCES = main.vala \ |
59 | source.vala \ |
60 | common.vala |
61 | -indicator_keyboard_service_VALAFLAGS = $(AM_VALAFLAGS) \ |
62 | - --pkg gee-1.0 \ |
63 | - --pkg posix \ |
64 | - --pkg pangocairo \ |
65 | - --pkg gtk+-3.0 \ |
66 | - --pkg GDesktopEnums-3.0 \ |
67 | - --pkg gnome-desktop-3.0 \ |
68 | - --pkg Xkl-1.0 \ |
69 | - --pkg Gkbd-3.0 \ |
70 | - --pkg ibus-1.0 \ |
71 | +indicator_keyboard_service_VALAFLAGS = $(AM_VALAFLAGS) \ |
72 | + --pkg gee-1.0 \ |
73 | + --pkg posix \ |
74 | + --pkg pangocairo \ |
75 | + --pkg gtk+-3.0 \ |
76 | + --pkg GDesktopEnums-3.0 \ |
77 | + --pkg gnome-desktop-3.0 \ |
78 | + --pkg Xkl-1.0 \ |
79 | + --pkg Gkbd-3.0 \ |
80 | + --pkg ibus-1.0 \ |
81 | + --pkg accountsservice \ |
82 | + --pkg liblightdm-gobject-1 \ |
83 | --pkg libbamf3 |
84 | -indicator_keyboard_service_CFLAGS = $(AM_CFLAGS) \ |
85 | - $(GEE_CFLAGS) \ |
86 | - $(PANGOCAIRO_CFLAGS) \ |
87 | - $(GTK_CFLAGS) \ |
88 | - $(GNOME_DESKTOP_CFLAGS) \ |
89 | - $(LIBXKLAVIER_CFLAGS) \ |
90 | - $(LIBGNOMEKBD_CFLAGS) \ |
91 | - $(IBUS_CFLAGS) \ |
92 | +indicator_keyboard_service_CFLAGS = $(AM_CFLAGS) \ |
93 | + $(GEE_CFLAGS) \ |
94 | + $(PANGOCAIRO_CFLAGS) \ |
95 | + $(GTK_CFLAGS) \ |
96 | + $(GNOME_DESKTOP_CFLAGS) \ |
97 | + $(LIBXKLAVIER_CFLAGS) \ |
98 | + $(LIBGNOMEKBD_CFLAGS) \ |
99 | + $(IBUS_CFLAGS) \ |
100 | + $(ACCOUNTSSERVICE_CFLAGS) \ |
101 | + $(LIGHTDM_CFLAGS) \ |
102 | $(BAMF_CFLAGS) |
103 | -indicator_keyboard_service_LDFLAGS = $(AM_LDFLAGS) \ |
104 | - $(GEE_LIBS) \ |
105 | - $(PANGOCAIRO_LIBS) \ |
106 | - $(GTK_LIBS) \ |
107 | - $(GNOME_DESKTOP_LIBS) \ |
108 | - $(LIBXKLAVIER_LIBS) \ |
109 | - $(LIBGNOMEKBD_LIBS) \ |
110 | - $(IBUS_LIBS) \ |
111 | +indicator_keyboard_service_LDFLAGS = $(AM_LDFLAGS) \ |
112 | + $(GEE_LIBS) \ |
113 | + $(PANGOCAIRO_LIBS) \ |
114 | + $(GTK_LIBS) \ |
115 | + $(GNOME_DESKTOP_LIBS) \ |
116 | + $(LIBXKLAVIER_LIBS) \ |
117 | + $(LIBGNOMEKBD_LIBS) \ |
118 | + $(IBUS_LIBS) \ |
119 | + $(ACCOUNTSSERVICE_LIBS) \ |
120 | + $(LIGHTDM_LIBS) \ |
121 | $(BAMF_LIBS) |
122 | |
123 | === modified file 'lib/main.vala' |
124 | --- lib/main.vala 2013-08-12 01:33:27 +0000 |
125 | +++ lib/main.vala 2013-08-22 10:36:45 +0000 |
126 | @@ -29,6 +29,7 @@ |
127 | private Settings indicator_settings; |
128 | private Settings source_settings; |
129 | private Settings per_window_settings; |
130 | + private SList<Act.User> users; |
131 | private Bamf.Matcher? matcher; |
132 | private Gee.HashMap<string, uint>? window_sources; |
133 | |
134 | @@ -67,6 +68,11 @@ |
135 | } |
136 | |
137 | [DBus (visible = false)] |
138 | + private static bool is_login_user () { |
139 | + return Environment.get_user_name () == "lightdm"; |
140 | + } |
141 | + |
142 | + [DBus (visible = false)] |
143 | private static IBus.Bus get_ibus () { |
144 | if (ibus == null) { |
145 | IBus.init (); |
146 | @@ -91,64 +97,177 @@ |
147 | |
148 | [DBus (visible = false)] |
149 | private void migrate_keyboard_layouts () { |
150 | - if (!indicator_settings.get_boolean ("migrated")) { |
151 | - var builder = new VariantBuilder (new VariantType ("a(ss)")); |
152 | - var length = 0; |
153 | - |
154 | - var layout_settings = new Settings ("org.gnome.libgnomekbd.keyboard"); |
155 | - var layouts = layout_settings.get_strv ("layouts"); |
156 | - |
157 | - foreach (var layout in layouts) { |
158 | - var source = layout; |
159 | - |
160 | - source = source.replace (" ", "+"); |
161 | - source = source.replace ("\t", "+"); |
162 | - |
163 | - builder.add ("(ss)", "xkb", source); |
164 | - length++; |
165 | + if (is_login_user ()) { |
166 | + Act.UserManager manager = Act.UserManager.get_default (); |
167 | + |
168 | + if (manager.is_loaded) { |
169 | + users = manager.list_users (); |
170 | + |
171 | + foreach (var user in users) { |
172 | + if (user.is_loaded) { |
173 | + migrate_input_sources (); |
174 | + } else { |
175 | + user.notify["is-loaded"].connect ((pspec) => { |
176 | + if (user.is_loaded) { |
177 | + migrate_input_sources (); |
178 | + } |
179 | + }); |
180 | + } |
181 | + } |
182 | + } else { |
183 | + manager.notify["is-loaded"].connect ((pspec) => { |
184 | + if (manager.is_loaded) { |
185 | + users = manager.list_users (); |
186 | + |
187 | + foreach (var user in users) { |
188 | + if (user.is_loaded) { |
189 | + migrate_input_sources (); |
190 | + } else { |
191 | + user.notify["is-loaded"].connect ((pspec) => { |
192 | + if (user.is_loaded) { |
193 | + migrate_input_sources (); |
194 | + } |
195 | + }); |
196 | + } |
197 | + } |
198 | + } |
199 | + }); |
200 | } |
201 | - |
202 | - var engines = get_ibus ().list_active_engines (); |
203 | - |
204 | - foreach (var engine in engines) { |
205 | - if (length == 0 || engine.name.has_prefix ("xkb")) { |
206 | - var source = "us"; |
207 | - string? layout = engine.get_layout (); |
208 | - string? variant = engine.get_layout_variant (); |
209 | - |
210 | - if (layout != null && ((!) layout).length == 0) { |
211 | - layout = null; |
212 | - } |
213 | - |
214 | - if (variant != null && ((!) variant).length == 0) { |
215 | - variant = null; |
216 | - } |
217 | - |
218 | - if (layout != null && variant != null) { |
219 | - source = @"$((!) layout)+$((!) variant)"; |
220 | - } else if (layout != null) { |
221 | - source = (!) layout; |
222 | - } |
223 | + } else { |
224 | + if (!indicator_settings.get_boolean ("migrated")) { |
225 | + var builder = new VariantBuilder (new VariantType ("a(ss)")); |
226 | + var length = 0; |
227 | + |
228 | + var layout_settings = new Settings ("org.gnome.libgnomekbd.keyboard"); |
229 | + var layouts = layout_settings.get_strv ("layouts"); |
230 | + |
231 | + foreach (var layout in layouts) { |
232 | + var source = layout; |
233 | + source = source.replace (" ", "+"); |
234 | + source = source.replace ("\t", "+"); |
235 | |
236 | builder.add ("(ss)", "xkb", source); |
237 | length++; |
238 | } |
239 | |
240 | - if (!engine.name.has_prefix ("xkb")) { |
241 | - builder.add ("(ss)", "ibus", engine.name); |
242 | - length++; |
243 | - } |
244 | - } |
245 | - |
246 | - source_settings.set_value ("sources", builder.end ()); |
247 | - |
248 | - indicator_settings.set_boolean ("migrated", true); |
249 | + var engines = get_ibus ().list_active_engines (); |
250 | + |
251 | + foreach (var engine in engines) { |
252 | + if (length == 0 || engine.name.has_prefix ("xkb")) { |
253 | + var source = "us"; |
254 | + string? layout = engine.get_layout (); |
255 | + string? variant = engine.get_layout_variant (); |
256 | + |
257 | + if (layout != null && ((!) layout).length == 0) { |
258 | + layout = null; |
259 | + } |
260 | + |
261 | + if (variant != null && ((!) variant).length == 0) { |
262 | + variant = null; |
263 | + } |
264 | + |
265 | + if (layout != null && variant != null) { |
266 | + source = @"$((!) layout)+$((!) variant)"; |
267 | + } else if (layout != null) { |
268 | + source = (!) layout; |
269 | + } |
270 | + |
271 | + builder.add ("(ss)", "xkb", source); |
272 | + length++; |
273 | + } |
274 | + |
275 | + if (!engine.name.has_prefix ("xkb")) { |
276 | + builder.add ("(ss)", "ibus", engine.name); |
277 | + length++; |
278 | + } |
279 | + } |
280 | + |
281 | + source_settings.set_value ("sources", builder.end ()); |
282 | + indicator_settings.set_boolean ("migrated", true); |
283 | + } |
284 | + } |
285 | + } |
286 | + |
287 | + [DBus (visible = false)] |
288 | + private void migrate_input_sources () { |
289 | + var list = new Gee.LinkedList<string> (); |
290 | + var added = new Gee.HashSet<string> (); |
291 | + |
292 | + foreach (var user in users) { |
293 | + if (user.is_loaded) { |
294 | + var sources = user.input_sources; |
295 | + var layouts = user.xkeyboard_layouts; |
296 | + |
297 | + VariantIter outer; |
298 | + VariantIter inner; |
299 | + |
300 | + sources.get ("aa{ss}", out outer); |
301 | + |
302 | + while (outer.next ("a{ss}", out inner)) { |
303 | + unowned string key; |
304 | + unowned string source; |
305 | + |
306 | + while (inner.next ("{&s&s}", out key, out source)) { |
307 | + if (key == "xkb") { |
308 | + if (!added.contains (source)) { |
309 | + list.add (source); |
310 | + added.add (source); |
311 | + } |
312 | + } |
313 | + } |
314 | + } |
315 | + |
316 | + foreach (var layout in layouts) { |
317 | + var source = layout; |
318 | + source = source.replace (" ", "+"); |
319 | + source = source.replace ("\t", "+"); |
320 | + |
321 | + if (!added.contains (source)) { |
322 | + list.add (source); |
323 | + added.add (source); |
324 | + } |
325 | + } |
326 | + } |
327 | + } |
328 | + |
329 | + var builder = new VariantBuilder (new VariantType ("a(ss)")); |
330 | + |
331 | + foreach (var layout in list) { |
332 | + builder.add ("(ss)", "xkb", layout); |
333 | + } |
334 | + |
335 | + source_settings.set_value ("sources", builder.end ()); |
336 | + } |
337 | + |
338 | + [DBus (visible = false)] |
339 | + private void update_login_layout () { |
340 | + unowned List<LightDM.Layout> layouts = LightDM.get_layouts (); |
341 | + var current = source_settings.get_uint ("current"); |
342 | + |
343 | + if (current < get_sources ().length) { |
344 | + var source = get_sources ()[current]; |
345 | + string? name = null; |
346 | + |
347 | + if (source.layout != null && source.variant != null) { |
348 | + name = @"$((!) source.layout)\t$((!) source.variant)"; |
349 | + } else if (source.layout != null) { |
350 | + name = source.layout; |
351 | + } |
352 | + |
353 | + if (name != null) { |
354 | + foreach (var layout in layouts) { |
355 | + if (layout.name == (!) name) { |
356 | + LightDM.set_layout (layout); |
357 | + break; |
358 | + } |
359 | + } |
360 | + } |
361 | } |
362 | } |
363 | |
364 | [DBus (visible = false)] |
365 | private void update_window_sources () { |
366 | - if (use_bamf) { |
367 | + if (use_bamf && !is_login_user ()) { |
368 | var group_per_window = per_window_settings.get_boolean ("group-per-window"); |
369 | |
370 | if (group_per_window != (window_sources != null)) { |
371 | @@ -324,11 +443,13 @@ |
372 | |
373 | submenu.append_section (null, section_menu); |
374 | |
375 | - var section = new Menu (); |
376 | - section.append (_ ("Character Map"), "indicator.map"); |
377 | - section.append (_ ("Keyboard Layout Chart"), "indicator.chart"); |
378 | - section.append (_ ("Text Entry Settings..."), "indicator.settings"); |
379 | - submenu.append_section (null, section); |
380 | + if (!is_login_user ()) { |
381 | + var section = new Menu (); |
382 | + section.append (_ ("Character Map"), "indicator.map"); |
383 | + section.append (_ ("Keyboard Layout Chart"), "indicator.chart"); |
384 | + section.append (_ ("Text Entry Settings..."), "indicator.settings"); |
385 | + submenu.append_section (null, section); |
386 | + } |
387 | |
388 | var indicator = new MenuItem.submenu ("x", submenu); |
389 | indicator.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root"); |
390 | @@ -355,6 +476,7 @@ |
391 | [DBus (visible = false)] |
392 | private void handle_changed_current (string key) { |
393 | update_indicator_action (); |
394 | + update_login_layout (); |
395 | } |
396 | |
397 | [DBus (visible = false)] |
398 | @@ -363,6 +485,7 @@ |
399 | |
400 | update_sources_menu (); |
401 | update_indicator_action (); |
402 | + update_login_layout (); |
403 | } |
404 | |
405 | [DBus (visible = false)] |
FAILED: Continuous integration, rev:99 jenkins. qa.ubuntu. com/job/ indicator- keyboard- ci/4/ jenkins. qa.ubuntu. com/job/ indicator- keyboard- saucy-amd64- ci/4/console jenkins. qa.ubuntu. com/job/ indicator- keyboard- saucy-armhf- ci/4/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ indicator- keyboard- ci/4/rebuild
http://