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

Proposed by William Hua
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
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://bugs.launchpad.net/ubuntu/+source/accountsservice/+bug/1209227.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

seems fine to me and we have the accountsservice patch in now

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

Merge trunk.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2013-08-08 18:41:27 +0000
+++ configure.ac 2013-08-22 10:36:45 +0000
@@ -70,6 +70,14 @@
70AC_SUBST([IBUS_CFLAGS])70AC_SUBST([IBUS_CFLAGS])
71AC_SUBST([IBUS_LIBS])71AC_SUBST([IBUS_LIBS])
7272
73PKG_CHECK_MODULES([ACCOUNTSSERVICE], [accountsservice])
74AC_SUBST([ACCOUNTSSERVICE_CFLAGS])
75AC_SUBST([ACCOUNTSSERVICE_LIBS])
76
77PKG_CHECK_MODULES([LIGHTDM], [liblightdm-gobject-1])
78AC_SUBST([LIGHTDM_CFLAGS])
79AC_SUBST([LIGHTDM_LIBS])
80
73PKG_CHECK_MODULES([BAMF], [libbamf3])81PKG_CHECK_MODULES([BAMF], [libbamf3])
74AC_SUBST([BAMF_CFLAGS])82AC_SUBST([BAMF_CFLAGS])
75AC_SUBST([BAMF_LIBS])83AC_SUBST([BAMF_LIBS])
7684
=== modified file 'data/Makefile.am'
--- data/Makefile.am 2013-07-18 22:01:28 +0000
+++ data/Makefile.am 2013-08-22 10:36:45 +0000
@@ -48,6 +48,9 @@
48 echo 'ObjectPath=/com/canonical/indicator/keyboard'; \48 echo 'ObjectPath=/com/canonical/indicator/keyboard'; \
49 echo ''; \49 echo ''; \
50 echo '[desktop]'; \50 echo '[desktop]'; \
51 echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop'; \
52 echo ''; \
53 echo '[desktop_greeter]'; \
51 echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop') > $@.tmp && \54 echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop') > $@.tmp && \
52 mv $@.tmp $@55 mv $@.tmp $@
5356
5457
=== modified file 'debian/control'
--- debian/control 2013-08-07 15:20:47 +0000
+++ debian/control 2013-08-22 10:36:45 +0000
@@ -8,6 +8,7 @@
8 dh-autoreconf,8 dh-autoreconf,
9 dh-translations,9 dh-translations,
10 dbus,10 dbus,
11 libaccountsservice-dev,
11 libbamf3-dev,12 libbamf3-dev,
12 libgee-dev,13 libgee-dev,
13 libgirepository1.0-dev,14 libgirepository1.0-dev,
@@ -15,6 +16,7 @@
15 libgnomekbd-dev,16 libgnomekbd-dev,
16 libgtk-3-dev,17 libgtk-3-dev,
17 libibus-1.0-dev (>= 1.5.0),18 libibus-1.0-dev (>= 1.5.0),
19 liblightdm-gobject-1-dev,
18 valac,20 valac,
19 xauth,21 xauth,
20 xvfb,22 xvfb,
2123
=== modified file 'lib/Makefile.am'
--- lib/Makefile.am 2013-08-07 19:11:32 +0000
+++ lib/Makefile.am 2013-08-22 10:36:45 +0000
@@ -9,32 +9,38 @@
9indicator_keyboard_service_SOURCES = main.vala \9indicator_keyboard_service_SOURCES = main.vala \
10 source.vala \10 source.vala \
11 common.vala11 common.vala
12indicator_keyboard_service_VALAFLAGS = $(AM_VALAFLAGS) \12indicator_keyboard_service_VALAFLAGS = $(AM_VALAFLAGS) \
13 --pkg gee-1.0 \13 --pkg gee-1.0 \
14 --pkg posix \14 --pkg posix \
15 --pkg pangocairo \15 --pkg pangocairo \
16 --pkg gtk+-3.0 \16 --pkg gtk+-3.0 \
17 --pkg GDesktopEnums-3.0 \17 --pkg GDesktopEnums-3.0 \
18 --pkg gnome-desktop-3.0 \18 --pkg gnome-desktop-3.0 \
19 --pkg Xkl-1.0 \19 --pkg Xkl-1.0 \
20 --pkg Gkbd-3.0 \20 --pkg Gkbd-3.0 \
21 --pkg ibus-1.0 \21 --pkg ibus-1.0 \
22 --pkg accountsservice \
23 --pkg liblightdm-gobject-1 \
22 --pkg libbamf324 --pkg libbamf3
23indicator_keyboard_service_CFLAGS = $(AM_CFLAGS) \25indicator_keyboard_service_CFLAGS = $(AM_CFLAGS) \
24 $(GEE_CFLAGS) \26 $(GEE_CFLAGS) \
25 $(PANGOCAIRO_CFLAGS) \27 $(PANGOCAIRO_CFLAGS) \
26 $(GTK_CFLAGS) \28 $(GTK_CFLAGS) \
27 $(GNOME_DESKTOP_CFLAGS) \29 $(GNOME_DESKTOP_CFLAGS) \
28 $(LIBXKLAVIER_CFLAGS) \30 $(LIBXKLAVIER_CFLAGS) \
29 $(LIBGNOMEKBD_CFLAGS) \31 $(LIBGNOMEKBD_CFLAGS) \
30 $(IBUS_CFLAGS) \32 $(IBUS_CFLAGS) \
33 $(ACCOUNTSSERVICE_CFLAGS) \
34 $(LIGHTDM_CFLAGS) \
31 $(BAMF_CFLAGS)35 $(BAMF_CFLAGS)
32indicator_keyboard_service_LDFLAGS = $(AM_LDFLAGS) \36indicator_keyboard_service_LDFLAGS = $(AM_LDFLAGS) \
33 $(GEE_LIBS) \37 $(GEE_LIBS) \
34 $(PANGOCAIRO_LIBS) \38 $(PANGOCAIRO_LIBS) \
35 $(GTK_LIBS) \39 $(GTK_LIBS) \
36 $(GNOME_DESKTOP_LIBS) \40 $(GNOME_DESKTOP_LIBS) \
37 $(LIBXKLAVIER_LIBS) \41 $(LIBXKLAVIER_LIBS) \
38 $(LIBGNOMEKBD_LIBS) \42 $(LIBGNOMEKBD_LIBS) \
39 $(IBUS_LIBS) \43 $(IBUS_LIBS) \
44 $(ACCOUNTSSERVICE_LIBS) \
45 $(LIGHTDM_LIBS) \
40 $(BAMF_LIBS)46 $(BAMF_LIBS)
4147
=== modified file 'lib/main.vala'
--- lib/main.vala 2013-08-12 01:33:27 +0000
+++ lib/main.vala 2013-08-22 10:36:45 +0000
@@ -29,6 +29,7 @@
29 private Settings indicator_settings;29 private Settings indicator_settings;
30 private Settings source_settings;30 private Settings source_settings;
31 private Settings per_window_settings;31 private Settings per_window_settings;
32 private SList<Act.User> users;
32 private Bamf.Matcher? matcher;33 private Bamf.Matcher? matcher;
33 private Gee.HashMap<string, uint>? window_sources;34 private Gee.HashMap<string, uint>? window_sources;
3435
@@ -67,6 +68,11 @@
67 }68 }
6869
69 [DBus (visible = false)]70 [DBus (visible = false)]
71 private static bool is_login_user () {
72 return Environment.get_user_name () == "lightdm";
73 }
74
75 [DBus (visible = false)]
70 private static IBus.Bus get_ibus () {76 private static IBus.Bus get_ibus () {
71 if (ibus == null) {77 if (ibus == null) {
72 IBus.init ();78 IBus.init ();
@@ -91,64 +97,177 @@
9197
92 [DBus (visible = false)]98 [DBus (visible = false)]
93 private void migrate_keyboard_layouts () {99 private void migrate_keyboard_layouts () {
94 if (!indicator_settings.get_boolean ("migrated")) {100 if (is_login_user ()) {
95 var builder = new VariantBuilder (new VariantType ("a(ss)"));101 Act.UserManager manager = Act.UserManager.get_default ();
96 var length = 0;102
97103 if (manager.is_loaded) {
98 var layout_settings = new Settings ("org.gnome.libgnomekbd.keyboard");104 users = manager.list_users ();
99 var layouts = layout_settings.get_strv ("layouts");105
100106 foreach (var user in users) {
101 foreach (var layout in layouts) {107 if (user.is_loaded) {
102 var source = layout;108 migrate_input_sources ();
103109 } else {
104 source = source.replace (" ", "+");110 user.notify["is-loaded"].connect ((pspec) => {
105 source = source.replace ("\t", "+");111 if (user.is_loaded) {
106112 migrate_input_sources ();
107 builder.add ("(ss)", "xkb", source);113 }
108 length++;114 });
115 }
116 }
117 } else {
118 manager.notify["is-loaded"].connect ((pspec) => {
119 if (manager.is_loaded) {
120 users = manager.list_users ();
121
122 foreach (var user in users) {
123 if (user.is_loaded) {
124 migrate_input_sources ();
125 } else {
126 user.notify["is-loaded"].connect ((pspec) => {
127 if (user.is_loaded) {
128 migrate_input_sources ();
129 }
130 });
131 }
132 }
133 }
134 });
109 }135 }
110136 } else {
111 var engines = get_ibus ().list_active_engines ();137 if (!indicator_settings.get_boolean ("migrated")) {
112138 var builder = new VariantBuilder (new VariantType ("a(ss)"));
113 foreach (var engine in engines) {139 var length = 0;
114 if (length == 0 || engine.name.has_prefix ("xkb")) {140
115 var source = "us";141 var layout_settings = new Settings ("org.gnome.libgnomekbd.keyboard");
116 string? layout = engine.get_layout ();142 var layouts = layout_settings.get_strv ("layouts");
117 string? variant = engine.get_layout_variant ();143
118144 foreach (var layout in layouts) {
119 if (layout != null && ((!) layout).length == 0) {145 var source = layout;
120 layout = null;146 source = source.replace (" ", "+");
121 }147 source = source.replace ("\t", "+");
122
123 if (variant != null && ((!) variant).length == 0) {
124 variant = null;
125 }
126
127 if (layout != null && variant != null) {
128 source = @"$((!) layout)+$((!) variant)";
129 } else if (layout != null) {
130 source = (!) layout;
131 }
132148
133 builder.add ("(ss)", "xkb", source);149 builder.add ("(ss)", "xkb", source);
134 length++;150 length++;
135 }151 }
136152
137 if (!engine.name.has_prefix ("xkb")) {153 var engines = get_ibus ().list_active_engines ();
138 builder.add ("(ss)", "ibus", engine.name);154
139 length++;155 foreach (var engine in engines) {
140 }156 if (length == 0 || engine.name.has_prefix ("xkb")) {
141 }157 var source = "us";
142158 string? layout = engine.get_layout ();
143 source_settings.set_value ("sources", builder.end ());159 string? variant = engine.get_layout_variant ();
144160
145 indicator_settings.set_boolean ("migrated", true);161 if (layout != null && ((!) layout).length == 0) {
162 layout = null;
163 }
164
165 if (variant != null && ((!) variant).length == 0) {
166 variant = null;
167 }
168
169 if (layout != null && variant != null) {
170 source = @"$((!) layout)+$((!) variant)";
171 } else if (layout != null) {
172 source = (!) layout;
173 }
174
175 builder.add ("(ss)", "xkb", source);
176 length++;
177 }
178
179 if (!engine.name.has_prefix ("xkb")) {
180 builder.add ("(ss)", "ibus", engine.name);
181 length++;
182 }
183 }
184
185 source_settings.set_value ("sources", builder.end ());
186 indicator_settings.set_boolean ("migrated", true);
187 }
188 }
189 }
190
191 [DBus (visible = false)]
192 private void migrate_input_sources () {
193 var list = new Gee.LinkedList<string> ();
194 var added = new Gee.HashSet<string> ();
195
196 foreach (var user in users) {
197 if (user.is_loaded) {
198 var sources = user.input_sources;
199 var layouts = user.xkeyboard_layouts;
200
201 VariantIter outer;
202 VariantIter inner;
203
204 sources.get ("aa{ss}", out outer);
205
206 while (outer.next ("a{ss}", out inner)) {
207 unowned string key;
208 unowned string source;
209
210 while (inner.next ("{&s&s}", out key, out source)) {
211 if (key == "xkb") {
212 if (!added.contains (source)) {
213 list.add (source);
214 added.add (source);
215 }
216 }
217 }
218 }
219
220 foreach (var layout in layouts) {
221 var source = layout;
222 source = source.replace (" ", "+");
223 source = source.replace ("\t", "+");
224
225 if (!added.contains (source)) {
226 list.add (source);
227 added.add (source);
228 }
229 }
230 }
231 }
232
233 var builder = new VariantBuilder (new VariantType ("a(ss)"));
234
235 foreach (var layout in list) {
236 builder.add ("(ss)", "xkb", layout);
237 }
238
239 source_settings.set_value ("sources", builder.end ());
240 }
241
242 [DBus (visible = false)]
243 private void update_login_layout () {
244 unowned List<LightDM.Layout> layouts = LightDM.get_layouts ();
245 var current = source_settings.get_uint ("current");
246
247 if (current < get_sources ().length) {
248 var source = get_sources ()[current];
249 string? name = null;
250
251 if (source.layout != null && source.variant != null) {
252 name = @"$((!) source.layout)\t$((!) source.variant)";
253 } else if (source.layout != null) {
254 name = source.layout;
255 }
256
257 if (name != null) {
258 foreach (var layout in layouts) {
259 if (layout.name == (!) name) {
260 LightDM.set_layout (layout);
261 break;
262 }
263 }
264 }
146 }265 }
147 }266 }
148267
149 [DBus (visible = false)]268 [DBus (visible = false)]
150 private void update_window_sources () {269 private void update_window_sources () {
151 if (use_bamf) {270 if (use_bamf && !is_login_user ()) {
152 var group_per_window = per_window_settings.get_boolean ("group-per-window");271 var group_per_window = per_window_settings.get_boolean ("group-per-window");
153272
154 if (group_per_window != (window_sources != null)) {273 if (group_per_window != (window_sources != null)) {
@@ -324,11 +443,13 @@
324443
325 submenu.append_section (null, section_menu);444 submenu.append_section (null, section_menu);
326445
327 var section = new Menu ();446 if (!is_login_user ()) {
328 section.append (_ ("Character Map"), "indicator.map");447 var section = new Menu ();
329 section.append (_ ("Keyboard Layout Chart"), "indicator.chart");448 section.append (_ ("Character Map"), "indicator.map");
330 section.append (_ ("Text Entry Settings..."), "indicator.settings");449 section.append (_ ("Keyboard Layout Chart"), "indicator.chart");
331 submenu.append_section (null, section);450 section.append (_ ("Text Entry Settings..."), "indicator.settings");
451 submenu.append_section (null, section);
452 }
332453
333 var indicator = new MenuItem.submenu ("x", submenu);454 var indicator = new MenuItem.submenu ("x", submenu);
334 indicator.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root");455 indicator.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root");
@@ -355,6 +476,7 @@
355 [DBus (visible = false)]476 [DBus (visible = false)]
356 private void handle_changed_current (string key) {477 private void handle_changed_current (string key) {
357 update_indicator_action ();478 update_indicator_action ();
479 update_login_layout ();
358 }480 }
359481
360 [DBus (visible = false)]482 [DBus (visible = false)]
@@ -363,6 +485,7 @@
363485
364 update_sources_menu ();486 update_sources_menu ();
365 update_indicator_action ();487 update_indicator_action ();
488 update_login_layout ();
366 }489 }
367490
368 [DBus (visible = false)]491 [DBus (visible = false)]

Subscribers

People subscribed via source and target branches

to all changes: