Merge lp:~jbicha/indicator-keyboard/drop-patches into lp:indicator-keyboard

Proposed by Jeremy Bicha
Status: Merged
Approved by: William Hua
Approved revision: 93
Merged at revision: 94
Proposed branch: lp:~jbicha/indicator-keyboard/drop-patches
Merge into: lp:indicator-keyboard
Diff against target: 2287 lines (+0/-2220)
12 files modified
.pc/.quilt_patches (+0/-1)
.pc/.quilt_series (+0/-1)
.pc/.version (+0/-1)
.pc/applied-patches (+0/-3)
.pc/default-icon-colour.patch/lib/main.vala (+0/-754)
.pc/disable-experimental-non-null.patch/tests/Makefile.am (+0/-18)
.pc/disable-experimental-non-null.patch/tests/main.vala (+0/-675)
.pc/relax-test-missing-ibus.patch/tests/main.vala (+0/-675)
debian/patches/default-icon-colour.patch (+0/-10)
debian/patches/disable-experimental-non-null.patch (+0/-68)
debian/patches/relax-test-missing-ibus.patch (+0/-11)
debian/patches/series (+0/-3)
To merge this branch: bzr merge lp:~jbicha/indicator-keyboard/drop-patches
Reviewer Review Type Date Requested Status
William Hua (community) Approve
Review via email: mp+177306@code.launchpad.net

Description of the change

the upstream branch shouldn't need patches...

To post a comment you must log in.
Revision history for this message
William Hua (attente) wrote :

