Merge lp:~3v1n0/unity/app-title-icon-properties into lp:unity
- app-title-icon-properties
- Merge into trunk
Proposed by
Marco Trevisan (Treviño)
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Andrea Azzarone | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 3387 | ||||
Proposed branch: | lp:~3v1n0/unity/app-title-icon-properties | ||||
Merge into: | lp:unity | ||||
Diff against target: |
531 lines (+94/-92) 14 files modified
debian/control (+1/-1) launcher/ApplicationLauncherIcon.cpp (+13/-14) launcher/ApplicationLauncherIcon.h (+2/-0) launcher/MockLauncherIcon.h (+5/-3) launcher/StandaloneLauncher.cpp (+2/-0) panel/PanelMenuView.cpp (+4/-1) panel/PanelMenuView.h (+1/-0) tests/mock-application.h (+15/-22) tests/test_application_launcher_icon.cpp (+8/-10) tests/test_switcher_controller.h (+0/-2) tests/test_switcher_controller_class.cpp (+3/-2) unity-shared/ApplicationManager.h (+6/-4) unity-shared/BamfApplicationManager.cpp (+32/-27) unity-shared/BamfApplicationManager.h (+2/-6) |
||||
To merge this branch: | bzr merge lp:~3v1n0/unity/app-title-icon-properties | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Azzarone (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+171770@code.launchpad.net |
Commit message
ApplicationManager: Use nux::ROProperty for Window and Application title and icon
So BamfApplication
and ApplicationLaun
Description of the change
Use nux::ROProperty's to handle an application title and icon, update the code to work with it and connect to related BamfApplication signals so that we can update these values if they change (unlikely, but it can happen on some desktop-less applications, especially after that lp:~3v1n0/bamf/app-main-view will land).
Removed one workaround that is not needed anymore since we moved to libgdbus properties on libbamf.
Tests updated.
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/control' | |||
2 | --- debian/control 2013-06-26 14:29:55 +0000 | |||
3 | +++ debian/control 2013-06-27 10:54:34 +0000 | |||
4 | @@ -15,7 +15,7 @@ | |||
5 | 15 | libsigc++-2.0-dev, | 15 | libsigc++-2.0-dev, |
6 | 16 | libgee-dev (>= 0.5.0), | 16 | libgee-dev (>= 0.5.0), |
7 | 17 | libunique-dev, | 17 | libunique-dev, |
9 | 18 | libbamf3-dev (>= 0.4), | 18 | libbamf3-dev (>= 0.5.0+13.10.20130626), |
10 | 19 | gsettings-desktop-schemas-dev, | 19 | gsettings-desktop-schemas-dev, |
11 | 20 | libglib2.0-dev (>= 2.30), | 20 | libglib2.0-dev (>= 2.30), |
12 | 21 | libdbusmenu-glib-dev (>= 0.3.91), | 21 | libdbusmenu-glib-dev (>= 0.3.91), |
13 | 22 | 22 | ||
14 | === modified file 'launcher/ApplicationLauncherIcon.cpp' | |||
15 | --- launcher/ApplicationLauncherIcon.cpp 2013-05-17 22:53:57 +0000 | |||
16 | +++ launcher/ApplicationLauncherIcon.cpp 2013-06-27 10:54:34 +0000 | |||
17 | @@ -69,7 +69,7 @@ | |||
18 | 69 | app->seen = true; | 69 | app->seen = true; |
19 | 70 | 70 | ||
20 | 71 | tooltip_text = app->title(); | 71 | tooltip_text = app->title(); |
22 | 72 | std::string icon = app->icon(); | 72 | std::string const& icon = app->icon(); |
23 | 73 | icon_name = (icon.empty() ? DEFAULT_ICON : icon); | 73 | icon_name = (icon.empty() ? DEFAULT_ICON : icon); |
24 | 74 | 74 | ||
25 | 75 | SetQuirk(Quirk::VISIBLE, app->visible()); | 75 | SetQuirk(Quirk::VISIBLE, app->visible()); |
26 | @@ -148,6 +148,16 @@ | |||
27 | 148 | SetQuirk(Quirk::ACTIVE, active); | 148 | SetQuirk(Quirk::ACTIVE, active); |
28 | 149 | }); | 149 | }); |
29 | 150 | 150 | ||
30 | 151 | title_changed_connection_ = app_->title.changed.connect([this](std::string const& name) { | ||
31 | 152 | LOG_DEBUG(logger) << tooltip_text() << " name now " << name; | ||
32 | 153 | tooltip_text = name; | ||
33 | 154 | }); | ||
34 | 155 | |||
35 | 156 | icon_changed_connection_ = app_->icon.changed.connect([this](std::string const& icon) { | ||
36 | 157 | LOG_DEBUG(logger) << tooltip_text() << " icon now " << icon; | ||
37 | 158 | icon_name = (icon.empty() ? DEFAULT_ICON : icon); | ||
38 | 159 | }); | ||
39 | 160 | |||
40 | 151 | running_changed_connection_ = app_->running.changed.connect([this](bool const& running) { | 161 | running_changed_connection_ = app_->running.changed.connect([this](bool const& running) { |
41 | 152 | LOG_DEBUG(logger) << tooltip_text() << " running now " << (running ? "true" : "false"); | 162 | LOG_DEBUG(logger) << tooltip_text() << " running now " << (running ? "true" : "false"); |
42 | 153 | SetQuirk(Quirk::RUNNING, running); | 163 | SetQuirk(Quirk::RUNNING, running); |
43 | @@ -156,19 +166,6 @@ | |||
44 | 156 | { | 166 | { |
45 | 157 | _source_manager.Remove(ICON_REMOVE_TIMEOUT); | 167 | _source_manager.Remove(ICON_REMOVE_TIMEOUT); |
46 | 158 | 168 | ||
47 | 159 | /* It can happen that these values are not set | ||
48 | 160 | * during initialization if the view is closed | ||
49 | 161 | * very early, so we need to make sure that they | ||
50 | 162 | * are updated as soon as the view is re-opened. */ | ||
51 | 163 | if (tooltip_text().empty()) | ||
52 | 164 | tooltip_text = app_->title(); | ||
53 | 165 | |||
54 | 166 | if (icon_name == DEFAULT_ICON) | ||
55 | 167 | { | ||
56 | 168 | std::string icon = app_->icon(); | ||
57 | 169 | icon_name = (icon.empty() ? DEFAULT_ICON : icon); | ||
58 | 170 | } | ||
59 | 171 | |||
60 | 172 | EnsureWindowState(); | 169 | EnsureWindowState(); |
61 | 173 | UpdateIconGeometries(GetCenters()); | 170 | UpdateIconGeometries(GetCenters()); |
62 | 174 | } | 171 | } |
63 | @@ -207,6 +204,8 @@ | |||
64 | 207 | active_changed_connection_.disconnect(); | 204 | active_changed_connection_.disconnect(); |
65 | 208 | running_changed_connection_.disconnect(); | 205 | running_changed_connection_.disconnect(); |
66 | 209 | visible_changed_connection_.disconnect(); | 206 | visible_changed_connection_.disconnect(); |
67 | 207 | title_changed_connection_.disconnect(); | ||
68 | 208 | icon_changed_connection_.disconnect(); | ||
69 | 210 | closed_changed_connection_.disconnect(); | 209 | closed_changed_connection_.disconnect(); |
70 | 211 | } | 210 | } |
71 | 212 | 211 | ||
72 | 213 | 212 | ||
73 | === modified file 'launcher/ApplicationLauncherIcon.h' | |||
74 | --- launcher/ApplicationLauncherIcon.h 2013-05-17 22:53:57 +0000 | |||
75 | +++ launcher/ApplicationLauncherIcon.h 2013-06-27 10:54:34 +0000 | |||
76 | @@ -153,6 +153,8 @@ | |||
77 | 153 | sigc::connection window_opened_connection_; | 153 | sigc::connection window_opened_connection_; |
78 | 154 | sigc::connection window_closed_connection_; | 154 | sigc::connection window_closed_connection_; |
79 | 155 | sigc::connection window_moved_connection_; | 155 | sigc::connection window_moved_connection_; |
80 | 156 | sigc::connection icon_changed_connection_; | ||
81 | 157 | sigc::connection title_changed_connection_; | ||
82 | 156 | sigc::connection urgent_changed_connection_; | 158 | sigc::connection urgent_changed_connection_; |
83 | 157 | sigc::connection active_changed_connection_; | 159 | sigc::connection active_changed_connection_; |
84 | 158 | sigc::connection running_changed_connection_; | 160 | sigc::connection running_changed_connection_; |
85 | 159 | 161 | ||
86 | === modified file 'launcher/MockLauncherIcon.h' | |||
87 | --- launcher/MockLauncherIcon.h 2013-05-17 22:53:57 +0000 | |||
88 | +++ launcher/MockLauncherIcon.h 2013-06-27 10:54:34 +0000 | |||
89 | @@ -43,10 +43,12 @@ | |||
90 | 43 | class MockApplicationWindow : public ApplicationWindow | 43 | class MockApplicationWindow : public ApplicationWindow |
91 | 44 | { | 44 | { |
92 | 45 | public: | 45 | public: |
94 | 46 | MockApplicationWindow(Window xid) : xid_(xid) {} | 46 | MockApplicationWindow(Window xid) : xid_(xid) |
95 | 47 | { | ||
96 | 48 | title.SetGetterFunction([this] { return "MockApplicationWindow"; }); | ||
97 | 49 | icon.SetGetterFunction([this] { return ""; }); | ||
98 | 50 | } | ||
99 | 47 | 51 | ||
100 | 48 | std::string title() const { return "MockApplicationWindow"; } | ||
101 | 49 | virtual std::string icon() const { return ""; } | ||
102 | 50 | virtual std::string type() const { return "mock"; } | 52 | virtual std::string type() const { return "mock"; } |
103 | 51 | 53 | ||
104 | 52 | virtual Window window_id() const { return xid_; } | 54 | virtual Window window_id() const { return xid_; } |
105 | 53 | 55 | ||
106 | === modified file 'launcher/StandaloneLauncher.cpp' | |||
107 | --- launcher/StandaloneLauncher.cpp 2013-03-19 12:41:22 +0000 | |||
108 | +++ launcher/StandaloneLauncher.cpp 2013-06-27 10:54:34 +0000 | |||
109 | @@ -21,6 +21,7 @@ | |||
110 | 21 | #include <Nux/Nux.h> | 21 | #include <Nux/Nux.h> |
111 | 22 | #include <Nux/NuxTimerTickSource.h> | 22 | #include <Nux/NuxTimerTickSource.h> |
112 | 23 | #include <NuxCore/AnimationController.h> | 23 | #include <NuxCore/AnimationController.h> |
113 | 24 | #include <NuxCore/Logger.h> | ||
114 | 24 | #include <gtk/gtk.h> | 25 | #include <gtk/gtk.h> |
115 | 25 | 26 | ||
116 | 26 | #include "unity-shared/BackgroundEffectHelper.h" | 27 | #include "unity-shared/BackgroundEffectHelper.h" |
117 | @@ -96,6 +97,7 @@ | |||
118 | 96 | int main(int argc, char** argv) | 97 | int main(int argc, char** argv) |
119 | 97 | { | 98 | { |
120 | 98 | gtk_init(&argc, &argv); | 99 | gtk_init(&argc, &argv); |
121 | 100 | nux::logging::configure_logging(::getenv("UNITY_LOG_SEVERITY")); | ||
122 | 99 | nux::NuxInitialize(0); | 101 | nux::NuxInitialize(0); |
123 | 100 | 102 | ||
124 | 101 | LauncherWindow lc; | 103 | LauncherWindow lc; |
125 | 102 | 104 | ||
126 | === modified file 'panel/PanelMenuView.cpp' | |||
127 | --- panel/PanelMenuView.cpp 2013-02-21 13:43:48 +0000 | |||
128 | +++ panel/PanelMenuView.cpp 2013-06-27 10:54:34 +0000 | |||
129 | @@ -1019,6 +1019,10 @@ | |||
130 | 1019 | { | 1019 | { |
131 | 1020 | if (BAMF_IS_APPLICATION(new_app)) | 1020 | if (BAMF_IS_APPLICATION(new_app)) |
132 | 1021 | { | 1021 | { |
133 | 1022 | app_name_changed_signal_.Disconnect(); | ||
134 | 1023 | app_name_changed_signal_.Connect(BAMF_VIEW(new_app), "name-changed", | ||
135 | 1024 | sigc::mem_fun(this, &PanelMenuView::OnNameChanged)); | ||
136 | 1025 | |||
137 | 1022 | if (std::find(new_apps_.begin(), new_apps_.end(), new_app) != new_apps_.end()) | 1026 | if (std::find(new_apps_.begin(), new_apps_.end(), new_app) != new_apps_.end()) |
138 | 1023 | { | 1027 | { |
139 | 1024 | if (new_application_ != new_app) | 1028 | if (new_application_ != new_app) |
140 | @@ -1087,7 +1091,6 @@ | |||
141 | 1087 | 1091 | ||
142 | 1088 | // first see if we need to remove and old callback | 1092 | // first see if we need to remove and old callback |
143 | 1089 | view_name_changed_signal_.Disconnect(); | 1093 | view_name_changed_signal_.Disconnect(); |
144 | 1090 | |||
145 | 1091 | // register callback for new view | 1094 | // register callback for new view |
146 | 1092 | view_name_changed_signal_.Connect(new_view, "name-changed", | 1095 | view_name_changed_signal_.Connect(new_view, "name-changed", |
147 | 1093 | sigc::mem_fun(this, &PanelMenuView::OnNameChanged)); | 1096 | sigc::mem_fun(this, &PanelMenuView::OnNameChanged)); |
148 | 1094 | 1097 | ||
149 | === modified file 'panel/PanelMenuView.h' | |||
150 | --- panel/PanelMenuView.h 2013-02-01 18:13:40 +0000 | |||
151 | +++ panel/PanelMenuView.h 2013-06-27 10:54:34 +0000 | |||
152 | @@ -194,6 +194,7 @@ | |||
153 | 194 | glib::Signal<void, BamfMatcher*, BamfView*, BamfView*> active_win_changed_signal_; | 194 | glib::Signal<void, BamfMatcher*, BamfView*, BamfView*> active_win_changed_signal_; |
154 | 195 | glib::Signal<void, BamfMatcher*, BamfApplication*, BamfApplication*> active_app_changed_signal_; | 195 | glib::Signal<void, BamfMatcher*, BamfApplication*, BamfApplication*> active_app_changed_signal_; |
155 | 196 | glib::Signal<void, BamfView*, gchar*, gchar*> view_name_changed_signal_; | 196 | glib::Signal<void, BamfView*, gchar*, gchar*> view_name_changed_signal_; |
156 | 197 | glib::Signal<void, BamfView*, gchar*, gchar*> app_name_changed_signal_; | ||
157 | 197 | sigc::connection style_changed_connection_; | 198 | sigc::connection style_changed_connection_; |
158 | 198 | 199 | ||
159 | 199 | UBusManager ubus_manager_; | 200 | UBusManager ubus_manager_; |
160 | 200 | 201 | ||
161 | === modified file 'tests/mock-application.h' | |||
162 | --- tests/mock-application.h 2013-04-17 19:16:54 +0000 | |||
163 | +++ tests/mock-application.h 2013-06-27 10:54:34 +0000 | |||
164 | @@ -40,6 +40,8 @@ | |||
165 | 40 | visible.SetGetterFunction([this] { return visible_; }); | 40 | visible.SetGetterFunction([this] { return visible_; }); |
166 | 41 | active.SetGetterFunction([this] { return active_; }); | 41 | active.SetGetterFunction([this] { return active_; }); |
167 | 42 | urgent.SetGetterFunction([this] { return urgent_; }); | 42 | urgent.SetGetterFunction([this] { return urgent_; }); |
168 | 43 | title.SetGetterFunction([this] { return title_; }); | ||
169 | 44 | icon.SetGetterFunction([this] { return icon_; }); | ||
170 | 43 | } | 45 | } |
171 | 44 | 46 | ||
172 | 45 | Window xid_; | 47 | Window xid_; |
173 | @@ -52,8 +54,6 @@ | |||
174 | 52 | bool active_; | 54 | bool active_; |
175 | 53 | bool urgent_; | 55 | bool urgent_; |
176 | 54 | 56 | ||
177 | 55 | virtual std::string title() const { return title_; } | ||
178 | 56 | virtual std::string icon() const { return icon_; } | ||
179 | 57 | virtual std::string type() const { return type_; } | 57 | virtual std::string type() const { return type_; } |
180 | 58 | 58 | ||
181 | 59 | virtual Window window_id() const { return xid_; } | 59 | virtual Window window_id() const { return xid_; } |
182 | @@ -73,11 +73,11 @@ | |||
183 | 73 | struct MockApplication : unity::Application | 73 | struct MockApplication : unity::Application |
184 | 74 | { | 74 | { |
185 | 75 | MockApplication(std::string const& desktop_file, | 75 | MockApplication(std::string const& desktop_file, |
188 | 76 | std::string const& icon = "", | 76 | std::string const& icon_name = "", |
189 | 77 | std::string const& title = "") | 77 | std::string const& title_str = "") |
190 | 78 | : desktop_file_(desktop_file) | 78 | : desktop_file_(desktop_file) |
193 | 79 | , icon_(icon) | 79 | , icon_(icon_name) |
194 | 80 | , title_(title) | 80 | , title_(title_str) |
195 | 81 | , seen_(false) | 81 | , seen_(false) |
196 | 82 | , sticky_(false) | 82 | , sticky_(false) |
197 | 83 | , visible_(false) | 83 | , visible_(false) |
198 | @@ -86,14 +86,17 @@ | |||
199 | 86 | , urgent_(false) | 86 | , urgent_(false) |
200 | 87 | , type_("mock") | 87 | , type_("mock") |
201 | 88 | { | 88 | { |
202 | 89 | seen.SetGetterFunction(sigc::mem_fun(this, &MockApplication::GetSeen)); | ||
203 | 90 | seen.SetSetterFunction(sigc::mem_fun(this, &MockApplication::SetSeen)); | 89 | seen.SetSetterFunction(sigc::mem_fun(this, &MockApplication::SetSeen)); |
204 | 91 | sticky.SetGetterFunction(sigc::mem_fun(this, &MockApplication::GetSticky)); | ||
205 | 92 | sticky.SetSetterFunction(sigc::mem_fun(this, &MockApplication::SetSticky)); | 90 | sticky.SetSetterFunction(sigc::mem_fun(this, &MockApplication::SetSticky)); |
210 | 93 | visible.SetGetterFunction(sigc::mem_fun(this, &MockApplication::GetVisible)); | 91 | |
211 | 94 | active.SetGetterFunction(sigc::mem_fun(this, &MockApplication::GetActive)); | 92 | seen.SetGetterFunction([this] { return seen_; }); |
212 | 95 | running.SetGetterFunction(sigc::mem_fun(this, &MockApplication::GetRunning)); | 93 | sticky.SetGetterFunction([this] { return sticky_; }); |
213 | 96 | urgent.SetGetterFunction(sigc::mem_fun(this, &MockApplication::GetUrgent)); | 94 | visible.SetGetterFunction([this] { return visible_; }); |
214 | 95 | active.SetGetterFunction([this] { return active_; }); | ||
215 | 96 | running.SetGetterFunction([this] { return running_; }); | ||
216 | 97 | urgent.SetGetterFunction([this] { return urgent_; }); | ||
217 | 98 | title.SetGetterFunction([this] { return title_; }); | ||
218 | 99 | icon.SetGetterFunction([this] { return icon_; }); | ||
219 | 97 | } | 100 | } |
220 | 98 | 101 | ||
221 | 99 | std::string desktop_file_; | 102 | std::string desktop_file_; |
222 | @@ -108,9 +111,6 @@ | |||
223 | 108 | unity::WindowList windows_; | 111 | unity::WindowList windows_; |
224 | 109 | std::string type_; | 112 | std::string type_; |
225 | 110 | 113 | ||
226 | 111 | |||
227 | 112 | virtual std::string icon() const { return icon_; } | ||
228 | 113 | virtual std::string title() const { return title_; } | ||
229 | 114 | virtual std::string desktop_file() const { return desktop_file_; } | 114 | virtual std::string desktop_file() const { return desktop_file_; } |
230 | 115 | virtual std::string type() const { return type_; } | 115 | virtual std::string type() const { return type_; } |
231 | 116 | virtual std::string repr() const { return "MockApplication"; } | 116 | virtual std::string repr() const { return "MockApplication"; } |
232 | @@ -133,7 +133,6 @@ | |||
233 | 133 | running.changed.emit(state); | 133 | running.changed.emit(state); |
234 | 134 | } | 134 | } |
235 | 135 | 135 | ||
236 | 136 | bool GetSeen() const { return seen_; } | ||
237 | 137 | bool SetSeen(bool const& param) { | 136 | bool SetSeen(bool const& param) { |
238 | 138 | if (param != seen_) { | 137 | if (param != seen_) { |
239 | 139 | seen_ = param; | 138 | seen_ = param; |
240 | @@ -142,7 +141,6 @@ | |||
241 | 142 | return false; | 141 | return false; |
242 | 143 | } | 142 | } |
243 | 144 | 143 | ||
244 | 145 | bool GetSticky() const { return sticky_; } | ||
245 | 146 | bool SetSticky(bool const& param) { | 144 | bool SetSticky(bool const& param) { |
246 | 147 | if (param != sticky_) { | 145 | if (param != sticky_) { |
247 | 148 | sticky_ = param; | 146 | sticky_ = param; |
248 | @@ -158,11 +156,6 @@ | |||
249 | 158 | active_ = state; | 156 | active_ = state; |
250 | 159 | active.changed.emit(state); | 157 | active.changed.emit(state); |
251 | 160 | } | 158 | } |
252 | 161 | |||
253 | 162 | bool GetVisible() const { return visible_; } | ||
254 | 163 | bool GetActive() const { return active_; } | ||
255 | 164 | bool GetRunning() const { return running_; } | ||
256 | 165 | bool GetUrgent() const { return urgent_; } | ||
257 | 166 | }; | 159 | }; |
258 | 167 | 160 | ||
259 | 168 | class MockApplicationManager : public unity::ApplicationManager | 161 | class MockApplicationManager : public unity::ApplicationManager |
260 | 169 | 162 | ||
261 | === modified file 'tests/test_application_launcher_icon.cpp' | |||
262 | --- tests/test_application_launcher_icon.cpp 2013-05-17 22:02:43 +0000 | |||
263 | +++ tests/test_application_launcher_icon.cpp 2013-06-27 10:54:34 +0000 | |||
264 | @@ -195,35 +195,33 @@ | |||
265 | 195 | EXPECT_TRUE(mock_icon->RemoteUri().empty()); | 195 | EXPECT_TRUE(mock_icon->RemoteUri().empty()); |
266 | 196 | } | 196 | } |
267 | 197 | 197 | ||
269 | 198 | TEST_F(TestApplicationLauncherIcon, EmptyTooltipUpdatesOnRunning) | 198 | TEST_F(TestApplicationLauncherIcon, TooltipUpdates) |
270 | 199 | { | 199 | { |
271 | 200 | ASSERT_TRUE(mock_icon->tooltip_text().empty()); | 200 | ASSERT_TRUE(mock_icon->tooltip_text().empty()); |
272 | 201 | mock_app->title_ = "Got Name"; | 201 | mock_app->title_ = "Got Name"; |
273 | 202 | ASSERT_TRUE(mock_icon->tooltip_text().empty()); | 202 | ASSERT_TRUE(mock_icon->tooltip_text().empty()); |
274 | 203 | 203 | ||
276 | 204 | mock_app->SetRunState(true); | 204 | mock_app->title.changed.emit(mock_app->title_); |
277 | 205 | EXPECT_EQ(mock_icon->tooltip_text(), "Got Name"); | 205 | EXPECT_EQ(mock_icon->tooltip_text(), "Got Name"); |
278 | 206 | 206 | ||
279 | 207 | mock_app->SetRunState(false); | ||
280 | 208 | mock_app->title_ = "New Name"; | 207 | mock_app->title_ = "New Name"; |
283 | 209 | mock_app->SetRunState(true); | 208 | mock_app->title.changed.emit(mock_app->title_); |
284 | 210 | EXPECT_EQ(mock_icon->tooltip_text(), "Got Name"); | 209 | EXPECT_EQ(mock_icon->tooltip_text(), "New Name"); |
285 | 211 | } | 210 | } |
286 | 212 | 211 | ||
288 | 213 | TEST_F(TestApplicationLauncherIcon, InvalidIconUpdatesOnRunning) | 212 | TEST_F(TestApplicationLauncherIcon, IconUpdates) |
289 | 214 | { | 213 | { |
290 | 215 | ASSERT_EQ(mock_icon->icon_name(), DEFAULT_EMPTY_ICON); | 214 | ASSERT_EQ(mock_icon->icon_name(), DEFAULT_EMPTY_ICON); |
291 | 216 | mock_app->icon_ = "icon-name"; | 215 | mock_app->icon_ = "icon-name"; |
292 | 217 | 216 | ||
293 | 218 | ASSERT_EQ(mock_icon->icon_name(), DEFAULT_EMPTY_ICON); | 217 | ASSERT_EQ(mock_icon->icon_name(), DEFAULT_EMPTY_ICON); |
294 | 219 | 218 | ||
296 | 220 | mock_app->SetRunState(true); | 219 | mock_app->icon.changed.emit(mock_app->icon_); |
297 | 221 | EXPECT_EQ(mock_icon->icon_name(), "icon-name"); | 220 | EXPECT_EQ(mock_icon->icon_name(), "icon-name"); |
298 | 222 | 221 | ||
299 | 223 | mock_app->SetRunState(false); | ||
300 | 224 | mock_app->icon_ = "new-icon-name"; | 222 | mock_app->icon_ = "new-icon-name"; |
303 | 225 | mock_app->SetRunState(true); | 223 | mock_app->icon.changed.emit(mock_app->icon_); |
304 | 226 | EXPECT_EQ(mock_icon->icon_name(), "icon-name"); | 224 | EXPECT_EQ(mock_icon->icon_name(), "new-icon-name"); |
305 | 227 | } | 225 | } |
306 | 228 | 226 | ||
307 | 229 | TEST_F(TestApplicationLauncherIcon, PerformScrollTowardsTheUser) | 227 | TEST_F(TestApplicationLauncherIcon, PerformScrollTowardsTheUser) |
308 | 230 | 228 | ||
309 | === modified file 'tests/test_switcher_controller.h' | |||
310 | --- tests/test_switcher_controller.h 2013-05-17 22:53:57 +0000 | |||
311 | +++ tests/test_switcher_controller.h 2013-06-27 10:54:34 +0000 | |||
312 | @@ -54,8 +54,6 @@ | |||
313 | 54 | public: | 54 | public: |
314 | 55 | FakeApplicationWindow(Window xid, uint64_t active_number = 0); | 55 | FakeApplicationWindow(Window xid, uint64_t active_number = 0); |
315 | 56 | 56 | ||
316 | 57 | std::string title() const; | ||
317 | 58 | virtual std::string icon() const; | ||
318 | 59 | virtual std::string type() const; | 57 | virtual std::string type() const; |
319 | 60 | 58 | ||
320 | 61 | virtual Window window_id() const; | 59 | virtual Window window_id() const; |
321 | 62 | 60 | ||
322 | === modified file 'tests/test_switcher_controller_class.cpp' | |||
323 | --- tests/test_switcher_controller_class.cpp 2013-05-17 22:53:57 +0000 | |||
324 | +++ tests/test_switcher_controller_class.cpp 2013-06-27 10:54:34 +0000 | |||
325 | @@ -32,10 +32,11 @@ | |||
326 | 32 | auto standalone_window = std::make_shared<StandaloneWindow>(xid_); | 32 | auto standalone_window = std::make_shared<StandaloneWindow>(xid_); |
327 | 33 | standalone_window->active_number = active_number; | 33 | standalone_window->active_number = active_number; |
328 | 34 | WM->AddStandaloneWindow(standalone_window); | 34 | WM->AddStandaloneWindow(standalone_window); |
329 | 35 | |||
330 | 36 | title.SetGetterFunction([this] { return "FakeApplicationWindow"; }); | ||
331 | 37 | icon.SetGetterFunction([this] { return ""; }); | ||
332 | 35 | } | 38 | } |
333 | 36 | 39 | ||
334 | 37 | std::string FakeApplicationWindow::title() const { return "FakeApplicationWindow"; } | ||
335 | 38 | std::string FakeApplicationWindow::icon() const { return ""; } | ||
336 | 39 | std::string FakeApplicationWindow::type() const { return "mock"; } | 40 | std::string FakeApplicationWindow::type() const { return "mock"; } |
337 | 40 | 41 | ||
338 | 41 | Window FakeApplicationWindow::window_id() const { return xid_; } | 42 | Window FakeApplicationWindow::window_id() const { return xid_; } |
339 | 42 | 43 | ||
340 | === modified file 'unity-shared/ApplicationManager.h' | |||
341 | --- unity-shared/ApplicationManager.h 2012-12-19 22:34:22 +0000 | |||
342 | +++ unity-shared/ApplicationManager.h 2013-06-27 10:54:34 +0000 | |||
343 | @@ -46,8 +46,6 @@ | |||
344 | 46 | public: | 46 | public: |
345 | 47 | virtual ~ApplicationWindow() {} | 47 | virtual ~ApplicationWindow() {} |
346 | 48 | 48 | ||
347 | 49 | virtual std::string title() const = 0; | ||
348 | 50 | virtual std::string icon() const = 0; | ||
349 | 51 | virtual std::string type() const = 0; // 'window' or 'tab' | 49 | virtual std::string type() const = 0; // 'window' or 'tab' |
350 | 52 | 50 | ||
351 | 53 | virtual Window window_id() const = 0; | 51 | virtual Window window_id() const = 0; |
352 | @@ -62,6 +60,9 @@ | |||
353 | 62 | // Closes the window, or the browser tab if a webapp. | 60 | // Closes the window, or the browser tab if a webapp. |
354 | 63 | virtual void Quit() const = 0; | 61 | virtual void Quit() const = 0; |
355 | 64 | 62 | ||
356 | 63 | nux::ROProperty<std::string> title; | ||
357 | 64 | nux::ROProperty<std::string> icon; | ||
358 | 65 | |||
359 | 65 | nux::ROProperty<bool> visible; | 66 | nux::ROProperty<bool> visible; |
360 | 66 | nux::ROProperty<bool> active; | 67 | nux::ROProperty<bool> active; |
361 | 67 | nux::ROProperty<bool> urgent; | 68 | nux::ROProperty<bool> urgent; |
362 | @@ -73,8 +74,6 @@ | |||
363 | 73 | public: | 74 | public: |
364 | 74 | virtual ~Application() {} | 75 | virtual ~Application() {} |
365 | 75 | 76 | ||
366 | 76 | virtual std::string icon() const = 0; | ||
367 | 77 | virtual std::string title() const = 0; | ||
368 | 78 | virtual std::string desktop_file() const = 0; | 77 | virtual std::string desktop_file() const = 0; |
369 | 79 | virtual std::string type() const = 0; | 78 | virtual std::string type() const = 0; |
370 | 80 | 79 | ||
371 | @@ -91,6 +90,9 @@ | |||
372 | 91 | // Calls quit on all the Windows for this application. | 90 | // Calls quit on all the Windows for this application. |
373 | 92 | virtual void Quit() const = 0; | 91 | virtual void Quit() const = 0; |
374 | 93 | 92 | ||
375 | 93 | nux::ROProperty<std::string> title; | ||
376 | 94 | nux::ROProperty<std::string> icon; | ||
377 | 95 | |||
378 | 94 | // Considering using a property for the "unity-seen" quark | 96 | // Considering using a property for the "unity-seen" quark |
379 | 95 | nux::RWProperty<bool> seen; | 97 | nux::RWProperty<bool> seen; |
380 | 96 | nux::RWProperty<bool> sticky; | 98 | nux::RWProperty<bool> sticky; |
381 | 97 | 99 | ||
382 | === modified file 'unity-shared/BamfApplicationManager.cpp' | |||
383 | --- unity-shared/BamfApplicationManager.cpp 2013-06-01 02:10:49 +0000 | |||
384 | +++ unity-shared/BamfApplicationManager.cpp 2013-06-27 10:54:34 +0000 | |||
385 | @@ -44,12 +44,12 @@ | |||
386 | 44 | { | 44 | { |
387 | 45 | } | 45 | } |
388 | 46 | 46 | ||
390 | 47 | std::string View::title() const | 47 | std::string View::GetTitle() const |
391 | 48 | { | 48 | { |
392 | 49 | return glib::String(bamf_view_get_name(bamf_view_)).Str(); | 49 | return glib::String(bamf_view_get_name(bamf_view_)).Str(); |
393 | 50 | } | 50 | } |
394 | 51 | 51 | ||
396 | 52 | std::string View::icon() const | 52 | std::string View::GetIcon() const |
397 | 53 | { | 53 | { |
398 | 54 | return glib::String(bamf_view_get_icon(bamf_view_)).Str(); | 54 | return glib::String(bamf_view_get_icon(bamf_view_)).Str(); |
399 | 55 | } | 55 | } |
400 | @@ -81,15 +81,32 @@ | |||
401 | 81 | } | 81 | } |
402 | 82 | 82 | ||
403 | 83 | 83 | ||
404 | 84 | std::string WindowBase::type() const | ||
405 | 85 | { | ||
406 | 86 | return View::type(); | ||
407 | 87 | } | ||
408 | 88 | |||
409 | 84 | WindowBase::WindowBase(ApplicationManager const& manager, | 89 | WindowBase::WindowBase(ApplicationManager const& manager, |
410 | 85 | glib::Object<BamfView> const& window) | 90 | glib::Object<BamfView> const& window) |
411 | 86 | : View(manager, window) | 91 | : View(manager, window) |
412 | 87 | { | 92 | { |
413 | 93 | title.SetGetterFunction(sigc::mem_fun(this, &View::GetTitle)); | ||
414 | 94 | icon.SetGetterFunction(sigc::mem_fun(this, &View::GetIcon)); | ||
415 | 88 | visible.SetGetterFunction(sigc::mem_fun(this, &View::GetVisible)); | 95 | visible.SetGetterFunction(sigc::mem_fun(this, &View::GetVisible)); |
416 | 89 | active.SetGetterFunction(sigc::mem_fun(this, &View::GetActive)); | 96 | active.SetGetterFunction(sigc::mem_fun(this, &View::GetActive)); |
417 | 90 | urgent.SetGetterFunction(sigc::mem_fun(this, &View::GetUrgent)); | 97 | urgent.SetGetterFunction(sigc::mem_fun(this, &View::GetUrgent)); |
418 | 91 | 98 | ||
419 | 92 | glib::SignalBase* sig; | 99 | glib::SignalBase* sig; |
420 | 100 | sig = new glib::Signal<void, BamfView*, const char*, const char*>(bamf_view_, "name-changed", | ||
421 | 101 | [this] (BamfView*, const char*, const char* new_name) { | ||
422 | 102 | this->title.changed.emit(glib::gchar_to_string(new_name)); | ||
423 | 103 | }); | ||
424 | 104 | signals_.Add(sig); | ||
425 | 105 | sig = new glib::Signal<void, BamfView*, const char*>(bamf_view_, "icon-changed", | ||
426 | 106 | [this] (BamfView*, const char* icon) { | ||
427 | 107 | this->icon.changed.emit(glib::gchar_to_string(icon)); | ||
428 | 108 | }); | ||
429 | 109 | signals_.Add(sig); | ||
430 | 93 | sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view_, "user-visible-changed", | 110 | sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view_, "user-visible-changed", |
431 | 94 | [this] (BamfView*, gboolean visible) { | 111 | [this] (BamfView*, gboolean visible) { |
432 | 95 | this->visible.changed.emit(visible); | 112 | this->visible.changed.emit(visible); |
433 | @@ -107,21 +124,6 @@ | |||
434 | 107 | signals_.Add(sig); | 124 | signals_.Add(sig); |
435 | 108 | } | 125 | } |
436 | 109 | 126 | ||
437 | 110 | std::string WindowBase::title() const | ||
438 | 111 | { | ||
439 | 112 | return View::title(); | ||
440 | 113 | } | ||
441 | 114 | |||
442 | 115 | std::string WindowBase::icon() const | ||
443 | 116 | { | ||
444 | 117 | return View::icon(); | ||
445 | 118 | } | ||
446 | 119 | |||
447 | 120 | std::string WindowBase::type() const | ||
448 | 121 | { | ||
449 | 122 | return View::type(); | ||
450 | 123 | } | ||
451 | 124 | |||
452 | 125 | bool WindowBase::Focus() const | 127 | bool WindowBase::Focus() const |
453 | 126 | { | 128 | { |
454 | 127 | Window xid = window_id(); | 129 | Window xid = window_id(); |
455 | @@ -238,6 +240,8 @@ | |||
456 | 238 | void Application::HookUpEvents() | 240 | void Application::HookUpEvents() |
457 | 239 | { | 241 | { |
458 | 240 | // Hook up the property set/get functions | 242 | // Hook up the property set/get functions |
459 | 243 | title.SetGetterFunction(sigc::mem_fun(this, &View::GetTitle)); | ||
460 | 244 | icon.SetGetterFunction(sigc::mem_fun(this, &View::GetIcon)); | ||
461 | 241 | seen.SetGetterFunction(sigc::mem_fun(this, &Application::GetSeen)); | 245 | seen.SetGetterFunction(sigc::mem_fun(this, &Application::GetSeen)); |
462 | 242 | seen.SetSetterFunction(sigc::mem_fun(this, &Application::SetSeen)); | 246 | seen.SetSetterFunction(sigc::mem_fun(this, &Application::SetSeen)); |
463 | 243 | sticky.SetGetterFunction(sigc::mem_fun(this, &Application::GetSticky)); | 247 | sticky.SetGetterFunction(sigc::mem_fun(this, &Application::GetSticky)); |
464 | @@ -247,7 +251,18 @@ | |||
465 | 247 | running.SetGetterFunction(sigc::mem_fun(this, &View::GetRunning)); | 251 | running.SetGetterFunction(sigc::mem_fun(this, &View::GetRunning)); |
466 | 248 | urgent.SetGetterFunction(sigc::mem_fun(this, &View::GetUrgent)); | 252 | urgent.SetGetterFunction(sigc::mem_fun(this, &View::GetUrgent)); |
467 | 249 | 253 | ||
468 | 254 | // Use signals_.Add.... | ||
469 | 250 | glib::SignalBase* sig; | 255 | glib::SignalBase* sig; |
470 | 256 | sig = new glib::Signal<void, BamfView*, const char*, const char*>(bamf_view_, "name-changed", | ||
471 | 257 | [this] (BamfView*, const char*, const char* new_name) { | ||
472 | 258 | this->title.changed.emit(glib::gchar_to_string(new_name)); | ||
473 | 259 | }); | ||
474 | 260 | signals_.Add(sig); | ||
475 | 261 | sig = new glib::Signal<void, BamfView*, const char*>(bamf_view_, "icon-changed", | ||
476 | 262 | [this] (BamfView*, const char* icon) { | ||
477 | 263 | this->icon.changed.emit(glib::gchar_to_string(icon)); | ||
478 | 264 | }); | ||
479 | 265 | signals_.Add(sig); | ||
480 | 251 | sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view_, "user-visible-changed", | 266 | sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view_, "user-visible-changed", |
481 | 252 | [this] (BamfView*, gboolean visible) { | 267 | [this] (BamfView*, gboolean visible) { |
482 | 253 | LOG_TRACE(logger) << "user-visible-changed " << visible; | 268 | LOG_TRACE(logger) << "user-visible-changed " << visible; |
483 | @@ -305,16 +320,6 @@ | |||
484 | 305 | signals_.Add(sig); | 320 | signals_.Add(sig); |
485 | 306 | } | 321 | } |
486 | 307 | 322 | ||
487 | 308 | std::string Application::title() const | ||
488 | 309 | { | ||
489 | 310 | return View::title(); | ||
490 | 311 | } | ||
491 | 312 | |||
492 | 313 | std::string Application::icon() const | ||
493 | 314 | { | ||
494 | 315 | return View::icon(); | ||
495 | 316 | } | ||
496 | 317 | |||
497 | 318 | std::string Application::desktop_file() const | 323 | std::string Application::desktop_file() const |
498 | 319 | { | 324 | { |
499 | 320 | const gchar* file = bamf_application_get_desktop_file(bamf_app_); | 325 | const gchar* file = bamf_application_get_desktop_file(bamf_app_); |
500 | 321 | 326 | ||
501 | === modified file 'unity-shared/BamfApplicationManager.h' | |||
502 | --- unity-shared/BamfApplicationManager.h 2012-12-19 22:34:22 +0000 | |||
503 | +++ unity-shared/BamfApplicationManager.h 2013-06-27 10:54:34 +0000 | |||
504 | @@ -37,8 +37,8 @@ | |||
505 | 37 | View(ApplicationManager const& manager, | 37 | View(ApplicationManager const& manager, |
506 | 38 | glib::Object<BamfView> const& view); | 38 | glib::Object<BamfView> const& view); |
507 | 39 | 39 | ||
510 | 40 | std::string title() const; | 40 | std::string GetTitle() const; |
511 | 41 | std::string icon() const; | 41 | std::string GetIcon() const; |
512 | 42 | std::string type() const; | 42 | std::string type() const; |
513 | 43 | 43 | ||
514 | 44 | bool GetVisible() const; | 44 | bool GetVisible() const; |
515 | @@ -59,8 +59,6 @@ | |||
516 | 59 | glib::Object<BamfView> const& window); | 59 | glib::Object<BamfView> const& window); |
517 | 60 | 60 | ||
518 | 61 | public: | 61 | public: |
519 | 62 | virtual std::string title() const; | ||
520 | 63 | virtual std::string icon() const; | ||
521 | 64 | virtual std::string type() const; // 'window' or 'tab' | 62 | virtual std::string type() const; // 'window' or 'tab' |
522 | 65 | 63 | ||
523 | 66 | virtual bool Focus() const; | 64 | virtual bool Focus() const; |
524 | @@ -110,8 +108,6 @@ | |||
525 | 110 | Application(ApplicationManager const& manager, | 108 | Application(ApplicationManager const& manager, |
526 | 111 | glib::Object<BamfApplication> const& app); | 109 | glib::Object<BamfApplication> const& app); |
527 | 112 | 110 | ||
528 | 113 | virtual std::string title() const; | ||
529 | 114 | virtual std::string icon() const; | ||
530 | 115 | virtual std::string desktop_file() const; | 111 | virtual std::string desktop_file() const; |
531 | 116 | virtual std::string type() const; | 112 | virtual std::string type() const; |
532 | 117 | 113 |
PASSED: Continuous integration, rev:3395 jenkins. qa.ubuntu. com/job/ unity-ci/ 156/ jenkins. qa.ubuntu. com/job/ unity-saucy- amd64-ci/ 44 jenkins. qa.ubuntu. com/job/ unity-saucy- armhf-ci/ 44 jenkins. qa.ubuntu. com/job/ unity-saucy- i386-ci/ 44
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ unity-ci/ 156/rebuild
http://