Merge lp:~brandontschaefer/unity/lp.1237132-fix into lp:unity

Proposed by Brandon Schaefer
Status: Merged
Approved by: Christopher Townsend
Approved revision: no longer in the source branch.
Merged at revision: 3867
Proposed branch: lp:~brandontschaefer/unity/lp.1237132-fix
Merge into: lp:unity
Diff against target: 74 lines (+19/-1)
4 files modified
launcher/DesktopLauncherIcon.cpp (+13/-1)
launcher/DesktopLauncherIcon.h (+2/-0)
unity-shared/PluginAdapter.cpp (+2/-0)
unity-shared/WindowManager.h (+2/-0)
To merge this branch: bzr merge lp:~brandontschaefer/unity/lp.1237132-fix
Reviewer Review Type Date Requested Status
Christopher Townsend Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+230732@code.launchpad.net

Commit message

When Show Desktop is active, it will set the tooltip icon as "Restore Windows". This is per workspace. So each time show_destop bool is updated in PluginAdapter, the Show Desktop icon will update its tooltip if needed.

Description of the change

When Show Desktop is active, it will set the tooltip icon as "Restore Windows". This is per workspace. So each time show_destop bool is updated in PluginAdapter, the Show Desktop icon will update its tooltip if needed.

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
Christopher Townsend (townsend) wrote :

Very cool. +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/DesktopLauncherIcon.cpp'
--- launcher/DesktopLauncherIcon.cpp 2013-10-13 23:09:05 +0000
+++ launcher/DesktopLauncherIcon.cpp 2014-08-13 23:35:36 +0000
@@ -33,7 +33,9 @@
33 : SimpleLauncherIcon(IconType::DESKTOP)33 : SimpleLauncherIcon(IconType::DESKTOP)
34 , show_in_switcher_(true)34 , show_in_switcher_(true)
35{35{
36 tooltip_text = _("Show Desktop");36 WindowManager::Default().show_desktop_changed.connect(sigc::mem_fun(this, &DesktopLauncherIcon::UpdateTooltipText));
37
38 UpdateTooltipText();
37 icon_name = "desktop";39 icon_name = "desktop";
38 SetQuirk(Quirk::VISIBLE, true);40 SetQuirk(Quirk::VISIBLE, true);
39 SetShortcut('d');41 SetShortcut('d');
@@ -43,6 +45,16 @@
43{45{
44 SimpleLauncherIcon::ActivateLauncherIcon(arg);46 SimpleLauncherIcon::ActivateLauncherIcon(arg);
45 WindowManager::Default().ShowDesktop();47 WindowManager::Default().ShowDesktop();
48 UpdateTooltipText();
49}
50
51void DesktopLauncherIcon::UpdateTooltipText()
52{
53 auto const& wm = WindowManager::Default();
54 if (wm.InShowDesktop())
55 tooltip_text = _("Restore Windows");
56 else
57 tooltip_text = _("Show Desktop");
46}58}
4759
48std::string DesktopLauncherIcon::GetName() const60std::string DesktopLauncherIcon::GetName() const
4961
=== modified file 'launcher/DesktopLauncherIcon.h'
--- launcher/DesktopLauncherIcon.h 2013-08-05 13:59:08 +0000
+++ launcher/DesktopLauncherIcon.h 2014-08-13 23:35:36 +0000
@@ -41,6 +41,8 @@
41 std::string GetRemoteUri() const;41 std::string GetRemoteUri() const;
4242
43private:43private:
44 void UpdateTooltipText();
45
44 bool show_in_switcher_;46 bool show_in_switcher_;
45};47};
4648
4749
=== modified file 'unity-shared/PluginAdapter.cpp'
--- unity-shared/PluginAdapter.cpp 2014-07-30 18:16:08 +0000
+++ unity-shared/PluginAdapter.cpp 2014-08-13 23:35:36 +0000
@@ -1005,11 +1005,13 @@
1005void PluginAdapter::OnShowDesktop()1005void PluginAdapter::OnShowDesktop()
1006{1006{
1007 _in_show_desktop = true;1007 _in_show_desktop = true;
1008 show_desktop_changed.emit();
1008}1009}
10091010
1010void PluginAdapter::OnLeaveDesktop()1011void PluginAdapter::OnLeaveDesktop()
1011{1012{
1012 _in_show_desktop = false;1013 _in_show_desktop = false;
1014 show_desktop_changed.emit();
1013}1015}
10141016
1015void PluginAdapter::UpdateShowDesktopState()1017void PluginAdapter::UpdateShowDesktopState()
10161018
=== modified file 'unity-shared/WindowManager.h'
--- unity-shared/WindowManager.h 2014-04-02 21:42:12 +0000
+++ unity-shared/WindowManager.h 2014-08-13 23:35:36 +0000
@@ -189,6 +189,8 @@
189 sigc::signal<void, Window> window_moved;189 sigc::signal<void, Window> window_moved;
190 sigc::signal<void, Window> window_focus_changed;190 sigc::signal<void, Window> window_focus_changed;
191191
192 sigc::signal<void> show_desktop_changed;
193
192 sigc::signal<void> initiate_spread;194 sigc::signal<void> initiate_spread;
193 sigc::signal<void> terminate_spread;195 sigc::signal<void> terminate_spread;
194196