Merge lp:~jaapz-b/switchboard/fix-1014707 into lp:~elementary-pantheon/switchboard/switchboard

Proposed by Jaap Broekhuizen
Status: Merged
Approved by: Mario Guerriero
Approved revision: 343
Merged at revision: 344
Proposed branch: lp:~jaapz-b/switchboard/fix-1014707
Merge into: lp:~elementary-pantheon/switchboard/switchboard
Diff against target: 19 lines (+9/-0)
1 file modified
Switchboard/switchboard-app.vala (+9/-0)
To merge this branch: bzr merge lp:~jaapz-b/switchboard/fix-1014707
Reviewer Review Type Date Requested Status
Victor Martinez (community) Needs Fixing
Review via email: mp+135944@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Victor Martinez (victored) wrote :

This code also grabs key presses when modifier keys are active, which means that using desktop shortcuts while the Switchboard's window is active will also move focus to the search entry. I'd suggest doing the following:

var modifiers = Gtk.accelerator_get_default_mod_mask ();
bool modifiers_active = (event.state & modifiers) != 0;

if (!modifiers_active) {
    [... run proposed code ...]
}

Diff line 10 could be replaced by "search_box.has_focus"

The rest looks perfect to me.

review: Needs Fixing
lp:~jaapz-b/switchboard/fix-1014707 updated
343. By Jaap Broekhuizen

Check for modifier keys.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Switchboard/switchboard-app.vala'
2--- Switchboard/switchboard-app.vala 2012-11-24 14:20:29 +0000
3+++ Switchboard/switchboard-app.vala 2012-11-24 15:18:19 +0000
4@@ -490,6 +490,15 @@
5 var find_toolitem = new Gtk.ToolItem ();
6 find_toolitem.add(search_box);
7
8+ // Focus typing to the search bar
9+ main_window.key_press_event.connect ((event) => {
10+ // Don't focus if it is a modifier or if search_box is already focused.
11+ if ((event.is_modifier == 0) && !search_box.has_focus)
12+ search_box.grab_focus ();
13+
14+ return false;
15+ });
16+
17 // Nav button
18 navigation_button = new Gtk.ToolButton.from_stock(Gtk.Stock.GO_BACK);
19 navigation_button.clicked.connect (handle_navigation_button_clicked);

Subscribers

People subscribed via source and target branches

to all changes: