Merge lp:~pqp/noise/fix-1082862 into lp:~elementary-apps/noise/trunk

Proposed by Patrick Pace
Status: Merged
Approved by: David Gomes
Approved revision: 1193
Merged at revision: 1188
Proposed branch: lp:~pqp/noise/fix-1082862
Merge into: lp:~elementary-apps/noise/trunk
Diff against target: 27 lines (+13/-4)
1 file modified
src/LibraryWindow.vala (+13/-4)
To merge this branch: bzr merge lp:~pqp/noise/fix-1082862
Reviewer Review Type Date Requested Status
David Gomes (community) Approve
Review via email: mp+136058@code.launchpad.net

Description of the change

I implemented keyboard shortcuts that will close Noise (Ctrl+W & Ctrl+Q), and reorganized key_press_event() a bit to allow for more shortcuts if necessary.

To post a comment you must log in.
Revision history for this message
David Gomes (davidgomes) wrote :

this.destroy();
playClicked();

There should be a space before '('.

Also, on the 23rd line of the .diff, the curly brace ending the function doesn't seem to be matching the indentation of "var typed_unichar = event.str.get_char ();"

Implementation-wise, looks good.

review: Needs Fixing
Revision history for this message
Patrick Pace (pqp) wrote :

Yeah, I proposed a merge too soon. The branch should be fine now.

lp:~pqp/noise/fix-1082862 updated
1193. By Patrick Pace

NEWLINE YAY.

Revision history for this message
David Gomes (davidgomes) wrote :

Good code.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/LibraryWindow.vala'
2--- src/LibraryWindow.vala 2012-11-07 00:55:30 +0000
3+++ src/LibraryWindow.vala 2012-11-25 18:34:19 +0000
4@@ -153,10 +153,19 @@
5 }
6
7 public override bool key_press_event (Gdk.EventKey event) {
8- if(event.keyval == Gdk.Key.space && !searchField.has_focus) {
9- playClicked ();
10- return true;
11- }
12+ if (!searchField.has_focus) {
13+ switch (event.keyval) {
14+ case Gdk.Key.space:
15+ playClicked ();
16+ return true;
17+ case Gdk.Key.q:
18+ case Gdk.Key.w:
19+ if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0)
20+ this.destroy ();
21+ break;
22+ }
23+ }
24+
25 var typed_unichar = event.str.get_char ();
26 // Redirect valid key presses to the search entry
27 if (typed_unichar.validate () && searchField.sensitive && !searchField.has_focus) {

Subscribers

People subscribed via source and target branches