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

Proposed by Brandon Schaefer
Status: Merged
Approved by: Christopher Townsend
Approved revision: 3861
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
1=== modified file 'launcher/DesktopLauncherIcon.cpp'
2--- launcher/DesktopLauncherIcon.cpp 2013-10-13 23:09:05 +0000
3+++ launcher/DesktopLauncherIcon.cpp 2014-08-13 23:35:36 +0000
4@@ -33,7 +33,9 @@
5 : SimpleLauncherIcon(IconType::DESKTOP)
6 , show_in_switcher_(true)
7 {
8- tooltip_text = _("Show Desktop");
9+ WindowManager::Default().show_desktop_changed.connect(sigc::mem_fun(this, &DesktopLauncherIcon::UpdateTooltipText));
10+
11+ UpdateTooltipText();
12 icon_name = "desktop";
13 SetQuirk(Quirk::VISIBLE, true);
14 SetShortcut('d');
15@@ -43,6 +45,16 @@
16 {
17 SimpleLauncherIcon::ActivateLauncherIcon(arg);
18 WindowManager::Default().ShowDesktop();
19+ UpdateTooltipText();
20+}
21+
22+void DesktopLauncherIcon::UpdateTooltipText()
23+{
24+ auto const& wm = WindowManager::Default();
25+ if (wm.InShowDesktop())
26+ tooltip_text = _("Restore Windows");
27+ else
28+ tooltip_text = _("Show Desktop");
29 }
30
31 std::string DesktopLauncherIcon::GetName() const
32
33=== modified file 'launcher/DesktopLauncherIcon.h'
34--- launcher/DesktopLauncherIcon.h 2013-08-05 13:59:08 +0000
35+++ launcher/DesktopLauncherIcon.h 2014-08-13 23:35:36 +0000
36@@ -41,6 +41,8 @@
37 std::string GetRemoteUri() const;
38
39 private:
40+ void UpdateTooltipText();
41+
42 bool show_in_switcher_;
43 };
44
45
46=== modified file 'unity-shared/PluginAdapter.cpp'
47--- unity-shared/PluginAdapter.cpp 2014-07-30 18:16:08 +0000
48+++ unity-shared/PluginAdapter.cpp 2014-08-13 23:35:36 +0000
49@@ -1005,11 +1005,13 @@
50 void PluginAdapter::OnShowDesktop()
51 {
52 _in_show_desktop = true;
53+ show_desktop_changed.emit();
54 }
55
56 void PluginAdapter::OnLeaveDesktop()
57 {
58 _in_show_desktop = false;
59+ show_desktop_changed.emit();
60 }
61
62 void PluginAdapter::UpdateShowDesktopState()
63
64=== modified file 'unity-shared/WindowManager.h'
65--- unity-shared/WindowManager.h 2014-04-02 21:42:12 +0000
66+++ unity-shared/WindowManager.h 2014-08-13 23:35:36 +0000
67@@ -189,6 +189,8 @@
68 sigc::signal<void, Window> window_moved;
69 sigc::signal<void, Window> window_focus_changed;
70
71+ sigc::signal<void> show_desktop_changed;
72+
73 sigc::signal<void> initiate_spread;
74 sigc::signal<void> terminate_spread;
75