Merge lp:~mterry/unity-greeter/close-orca into lp:unity-greeter

Proposed by Michael Terry
Status: Merged
Approved by: Robert Ancell
Approved revision: 616
Merged at revision: 685
Proposed branch: lp:~mterry/unity-greeter/close-orca
Merge into: lp:unity-greeter
Diff against target: 78 lines (+34/-18)
1 file modified
src/menubar.vala (+34/-18)
To merge this branch: bzr merge lp:~mterry/unity-greeter/close-orca
Reviewer Review Type Date Requested Status
Unity Greeter Development Team Pending
Review via email: mp+128541@code.launchpad.net

Description of the change

During quantal, orca dropped the --quit argument. So without this patch, we actually launch orca a second time when the user tries to stop the screen reader (with splash and main window and everything). Very bad experience.

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

I for one am opposed to "very bad experiences". So I support this patch!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/menubar.vala'
2--- src/menubar.vala 2012-10-03 14:30:19 +0000
3+++ src/menubar.vala 2012-10-08 16:26:20 +0000
4@@ -132,6 +132,7 @@
5 private Gtk.CheckMenuItem high_contrast_item;
6 private Gtk.Label keyboard_label = null;
7 private Pid keyboard_pid = 0;
8+ private Pid reader_pid = 0;
9 private Gtk.CheckMenuItem onscreen_keyboard_item;
10
11 construct
12@@ -170,15 +171,21 @@
13 UnityGreeter.singleton.starting_session.connect (cleanup);
14 }
15
16+ private void close_pid (ref Pid pid)
17+ {
18+ if (pid != 0)
19+ {
20+ Posix.kill (pid, Posix.SIGTERM);
21+ int status;
22+ Posix.waitpid (pid, out status, 0);
23+ pid = 0;
24+ }
25+ }
26+
27 public void cleanup ()
28 {
29- if (keyboard_pid != 0)
30- {
31- Posix.kill (keyboard_pid, Posix.SIGTERM);
32- int status;
33- Posix.waitpid (keyboard_pid, out status, 0);
34- keyboard_pid = 0;
35- }
36+ close_pid (ref keyboard_pid);
37+ close_pid (ref reader_pid);
38 }
39
40 public override void get_preferred_height (out int min, out int nat)
41@@ -468,17 +475,26 @@
42 UGSettings.set_boolean (UGSettings.KEY_SCREEN_READER, item.active);
43
44 /* Hardcoded orca: */
45- try
46- {
47- if (item.active)
48- Process.spawn_command_line_async ("orca --replace --no-setup --disable splash-window,main-window");
49- else
50- Process.spawn_command_line_async ("orca --quit");
51- }
52- catch (Error e)
53- {
54- warning ("Failed to run Orca: %s", e.message);
55- }
56+ if (item.active)
57+ {
58+ try
59+ {
60+ string[] argv;
61+ Shell.parse_argv ("orca --replace --no-setup --disable splash-window,main-window", out argv);
62+ Process.spawn_async (null,
63+ argv,
64+ null,
65+ SpawnFlags.SEARCH_PATH,
66+ null,
67+ out reader_pid);
68+ }
69+ catch (Error e)
70+ {
71+ warning ("Failed to run Orca: %s", e.message);
72+ }
73+ }
74+ else
75+ close_pid (ref reader_pid);
76 }
77
78 private uint get_indicator_index (Indicator.Object object)

Subscribers

People subscribed via source and target branches