Merge lp:~nick-dedekind/unity/smart-scopes.scope-bar-tabbing into lp:~unity-team/unity/libunity-7.0-breakage

Proposed by Nick Dedekind
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3096
Proposed branch: lp:~nick-dedekind/unity/smart-scopes.scope-bar-tabbing
Merge into: lp:~unity-team/unity/libunity-7.0-breakage
Diff against target: 104 lines (+24/-31)
2 files modified
dash/ScopeBar.cpp (+24/-30)
dash/ScopeBar.h (+0/-1)
To merge this branch: bzr merge lp:~nick-dedekind/unity/smart-scopes.scope-bar-tabbing
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+155032@code.launchpad.net

Commit message

Fixed inconsistent previous lens/scope keybinding behavior for non-visible scopes (command.scope) LP#1158236

Description of the change

Fixed inconsistent previous lens/scope keybinding behavior for non-visible scopes (command.scope) LP#1158236

To post a comment you must log in.
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Cool LGTM and works!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/ScopeBar.cpp'
2--- dash/ScopeBar.cpp 2013-03-20 13:14:31 +0000
3+++ dash/ScopeBar.cpp 2013-03-22 18:22:20 +0000
4@@ -278,13 +278,6 @@
5
6 void ScopeBar::ActivateNext()
7 {
8- // Special case when switching from the command scope.
9- if (GetActiveScopeId() == "commands.scope")
10- {
11- SetActive(icons_[0]);
12- return;
13- }
14-
15 bool activate_next = false;
16 for (auto it = icons_.begin();
17 it < icons_.end();
18@@ -300,25 +293,27 @@
19 if (icon->active)
20 activate_next = true;
21 }
22- SetActive(icons_[0]);
23
24+ // fallback. select first visible icon.
25+ for (auto it = icons_.begin(); it != icons_.end(); ++it)
26+ {
27+ ScopeBarIcon *icon = *it;
28+ if (icon->IsVisible())
29+ {
30+ SetActive(icon);
31+ break;
32+ }
33+ }
34 }
35
36 void ScopeBar::ActivatePrevious()
37 {
38- // Special case when switching from the command scope.
39- if (GetActiveScopeId() == "commands.scope")
40- {
41- SetActive(icons_.back());
42- return;
43- }
44-
45 bool activate_previous = false;
46- for (auto it = icons_.rbegin();
47- it < icons_.rend();
48- ++it)
49+ for (auto rit = icons_.rbegin();
50+ rit < icons_.rend();
51+ ++rit)
52 {
53- ScopeBarIcon *icon = *it;
54+ ScopeBarIcon *icon = *rit;
55
56 if (activate_previous && icon->IsVisible())
57 {
58@@ -328,8 +323,17 @@
59 if (icon->active)
60 activate_previous = true;
61 }
62- SetActive(icons_.back());
63
64+ // fallback. select last visible icon.
65+ for (auto rit = icons_.rbegin(); rit != icons_.rend(); ++rit)
66+ {
67+ ScopeBarIcon *icon = *rit;
68+ if (icon->IsVisible())
69+ {
70+ SetActive(icon);
71+ break;
72+ }
73+ }
74 }
75
76 // Keyboard navigation
77@@ -360,15 +364,5 @@
78 }
79 }
80
81-std::string ScopeBar::GetActiveScopeId() const
82-{
83- for (auto icon : icons_)
84- {
85- if (icon->active)
86- return icon->id;
87- }
88- return "";
89-}
90-
91 }
92 }
93
94=== modified file 'dash/ScopeBar.h'
95--- dash/ScopeBar.h 2013-02-12 11:45:57 +0000
96+++ dash/ScopeBar.h 2013-03-22 18:22:20 +0000
97@@ -80,7 +80,6 @@
98 std::string GetName() const;
99 void AddProperties(GVariantBuilder* builder);
100
101- std::string GetActiveScopeId() const;
102 typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
103
104 ScopeIcons icons_;

Subscribers

People subscribed via source and target branches

to all changes: