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
=== modified file 'dash/ScopeBar.cpp'
--- dash/ScopeBar.cpp 2013-03-20 13:14:31 +0000
+++ dash/ScopeBar.cpp 2013-03-22 18:22:20 +0000
@@ -278,13 +278,6 @@
278278
279void ScopeBar::ActivateNext()279void ScopeBar::ActivateNext()
280{280{
281 // Special case when switching from the command scope.
282 if (GetActiveScopeId() == "commands.scope")
283 {
284 SetActive(icons_[0]);
285 return;
286 }
287
288 bool activate_next = false;281 bool activate_next = false;
289 for (auto it = icons_.begin();282 for (auto it = icons_.begin();
290 it < icons_.end();283 it < icons_.end();
@@ -300,25 +293,27 @@
300 if (icon->active)293 if (icon->active)
301 activate_next = true;294 activate_next = true;
302 }295 }
303 SetActive(icons_[0]);
304296
297 // fallback. select first visible icon.
298 for (auto it = icons_.begin(); it != icons_.end(); ++it)
299 {
300 ScopeBarIcon *icon = *it;
301 if (icon->IsVisible())
302 {
303 SetActive(icon);
304 break;
305 }
306 }
305}307}
306308
307void ScopeBar::ActivatePrevious()309void ScopeBar::ActivatePrevious()
308{310{
309 // Special case when switching from the command scope.
310 if (GetActiveScopeId() == "commands.scope")
311 {
312 SetActive(icons_.back());
313 return;
314 }
315
316 bool activate_previous = false;311 bool activate_previous = false;
317 for (auto it = icons_.rbegin();312 for (auto rit = icons_.rbegin();
318 it < icons_.rend();313 rit < icons_.rend();
319 ++it)314 ++rit)
320 {315 {
321 ScopeBarIcon *icon = *it;316 ScopeBarIcon *icon = *rit;
322317
323 if (activate_previous && icon->IsVisible())318 if (activate_previous && icon->IsVisible())
324 {319 {
@@ -328,8 +323,17 @@
328 if (icon->active)323 if (icon->active)
329 activate_previous = true;324 activate_previous = true;
330 }325 }
331 SetActive(icons_.back());
332326
327 // fallback. select last visible icon.
328 for (auto rit = icons_.rbegin(); rit != icons_.rend(); ++rit)
329 {
330 ScopeBarIcon *icon = *rit;
331 if (icon->IsVisible())
332 {
333 SetActive(icon);
334 break;
335 }
336 }
333}337}
334338
335// Keyboard navigation339// Keyboard navigation
@@ -360,15 +364,5 @@
360 }364 }
361}365}
362366
363std::string ScopeBar::GetActiveScopeId() const
364{
365 for (auto icon : icons_)
366 {
367 if (icon->active)
368 return icon->id;
369 }
370 return "";
371}
372
373}367}
374}368}
375369
=== modified file 'dash/ScopeBar.h'
--- dash/ScopeBar.h 2013-02-12 11:45:57 +0000
+++ dash/ScopeBar.h 2013-03-22 18:22:20 +0000
@@ -80,7 +80,6 @@
80 std::string GetName() const;80 std::string GetName() const;
81 void AddProperties(GVariantBuilder* builder);81 void AddProperties(GVariantBuilder* builder);
8282
83 std::string GetActiveScopeId() const;
84 typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;83 typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
8584
86 ScopeIcons icons_;85 ScopeIcons icons_;

Subscribers

People subscribed via source and target branches

to all changes: