Do

Merge lp://qastaging/~alexlauni/do/summon-to-close into lp://qastaging/do

Proposed by Alex Launi
Status: Merged
Approved by: Alex Launi
Approved revision: 1286
Merged at revision: not available
Proposed branch: lp://qastaging/~alexlauni/do/summon-to-close
Merge into: lp://qastaging/do
Diff against target: None lines
To merge this branch: bzr merge lp://qastaging/~alexlauni/do/summon-to-close
Reviewer Review Type Date Requested Status
Chris S. Approve
Review via email: mp+9601@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Alex Launi (alexlauni) wrote :

Some cleanup to the keybindings code, and fixes a regression that causes summon to not close Do when Do is already summoned.

1287. By Alex Launi

Organize keybindings in UI logically

1288. By Alex Launi

Show 'Summon into Text Mode' binding (default disabled) in UI

Revision history for this message
Chris S. (cszikszoy) wrote :

Looks good to me. However, before pushing you might want to see the comments I posted here: https://bugs.edge.launchpad.net/do/+bug/408571 about ideas for how to fix the issue of the summon keybindings not being at the top of the treeview.

review: Approve
1289. By Alex Launi

Address a double fail in OS binding registration

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Do/src/Do.Core/Controller.cs'
2--- Do/src/Do.Core/Controller.cs 2009-08-03 20:33:51 +0000
3+++ Do/src/Do.Core/Controller.cs 2009-08-03 20:40:54 +0000
4@@ -109,6 +109,18 @@
5 Screen.Default.CompositedChanged += OnCompositingChanged;
6
7 // Register Shortcuts
8+ SetupKeybindings ();
9+ }
10+
11+ void SetupKeybindings ()
12+ {
13+ Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Summon Do"), "<Super>space",
14+ OnSummonKeyPressEvent, true));
15+
16+ // this keybinding is disabled by default - note the empty binding
17+ Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Summon in Text Mode"), "",
18+ OnTextModeSummonKeyPressEvent, true));
19+
20 Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Enter Text Mode"), "period",
21 OnTextModePressEvent));
22 Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Copy to Clipboard"), "<Control>c",
23@@ -137,9 +149,6 @@
24 OnRightKeyPressEvent));
25 Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Select Multiple Items"), "comma",
26 OnSelectionKeyPressEvent));
27- //summon in text mode
28- Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Summon in Text Mode"), "",
29- delegate { this.Summon (); SearchController.TextMode = true; UpdatePane (CurrentPane); } , true));
30 }
31
32 void OnSummoned ()
33@@ -508,8 +517,19 @@
34
35 void OnSummonKeyPressEvent (EventKey evnt)
36 {
37- Reset ();
38- Vanish ();
39+ if (IsSummoned) {
40+ Reset ();
41+ Vanish ();
42+ } else {
43+ Summon ();
44+ }
45+ }
46+
47+ void OnTextModeSummonKeyPressEvent (EventKey evnt)
48+ {
49+ Summon ();
50+ SearchController.TextMode = true;
51+ UpdatePane (CurrentPane);
52 }
53
54 void OnEscapeKeyPressEvent (EventKey evnt)
55
56=== modified file 'Do/src/Do.cs'
57--- Do/src/Do.cs 2009-07-23 09:29:41 +0000
58+++ Do/src/Do.cs 2009-08-03 20:31:41 +0000
59@@ -70,8 +70,6 @@
60 Controller.Initialize ();
61 UniverseManager.Initialize ();
62
63- SetupKeybindings ();
64-
65 if (!Preferences.QuietStart)
66 Controller.Summon ();
67
68@@ -96,17 +94,5 @@
69 return universe_manager;
70 }
71 }
72-
73- static void SetupKeybindings ()
74- {
75- try {
76- if (!Services.Keybinder.RegisterKeyBinding (new KeyBinding (Catalog.GetString ("Summon Do"),
77- "<Super>space", delegate { controller.Summon (); }, true)))
78- throw new Exception ();
79- } catch (Exception e) {
80- Log.Fatal ("Could not bind summon key!");
81- Log.Debug (e.StackTrace);
82- }
83- }
84 }
85 }