Did this with the intention of keeping workarounds to certain problems isolated in their respective patches, but guess it was more trouble than it was worth...

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed directory '.pc'
2=== removed file '.pc/.quilt_patches'
3--- .pc/.quilt_patches 2013-06-22 20:26:13 +0000
4+++ .pc/.quilt_patches 1970-01-01 00:00:00 +0000
5@@ -1,1 +0,0 @@
6-debian/patches
7
8=== removed file '.pc/.quilt_series'
9--- .pc/.quilt_series 2013-06-22 20:26:13 +0000
10+++ .pc/.quilt_series 1970-01-01 00:00:00 +0000
11@@ -1,1 +0,0 @@
12-series
13
14=== removed file '.pc/.version'
15--- .pc/.version 2013-06-22 20:26:13 +0000
16+++ .pc/.version 1970-01-01 00:00:00 +0000
17@@ -1,1 +0,0 @@
18-2
19
20=== removed file '.pc/applied-patches'
21--- .pc/applied-patches 2013-07-17 20:06:48 +0000
22+++ .pc/applied-patches 1970-01-01 00:00:00 +0000
23@@ -1,3 +0,0 @@
24-default-icon-colour.patch
25-disable-experimental-non-null.patch
26-relax-test-missing-ibus.patch
27
28=== removed directory '.pc/default-icon-colour.patch'
29=== removed directory '.pc/default-icon-colour.patch/lib'
30=== removed file '.pc/default-icon-colour.patch/lib/main.vala'
31--- .pc/default-icon-colour.patch/lib/main.vala 2013-07-17 18:47:22 +0000
32+++ .pc/default-icon-colour.patch/lib/main.vala 1970-01-01 00:00:00 +0000
33@@ -1,754 +0,0 @@
34-[DBus (name = "com.canonical.indicator.keyboard")]
35-public class Indicator.Keyboard.Service : Object {
36-
37- private bool use_gtk;
38- private bool use_bamf;
39- private MainLoop? loop;
40- private Settings indicator_settings;
41- private Settings source_settings;
42- private Settings per_window_settings;
43- private Gnome.XkbInfo xkb_info;
44- private IBus.Bus? ibus;
45- private Bamf.Matcher? matcher;
46- private Gee.HashMap<string, uint>? window_sources;
47-
48- private SimpleActionGroup? action_group;
49- private SimpleAction? indicator_action;
50- private MenuModel? menu_model;
51- private Menu? sources_menu;
52-
53- private Icon?[]? icons;
54- private string[]? icon_strings;
55- private int[]? icon_string_uniques;
56- private uint[]? icon_string_subscripts;
57-
58- [DBus (visible = false)]
59- public Service (ref unowned string[] args) {
60- Bus.own_name (BusType.SESSION,
61- "com.canonical.indicator.keyboard",
62- BusNameOwnerFlags.ALLOW_REPLACEMENT | ("--force" in args ? BusNameOwnerFlags.REPLACE : 0),
63- this.handle_bus_acquired,
64- null,
65- this.handle_name_lost);
66-
67- this.use_gtk = "--use-gtk" in args;
68- this.use_bamf = "--use-bamf" in args;
69-
70- if (this.use_gtk) {
71- this.use_gtk = Gtk.init_check (ref args);
72- } else {
73- Gdk.init (ref args);
74- }
75-
76- this.indicator_settings = new Settings ("com.canonical.indicator.keyboard");
77- this.indicator_settings.changed["visible"].connect (this.handle_changed_visible);
78-
79- this.source_settings = new Settings ("org.gnome.desktop.input-sources");
80- this.source_settings.changed["current"].connect (this.handle_changed_current);
81- this.source_settings.changed["sources"].connect (this.handle_changed_sources);
82-
83- this.per_window_settings = new Settings ("org.gnome.libgnomekbd.desktop");
84- this.per_window_settings.changed["group-per-window"].connect (this.handle_changed_group_per_window);
85-
86- this.xkb_info = new Gnome.XkbInfo ();
87-
88- migrate_keyboard_layouts ();
89-
90- update_window_sources ();
91-
92- this.loop = new MainLoop ();
93- ((!) this.loop).run ();
94- }
95-
96- [DBus (visible = false)]
97- private IBus.Bus get_ibus () {
98- if (this.ibus == null) {
99- IBus.init ();
100- this.ibus = new IBus.Bus ();
101- }
102-
103- return (!) this.ibus;
104- }
105-
106- [DBus (visible = false)]
107- private void migrate_keyboard_layouts () {
108- if (!this.indicator_settings.get_boolean ("migrated")) {
109- var builder = new VariantBuilder (new VariantType ("a(ss)"));
110- var length = 0;
111-
112- var layout_settings = new Settings ("org.gnome.libgnomekbd.keyboard");
113- var layouts = layout_settings.get_strv ("layouts");
114-
115- foreach (var layout in layouts) {
116- var source = layout;
117-
118- source = source.replace (" ", "+");
119- source = source.replace ("\t", "+");
120-
121- builder.add ("(ss)", "xkb", source);
122- length++;
123- }
124-
125- var engines = get_ibus ().list_active_engines ();
126-
127- foreach (var engine in engines) {
128- if (length == 0 || engine.name.has_prefix ("xkb")) {
129- var source = "us";
130- string? layout = engine.get_layout ();
131- string? variant = engine.get_layout_variant ();
132-
133- if (layout != null && ((!) layout).length == 0) {
134- layout = null;
135- }
136-
137- if (variant != null && ((!) variant).length == 0) {
138- variant = null;
139- }
140-
141- if (layout != null && variant != null) {
142- source = @"$((!) layout)+$((!) variant)";
143- } else if (layout != null) {
144- source = (!) layout;
145- }
146-
147- builder.add ("(ss)", "xkb", source);
148- length++;
149- }
150-
151- if (!engine.name.has_prefix ("xkb")) {
152- builder.add ("(ss)", "ibus", engine.name);
153- length++;
154- }
155- }
156-
157- this.source_settings.set_value ("sources", builder.end ());
158-
159- this.indicator_settings.set_boolean ("migrated", true);
160- }
161- }
162-
163- [DBus (visible = false)]
164- private void update_window_sources () {
165- if (this.use_bamf) {
166- var group_per_window = this.per_window_settings.get_boolean ("group-per-window");
167-
168- if (group_per_window != (this.window_sources != null)) {
169- if (group_per_window) {
170- this.window_sources = new Gee.HashMap<string, uint> ();
171- this.matcher = Bamf.Matcher.get_default ();
172- ((!) this.matcher).active_window_changed.connect (this.handle_active_window_changed);
173- } else {
174- ((!) this.matcher).active_window_changed.disconnect (this.handle_active_window_changed);
175- this.matcher = null;
176- this.window_sources = null;
177- }
178- }
179- }
180- }
181-
182- [DBus (visible = false)]
183- private void handle_changed_group_per_window (string key) {
184- update_window_sources ();
185- }
186-
187- [DBus (visible = false)]
188- private void handle_active_window_changed (Bamf.View? old_view, Bamf.View? new_view) {
189- if (old_view != null) {
190- ((!) this.window_sources)[((!) old_view).path] = this.source_settings.get_uint ("current");
191- }
192-
193- if (new_view != null) {
194- if (!((!) this.window_sources).has_key (((!) new_view).path)) {
195- var default_group = this.per_window_settings.get_int ("default-group");
196-
197- if (default_group >= 0) {
198- this.source_settings.set_uint ("current", (uint) default_group);
199- }
200- } else {
201- this.source_settings.set_uint ("current", ((!) this.window_sources)[((!) new_view).path]);
202- }
203- }
204- }
205-
206- [DBus (visible = false)]
207- private Gtk.StyleContext? get_style_context () {
208- Gtk.StyleContext? context = null;
209-
210- if (this.use_gtk) {
211- Gdk.Screen? screen = Gdk.Screen.get_default ();
212-
213- if (screen != null) {
214- context = new Gtk.StyleContext ();
215- ((!) context).set_screen ((!) screen);
216-
217- var path = new Gtk.WidgetPath ();
218- path.append_type (typeof (Gtk.MenuItem));
219- ((!) context).set_path (path);
220- }
221- }
222-
223- return context;
224- }
225-
226- [DBus (visible = false)]
227- protected virtual Icon? create_icon (string? text, uint subscript) {
228- Icon? icon = null;
229-
230- var style = get_style_context ();
231-
232- if (style != null) {
233- const int W = 22;
234- const int H = 22;
235- const int w = 20;
236- const int h = 20;
237- const double R = 2.0;
238- const double TEXT_SIZE = 12.0;
239- const double SUBSCRIPT_SIZE = 8.0;
240-
241- Pango.FontDescription description;
242- var colour = ((!) style).get_color (Gtk.StateFlags.NORMAL);
243- ((!) style).get (Gtk.StateFlags.NORMAL, Gtk.STYLE_PROPERTY_FONT, out description);
244-
245- var surface = new Cairo.ImageSurface (Cairo.Format.ARGB32, W, H);
246- var context = new Cairo.Context (surface);
247-
248- context.translate (0.5 * (W - w), 0.5 * (H - h));
249-
250- context.new_sub_path ();
251- context.arc (R, R, R, Math.PI, -0.5 * Math.PI);
252- context.arc (w - R, R, R, -0.5 * Math.PI, 0);
253- context.arc (w - R, h - R, R, 0, 0.5 * Math.PI);
254- context.arc (R, h - R, R, 0.5 * Math.PI, Math.PI);
255- context.close_path ();
256-
257- context.set_source_rgba (colour.red, colour.green, colour.blue, colour.alpha);
258- context.fill ();
259- context.set_operator (Cairo.Operator.CLEAR);
260-
261- if (text != null) {
262- var text_layout = Pango.cairo_create_layout (context);
263- text_layout.set_alignment (Pango.Alignment.CENTER);
264- description.set_absolute_size (Pango.units_from_double (TEXT_SIZE));
265- text_layout.set_font_description (description);
266- text_layout.set_text ((!) text, -1);
267- Pango.cairo_update_layout (context, text_layout);
268- int text_width;
269- int text_height;
270- text_layout.get_pixel_size (out text_width, out text_height);
271-
272- if (subscript > 0) {
273- var subscript_layout = Pango.cairo_create_layout (context);
274- subscript_layout.set_alignment (Pango.Alignment.CENTER);
275- description.set_absolute_size (Pango.units_from_double (SUBSCRIPT_SIZE));
276- subscript_layout.set_font_description (description);
277- subscript_layout.set_text (@"$subscript", -1);
278- Pango.cairo_update_layout (context, subscript_layout);
279- int subscript_width;
280- int subscript_height;
281- subscript_layout.get_pixel_size (out subscript_width, out subscript_height);
282-
283- context.save ();
284- context.translate ((w - (text_width + subscript_width)) / 2, (h - text_height) / 2);
285- Pango.cairo_layout_path (context, text_layout);
286- context.fill ();
287- context.restore ();
288-
289- context.save ();
290- context.translate ((w + (text_width - subscript_width)) / 2, (h + text_height) / 2 - subscript_height);
291- Pango.cairo_layout_path (context, subscript_layout);
292- context.fill ();
293- context.restore ();
294- } else {
295- context.save ();
296- context.translate ((w - text_width) / 2, (h - text_height) / 2);
297- Pango.cairo_layout_path (context, text_layout);
298- context.fill ();
299- context.restore ();
300- }
301- }
302-
303- var buffer = new ByteArray ();
304-
305- surface.write_to_png_stream ((data) => {
306- buffer.append (data);
307- return Cairo.Status.SUCCESS;
308- });
309-
310- icon = new BytesIcon (ByteArray.free_to_bytes ((owned) buffer));
311- }
312-
313- return icon;
314- }
315-
316- [DBus (visible = false)]
317- private string get_icon_string (uint index) {
318- string? icon_string = null;
319-
320- if (this.icon_strings == null) {
321- var array = this.source_settings.get_value ("sources");
322- this.icon_strings = new string[array.n_children ()];
323- }
324-
325- if (index < ((!) this.icon_strings).length) {
326- icon_string = this.icon_strings[index];
327-
328- if (icon_string == null) {
329- var array = this.source_settings.get_value ("sources");
330-
331- string type;
332- string name;
333-
334- array.get_child (index, "(ss)", out type, out name);
335-
336- if (type == "xkb") {
337- string? short_name;
338-
339- this.xkb_info.get_layout_info (name, null, out short_name, null, null);
340-
341- if (short_name != null) {
342- this.icon_strings[index] = get_abbreviation ((!) short_name);
343- icon_string = this.icon_strings[index];
344- }
345- }
346- }
347- }
348-
349- if (icon_string == null) {
350- icon_string = "";
351- }
352-
353- return (!) icon_string;
354- }
355-
356- [DBus (visible = false)]
357- private bool is_icon_string_unique (uint index) {
358- bool icon_string_unique = true;
359-
360- if (this.icon_string_uniques == null) {
361- var array = this.source_settings.get_value ("sources");
362- this.icon_string_uniques = new int[array.n_children ()];
363-
364- for (var i = 0; i < ((!) this.icon_string_uniques).length; i++) {
365- this.icon_string_uniques[i] = -1;
366- }
367- }
368-
369- if (index < ((!) this.icon_string_uniques).length) {
370- if (this.icon_string_uniques[index] == -1) {
371- this.icon_string_uniques[index] = 1;
372-
373- var icon_string = get_icon_string (index);
374-
375- for (var i = 0; i < ((!) this.icon_string_uniques).length && this.icon_string_uniques[index] == 1; i++) {
376- if (i != index && get_icon_string (i) == icon_string) {
377- this.icon_string_uniques[index] = 0;
378- }
379- }
380- }
381-
382- icon_string_unique = this.icon_string_uniques[index] != 0;
383- }
384-
385- return icon_string_unique;
386- }
387-
388- [DBus (visible = false)]
389- private uint get_icon_string_subscript (uint index) {
390- uint icon_string_subscript = 0;
391-
392- if (this.icon_string_subscripts == null) {
393- var array = this.source_settings.get_value ("sources");
394- this.icon_string_subscripts = new uint[array.n_children ()];
395- }
396-
397- if (index < ((!) this.icon_string_subscripts).length) {
398- icon_string_subscript = this.icon_string_subscripts[index];
399-
400- if (icon_string_subscript == 0) {
401- this.icon_string_subscripts[index] = 1;
402-
403- for (var i = (int) index - 1; i >= 0 && this.icon_string_subscripts[index] == 1; i--) {
404- if (get_icon_string (i) == get_icon_string (index)) {
405- this.icon_string_subscripts[index] = get_icon_string_subscript (i) + 1;
406- }
407- }
408-
409- icon_string_subscript = this.icon_string_subscripts[index];
410- }
411- }
412-
413- return icon_string_subscript;
414- }
415-
416- [DBus (visible = false)]
417- private Icon? get_icon (uint index) {
418- Icon? icon = null;
419-
420- if (this.icons == null) {
421- var array = this.source_settings.get_value ("sources");
422- this.icons = new Icon?[array.n_children ()];
423- }
424-
425- if (index < ((!) this.icons).length) {
426- icon = this.icons[index];
427-
428- if (icon == null) {
429- var array = this.source_settings.get_value ("sources");
430-
431- string type;
432- string name;
433-
434- array.get_child (index, "(ss)", out type, out name);
435-
436- if (type == "xkb") {
437- var icon_string = get_icon_string (index);
438- var icon_unique = is_icon_string_unique (index);
439- var icon_subscript = get_icon_string_subscript (index);
440-
441- if (icon_string.get_char () != '\0') {
442- string icon_name;
443-
444- if (icon_unique) {
445- icon_name = @"indicator-keyboard-$((!) icon_string)";
446- } else {
447- icon_name = @"indicator-keyboard-$((!) icon_string)-$icon_subscript";
448- }
449-
450- if (this.use_gtk) {
451- var icon_theme = Gtk.IconTheme.get_default ();
452- Gtk.IconInfo? icon_info = icon_theme.lookup_icon (icon_name, 22, 0);
453-
454- if (icon_info != null) {
455- try {
456- this.icons[index] = Icon.new_for_string (((!) icon_info).get_filename ());
457- } catch (Error error) {
458- this.icons[index] = null;
459- }
460- }
461- } else {
462- this.icons[index] = new ThemedIcon (icon_name);
463- }
464- }
465-
466- if (this.icons[index] == null) {
467- if (icon_unique) {
468- this.icons[index] = create_icon (icon_string, 0);
469- } else {
470- this.icons[index] = create_icon (icon_string, icon_subscript);
471- }
472- }
473- } else if (type == "ibus") {
474- var names = new string[2];
475- names[0] = name;
476-
477- var engines = get_ibus ().get_engines_by_names (names);
478-
479- if (engines.length > 0) {
480- var engine = engines[0];
481-
482- try {
483- this.icons[index] = Icon.new_for_string (engine.get_icon ());
484- } catch (Error error) {
485- warning ("error: %s", error.message);
486- }
487- }
488- }
489-
490- icon = this.icons[index];
491- }
492- }
493-
494- return icon;
495- }
496-
497- [DBus (visible = false)]
498- protected virtual SimpleActionGroup create_action_group (Action root_action) {
499- var group = new SimpleActionGroup ();
500-
501- group.insert (root_action);
502- group.insert (this.source_settings.create_action ("current"));
503-
504- var action = new SimpleAction ("map", null);
505- action.activate.connect (this.handle_activate_map);
506- group.insert (action);
507-
508- action = new SimpleAction ("chart", null);
509- action.activate.connect (this.handle_activate_chart);
510- group.insert (action);
511-
512- action = new SimpleAction ("settings", null);
513- action.activate.connect (this.handle_activate_settings);
514- group.insert (action);
515-
516- return group;
517- }
518-
519- [DBus (visible = false)]
520- private void update_indicator_action () {
521- var visible = this.indicator_settings.get_boolean ("visible");
522- var current = this.source_settings.get_uint ("current");
523- var icon = get_icon (current);
524- Variant state;
525-
526- if (icon != null) {
527- state = new Variant.parsed ("{ 'visible' : <%b>, 'icon' : %v }", visible, ((!) icon).serialize ());
528- } else {
529- state = new Variant.parsed ("{ 'visible' : <%b> }", visible);
530- }
531-
532- get_indicator_action ().set_state (state);
533- }
534-
535- [DBus (visible = false)]
536- private SimpleAction get_indicator_action () {
537- if (this.indicator_action == null) {
538- var state = new Variant.parsed ("{ 'visible' : <false> }");
539- this.indicator_action = new SimpleAction.stateful ("indicator", null, state);
540- update_indicator_action ();
541- }
542-
543- return (!) this.indicator_action;
544- }
545-
546- [DBus (visible = false)]
547- public SimpleActionGroup get_action_group () {
548- if (this.action_group == null) {
549- this.action_group = create_action_group (get_indicator_action ());
550- }
551-
552- return (!) this.action_group;
553- }
554-
555- [DBus (visible = false)]
556- protected virtual MenuModel create_menu_model (MenuModel section_menu) {
557- var menu = new Menu ();
558-
559- var submenu = new Menu ();
560-
561- submenu.append_section (null, section_menu);
562-
563- var section = new Menu ();
564- section.append (_ ("Character Map"), "indicator.map");
565- section.append (_ ("Keyboard Layout Chart"), "indicator.chart");
566- section.append (_ ("Text Entry Settings..."), "indicator.settings");
567- submenu.append_section (null, section);
568-
569- var indicator = new MenuItem.submenu ("x", submenu);
570- indicator.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root");
571- indicator.set_detailed_action ("indicator.indicator");
572- menu.append_item (indicator);
573-
574- return menu;
575- }
576-
577- [DBus (visible = false)]
578- private string get_display_name (string layout) {
579- string? language = Xkl.get_language_name (layout);
580- string? country = Xkl.get_country_name (layout);
581- var has_language = language != null && ((!) language).get_char () != '\0';
582- var has_country = country != null && ((!) country).get_char () != '\0';
583-
584- if (has_language && has_country) {
585- return @"$((!) language) ($((!) country))";
586- } else if (has_language) {
587- return (!) language;
588- } else if (has_country) {
589- return (!) country;
590- } else {
591- return "";
592- }
593- }
594-
595- [DBus (visible = false)]
596- private void update_sources_menu () {
597- if (this.sources_menu != null) {
598- var menu = get_sources_menu ();
599-
600- while (menu.get_n_items () > 0)
601- menu.remove (0);
602-
603- VariantIter iter;
604- string type;
605- string name;
606-
607- this.source_settings.get ("sources", "a(ss)", out iter);
608-
609- for (var i = 0; iter.next ("(ss)", out type, out name); i++) {
610- if (type == "xkb") {
611- string? display_name;
612- string? layout_name;
613-
614- this.xkb_info.get_layout_info (name, out display_name, null, out layout_name, null);
615-
616- if (display_name != null) {
617- name = (!) display_name;
618- } else if (layout_name != null) {
619- name = get_display_name ((!) layout_name);
620- }
621- }
622- else if (type == "ibus") {
623- var names = new string[2];
624- names[0] = name;
625-
626- var engines = get_ibus ().get_engines_by_names (names);
627-
628- if (engines.length > 0) {
629- var engine = engines[0];
630- string? language = engine.get_language ();
631- string? display_name = engine.get_longname ();
632-
633- if (language != null) {
634- language = Xkl.get_language_name ((!) language);
635- }
636-
637- if (language != null && display_name != null) {
638- name = @"$((!) language) ($((!) display_name))";
639- } else if (language != null) {
640- name = (!) language;
641- } else if (display_name != null) {
642- name = (!) display_name;
643- }
644- }
645- }
646-
647- var menu_item = new MenuItem (name, "indicator.current");
648- menu_item.set_attribute (Menu.ATTRIBUTE_TARGET, "u", i);
649-
650- var icon = get_icon (i);
651- if (icon != null) {
652- menu_item.set_icon ((!) icon);
653- }
654-
655- menu.append_item (menu_item);
656- }
657- } else {
658- get_sources_menu ();
659- }
660- }
661-
662- [DBus (visible = false)]
663- private Menu get_sources_menu () {
664- if (this.sources_menu == null) {
665- this.sources_menu = new Menu ();
666- update_sources_menu ();
667- }
668-
669- return (!) this.sources_menu;
670- }
671-
672- [DBus (visible = false)]
673- public MenuModel get_menu_model () {
674- if (this.menu_model == null) {
675- this.menu_model = create_menu_model (get_sources_menu ());
676- }
677-
678- return (!) this.menu_model;
679- }
680-
681- [DBus (visible = false)]
682- private void handle_changed_visible (string key) {
683- update_indicator_action ();
684- }
685-
686- [DBus (visible = false)]
687- private void handle_changed_current (string key) {
688- update_indicator_action ();
689- }
690-
691- [DBus (visible = false)]
692- private void handle_changed_sources (string key) {
693- this.icon_string_subscripts = null;
694- this.icon_string_uniques = null;
695- this.icon_strings = null;
696- this.icons = null;
697-
698- update_sources_menu ();
699- update_indicator_action ();
700- }
701-
702- [DBus (visible = false)]
703- private void handle_activate_map (Variant? parameter) {
704- try {
705- Process.spawn_command_line_async ("gucharmap");
706- } catch (SpawnError error) {
707- warning ("error: %s", error.message);
708- }
709- }
710-
711- [DBus (visible = false)]
712- private void handle_activate_chart (Variant? parameter) {
713- var layout = "us";
714- string? variant = null;
715-
716- var current = this.source_settings.get_uint ("current");
717- var array = this.source_settings.get_value ("sources");
718-
719- if (current < array.n_children ()) {
720- string type;
721- string name;
722-
723- array.get_child (current, "(ss)", out type, out name);
724-
725- if (type == "xkb") {
726- this.xkb_info.get_layout_info (name, null, null, out layout, out variant);
727- } else if (type == "ibus") {
728- var names = new string[2];
729- names[0] = name;
730-
731- var engines = get_ibus ().get_engines_by_names (names);
732-
733- if (engines.length > 0) {
734- var engine = engines[0];
735-
736- layout = engine.get_layout ();
737- variant = engine.get_layout_variant ();
738- }
739- }
740- }
741-
742- try {
743- string command;
744-
745- if (variant != null && ((!) variant).get_char () != '\0') {
746- command = @"gkbd-keyboard-display -l \"$layout\t$((!) variant)\"";
747- } else {
748- command = @"gkbd-keyboard-display -l $layout";
749- }
750-
751- Process.spawn_command_line_async (command);
752- } catch (SpawnError error) {
753- warning ("error: %s", error.message);
754- }
755- }
756-
757- [DBus (visible = false)]
758- private void handle_activate_settings (Variant? parameter) {
759- try {
760- Process.spawn_command_line_async ("gnome-control-center region layouts");
761- } catch (SpawnError error) {
762- warning ("error: %s", error.message);
763- }
764- }
765-
766- [DBus (visible = false)]
767- private void handle_bus_acquired (DBusConnection connection, string name) {
768- try {
769- connection.export_action_group ("/com/canonical/indicator/keyboard", get_action_group ());
770- connection.export_menu_model ("/com/canonical/indicator/keyboard/desktop", get_menu_model ());
771- } catch (Error error) {
772- warning ("error: %s", error.message);
773- }
774- }
775-
776- [DBus (visible = false)]
777- private void handle_name_lost (DBusConnection? connection, string name) {
778- ((!) this.loop).quit ();
779- this.loop = null;
780- }
781-
782- [DBus (visible = false)]
783- public static int main (string[] args) {
784- new Service (ref args);
785- return 0;
786- }
787-}
788
789=== removed directory '.pc/disable-experimental-non-null.patch'
790=== removed directory '.pc/disable-experimental-non-null.patch/tests'
791=== removed file '.pc/disable-experimental-non-null.patch/tests/Makefile.am'
792--- .pc/disable-experimental-non-null.patch/tests/Makefile.am 2013-07-17 19:17:32 +0000
793+++ .pc/disable-experimental-non-null.patch/tests/Makefile.am 1970-01-01 00:00:00 +0000
794@@ -1,18 +0,0 @@
795-TESTS = indicator-keyboard-test
796-
797-check_PROGRAMS = indicator-keyboard-tests
798-
799-AM_CFLAGS = -w
800-AM_LDFLAGS = -lm
801-AM_VALAFLAGS = --enable-experimental-non-null \
802- --metadatadir $(top_srcdir)/deps \
803- --vapidir $(top_srcdir)/deps
804-
805-indicator_keyboard_tests_SOURCES = main.vala \
806- config.vala
807-indicator_keyboard_tests_VALAFLAGS = $(AM_VALAFLAGS) \
808- --pkg gio-2.0
809-indicator_keyboard_tests_CFLAGS = $(AM_CFLAGS) \
810- $(GIO_CFLAGS)
811-indicator_keyboard_tests_LDFLAGS = $(AM_LDFLAGS) \
812- $(GIO_LIBS)
813
814=== removed file '.pc/disable-experimental-non-null.patch/tests/main.vala'
815--- .pc/disable-experimental-non-null.patch/tests/main.vala 2013-07-04 04:12:14 +0000
816+++ .pc/disable-experimental-non-null.patch/tests/main.vala 1970-01-01 00:00:00 +0000
817@@ -1,675 +0,0 @@
818-const int TIMEOUT_S = 1;
819-const int TIMEOUT_MS = 1000;
820-
821-[DBus (name = "com.canonical.indicator.keyboard.test")]
822-public class Service : Object {
823-
824- [DBus (visible = false)]
825- private string? _command;
826-
827- [DBus (visible = false)]
828- public string? command {
829- get { return _command; }
830- }
831-
832- public void execute (string command) {
833- this._command = command;
834-
835- var pspec = this.get_class ().find_property ("command");
836-
837- if (pspec != null) {
838- this.notify["command"] ((!) pspec);
839- }
840- }
841-}
842-
843-struct Fixture {
844- TestDBus? bus;
845- uint service_name;
846- DBusConnection? connection;
847- Service? service;
848- uint object_name;
849-}
850-
851-static void start_service (Fixture *fixture) {
852- if (fixture.connection != null) {
853- try {
854- fixture.service = new Service ();
855- fixture.object_name = ((!) fixture.connection).register_object ("/com/canonical/indicator/keyboard/test", fixture.service);
856- } catch (IOError error) {
857- fixture.connection = null;
858- fixture.service = null;
859- fixture.object_name = 0;
860-
861- Test.message ("error: %s", error.message);
862- Test.fail ();
863- }
864- }
865-}
866-
867-static void begin_test (void *data) {
868- var fixture = (Fixture *) data;
869-
870- fixture.bus = new TestDBus (TestDBusFlags.NONE);
871- ((!) fixture.bus).add_service_dir (SERVICE_DIR);
872- ((!) fixture.bus).up ();
873-
874- var loop = new MainLoop (null, false);
875-
876- fixture.service_name = Bus.own_name (BusType.SESSION,
877- "com.canonical.indicator.keyboard.test",
878- BusNameOwnerFlags.ALLOW_REPLACEMENT | BusNameOwnerFlags.REPLACE,
879- (connection, name) => {
880- if (loop.is_running ()) {
881- fixture.connection = connection;
882-
883- start_service (fixture);
884-
885- loop.quit ();
886- }
887- },
888- null,
889- (connection, name) => {
890- if (loop.is_running ()) {
891- fixture.connection = null;
892- fixture.service = null;
893- fixture.object_name = 0;
894-
895- loop.quit ();
896- }
897- });
898-
899- loop.run ();
900-
901- if (fixture.connection == null) {
902- Test.message ("error: Unable to connect to com.canonical.indicator.keyboard.test.");
903- Test.fail ();
904- }
905-}
906-
907-static void end_test (void *data) {
908- var fixture = (Fixture *) data;
909-
910- if (fixture.object_name != 0) {
911- ((!) fixture.connection).unregister_object (fixture.object_name);
912- fixture.object_name = 0;
913- }
914-
915- if (fixture.service_name != 0) {
916- Bus.unown_name (fixture.service_name);
917- fixture.service_name = 0;
918- }
919-
920- fixture.service = null;
921- fixture.connection = null;
922-
923- if (fixture.bus != null) {
924- ((!) fixture.bus).down ();
925- fixture.bus = null;
926- }
927-}
928-
929-static void test_activate_input_source (void *data) {
930- var fixture = (Fixture *) data;
931-
932- if (fixture.object_name == 0) {
933- Test.message ("error: Test fixture not initialized.");
934- Test.fail ();
935- return;
936- }
937-
938- try {
939- var current = 0;
940- var sources = "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo'), ('ibus', 'pinyin')]";
941- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
942- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
943- } catch (SpawnError error) {
944- Test.message ("error: %s", error.message);
945- Test.fail ();
946- return;
947- }
948-
949- var action_group = DBusActionGroup.get ((!) fixture.connection,
950- "com.canonical.indicator.keyboard",
951- "/com/canonical/indicator/keyboard");
952- var loop = new MainLoop (null, false);
953- var signal_name = action_group.action_state_changed["current"].connect ((action, state) => {
954- loop.quit ();
955- });
956-
957- action_group.list_actions ();
958- action_group.activate_action ("current", new Variant.uint32 (2));
959-
960- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
961- loop.run ();
962- Source.remove (source);
963- action_group.disconnect (signal_name);
964-
965- var state = action_group.get_action_state ("current");
966- var current = ((!) state).get_uint32 ();
967- assert (current == 2);
968-
969- try {
970- string output;
971- Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources current", out output);
972- assert (strcmp (output, "uint32 2\n") == 0);
973- } catch (SpawnError error) {
974- Test.message ("error: %s", error.message);
975- Test.fail ();
976- return;
977- }
978-}
979-
980-static void test_activate_character_map (void *data) {
981- var fixture = (Fixture *) data;
982-
983- if (fixture.object_name == 0) {
984- Test.message ("error: Test fixture not initialized.");
985- Test.fail ();
986- return;
987- }
988-
989- var action_group = DBusActionGroup.get ((!) fixture.connection,
990- "com.canonical.indicator.keyboard",
991- "/com/canonical/indicator/keyboard");
992- var loop = new MainLoop (null, false);
993- var signal_name = ((!) fixture.service).notify["command"].connect ((pspec) => {
994- loop.quit ();
995- });
996-
997- action_group.activate_action ("map", null);
998-
999- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1000- loop.run ();
1001- Source.remove (source);
1002- ((!) fixture.service).disconnect (signal_name);
1003-
1004- assert (strcmp ((!) ((!) fixture.service).command, "'gucharmap '") == 0);
1005-}
1006-
1007-static void test_activate_keyboard_layout_chart (void *data) {
1008- var fixture = (Fixture *) data;
1009-
1010- if (fixture.object_name == 0) {
1011- Test.message ("error: Test fixture not initialized.");
1012- Test.fail ();
1013- return;
1014- }
1015-
1016- try {
1017- var current = 1;
1018- var sources = "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo'), ('ibus', 'pinyin')]";
1019- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
1020- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
1021- } catch (SpawnError error) {
1022- Test.message ("error: %s", error.message);
1023- Test.fail ();
1024- return;
1025- }
1026-
1027- var action_group = DBusActionGroup.get ((!) fixture.connection,
1028- "com.canonical.indicator.keyboard",
1029- "/com/canonical/indicator/keyboard");
1030- var loop = new MainLoop (null, false);
1031- var signal_name = ((!) fixture.service).notify["command"].connect ((pspec) => {
1032- loop.quit ();
1033- });
1034-
1035- action_group.activate_action ("chart", null);
1036-
1037- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1038- loop.run ();
1039- Source.remove (source);
1040- ((!) fixture.service).disconnect (signal_name);
1041-
1042- assert (strcmp ((!) ((!) fixture.service).command, "'gkbd-keyboard-display -l ca\teng'") == 0);
1043-}
1044-
1045-static void test_activate_text_entry_settings (void *data) {
1046- var fixture = (Fixture *) data;
1047-
1048- if (fixture.object_name == 0) {
1049- Test.message ("error: Test fixture not initialized.");
1050- Test.fail ();
1051- return;
1052- }
1053-
1054- var action_group = DBusActionGroup.get ((!) fixture.connection,
1055- "com.canonical.indicator.keyboard",
1056- "/com/canonical/indicator/keyboard");
1057- var loop = new MainLoop (null, false);
1058- var signal_name = ((!) fixture.service).notify["command"].connect ((pspec) => {
1059- loop.quit ();
1060- });
1061-
1062- action_group.activate_action ("settings", null);
1063-
1064- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1065- loop.run ();
1066- Source.remove (source);
1067- ((!) fixture.service).disconnect (signal_name);
1068-
1069- assert (strcmp ((!) ((!) fixture.service).command, "'gnome-control-center region layouts'") == 0);
1070-}
1071-
1072-static void test_migration (void *data) {
1073- var fixture = (Fixture *) data;
1074-
1075- if (fixture.object_name == 0) {
1076- Test.message ("error: Test fixture not initialized.");
1077- Test.fail ();
1078- return;
1079- }
1080-
1081- try {
1082- var migrated = false;
1083- var sources = "[('xkb', 'us')]";
1084- var layouts = "['us', 'ca\teng', 'epo']";
1085- Process.spawn_command_line_sync (@"gsettings set com.canonical.indicator.keyboard migrated $migrated");
1086- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
1087- Process.spawn_command_line_sync (@"gsettings set org.gnome.libgnomekbd.keyboard layouts \"$layouts\"");
1088- } catch (SpawnError error) {
1089- Test.message ("error: %s", error.message);
1090- Test.fail ();
1091- return;
1092- }
1093-
1094- try {
1095- var cancellable = new Cancellable ();
1096-
1097- var source = Timeout.add_seconds (TIMEOUT_S, () => { cancellable.cancel (); return false; });
1098-
1099- var dbus_proxy = new DBusProxy.sync ((!) fixture.connection,
1100- DBusProxyFlags.NONE,
1101- null,
1102- "org.freedesktop.DBus",
1103- "/",
1104- "org.freedesktop.DBus",
1105- cancellable);
1106-
1107- Source.remove (source);
1108-
1109- if (cancellable.is_cancelled ()) {
1110- Test.message ("error: Unable to connect to org.freedesktop.DBus.");
1111- Test.fail ();
1112- return;
1113- }
1114-
1115- dbus_proxy.call_sync ("StartServiceByName", new Variant ("(su)", "com.canonical.indicator.keyboard", 0), DBusCallFlags.NONE, TIMEOUT_MS);
1116- } catch (Error error) {
1117- Test.message ("error: %s", error.message);
1118- Test.fail ();
1119- return;
1120- }
1121-
1122- try {
1123- string sources;
1124- Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources sources", out sources);
1125- assert (strcmp (sources, "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo')]\n") == 0);
1126- } catch (SpawnError error) {
1127- Test.message ("error: %s", error.message);
1128- Test.fail ();
1129- return;
1130- }
1131-}
1132-
1133-static void test_no_migration (void *data) {
1134- var fixture = (Fixture *) data;
1135-
1136- if (fixture.object_name == 0) {
1137- Test.message ("error: Test fixture not initialized.");
1138- Test.fail ();
1139- return;
1140- }
1141-
1142- try {
1143- var migrated = true;
1144- var sources = "[('xkb', 'us')]";
1145- var layouts = "['us', 'ca\teng', 'epo']";
1146- Process.spawn_command_line_sync (@"gsettings set com.canonical.indicator.keyboard migrated $migrated");
1147- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
1148- Process.spawn_command_line_sync (@"gsettings set org.gnome.libgnomekbd.keyboard layouts \"$layouts\"");
1149- } catch (SpawnError error) {
1150- Test.message ("error: %s", error.message);
1151- Test.fail ();
1152- return;
1153- }
1154-
1155- try {
1156- var cancellable = new Cancellable ();
1157-
1158- var source = Timeout.add_seconds (TIMEOUT_S, () => { cancellable.cancel (); return false; });
1159-
1160- var dbus_proxy = new DBusProxy.sync ((!) fixture.connection,
1161- DBusProxyFlags.NONE,
1162- null,
1163- "org.freedesktop.DBus",
1164- "/",
1165- "org.freedesktop.DBus",
1166- cancellable);
1167-
1168- Source.remove (source);
1169-
1170- if (cancellable.is_cancelled ()) {
1171- Test.message ("error: Unable to connect to org.freedesktop.DBus.");
1172- Test.fail ();
1173- return;
1174- }
1175-
1176- dbus_proxy.call_sync ("StartServiceByName", new Variant ("(su)", "com.canonical.indicator.keyboard", 0), DBusCallFlags.NONE, TIMEOUT_MS);
1177- } catch (Error error) {
1178- Test.message ("error: %s", error.message);
1179- Test.fail ();
1180- return;
1181- }
1182-
1183- try {
1184- string sources;
1185- Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources sources", out sources);
1186- assert (strcmp (sources, "[('xkb', 'us')]\n") == 0);
1187- } catch (SpawnError error) {
1188- Test.message ("error: %s", error.message);
1189- Test.fail ();
1190- return;
1191- }
1192-}
1193-
1194-static void test_update_visible (void *data) {
1195- var fixture = (Fixture *) data;
1196-
1197- if (fixture.object_name == 0) {
1198- Test.message ("error: Test fixture not initialized.");
1199- Test.fail ();
1200- return;
1201- }
1202-
1203- bool visible;
1204-
1205- try {
1206- visible = true;
1207- Process.spawn_command_line_sync (@"gsettings set com.canonical.indicator.keyboard visible $visible");
1208- } catch (SpawnError error) {
1209- Test.message ("error: %s", error.message);
1210- Test.fail ();
1211- return;
1212- }
1213-
1214- var action_group = DBusActionGroup.get ((!) fixture.connection,
1215- "com.canonical.indicator.keyboard",
1216- "/com/canonical/indicator/keyboard");
1217- var loop = new MainLoop (null, false);
1218- var signal_name = action_group.action_added["indicator"].connect ((action) => {
1219- loop.quit ();
1220- });
1221-
1222- action_group.list_actions ();
1223-
1224- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1225- loop.run ();
1226- Source.remove (source);
1227- action_group.disconnect (signal_name);
1228-
1229- var state = action_group.get_action_state ("indicator");
1230- assert (((!) state).lookup ("visible", "b", out visible));
1231- assert (visible);
1232-
1233- loop = new MainLoop (null, false);
1234- signal_name = action_group.action_state_changed["indicator"].connect ((action, state) => {
1235- loop.quit ();
1236- });
1237-
1238- try {
1239- visible = false;
1240- Process.spawn_command_line_sync (@"gsettings set com.canonical.indicator.keyboard visible $visible");
1241- } catch (SpawnError error) {
1242- Test.message ("error: %s", error.message);
1243- Test.fail ();
1244- return;
1245- }
1246-
1247- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1248- loop.run ();
1249- Source.remove (source);
1250- action_group.disconnect (signal_name);
1251-
1252- state = action_group.get_action_state ("indicator");
1253- assert (((!) state).lookup ("visible", "b", out visible));
1254- assert (!visible);
1255-
1256- loop = new MainLoop (null, false);
1257- signal_name = action_group.action_state_changed["indicator"].connect ((action, state) => {
1258- loop.quit ();
1259- });
1260-
1261- try {
1262- visible = true;
1263- Process.spawn_command_line_sync (@"gsettings set com.canonical.indicator.keyboard visible $visible");
1264- } catch (SpawnError error) {
1265- Test.message ("error: %s", error.message);
1266- Test.fail ();
1267- return;
1268- }
1269-
1270- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1271- loop.run ();
1272- Source.remove (source);
1273- action_group.disconnect (signal_name);
1274-
1275- state = action_group.get_action_state ("indicator");
1276- assert (((!) state).lookup ("visible", "b", out visible));
1277- assert (visible);
1278-}
1279-
1280-static void test_update_input_source (void *data) {
1281- var fixture = (Fixture *) data;
1282-
1283- if (fixture.object_name == 0) {
1284- Test.message ("error: Test fixture not initialized.");
1285- Test.fail ();
1286- return;
1287- }
1288-
1289- try {
1290- var current = 0;
1291- var sources = "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo'), ('ibus', 'pinyin')]";
1292- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
1293- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
1294- } catch (SpawnError error) {
1295- Test.message ("error: %s", error.message);
1296- Test.fail ();
1297- return;
1298- }
1299-
1300- var action_group = DBusActionGroup.get ((!) fixture.connection,
1301- "com.canonical.indicator.keyboard",
1302- "/com/canonical/indicator/keyboard");
1303- var loop = new MainLoop (null, false);
1304- var signal_name = action_group.action_state_changed["current"].connect ((action, state) => {
1305- loop.quit ();
1306- });
1307-
1308- action_group.list_actions ();
1309-
1310- try {
1311- var current = 1;
1312- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
1313- } catch (SpawnError error) {
1314- Test.message ("error: %s", error.message);
1315- Test.fail ();
1316- return;
1317- }
1318-
1319- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1320- loop.run ();
1321- Source.remove (source);
1322- action_group.disconnect (signal_name);
1323-
1324- var state = action_group.get_action_state ("current");
1325- var current = ((!) state).get_uint32 ();
1326- assert (current == 1);
1327-
1328- try {
1329- string output;
1330- Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources current", out output);
1331- assert (strcmp (output, "uint32 1\n") == 0);
1332- } catch (SpawnError error) {
1333- Test.message ("error: %s", error.message);
1334- Test.fail ();
1335- return;
1336- }
1337-
1338- loop = new MainLoop (null, false);
1339- signal_name = action_group.action_state_changed["current"].connect ((action, state) => {
1340- loop.quit ();
1341- });
1342-
1343- try {
1344- current = 0;
1345- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
1346- } catch (SpawnError error) {
1347- Test.message ("error: %s", error.message);
1348- Test.fail ();
1349- return;
1350- }
1351-
1352- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1353- loop.run ();
1354- Source.remove (source);
1355- action_group.disconnect (signal_name);
1356-
1357- state = action_group.get_action_state ("current");
1358- current = ((!) state).get_uint32 ();
1359- assert (current == 0);
1360-
1361- try {
1362- string output;
1363- Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources current", out output);
1364- assert (strcmp (output, "uint32 0\n") == 0);
1365- } catch (SpawnError error) {
1366- Test.message ("error: %s", error.message);
1367- Test.fail ();
1368- return;
1369- }
1370-}
1371-
1372-static void test_update_input_sources (void *data) {
1373- var fixture = (Fixture *) data;
1374-
1375- if (fixture.object_name == 0) {
1376- Test.message ("error: Test fixture not initialized.");
1377- Test.fail ();
1378- return;
1379- }
1380-
1381- try {
1382- var current = 0;
1383- var sources = "[('xkb', 'us')]";
1384- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
1385- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
1386- } catch (SpawnError error) {
1387- Test.message ("error: %s", error.message);
1388- Test.fail ();
1389- return;
1390- }
1391-
1392- var menu_model = DBusMenuModel.get ((!) fixture.connection,
1393- "com.canonical.indicator.keyboard",
1394- "/com/canonical/indicator/keyboard/desktop");
1395- var loop = new MainLoop (null, false);
1396- var signal_name = menu_model.items_changed.connect ((position, removed, added) => {
1397- loop.quit ();
1398- });
1399-
1400- menu_model.get_n_items ();
1401-
1402- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1403- loop.run ();
1404- Source.remove (source);
1405- menu_model.disconnect (signal_name);
1406-
1407- var menu = menu_model.get_item_link (0, Menu.LINK_SUBMENU);
1408- loop = new MainLoop (null, false);
1409- signal_name = menu.items_changed.connect ((position, removed, added) => {
1410- loop.quit ();
1411- });
1412-
1413- menu.get_n_items ();
1414-
1415- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1416- loop.run ();
1417- Source.remove (source);
1418- menu.disconnect (signal_name);
1419-
1420- var section = menu.get_item_link (0, Menu.LINK_SECTION);
1421- loop = new MainLoop (null, false);
1422- signal_name = section.items_changed.connect ((position, removed, added) => {
1423- loop.quit ();
1424- });
1425-
1426- section.get_n_items ();
1427-
1428- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1429- loop.run ();
1430- Source.remove (source);
1431- section.disconnect (signal_name);
1432-
1433- string label;
1434-
1435- assert (section.get_n_items () == 1);
1436- section.get_item_attribute (0, Menu.ATTRIBUTE_LABEL, "s", out label);
1437- assert (strcmp (label, "English (US)") == 0);
1438-
1439- loop = new MainLoop (null, false);
1440- signal_name = section.items_changed.connect ((position, removed, added) => {
1441- if (section.get_n_items () == 4) {
1442- loop.quit ();
1443- }
1444- });
1445-
1446- try {
1447- var sources = "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo'), ('ibus', 'pinyin')]";
1448- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
1449- } catch (SpawnError error) {
1450- Test.message ("error: %s", error.message);
1451- Test.fail ();
1452- return;
1453- }
1454-
1455- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1456- loop.run ();
1457- Source.remove (source);
1458- section.disconnect (signal_name);
1459-
1460- assert (section.get_n_items () == 4);
1461- section.get_item_attribute (0, Menu.ATTRIBUTE_LABEL, "s", out label);
1462- assert (strcmp (label, "English (US)") == 0);
1463- section.get_item_attribute (1, Menu.ATTRIBUTE_LABEL, "s", out label);
1464- assert (strcmp (label, "English (Canada)") == 0);
1465- section.get_item_attribute (2, Menu.ATTRIBUTE_LABEL, "s", out label);
1466- assert (strcmp (label, "Esperanto") == 0);
1467- section.get_item_attribute (3, Menu.ATTRIBUTE_LABEL, "s", out label);
1468- assert (strcmp (label, "Pinyin") == 0);
1469-}
1470-
1471-public int main (string[] args) {
1472- Environment.set_variable ("DCONF_PROFILE", DCONF_PROFILE, true);
1473- Environment.set_variable ("LC_ALL", "C", true);
1474-
1475- Test.init (ref args, null);
1476-
1477- var suite = new TestSuite ("indicator-keyboard");
1478-
1479- suite.add (new TestCase ("activate-input-source", begin_test, test_activate_input_source, end_test, sizeof (Fixture)));
1480- suite.add (new TestCase ("activate-character-map", begin_test, test_activate_character_map, end_test, sizeof (Fixture)));
1481- suite.add (new TestCase ("activate-keyboard-layout-chart", begin_test, test_activate_keyboard_layout_chart, end_test, sizeof (Fixture)));
1482- suite.add (new TestCase ("activate-text-entry-settings", begin_test, test_activate_text_entry_settings, end_test, sizeof (Fixture)));
1483- suite.add (new TestCase ("migration", begin_test, test_migration, end_test, sizeof (Fixture)));
1484- suite.add (new TestCase ("no-migration", begin_test, test_no_migration, end_test, sizeof (Fixture)));
1485- suite.add (new TestCase ("update-visible", begin_test, test_update_visible, end_test, sizeof (Fixture)));
1486- suite.add (new TestCase ("update-input-source", begin_test, test_update_input_source, end_test, sizeof (Fixture)));
1487- suite.add (new TestCase ("update-input-sources", begin_test, test_update_input_sources, end_test, sizeof (Fixture)));
1488-
1489- TestSuite.get_root ().add_suite (suite);
1490-
1491- return Test.run ();
1492-}
1493
1494=== removed directory '.pc/relax-test-missing-ibus.patch'
1495=== removed directory '.pc/relax-test-missing-ibus.patch/tests'
1496=== removed file '.pc/relax-test-missing-ibus.patch/tests/main.vala'
1497--- .pc/relax-test-missing-ibus.patch/tests/main.vala 2013-07-17 20:06:48 +0000
1498+++ .pc/relax-test-missing-ibus.patch/tests/main.vala 1970-01-01 00:00:00 +0000
1499@@ -1,675 +0,0 @@
1500-const int TIMEOUT_S = 1;
1501-const int TIMEOUT_MS = 1000;
1502-
1503-[DBus (name = "com.canonical.indicator.keyboard.test")]
1504-public class Service : Object {
1505-
1506- [DBus (visible = false)]
1507- private string? _command;
1508-
1509- [DBus (visible = false)]
1510- public string? command {
1511- get { return _command; }
1512- }
1513-
1514- public void execute (string command) {
1515- this._command = command;
1516-
1517- var pspec = this.get_class ().find_property ("command");
1518-
1519- if (pspec != null) {
1520- this.notify["command"] ((!) pspec);
1521- }
1522- }
1523-}
1524-
1525-struct Fixture {
1526- TestDBus? bus;
1527- uint service_name;
1528- DBusConnection? connection;
1529- Service? service;
1530- uint object_name;
1531-}
1532-
1533-static void start_service (Fixture *fixture) {
1534- if (fixture.connection != null) {
1535- try {
1536- fixture.service = new Service ();
1537- fixture.object_name = ((!) fixture.connection).register_object ("/com/canonical/indicator/keyboard/test", fixture.service);
1538- } catch (IOError error) {
1539- fixture.connection = null;
1540- fixture.service = null;
1541- fixture.object_name = 0;
1542-
1543- Test.message ("error: %s", error.message);
1544- Test.fail ();
1545- }
1546- }
1547-}
1548-
1549-static void begin_test (void *data) {
1550- var fixture = (Fixture *) data;
1551-
1552- fixture.bus = new TestDBus (TestDBusFlags.NONE);
1553- ((!) fixture.bus).add_service_dir (SERVICE_DIR);
1554- ((!) fixture.bus).up ();
1555-
1556- var loop = new MainLoop (null, false);
1557-
1558- fixture.service_name = Bus.own_name (BusType.SESSION,
1559- "com.canonical.indicator.keyboard.test",
1560- BusNameOwnerFlags.ALLOW_REPLACEMENT | BusNameOwnerFlags.REPLACE,
1561- (connection, name) => {
1562- if (loop.is_running ()) {
1563- fixture.connection = connection;
1564-
1565- start_service (fixture);
1566-
1567- loop.quit ();
1568- }
1569- },
1570- null,
1571- (connection, name) => {
1572- if (loop.is_running ()) {
1573- fixture.connection = null;
1574- fixture.service = null;
1575- fixture.object_name = 0;
1576-
1577- loop.quit ();
1578- }
1579- });
1580-
1581- loop.run ();
1582-
1583- if (fixture.connection == null) {
1584- Test.message ("error: Unable to connect to com.canonical.indicator.keyboard.test.");
1585- Test.fail ();
1586- }
1587-}
1588-
1589-static void end_test (void *data) {
1590- var fixture = (Fixture *) data;
1591-
1592- if (fixture.object_name != 0) {
1593- ((!) fixture.connection).unregister_object (fixture.object_name);
1594- fixture.object_name = 0;
1595- }
1596-
1597- if (fixture.service_name != 0) {
1598- Bus.unown_name (fixture.service_name);
1599- fixture.service_name = 0;
1600- }
1601-
1602- fixture.service = null;
1603- fixture.connection = null;
1604-
1605- if (fixture.bus != null) {
1606- ((!) fixture.bus).down ();
1607- fixture.bus = null;
1608- }
1609-}
1610-
1611-static void test_activate_input_source (void *data) {
1612- var fixture = (Fixture *) data;
1613-
1614- if (fixture.object_name == 0) {
1615- Test.message ("error: Test fixture not initialized.");
1616- Test.fail ();
1617- return;
1618- }
1619-
1620- try {
1621- var current = 0;
1622- var sources = "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo'), ('ibus', 'pinyin')]";
1623- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
1624- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
1625- } catch (SpawnError error) {
1626- Test.message ("error: %s", error.message);
1627- Test.fail ();
1628- return;
1629- }
1630-
1631- var action_group = DBusActionGroup.get ((!) fixture.connection,
1632- "com.canonical.indicator.keyboard",
1633- "/com/canonical/indicator/keyboard");
1634- var loop = new MainLoop (null, false);
1635- var signal_name = action_group.action_state_changed["current"].connect ((action, state) => {
1636- loop.quit ();
1637- });
1638-
1639- action_group.list_actions ();
1640- action_group.activate_action ("current", new Variant.uint32 (2));
1641-
1642- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1643- loop.run ();
1644- Source.remove (source);
1645- action_group.disconnect (signal_name);
1646-
1647- var state = action_group.get_action_state ("current");
1648- var current = state.get_uint32 ();
1649- assert (current == 2);
1650-
1651- try {
1652- string output;
1653- Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources current", out output);
1654- assert (strcmp (output, "uint32 2\n") == 0);
1655- } catch (SpawnError error) {
1656- Test.message ("error: %s", error.message);
1657- Test.fail ();
1658- return;
1659- }
1660-}
1661-
1662-static void test_activate_character_map (void *data) {
1663- var fixture = (Fixture *) data;
1664-
1665- if (fixture.object_name == 0) {
1666- Test.message ("error: Test fixture not initialized.");
1667- Test.fail ();
1668- return;
1669- }
1670-
1671- var action_group = DBusActionGroup.get ((!) fixture.connection,
1672- "com.canonical.indicator.keyboard",
1673- "/com/canonical/indicator/keyboard");
1674- var loop = new MainLoop (null, false);
1675- var signal_name = ((!) fixture.service).notify["command"].connect ((pspec) => {
1676- loop.quit ();
1677- });
1678-
1679- action_group.activate_action ("map", null);
1680-
1681- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1682- loop.run ();
1683- Source.remove (source);
1684- ((!) fixture.service).disconnect (signal_name);
1685-
1686- assert (strcmp ((!) ((!) fixture.service).command, "'gucharmap '") == 0);
1687-}
1688-
1689-static void test_activate_keyboard_layout_chart (void *data) {
1690- var fixture = (Fixture *) data;
1691-
1692- if (fixture.object_name == 0) {
1693- Test.message ("error: Test fixture not initialized.");
1694- Test.fail ();
1695- return;
1696- }
1697-
1698- try {
1699- var current = 1;
1700- var sources = "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo'), ('ibus', 'pinyin')]";
1701- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
1702- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
1703- } catch (SpawnError error) {
1704- Test.message ("error: %s", error.message);
1705- Test.fail ();
1706- return;
1707- }
1708-
1709- var action_group = DBusActionGroup.get ((!) fixture.connection,
1710- "com.canonical.indicator.keyboard",
1711- "/com/canonical/indicator/keyboard");
1712- var loop = new MainLoop (null, false);
1713- var signal_name = ((!) fixture.service).notify["command"].connect ((pspec) => {
1714- loop.quit ();
1715- });
1716-
1717- action_group.activate_action ("chart", null);
1718-
1719- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1720- loop.run ();
1721- Source.remove (source);
1722- ((!) fixture.service).disconnect (signal_name);
1723-
1724- assert (strcmp ((!) ((!) fixture.service).command, "'gkbd-keyboard-display -l ca\teng'") == 0);
1725-}
1726-
1727-static void test_activate_text_entry_settings (void *data) {
1728- var fixture = (Fixture *) data;
1729-
1730- if (fixture.object_name == 0) {
1731- Test.message ("error: Test fixture not initialized.");
1732- Test.fail ();
1733- return;
1734- }
1735-
1736- var action_group = DBusActionGroup.get ((!) fixture.connection,
1737- "com.canonical.indicator.keyboard",
1738- "/com/canonical/indicator/keyboard");
1739- var loop = new MainLoop (null, false);
1740- var signal_name = ((!) fixture.service).notify["command"].connect ((pspec) => {
1741- loop.quit ();
1742- });
1743-
1744- action_group.activate_action ("settings", null);
1745-
1746- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1747- loop.run ();
1748- Source.remove (source);
1749- ((!) fixture.service).disconnect (signal_name);
1750-
1751- assert (strcmp ((!) ((!) fixture.service).command, "'gnome-control-center region layouts'") == 0);
1752-}
1753-
1754-static void test_migration (void *data) {
1755- var fixture = (Fixture *) data;
1756-
1757- if (fixture.object_name == 0) {
1758- Test.message ("error: Test fixture not initialized.");
1759- Test.fail ();
1760- return;
1761- }
1762-
1763- try {
1764- var migrated = false;
1765- var sources = "[('xkb', 'us')]";
1766- var layouts = "['us', 'ca\teng', 'epo']";
1767- Process.spawn_command_line_sync (@"gsettings set com.canonical.indicator.keyboard migrated $migrated");
1768- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
1769- Process.spawn_command_line_sync (@"gsettings set org.gnome.libgnomekbd.keyboard layouts \"$layouts\"");
1770- } catch (SpawnError error) {
1771- Test.message ("error: %s", error.message);
1772- Test.fail ();
1773- return;
1774- }
1775-
1776- try {
1777- var cancellable = new Cancellable ();
1778-
1779- var source = Timeout.add_seconds (TIMEOUT_S, () => { cancellable.cancel (); return false; });
1780-
1781- var dbus_proxy = new DBusProxy.sync ((!) fixture.connection,
1782- DBusProxyFlags.NONE,
1783- null,
1784- "org.freedesktop.DBus",
1785- "/",
1786- "org.freedesktop.DBus",
1787- cancellable);
1788-
1789- Source.remove (source);
1790-
1791- if (cancellable.is_cancelled ()) {
1792- Test.message ("error: Unable to connect to org.freedesktop.DBus.");
1793- Test.fail ();
1794- return;
1795- }
1796-
1797- dbus_proxy.call_sync ("StartServiceByName", new Variant ("(su)", "com.canonical.indicator.keyboard", 0), DBusCallFlags.NONE, TIMEOUT_MS);
1798- } catch (Error error) {
1799- Test.message ("error: %s", error.message);
1800- Test.fail ();
1801- return;
1802- }
1803-
1804- try {
1805- string sources;
1806- Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources sources", out sources);
1807- assert (strcmp (sources, "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo')]\n") == 0);
1808- } catch (SpawnError error) {
1809- Test.message ("error: %s", error.message);
1810- Test.fail ();
1811- return;
1812- }
1813-}
1814-
1815-static void test_no_migration (void *data) {
1816- var fixture = (Fixture *) data;
1817-
1818- if (fixture.object_name == 0) {
1819- Test.message ("error: Test fixture not initialized.");
1820- Test.fail ();
1821- return;
1822- }
1823-
1824- try {
1825- var migrated = true;
1826- var sources = "[('xkb', 'us')]";
1827- var layouts = "['us', 'ca\teng', 'epo']";
1828- Process.spawn_command_line_sync (@"gsettings set com.canonical.indicator.keyboard migrated $migrated");
1829- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
1830- Process.spawn_command_line_sync (@"gsettings set org.gnome.libgnomekbd.keyboard layouts \"$layouts\"");
1831- } catch (SpawnError error) {
1832- Test.message ("error: %s", error.message);
1833- Test.fail ();
1834- return;
1835- }
1836-
1837- try {
1838- var cancellable = new Cancellable ();
1839-
1840- var source = Timeout.add_seconds (TIMEOUT_S, () => { cancellable.cancel (); return false; });
1841-
1842- var dbus_proxy = new DBusProxy.sync ((!) fixture.connection,
1843- DBusProxyFlags.NONE,
1844- null,
1845- "org.freedesktop.DBus",
1846- "/",
1847- "org.freedesktop.DBus",
1848- cancellable);
1849-
1850- Source.remove (source);
1851-
1852- if (cancellable.is_cancelled ()) {
1853- Test.message ("error: Unable to connect to org.freedesktop.DBus.");
1854- Test.fail ();
1855- return;
1856- }
1857-
1858- dbus_proxy.call_sync ("StartServiceByName", new Variant ("(su)", "com.canonical.indicator.keyboard", 0), DBusCallFlags.NONE, TIMEOUT_MS);
1859- } catch (Error error) {
1860- Test.message ("error: %s", error.message);
1861- Test.fail ();
1862- return;
1863- }
1864-
1865- try {
1866- string sources;
1867- Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources sources", out sources);
1868- assert (strcmp (sources, "[('xkb', 'us')]\n") == 0);
1869- } catch (SpawnError error) {
1870- Test.message ("error: %s", error.message);
1871- Test.fail ();
1872- return;
1873- }
1874-}
1875-
1876-static void test_update_visible (void *data) {
1877- var fixture = (Fixture *) data;
1878-
1879- if (fixture.object_name == 0) {
1880- Test.message ("error: Test fixture not initialized.");
1881- Test.fail ();
1882- return;
1883- }
1884-
1885- bool visible;
1886-
1887- try {
1888- visible = true;
1889- Process.spawn_command_line_sync (@"gsettings set com.canonical.indicator.keyboard visible $visible");
1890- } catch (SpawnError error) {
1891- Test.message ("error: %s", error.message);
1892- Test.fail ();
1893- return;
1894- }
1895-
1896- var action_group = DBusActionGroup.get ((!) fixture.connection,
1897- "com.canonical.indicator.keyboard",
1898- "/com/canonical/indicator/keyboard");
1899- var loop = new MainLoop (null, false);
1900- var signal_name = action_group.action_added["indicator"].connect ((action) => {
1901- loop.quit ();
1902- });
1903-
1904- action_group.list_actions ();
1905-
1906- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1907- loop.run ();
1908- Source.remove (source);
1909- action_group.disconnect (signal_name);
1910-
1911- var state = action_group.get_action_state ("indicator");
1912- assert (state.lookup ("visible", "b", out visible));
1913- assert (visible);
1914-
1915- loop = new MainLoop (null, false);
1916- signal_name = action_group.action_state_changed["indicator"].connect ((action, state) => {
1917- loop.quit ();
1918- });
1919-
1920- try {
1921- visible = false;
1922- Process.spawn_command_line_sync (@"gsettings set com.canonical.indicator.keyboard visible $visible");
1923- } catch (SpawnError error) {
1924- Test.message ("error: %s", error.message);
1925- Test.fail ();
1926- return;
1927- }
1928-
1929- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1930- loop.run ();
1931- Source.remove (source);
1932- action_group.disconnect (signal_name);
1933-
1934- state = action_group.get_action_state ("indicator");
1935- assert (state.lookup ("visible", "b", out visible));
1936- assert (!visible);
1937-
1938- loop = new MainLoop (null, false);
1939- signal_name = action_group.action_state_changed["indicator"].connect ((action, state) => {
1940- loop.quit ();
1941- });
1942-
1943- try {
1944- visible = true;
1945- Process.spawn_command_line_sync (@"gsettings set com.canonical.indicator.keyboard visible $visible");
1946- } catch (SpawnError error) {
1947- Test.message ("error: %s", error.message);
1948- Test.fail ();
1949- return;
1950- }
1951-
1952- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
1953- loop.run ();
1954- Source.remove (source);
1955- action_group.disconnect (signal_name);
1956-
1957- state = action_group.get_action_state ("indicator");
1958- assert (state.lookup ("visible", "b", out visible));
1959- assert (visible);
1960-}
1961-
1962-static void test_update_input_source (void *data) {
1963- var fixture = (Fixture *) data;
1964-
1965- if (fixture.object_name == 0) {
1966- Test.message ("error: Test fixture not initialized.");
1967- Test.fail ();
1968- return;
1969- }
1970-
1971- try {
1972- var current = 0;
1973- var sources = "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo'), ('ibus', 'pinyin')]";
1974- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
1975- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
1976- } catch (SpawnError error) {
1977- Test.message ("error: %s", error.message);
1978- Test.fail ();
1979- return;
1980- }
1981-
1982- var action_group = DBusActionGroup.get ((!) fixture.connection,
1983- "com.canonical.indicator.keyboard",
1984- "/com/canonical/indicator/keyboard");
1985- var loop = new MainLoop (null, false);
1986- var signal_name = action_group.action_state_changed["current"].connect ((action, state) => {
1987- loop.quit ();
1988- });
1989-
1990- action_group.list_actions ();
1991-
1992- try {
1993- var current = 1;
1994- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
1995- } catch (SpawnError error) {
1996- Test.message ("error: %s", error.message);
1997- Test.fail ();
1998- return;
1999- }
2000-
2001- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
2002- loop.run ();
2003- Source.remove (source);
2004- action_group.disconnect (signal_name);
2005-
2006- var state = action_group.get_action_state ("current");
2007- var current = state.get_uint32 ();
2008- assert (current == 1);
2009-
2010- try {
2011- string output;
2012- Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources current", out output);
2013- assert (strcmp (output, "uint32 1\n") == 0);
2014- } catch (SpawnError error) {
2015- Test.message ("error: %s", error.message);
2016- Test.fail ();
2017- return;
2018- }
2019-
2020- loop = new MainLoop (null, false);
2021- signal_name = action_group.action_state_changed["current"].connect ((action, state) => {
2022- loop.quit ();
2023- });
2024-
2025- try {
2026- current = 0;
2027- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
2028- } catch (SpawnError error) {
2029- Test.message ("error: %s", error.message);
2030- Test.fail ();
2031- return;
2032- }
2033-
2034- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
2035- loop.run ();
2036- Source.remove (source);
2037- action_group.disconnect (signal_name);
2038-
2039- state = action_group.get_action_state ("current");
2040- current = state.get_uint32 ();
2041- assert (current == 0);
2042-
2043- try {
2044- string output;
2045- Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources current", out output);
2046- assert (strcmp (output, "uint32 0\n") == 0);
2047- } catch (SpawnError error) {
2048- Test.message ("error: %s", error.message);
2049- Test.fail ();
2050- return;
2051- }
2052-}
2053-
2054-static void test_update_input_sources (void *data) {
2055- var fixture = (Fixture *) data;
2056-
2057- if (fixture.object_name == 0) {
2058- Test.message ("error: Test fixture not initialized.");
2059- Test.fail ();
2060- return;
2061- }
2062-
2063- try {
2064- var current = 0;
2065- var sources = "[('xkb', 'us')]";
2066- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
2067- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
2068- } catch (SpawnError error) {
2069- Test.message ("error: %s", error.message);
2070- Test.fail ();
2071- return;
2072- }
2073-
2074- var menu_model = DBusMenuModel.get ((!) fixture.connection,
2075- "com.canonical.indicator.keyboard",
2076- "/com/canonical/indicator/keyboard/desktop");
2077- var loop = new MainLoop (null, false);
2078- var signal_name = menu_model.items_changed.connect ((position, removed, added) => {
2079- loop.quit ();
2080- });
2081-
2082- menu_model.get_n_items ();
2083-
2084- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
2085- loop.run ();
2086- Source.remove (source);
2087- menu_model.disconnect (signal_name);
2088-
2089- var menu = menu_model.get_item_link (0, Menu.LINK_SUBMENU);
2090- loop = new MainLoop (null, false);
2091- signal_name = menu.items_changed.connect ((position, removed, added) => {
2092- loop.quit ();
2093- });
2094-
2095- menu.get_n_items ();
2096-
2097- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
2098- loop.run ();
2099- Source.remove (source);
2100- menu.disconnect (signal_name);
2101-
2102- var section = menu.get_item_link (0, Menu.LINK_SECTION);
2103- loop = new MainLoop (null, false);
2104- signal_name = section.items_changed.connect ((position, removed, added) => {
2105- loop.quit ();
2106- });
2107-
2108- section.get_n_items ();
2109-
2110- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
2111- loop.run ();
2112- Source.remove (source);
2113- section.disconnect (signal_name);
2114-
2115- string label;
2116-
2117- assert (section.get_n_items () == 1);
2118- section.get_item_attribute (0, Menu.ATTRIBUTE_LABEL, "s", out label);
2119- assert (strcmp (label, "English (US)") == 0);
2120-
2121- loop = new MainLoop (null, false);
2122- signal_name = section.items_changed.connect ((position, removed, added) => {
2123- if (section.get_n_items () == 4) {
2124- loop.quit ();
2125- }
2126- });
2127-
2128- try {
2129- var sources = "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo'), ('ibus', 'pinyin')]";
2130- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
2131- } catch (SpawnError error) {
2132- Test.message ("error: %s", error.message);
2133- Test.fail ();
2134- return;
2135- }
2136-
2137- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
2138- loop.run ();
2139- Source.remove (source);
2140- section.disconnect (signal_name);
2141-
2142- assert (section.get_n_items () == 4);
2143- section.get_item_attribute (0, Menu.ATTRIBUTE_LABEL, "s", out label);
2144- assert (strcmp (label, "English (US)") == 0);
2145- section.get_item_attribute (1, Menu.ATTRIBUTE_LABEL, "s", out label);
2146- assert (strcmp (label, "English (Canada)") == 0);
2147- section.get_item_attribute (2, Menu.ATTRIBUTE_LABEL, "s", out label);
2148- assert (strcmp (label, "Esperanto") == 0);
2149- section.get_item_attribute (3, Menu.ATTRIBUTE_LABEL, "s", out label);
2150- assert (strcmp (label, "Pinyin") == 0);
2151-}
2152-
2153-public int main (string[] args) {
2154- Environment.set_variable ("DCONF_PROFILE", DCONF_PROFILE, true);
2155- Environment.set_variable ("LC_ALL", "C", true);
2156-
2157- Test.init (ref args, null);
2158-
2159- var suite = new TestSuite ("indicator-keyboard");
2160-
2161- suite.add (new TestCase ("activate-input-source", begin_test, test_activate_input_source, end_test, sizeof (Fixture)));
2162- suite.add (new TestCase ("activate-character-map", begin_test, test_activate_character_map, end_test, sizeof (Fixture)));
2163- suite.add (new TestCase ("activate-keyboard-layout-chart", begin_test, test_activate_keyboard_layout_chart, end_test, sizeof (Fixture)));
2164- suite.add (new TestCase ("activate-text-entry-settings", begin_test, test_activate_text_entry_settings, end_test, sizeof (Fixture)));
2165- suite.add (new TestCase ("migration", begin_test, test_migration, end_test, sizeof (Fixture)));
2166- suite.add (new TestCase ("no-migration", begin_test, test_no_migration, end_test, sizeof (Fixture)));
2167- suite.add (new TestCase ("update-visible", begin_test, test_update_visible, end_test, sizeof (Fixture)));
2168- suite.add (new TestCase ("update-input-source", begin_test, test_update_input_source, end_test, sizeof (Fixture)));
2169- suite.add (new TestCase ("update-input-sources", begin_test, test_update_input_sources, end_test, sizeof (Fixture)));
2170-
2171- TestSuite.get_root ().add_suite (suite);
2172-
2173- return Test.run ();
2174-}
2175
2176=== removed directory 'debian/patches'
2177=== removed file 'debian/patches/default-icon-colour.patch'
2178--- debian/patches/default-icon-colour.patch 2013-07-17 18:47:22 +0000
2179+++ debian/patches/default-icon-colour.patch 1970-01-01 00:00:00 +0000
2180@@ -1,10 +0,0 @@
2181---- a/lib/main.vala
2182-+++ b/lib/main.vala
2183-@@ -207,6 +207,7 @@
2184-
2185- Pango.FontDescription description;
2186- var colour = ((!) style).get_color (Gtk.StateFlags.NORMAL);
2187-+ colour = { 0.5, 0.5, 0.5, 1.0 };
2188- ((!) style).get (Gtk.StateFlags.NORMAL, Gtk.STYLE_PROPERTY_FONT, out description);
2189-
2190- var surface = new Cairo.ImageSurface (Cairo.Format.ARGB32, W, H);
2191
2192=== removed file 'debian/patches/disable-experimental-non-null.patch'
2193--- debian/patches/disable-experimental-non-null.patch 2013-07-17 19:17:32 +0000
2194+++ debian/patches/disable-experimental-non-null.patch 1970-01-01 00:00:00 +0000
2195@@ -1,68 +0,0 @@
2196---- a/tests/Makefile.am
2197-+++ b/tests/Makefile.am
2198-@@ -4,8 +4,7 @@
2199-
2200- AM_CFLAGS = -w
2201- AM_LDFLAGS = -lm
2202--AM_VALAFLAGS = --enable-experimental-non-null \
2203-- --metadatadir $(top_srcdir)/deps \
2204-+AM_VALAFLAGS = --metadatadir $(top_srcdir)/deps \
2205- --vapidir $(top_srcdir)/deps
2206-
2207- indicator_keyboard_tests_SOURCES = main.vala \
2208---- a/tests/main.vala
2209-+++ b/tests/main.vala
2210-@@ -146,7 +146,7 @@
2211- action_group.disconnect (signal_name);
2212-
2213- var state = action_group.get_action_state ("current");
2214-- var current = ((!) state).get_uint32 ();
2215-+ var current = state.get_uint32 ();
2216- assert (current == 2);
2217-
2218- try {
2219-@@ -410,7 +410,7 @@
2220- action_group.disconnect (signal_name);
2221-
2222- var state = action_group.get_action_state ("indicator");
2223-- assert (((!) state).lookup ("visible", "b", out visible));
2224-+ assert (state.lookup ("visible", "b", out visible));
2225- assert (visible);
2226-
2227- loop = new MainLoop (null, false);
2228-@@ -433,7 +433,7 @@
2229- action_group.disconnect (signal_name);
2230-
2231- state = action_group.get_action_state ("indicator");
2232-- assert (((!) state).lookup ("visible", "b", out visible));
2233-+ assert (state.lookup ("visible", "b", out visible));
2234- assert (!visible);
2235-
2236- loop = new MainLoop (null, false);
2237-@@ -456,7 +456,7 @@
2238- action_group.disconnect (signal_name);
2239-
2240- state = action_group.get_action_state ("indicator");
2241-- assert (((!) state).lookup ("visible", "b", out visible));
2242-+ assert (state.lookup ("visible", "b", out visible));
2243- assert (visible);
2244- }
2245-
2246-@@ -505,7 +505,7 @@
2247- action_group.disconnect (signal_name);
2248-
2249- var state = action_group.get_action_state ("current");
2250-- var current = ((!) state).get_uint32 ();
2251-+ var current = state.get_uint32 ();
2252- assert (current == 1);
2253-
2254- try {
2255-@@ -538,7 +538,7 @@
2256- action_group.disconnect (signal_name);
2257-
2258- state = action_group.get_action_state ("current");
2259-- current = ((!) state).get_uint32 ();
2260-+ current = state.get_uint32 ();
2261- assert (current == 0);
2262-
2263- try {
2264
2265=== removed file 'debian/patches/relax-test-missing-ibus.patch'
2266--- debian/patches/relax-test-missing-ibus.patch 2013-07-17 20:06:48 +0000
2267+++ debian/patches/relax-test-missing-ibus.patch 1970-01-01 00:00:00 +0000
2268@@ -1,11 +0,0 @@
2269---- a/tests/main.vala
2270-+++ b/tests/main.vala
2271-@@ -648,7 +648,7 @@
2272- section.get_item_attribute (2, Menu.ATTRIBUTE_LABEL, "s", out label);
2273- assert (strcmp (label, "Esperanto") == 0);
2274- section.get_item_attribute (3, Menu.ATTRIBUTE_LABEL, "s", out label);
2275-- assert (strcmp (label, "Pinyin") == 0);
2276-+ assert (label.ascii_casecmp ("Pinyin") == 0);
2277- }
2278-
2279- public int main (string[] args) {
2280
2281=== removed file 'debian/patches/series'
2282--- debian/patches/series 2013-07-17 20:06:48 +0000
2283+++ debian/patches/series 1970-01-01 00:00:00 +0000
2284@@ -1,3 +0,0 @@
2285-default-icon-colour.patch
2286-disable-experimental-non-null.patch
2287-relax-test-missing-ibus.patch

Subscribers

People subscribed via source and target branches

to all changes: