Merge lp://staging/~townsend/unity/fix-urgent-icon-wiggle into lp://staging/unity

Proposed by Christopher Townsend
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3367
Proposed branch: lp://staging/~townsend/unity/fix-urgent-icon-wiggle
Merge into: lp://staging/unity
Diff against target: 287 lines (+204/-0)
3 files modified
launcher/Launcher.cpp (+123/-0)
launcher/Launcher.h (+10/-0)
tests/test_launcher.cpp (+71/-0)
To merge this branch: bzr merge lp://staging/~townsend/unity/fix-urgent-icon-wiggle
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+163800@code.staging.launchpad.net

Commit message

Add functionality to wiggle urgent icons at certain time intervals when the Launcher is hidden.

Description of the change

= Issue =
Currently, when the Launcher is hidden and an urgent icon is displayed, the only notification a user sees that the initial pop out wiggle of the icon and then nothing else. IF the user misses this, then they may be unaware of an app that needs attention.

= Fix =
Add timers and logic to pop out and wiggle the icon at certain intervals as defined in bug #893196. Also, handle the wiggle icons once the Launcher is revealed.

= Test =
This is really a visual issue and no tests automated tests are identified to handle this.
A manual test would be to have an application set an icon urgent and watch for the pop out wiggle at the defined intervals. Also, reveal the Launcher to see the icon(s) wiggle one last time.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Looks nice :)

review: Approve
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Yay

review: Approve
Revision history for this message
Christopher Townsend (townsend) wrote :

Setting the overall status to Needs Review since I'd like to get Marco's input on tests since he said it may be possible for automated tests.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

68 +void Launcher::HandleUrgentIcon(AbstractLauncherIcon::Ptr const& icon, struct timespec const& current)

Since the function is called at every redraw, why not just returning at the beginning of it in case of: if (options()->hide_mode == LAUNCHER_HIDE_NEVER) ?

187 + bool _urgent_acked;
Please include _urgent_acked in the initialization list as well. Also, even if it seems to work properly even if there's more than on icon, wouldn't probably be better to have a set of icons to wiggle instead?

124 + for (it = _model->main_begin(); it != _model->main_end(); ++it)

Using a for-each loop here is nicer...

127 + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT) &&

Traling space here

153 + sources_.Remove(URGENT_TIMEOUT);

This is not needed since it's automatically done when returning false on this callback function (see line 238 of SourceManager::Add on GLibSource.cpp).

157 + SetUrgentTimer(_urgent_wiggle_time);

Mh, why the current timer is not deleted in case you set up a new timer with different period?

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Ah, on the bug description there's written:
«- When the Launcher is visible, application alerts should should be indicated by a short wiggle (in addition to the existing blue pips). This short wiggle should not repeat.»

I wonder this applies to the case where the launcher is always visible, and it that case it should wiggle only when the urgency is set and not after a minute or so, right?

Revision history for this message
Christopher Townsend (townsend) wrote :

Hi Marco,

> 68 +void Launcher::HandleUrgentIcon(AbstractLauncherIcon::Ptr const&
> icon, struct timespec const& current)
>
> Since the function is called at every redraw, why not just returning at the
> beginning of it in case of: if (options()->hide_mode == LAUNCHER_HIDE_NEVER) ?

Yeah, that's a good point. I may put this in the if statement before calling HandleUrgentIcon().

>
> 187 + bool _urgent_acked;
> Please include _urgent_acked in the initialization list as well. Also, even if
> it seems to work properly even if there's more than on icon, wouldn't probably
> be better to have a set of icons to wiggle instead?

Sure, I can put it in the initialization list. Not sure what you really mean by your question about a set of icons though.

>
>
> 124 + for (it = _model->main_begin(); it != _model->main_end(); ++it)
>
> Using a for-each loop here is nicer...

Yes indeed.

>
> 127 + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT) &&
>
> Traling space here

OK

>
>
> 153 + sources_.Remove(URGENT_TIMEOUT);
>
> This is not needed since it's automatically done when returning false on this
> callback function (see line 238 of SourceManager::Add on GLibSource.cpp).

Ah, didn't catch that.

>
>
> 157 + SetUrgentTimer(_urgent_wiggle_time);
>
> Mh, why the current timer is not deleted in case you set up a new timer with
> different period?

I thought the current time is automatically deleted when setting up a new timer with the same name.

Revision history for this message
Christopher Townsend (townsend) wrote :

> Ah, on the bug description there's written:
> «- When the Launcher is visible, application alerts should should be indicated
> by a short wiggle (in addition to the existing blue pips). This short wiggle
> should not repeat.»
>
> I wonder this applies to the case where the launcher is always visible, and it
> that case it should wiggle only when the urgency is set and not after a minute
> or so, right?

That is the way I understand this too which is the current behavior.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Nice...

229 + EXPECT_FALSE(launcher_->_urgent_timer_running);

244 + EXPECT_EQ(launcher_->_urgent_wiggle_time, 0);
245 + EXPECT_EQ(launcher_->_urgent_finished_time.tv_sec, 0);
246 + EXPECT_EQ(launcher_->_urgent_finished_time.tv_nsec, 0);

Probably better to use ASSERT_EQ there^.

Is it now possible to also test that the icons wiggle once the launcher is shown?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

I think we're fine now, thanks! :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.