Merge lp:~azzar1/unity/gs-integration into lp:unity
- gs-integration
- Merge into trunk
Proposed by
Andrea Azzarone
Status: | Superseded |
---|---|
Proposed branch: | lp:~azzar1/unity/gs-integration |
Merge into: | lp:unity |
Diff against target: |
1121 lines (+290/-339) 23 files modified
CMakeLists.txt (+1/-0) com.canonical.Unity.gschema.xml (+1/-1) debian/control (+1/-0) launcher/LauncherController.cpp (+18/-57) launcher/LauncherControllerPrivate.h (+2/-3) launcher/LauncherIcon.cpp (+14/-0) launcher/LauncherIcon.h (+2/-0) launcher/SimpleLauncherIcon.cpp (+27/-8) launcher/SimpleLauncherIcon.h (+2/-0) launcher/SoftwareCenterLauncherIcon.cpp (+4/-108) launcher/SoftwareCenterLauncherIcon.h (+1/-7) tests/data/applications/org.gnome.Software.desktop (+3/-4) tests/test_application_launcher_icon.cpp (+7/-7) tests/test_desktop_utilities.cpp (+3/-3) tests/test_favorite_store.cpp (+1/-1) tests/test_favorite_store_gsettings.cpp (+1/-1) tests/test_launcher_controller.cpp (+1/-33) tests/test_software_center_launcher_icon.cpp (+31/-105) unity-shared/AppStreamApplication.cpp (+104/-0) unity-shared/AppStreamApplication.h (+61/-0) unity-shared/ApplicationManager.h (+3/-0) unity-shared/CMakeLists.txt (+1/-0) unity-shared/DesktopApplicationManager.h (+1/-1) |
To merge this branch: | bzr merge lp:~azzar1/unity/gs-integration |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Review via email: mp+286653@code.launchpad.net |
This proposal has been superseded by a proposal from 2016-02-23.
Commit message
Gnome-software launcher integration.
Description of the change
Gnome-software launcher integration.
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Needs Fixing
(continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Add libappstream-
Also, please, ensure that this merges with lp:~robert-ancell/unity/gnome-software
See comments, there might be some room for future optimization.
Revision history for this message
Andrea Azzarone (azzar1) wrote : | # |
Done. We can talk more about the icon stuff later on.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Ok, looks good...
It would be nice if we might also get the application icon path instead of the pixbuf, so please keep looking at this for next improvements.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2016-02-09 01:57:51 +0000 | |||
3 | +++ CMakeLists.txt 2016-02-23 15:49:50 +0000 | |||
4 | @@ -228,6 +228,7 @@ | |||
5 | 228 | set(UNITY_PROTOCOL_PRIVATE_DEPS unity-protocol-private>=7.1.0) | 228 | set(UNITY_PROTOCOL_PRIVATE_DEPS unity-protocol-private>=7.1.0) |
6 | 229 | set(UNITY_PLUGIN_SHARED_DEPS | 229 | set(UNITY_PLUGIN_SHARED_DEPS |
7 | 230 | ${UNITY_PROTOCOL_PRIVATE_DEPS} | 230 | ${UNITY_PROTOCOL_PRIVATE_DEPS} |
8 | 231 | appstream-glib | ||
9 | 231 | atk | 232 | atk |
10 | 232 | atk-bridge-2.0 | 233 | atk-bridge-2.0 |
11 | 233 | cairo>=1.13.1 | 234 | cairo>=1.13.1 |
12 | 234 | 235 | ||
13 | === modified file 'com.canonical.Unity.gschema.xml' | |||
14 | --- com.canonical.Unity.gschema.xml 2015-11-23 09:24:10 +0000 | |||
15 | +++ com.canonical.Unity.gschema.xml 2016-02-23 15:49:50 +0000 | |||
16 | @@ -117,7 +117,7 @@ | |||
17 | 117 | 'application://libreoffice-writer.desktop', | 117 | 'application://libreoffice-writer.desktop', |
18 | 118 | 'application://libreoffice-calc.desktop', | 118 | 'application://libreoffice-calc.desktop', |
19 | 119 | 'application://libreoffice-impress.desktop', | 119 | 'application://libreoffice-impress.desktop', |
21 | 120 | 'application://ubuntu-software-center.desktop', | 120 | 'application://org.gnome.Software.desktop', |
22 | 121 | 'application://ubuntu-amazon-default.desktop', | 121 | 'application://ubuntu-amazon-default.desktop', |
23 | 122 | 'application://unity-control-center.desktop', | 122 | 'application://unity-control-center.desktop', |
24 | 123 | 'unity://running-apps', | 123 | 'unity://running-apps', |
25 | 124 | 124 | ||
26 | === modified file 'debian/control' | |||
27 | --- debian/control 2016-02-09 12:20:47 +0000 | |||
28 | +++ debian/control 2016-02-23 15:49:50 +0000 | |||
29 | @@ -13,6 +13,7 @@ | |||
30 | 13 | gsettings-desktop-schemas-dev, | 13 | gsettings-desktop-schemas-dev, |
31 | 14 | gsettings-ubuntu-schemas (>= 0.0.1+14.04.20140219), | 14 | gsettings-ubuntu-schemas (>= 0.0.1+14.04.20140219), |
32 | 15 | intltool (>= 0.35.0), | 15 | intltool (>= 0.35.0), |
33 | 16 | libappstream-glib-dev, | ||
34 | 16 | libatk1.0-dev, | 17 | libatk1.0-dev, |
35 | 17 | libbamf3-dev (>= 0.5.2~bzr0), | 18 | libbamf3-dev (>= 0.5.2~bzr0), |
36 | 18 | libboost-dev, | 19 | libboost-dev, |
37 | 19 | 20 | ||
38 | === modified file 'launcher/LauncherController.cpp' | |||
39 | --- launcher/LauncherController.cpp 2015-12-17 22:32:37 +0000 | |||
40 | +++ launcher/LauncherController.cpp 2016-02-23 15:49:50 +0000 | |||
41 | @@ -41,6 +41,7 @@ | |||
42 | 41 | #include "ExpoLauncherIcon.h" | 41 | #include "ExpoLauncherIcon.h" |
43 | 42 | #include "TrashLauncherIcon.h" | 42 | #include "TrashLauncherIcon.h" |
44 | 43 | #include "BFBLauncherIcon.h" | 43 | #include "BFBLauncherIcon.h" |
45 | 44 | #include "unity-shared/AppStreamApplication.h" | ||
46 | 44 | #include "unity-shared/IconRenderer.h" | 45 | #include "unity-shared/IconRenderer.h" |
47 | 45 | #include "unity-shared/UScreen.h" | 46 | #include "unity-shared/UScreen.h" |
48 | 46 | #include "unity-shared/UBusMessages.h" | 47 | #include "unity-shared/UBusMessages.h" |
49 | @@ -61,13 +62,8 @@ | |||
50 | 61 | "<node>" | 62 | "<node>" |
51 | 62 | " <interface name='com.canonical.Unity.Launcher'>" | 63 | " <interface name='com.canonical.Unity.Launcher'>" |
52 | 63 | "" | 64 | "" |
60 | 64 | " <method name='AddLauncherItemFromPosition'>" | 65 | " <method name='AddLauncherItem'>" |
61 | 65 | " <arg type='s' name='title' direction='in'/>" | 66 | " <arg type='s' name='appstream_app_id' direction='in'/>" |
55 | 66 | " <arg type='s' name='icon' direction='in'/>" | ||
56 | 67 | " <arg type='i' name='icon_x' direction='in'/>" | ||
57 | 68 | " <arg type='i' name='icon_y' direction='in'/>" | ||
58 | 69 | " <arg type='i' name='icon_size' direction='in'/>" | ||
59 | 70 | " <arg type='s' name='desktop_file' direction='in'/>" | ||
62 | 71 | " <arg type='s' name='aptdaemon_task' direction='in'/>" | 67 | " <arg type='s' name='aptdaemon_task' direction='in'/>" |
63 | 72 | " </method>" | 68 | " </method>" |
64 | 73 | "" | 69 | "" |
65 | @@ -506,44 +502,25 @@ | |||
66 | 506 | } | 502 | } |
67 | 507 | 503 | ||
68 | 508 | void | 504 | void |
75 | 509 | Controller::Impl::OnLauncherAddRequestSpecial(std::string const& path, | 505 | Controller::Impl::OnLauncherAddRequestSpecial(std::string const& appstream_app_id, |
76 | 510 | std::string const& aptdaemon_trans_id, | 506 | std::string const& aptdaemon_trans_id) |
71 | 511 | std::string const& icon_path, | ||
72 | 512 | int icon_x, | ||
73 | 513 | int icon_y, | ||
74 | 514 | int icon_size) | ||
77 | 515 | { | 507 | { |
81 | 516 | // Check if desktop file was supplied, or if it's set to SC's agent | 508 | // Check if desktop file was supplied |
82 | 517 | // See https://bugs.launchpad.net/unity/+bug/1002440 | 509 | if (appstream_app_id.empty()) |
80 | 518 | if (path.empty() || path == local::SOFTWARE_CENTER_AGENT) | ||
83 | 519 | return; | 510 | return; |
84 | 520 | 511 | ||
85 | 521 | auto const& icon = std::find_if(model_->begin(), model_->end(), | 512 | auto const& icon = std::find_if(model_->begin(), model_->end(), |
87 | 522 | [&path](AbstractLauncherIcon::Ptr const& i) { return (i->DesktopFile() == path); }); | 513 | [&appstream_app_id](AbstractLauncherIcon::Ptr const& i) { return (i->DesktopFile() == appstream_app_id); }); |
88 | 523 | 514 | ||
89 | 524 | if (icon != model_->end()) | 515 | if (icon != model_->end()) |
90 | 525 | return; | 516 | return; |
91 | 526 | 517 | ||
93 | 527 | auto const& result = CreateSCLauncherIcon(path, aptdaemon_trans_id, icon_path); | 518 | auto const& result = CreateSCLauncherIcon(appstream_app_id, aptdaemon_trans_id); |
94 | 528 | 519 | ||
95 | 529 | if (result) | 520 | if (result) |
96 | 530 | { | 521 | { |
97 | 531 | // Setting the icon position and adding it to the model, makes the launcher | ||
98 | 532 | // to compute its center | ||
99 | 533 | RegisterIcon(result, GetLastIconPriority<ApplicationLauncherIcon>("", true)); | 522 | RegisterIcon(result, GetLastIconPriority<ApplicationLauncherIcon>("", true)); |
113 | 534 | 523 | result->SetQuirk(AbstractLauncherIcon::Quirk::VISIBLE, true); | |
101 | 535 | if (icon_x > 0 || icon_y > 0) | ||
102 | 536 | { | ||
103 | 537 | // This will ensure that the center of the new icon is set, so that | ||
104 | 538 | // the animation could be done properly. | ||
105 | 539 | sources_.AddIdle([this, icon_x, icon_y, result] { | ||
106 | 540 | return !result->Animate(CurrentLauncher(), icon_x, icon_y); | ||
107 | 541 | }); | ||
108 | 542 | } | ||
109 | 543 | else | ||
110 | 544 | { | ||
111 | 545 | result->SetQuirk(AbstractLauncherIcon::Quirk::VISIBLE, true); | ||
112 | 546 | } | ||
114 | 547 | } | 524 | } |
115 | 548 | } | 525 | } |
116 | 549 | 526 | ||
117 | @@ -944,22 +921,11 @@ | |||
118 | 944 | return AbstractLauncherIcon::Ptr(); | 921 | return AbstractLauncherIcon::Ptr(); |
119 | 945 | } | 922 | } |
120 | 946 | 923 | ||
124 | 947 | SoftwareCenterLauncherIcon::Ptr Controller::Impl::CreateSCLauncherIcon(std::string const& file_path, | 924 | SoftwareCenterLauncherIcon::Ptr Controller::Impl::CreateSCLauncherIcon(std::string const& appstream_app_id, |
125 | 948 | std::string const& aptdaemon_trans_id, | 925 | std::string const& aptdaemon_trans_id) |
123 | 949 | std::string const& icon_path) | ||
126 | 950 | { | 926 | { |
139 | 951 | SoftwareCenterLauncherIcon::Ptr result; | 927 | ApplicationPtr app = std::make_shared<appstream::Application>(appstream_app_id); |
140 | 952 | 928 | return SoftwareCenterLauncherIcon::Ptr(new SoftwareCenterLauncherIcon(app, aptdaemon_trans_id)); | |
129 | 953 | ApplicationPtr app = ApplicationManager::Default().GetApplicationForDesktopFile(file_path); | ||
130 | 954 | if (!app) | ||
131 | 955 | return result; | ||
132 | 956 | |||
133 | 957 | if (app->seen) | ||
134 | 958 | return result; | ||
135 | 959 | |||
136 | 960 | result = new SoftwareCenterLauncherIcon(app, aptdaemon_trans_id, icon_path); | ||
137 | 961 | |||
138 | 962 | return result; | ||
141 | 963 | } | 929 | } |
142 | 964 | 930 | ||
143 | 965 | void Controller::Impl::AddRunningApps() | 931 | void Controller::Impl::AddRunningApps() |
144 | @@ -1548,16 +1514,11 @@ | |||
145 | 1548 | 1514 | ||
146 | 1549 | GVariant* Controller::Impl::OnDBusMethodCall(std::string const& method, GVariant *parameters) | 1515 | GVariant* Controller::Impl::OnDBusMethodCall(std::string const& method, GVariant *parameters) |
147 | 1550 | { | 1516 | { |
149 | 1551 | if (method == "AddLauncherItemFromPosition") | 1517 | if (method == "AddLauncherItem") |
150 | 1552 | { | 1518 | { |
159 | 1553 | glib::String icon, icon_title, desktop_file, aptdaemon_task; | 1519 | glib::String appstream_app_id, aptdaemon_trans_id; |
160 | 1554 | gint icon_x, icon_y, icon_size; | 1520 | g_variant_get(parameters, "(ss)", &appstream_app_id, &aptdaemon_trans_id); |
161 | 1555 | 1521 | OnLauncherAddRequestSpecial(appstream_app_id.Str(), aptdaemon_trans_id.Str()); | |
154 | 1556 | g_variant_get(parameters, "(ssiiiss)", &icon_title, &icon, &icon_x, &icon_y, | ||
155 | 1557 | &icon_size, &desktop_file, &aptdaemon_task); | ||
156 | 1558 | |||
157 | 1559 | OnLauncherAddRequestSpecial(desktop_file.Str(), aptdaemon_task.Str(), | ||
158 | 1560 | icon.Str(), icon_x, icon_y, icon_size); | ||
162 | 1561 | } | 1522 | } |
163 | 1562 | else if (method == "UpdateLauncherIconFavoriteState") | 1523 | else if (method == "UpdateLauncherIconFavoriteState") |
164 | 1563 | { | 1524 | { |
165 | 1564 | 1525 | ||
166 | === modified file 'launcher/LauncherControllerPrivate.h' | |||
167 | --- launcher/LauncherControllerPrivate.h 2015-12-07 18:34:41 +0000 | |||
168 | +++ launcher/LauncherControllerPrivate.h 2016-02-23 15:49:50 +0000 | |||
169 | @@ -69,8 +69,7 @@ | |||
170 | 69 | void OnDeviceIconAdded(AbstractLauncherIcon::Ptr const& icon); | 69 | void OnDeviceIconAdded(AbstractLauncherIcon::Ptr const& icon); |
171 | 70 | 70 | ||
172 | 71 | void OnLauncherAddRequest(std::string const& icon_uri, AbstractLauncherIcon::Ptr const& before); | 71 | void OnLauncherAddRequest(std::string const& icon_uri, AbstractLauncherIcon::Ptr const& before); |
175 | 72 | void OnLauncherAddRequestSpecial(std::string const& path, std::string const& aptdaemon_trans_id, | 72 | void OnLauncherAddRequestSpecial(std::string const& appstream_app_id, std::string const& aptdaemon_trans_id); |
174 | 73 | std::string const& icon_path, int icon_x, int icon_y, int icon_size); | ||
176 | 74 | void OnLauncherUpdateIconStickyState(std::string const& desktop_file, bool sticky); | 73 | void OnLauncherUpdateIconStickyState(std::string const& desktop_file, bool sticky); |
177 | 75 | void OnLauncherRemoveRequest(AbstractLauncherIcon::Ptr const& icon); | 74 | void OnLauncherRemoveRequest(AbstractLauncherIcon::Ptr const& icon); |
178 | 76 | 75 | ||
179 | @@ -90,7 +89,7 @@ | |||
180 | 90 | ApplicationLauncherIcon* CreateAppLauncherIcon(ApplicationPtr const&); | 89 | ApplicationLauncherIcon* CreateAppLauncherIcon(ApplicationPtr const&); |
181 | 91 | AbstractLauncherIcon::Ptr CreateFavoriteIcon(std::string const& icon_uri, bool emit_signal = false); | 90 | AbstractLauncherIcon::Ptr CreateFavoriteIcon(std::string const& icon_uri, bool emit_signal = false); |
182 | 92 | AbstractLauncherIcon::Ptr GetIconByUri(std::string const& icon_uri); | 91 | AbstractLauncherIcon::Ptr GetIconByUri(std::string const& icon_uri); |
184 | 93 | SoftwareCenterLauncherIcon::Ptr CreateSCLauncherIcon(std::string const& file_path, std::string const& aptdaemon_trans_id, std::string const& icon_path); | 92 | SoftwareCenterLauncherIcon::Ptr CreateSCLauncherIcon(std::string const& appstream_app_id, std::string const& aptdaemon_trans_id); |
185 | 94 | 93 | ||
186 | 95 | void SetupIcons(); | 94 | void SetupIcons(); |
187 | 96 | void MigrateFavorites(); | 95 | void MigrateFavorites(); |
188 | 97 | 96 | ||
189 | === modified file 'launcher/LauncherIcon.cpp' | |||
190 | --- launcher/LauncherIcon.cpp 2015-11-25 23:16:11 +0000 | |||
191 | +++ launcher/LauncherIcon.cpp 2016-02-23 15:49:50 +0000 | |||
192 | @@ -365,6 +365,20 @@ | |||
193 | 365 | return _unity_theme; | 365 | return _unity_theme; |
194 | 366 | } | 366 | } |
195 | 367 | 367 | ||
196 | 368 | BaseTexturePtr LauncherIcon::TextureFromPixbuf(GdkPixbuf* pixbuf, int size, bool update_glow_colors) | ||
197 | 369 | { | ||
198 | 370 | g_return_val_if_fail(GDK_IS_PIXBUF(pixbuf), BaseTexturePtr()); | ||
199 | 371 | |||
200 | 372 | glib::Object<GdkPixbuf> scaled_pixbuf(gdk_pixbuf_scale_simple(pixbuf, size, size, GDK_INTERP_BILINEAR)); | ||
201 | 373 | |||
202 | 374 | if (update_glow_colors) | ||
203 | 375 | ColorForIcon(scaled_pixbuf, _background_color, _glow_color); | ||
204 | 376 | |||
205 | 377 | BaseTexturePtr result; | ||
206 | 378 | result.Adopt(nux::CreateTexture2DFromPixbuf(scaled_pixbuf, true)); | ||
207 | 379 | return result; | ||
208 | 380 | } | ||
209 | 381 | |||
210 | 368 | BaseTexturePtr LauncherIcon::TextureFromGtkTheme(std::string icon_name, int size, bool update_glow_colors) | 382 | BaseTexturePtr LauncherIcon::TextureFromGtkTheme(std::string icon_name, int size, bool update_glow_colors) |
211 | 369 | { | 383 | { |
212 | 370 | GtkIconTheme* default_theme; | 384 | GtkIconTheme* default_theme; |
213 | 371 | 385 | ||
214 | === modified file 'launcher/LauncherIcon.h' | |||
215 | --- launcher/LauncherIcon.h 2015-11-25 23:16:11 +0000 | |||
216 | +++ launcher/LauncherIcon.h 2016-02-23 15:49:50 +0000 | |||
217 | @@ -269,6 +269,8 @@ | |||
218 | 269 | 269 | ||
219 | 270 | virtual bool HandlesSpread () { return false; } | 270 | virtual bool HandlesSpread () { return false; } |
220 | 271 | 271 | ||
221 | 272 | BaseTexturePtr TextureFromPixbuf(GdkPixbuf *pixbuf, int size, bool update_glow_colors = true); | ||
222 | 273 | |||
223 | 272 | BaseTexturePtr TextureFromGtkTheme(std::string name, int size, bool update_glow_colors = true); | 274 | BaseTexturePtr TextureFromGtkTheme(std::string name, int size, bool update_glow_colors = true); |
224 | 273 | 275 | ||
225 | 274 | BaseTexturePtr TextureFromSpecificGtkTheme(GtkIconTheme* theme, std::string const& name, int size, bool update_glow_colors = true, bool is_default_theme = false); | 276 | BaseTexturePtr TextureFromSpecificGtkTheme(GtkIconTheme* theme, std::string const& name, int size, bool update_glow_colors = true, bool is_default_theme = false); |
226 | 275 | 277 | ||
227 | === modified file 'launcher/SimpleLauncherIcon.cpp' | |||
228 | --- launcher/SimpleLauncherIcon.cpp 2014-07-30 00:49:35 +0000 | |||
229 | +++ launcher/SimpleLauncherIcon.cpp 2016-02-23 15:49:50 +0000 | |||
230 | @@ -34,6 +34,7 @@ | |||
231 | 34 | SimpleLauncherIcon::SimpleLauncherIcon(IconType type) | 34 | SimpleLauncherIcon::SimpleLauncherIcon(IconType type) |
232 | 35 | : LauncherIcon(type) | 35 | : LauncherIcon(type) |
233 | 36 | , icon_name("", sigc::mem_fun(this, &SimpleLauncherIcon::SetIconName)) | 36 | , icon_name("", sigc::mem_fun(this, &SimpleLauncherIcon::SetIconName)) |
234 | 37 | , icon_pixbuf(glib::Object<GdkPixbuf>(), sigc::mem_fun(this, &SimpleLauncherIcon::SetIconPixbuf)) | ||
235 | 37 | { | 38 | { |
236 | 38 | auto* theme = gtk_icon_theme_get_default(); | 39 | auto* theme = gtk_icon_theme_get_default(); |
237 | 39 | theme_changed_signal_.Connect(theme, "changed", [this] (GtkIconTheme *) { | 40 | theme_changed_signal_.Connect(theme, "changed", [this] (GtkIconTheme *) { |
238 | @@ -53,17 +54,24 @@ | |||
239 | 53 | if (it != texture_map_.end()) | 54 | if (it != texture_map_.end()) |
240 | 54 | return it->second.GetPointer(); | 55 | return it->second.GetPointer(); |
241 | 55 | 56 | ||
242 | 56 | std::string const& icon_string = icon_name(); | ||
243 | 57 | |||
244 | 58 | if (icon_string.empty()) | ||
245 | 59 | return nullptr; | ||
246 | 60 | |||
247 | 61 | BaseTexturePtr texture; | 57 | BaseTexturePtr texture; |
248 | 62 | 58 | ||
251 | 63 | if (icon_string[0] == '/') | 59 | if (icon_pixbuf()) |
252 | 64 | texture = TextureFromPath(icon_string, size); | 60 | { |
253 | 61 | texture = TextureFromPixbuf(icon_pixbuf(), size); | ||
254 | 62 | } | ||
255 | 65 | else | 63 | else |
257 | 66 | texture = TextureFromGtkTheme(icon_string, size); | 64 | { |
258 | 65 | std::string const& icon_string = icon_name(); | ||
259 | 66 | |||
260 | 67 | if (icon_string.empty()) | ||
261 | 68 | return nullptr; | ||
262 | 69 | |||
263 | 70 | if (icon_string[0] == '/') | ||
264 | 71 | texture = TextureFromPath(icon_string, size); | ||
265 | 72 | else | ||
266 | 73 | texture = TextureFromGtkTheme(icon_string, size); | ||
267 | 74 | } | ||
268 | 67 | 75 | ||
269 | 68 | if (!texture) | 76 | if (!texture) |
270 | 69 | return nullptr; | 77 | return nullptr; |
271 | @@ -83,6 +91,17 @@ | |||
272 | 83 | return true; | 91 | return true; |
273 | 84 | } | 92 | } |
274 | 85 | 93 | ||
275 | 94 | bool SimpleLauncherIcon::SetIconPixbuf(glib::Object<GdkPixbuf>& target, glib::Object<GdkPixbuf> const& value) | ||
276 | 95 | { | ||
277 | 96 | if (target == value) | ||
278 | 97 | return false; | ||
279 | 98 | |||
280 | 99 | target = value; | ||
281 | 100 | ReloadIcon(); | ||
282 | 101 | |||
283 | 102 | return true; | ||
284 | 103 | } | ||
285 | 104 | |||
286 | 86 | void SimpleLauncherIcon::ReloadIcon() | 105 | void SimpleLauncherIcon::ReloadIcon() |
287 | 87 | { | 106 | { |
288 | 88 | texture_map_.clear(); | 107 | texture_map_.clear(); |
289 | 89 | 108 | ||
290 | === modified file 'launcher/SimpleLauncherIcon.h' | |||
291 | --- launcher/SimpleLauncherIcon.h 2013-09-19 16:44:03 +0000 | |||
292 | +++ launcher/SimpleLauncherIcon.h 2016-02-23 15:49:50 +0000 | |||
293 | @@ -38,6 +38,7 @@ | |||
294 | 38 | 38 | ||
295 | 39 | // Properties | 39 | // Properties |
296 | 40 | nux::Property<std::string> icon_name; | 40 | nux::Property<std::string> icon_name; |
297 | 41 | nux::Property<glib::Object<GdkPixbuf>> icon_pixbuf; | ||
298 | 41 | 42 | ||
299 | 42 | protected: | 43 | protected: |
300 | 43 | std::string GetName() const; | 44 | std::string GetName() const; |
301 | @@ -49,6 +50,7 @@ | |||
302 | 49 | private: | 50 | private: |
303 | 50 | void ReloadIcon(); | 51 | void ReloadIcon(); |
304 | 51 | bool SetIconName(std::string& target, std::string const& value); | 52 | bool SetIconName(std::string& target, std::string const& value); |
305 | 53 | bool SetIconPixbuf(glib::Object<GdkPixbuf>& target, glib::Object<GdkPixbuf> const& value); | ||
306 | 52 | 54 | ||
307 | 53 | private: | 55 | private: |
308 | 54 | std::unordered_map<int, BaseTexturePtr> texture_map_; | 56 | std::unordered_map<int, BaseTexturePtr> texture_map_; |
309 | 55 | 57 | ||
310 | === modified file 'launcher/SoftwareCenterLauncherIcon.cpp' | |||
311 | --- launcher/SoftwareCenterLauncherIcon.cpp 2015-12-07 16:13:42 +0000 | |||
312 | +++ launcher/SoftwareCenterLauncherIcon.cpp 2016-02-23 15:49:50 +0000 | |||
313 | @@ -44,8 +44,7 @@ | |||
314 | 44 | 44 | ||
315 | 45 | NUX_IMPLEMENT_OBJECT_TYPE(SoftwareCenterLauncherIcon); | 45 | NUX_IMPLEMENT_OBJECT_TYPE(SoftwareCenterLauncherIcon); |
316 | 46 | SoftwareCenterLauncherIcon::SoftwareCenterLauncherIcon(ApplicationPtr const& app, | 46 | SoftwareCenterLauncherIcon::SoftwareCenterLauncherIcon(ApplicationPtr const& app, |
319 | 47 | std::string const& aptdaemon_trans_id, | 47 | std::string const& aptdaemon_trans_id) |
318 | 48 | std::string const& icon_path) | ||
320 | 49 | : WindowedLauncherIcon(IconType::APPLICATION) | 48 | : WindowedLauncherIcon(IconType::APPLICATION) |
321 | 50 | , ApplicationLauncherIcon(app) | 49 | , ApplicationLauncherIcon(app) |
322 | 51 | , aptdaemon_trans_(std::make_shared<glib::DBusProxy>("org.debian.apt", | 50 | , aptdaemon_trans_(std::make_shared<glib::DBusProxy>("org.debian.apt", |
323 | @@ -69,61 +68,13 @@ | |||
324 | 69 | SetQuirk(Quirk::PROGRESS, (progress > 0)); | 68 | SetQuirk(Quirk::PROGRESS, (progress > 0)); |
325 | 70 | }); | 69 | }); |
326 | 71 | 70 | ||
329 | 72 | if (!icon_path.empty()) | 71 | if (app->icon_pixbuf()) |
330 | 73 | icon_name = icon_path; | 72 | icon_pixbuf = app->icon_pixbuf(); |
331 | 74 | 73 | ||
332 | 75 | if (!aptdaemon_trans_id_.empty()) // Application is being installed, or hasn't been installed yet | 74 | if (!aptdaemon_trans_id_.empty()) // Application is being installed, or hasn't been installed yet |
333 | 76 | tooltip_text = _("Waiting to install"); | 75 | tooltip_text = _("Waiting to install"); |
334 | 77 | } | 76 | } |
335 | 78 | 77 | ||
336 | 79 | bool SoftwareCenterLauncherIcon::Animate(nux::ObjectPtr<Launcher> const& launcher, int start_x, int start_y) | ||
337 | 80 | { | ||
338 | 81 | using namespace std::placeholders; | ||
339 | 82 | |||
340 | 83 | if (start_x <= 0 && start_y <= 0) | ||
341 | 84 | { | ||
342 | 85 | SetQuirk(Quirk::VISIBLE, true); | ||
343 | 86 | return true; | ||
344 | 87 | } | ||
345 | 88 | |||
346 | 89 | int monitor = launcher->monitor(); | ||
347 | 90 | auto const& icon_center = GetCenter(monitor); | ||
348 | 91 | |||
349 | 92 | if (icon_center.x == 0 && icon_center.y == 0) | ||
350 | 93 | return false; | ||
351 | 94 | |||
352 | 95 | auto* floating_icon = new SimpleLauncherIcon(GetIconType()); | ||
353 | 96 | AbstractLauncherIcon::Ptr floating_icon_ptr(floating_icon); | ||
354 | 97 | floating_icon->icon_name = icon_name(); | ||
355 | 98 | |||
356 | 99 | // Transform this in a spacer-icon and make it visible only on launcher's monitor | ||
357 | 100 | icon_name = ""; | ||
358 | 101 | SetQuirk(Quirk::VISIBLE, true, monitor); | ||
359 | 102 | |||
360 | 103 | auto rcb = std::bind(&Launcher::RenderIconToTexture, launcher.GetPointer(), _1, _2, floating_icon_ptr); | ||
361 | 104 | drag_window_ = new LauncherDragWindow(launcher->GetWidth(), rcb); | ||
362 | 105 | drag_window_->SetBaseXY(start_x, start_y); | ||
363 | 106 | drag_window_->SetAnimationTarget(icon_center.x, icon_center.y + (launcher->GetIconSize() / 2)); | ||
364 | 107 | |||
365 | 108 | launcher->ForceReveal(true); | ||
366 | 109 | drag_window_->ShowWindow(true); | ||
367 | 110 | |||
368 | 111 | auto cb = sigc::bind(sigc::mem_fun(this, &SoftwareCenterLauncherIcon::OnDragAnimationFinished), launcher, floating_icon->icon_name()); | ||
369 | 112 | drag_window_->anim_completed.connect(cb); | ||
370 | 113 | drag_window_->StartSlowAnimation(); | ||
371 | 114 | |||
372 | 115 | return true; | ||
373 | 116 | } | ||
374 | 117 | |||
375 | 118 | void SoftwareCenterLauncherIcon::OnDragAnimationFinished(nux::ObjectPtr<Launcher> const& launcher, std::string const& final_icon) | ||
376 | 119 | { | ||
377 | 120 | icon_name = final_icon; | ||
378 | 121 | drag_window_->ShowWindow(false); | ||
379 | 122 | drag_window_.Release(); | ||
380 | 123 | launcher->ForceReveal(false); | ||
381 | 124 | SetQuirk(Quirk::VISIBLE, true); | ||
382 | 125 | } | ||
383 | 126 | |||
384 | 127 | void SoftwareCenterLauncherIcon::ActivateLauncherIcon(ActionArg arg) | 78 | void SoftwareCenterLauncherIcon::ActivateLauncherIcon(ActionArg arg) |
385 | 128 | { | 79 | { |
386 | 129 | if (finished_) | 80 | if (finished_) |
387 | @@ -144,62 +95,7 @@ | |||
388 | 144 | 95 | ||
389 | 145 | std::string SoftwareCenterLauncherIcon::GetActualDesktopFileAfterInstall() | 96 | std::string SoftwareCenterLauncherIcon::GetActualDesktopFileAfterInstall() |
390 | 146 | { | 97 | { |
447 | 147 | // Fixup the _desktop_file because the one we get from software-center | 98 | return DesktopUtilities::GetDesktopPathById(DesktopFile()); |
392 | 148 | // is not the final one, e.g. the s-c-agent does send a temp one and | ||
393 | 149 | // app-install-data points to the "wrong" one in /usr/share/app-install | ||
394 | 150 | // | ||
395 | 151 | // So: | ||
396 | 152 | // - if there is a desktop file already and it startswith | ||
397 | 153 | // /usr/share/app-install/desktop, then transform to | ||
398 | 154 | // /usr/share/application | ||
399 | 155 | // - if there is a desktop file with prefix /tmp/software-center-agent: | ||
400 | 156 | // transform to /usr/share/application | ||
401 | 157 | // (its using "/tmp/software-center-agent:$random:$pkgname.desktop") | ||
402 | 158 | // maybe: | ||
403 | 159 | // - and search in /var/lib/apt/lists/$pkgname.list | ||
404 | 160 | // for a desktop file that roughly matches what we want | ||
405 | 161 | auto const& desktop_file = DesktopFile(); | ||
406 | 162 | |||
407 | 163 | // take /usr/share/app-install/desktop/foo:subdir__bar.desktop | ||
408 | 164 | // and tranform it | ||
409 | 165 | if (desktop_file.find("/share/app-install/desktop/") != std::string::npos) | ||
410 | 166 | { | ||
411 | 167 | auto colon_pos = desktop_file.rfind(":"); | ||
412 | 168 | auto filename = desktop_file.substr(colon_pos + 1, desktop_file.length() - colon_pos); | ||
413 | 169 | // the app-install-data package encodes subdirs in a funny way, once | ||
414 | 170 | // that is fixed, this code can be dropped | ||
415 | 171 | if (filename.find("__") != std::string::npos) | ||
416 | 172 | { | ||
417 | 173 | int pos = filename.find("__"); | ||
418 | 174 | filename = filename.replace(pos, 2, "-"); | ||
419 | 175 | } | ||
420 | 176 | filename = DesktopUtilities::GetDesktopPathById(filename); | ||
421 | 177 | return filename; | ||
422 | 178 | } | ||
423 | 179 | else if (desktop_file.find("/tmp/software-center-agent:") == 0) | ||
424 | 180 | { | ||
425 | 181 | // by convention the software-center-agent uses | ||
426 | 182 | // /usr/share/applications/$pkgname.desktop | ||
427 | 183 | // or | ||
428 | 184 | // /usr/share/applications/extras-$pkgname.desktop | ||
429 | 185 | auto colon_pos = desktop_file.rfind(":"); | ||
430 | 186 | auto desktopf = desktop_file.substr(colon_pos + 1, desktop_file.length() - colon_pos); | ||
431 | 187 | |||
432 | 188 | auto filename = DesktopUtilities::GetDesktopPathById(desktopf); | ||
433 | 189 | |||
434 | 190 | if (!filename.empty()) | ||
435 | 191 | return filename; | ||
436 | 192 | |||
437 | 193 | // now try extras-$pkgname.desktop | ||
438 | 194 | filename = DesktopUtilities::GetDesktopPathById("extras-" + desktopf); | ||
439 | 195 | if (!filename.empty()) | ||
440 | 196 | return filename; | ||
441 | 197 | |||
442 | 198 | // FIXME: test if there is a file now and if not, search | ||
443 | 199 | // /var/lib/dpkg/info/$pkgname.list for a desktop file | ||
444 | 200 | } | ||
445 | 201 | |||
446 | 202 | return desktop_file; | ||
448 | 203 | } | 99 | } |
449 | 204 | 100 | ||
450 | 205 | void SoftwareCenterLauncherIcon::OnFinished(GVariant *params) | 101 | void SoftwareCenterLauncherIcon::OnFinished(GVariant *params) |
451 | 206 | 102 | ||
452 | === modified file 'launcher/SoftwareCenterLauncherIcon.h' | |||
453 | --- launcher/SoftwareCenterLauncherIcon.h 2013-08-28 16:41:20 +0000 | |||
454 | +++ launcher/SoftwareCenterLauncherIcon.h 2016-02-23 15:49:50 +0000 | |||
455 | @@ -24,7 +24,6 @@ | |||
456 | 24 | #include <string> | 24 | #include <string> |
457 | 25 | #include <UnityCore/GLibDBusProxy.h> | 25 | #include <UnityCore/GLibDBusProxy.h> |
458 | 26 | #include "ApplicationLauncherIcon.h" | 26 | #include "ApplicationLauncherIcon.h" |
459 | 27 | #include "LauncherDragWindow.h" | ||
460 | 28 | 27 | ||
461 | 29 | namespace unity | 28 | namespace unity |
462 | 30 | { | 29 | { |
463 | @@ -39,10 +38,7 @@ | |||
464 | 39 | typedef nux::ObjectPtr<SoftwareCenterLauncherIcon> Ptr; | 38 | typedef nux::ObjectPtr<SoftwareCenterLauncherIcon> Ptr; |
465 | 40 | 39 | ||
466 | 41 | SoftwareCenterLauncherIcon(ApplicationPtr const& app, | 40 | SoftwareCenterLauncherIcon(ApplicationPtr const& app, |
471 | 42 | std::string const& aptdaemon_trans_id, | 41 | std::string const& aptdaemon_trans_id); |
468 | 43 | std::string const& icon_path); | ||
469 | 44 | |||
470 | 45 | bool Animate(nux::ObjectPtr<Launcher> const& launcher, int start_x, int start_y); | ||
472 | 46 | 42 | ||
473 | 47 | protected: | 43 | protected: |
474 | 48 | std::string GetName() const; | 44 | std::string GetName() const; |
475 | @@ -52,10 +48,8 @@ | |||
476 | 52 | std::string GetActualDesktopFileAfterInstall(); | 48 | std::string GetActualDesktopFileAfterInstall(); |
477 | 53 | void OnFinished(GVariant *params); | 49 | void OnFinished(GVariant *params); |
478 | 54 | void OnPropertyChanged(GVariant* params); | 50 | void OnPropertyChanged(GVariant* params); |
479 | 55 | void OnDragAnimationFinished(nux::ObjectPtr<Launcher> const&, std::string const&); | ||
480 | 56 | 51 | ||
481 | 57 | glib::DBusProxy::Ptr aptdaemon_trans_; | 52 | glib::DBusProxy::Ptr aptdaemon_trans_; |
482 | 58 | LauncherDragWindow::Ptr drag_window_; | ||
483 | 59 | bool finished_; | 53 | bool finished_; |
484 | 60 | bool needs_urgent_; | 54 | bool needs_urgent_; |
485 | 61 | std::string aptdaemon_trans_id_; | 55 | std::string aptdaemon_trans_id_; |
486 | 62 | 56 | ||
487 | === renamed file 'tests/data/applications/ubuntu-software-center.desktop' => 'tests/data/applications/org.gnome.Software.desktop' | |||
488 | --- tests/data/applications/ubuntu-software-center.desktop 2013-06-28 12:52:58 +0000 | |||
489 | +++ tests/data/applications/org.gnome.Software.desktop 2016-02-23 15:49:50 +0000 | |||
490 | @@ -1,9 +1,8 @@ | |||
491 | 1 | [Desktop Entry] | 1 | [Desktop Entry] |
495 | 2 | Name=Ubuntu Software Center | 2 | Name=Software |
496 | 3 | GenericName=Software Center | 3 | Comment=Add, remove or update software on this computer |
494 | 4 | Comment=Lets you choose from thousands of applications available for Ubuntu | ||
497 | 5 | Exec=/bin/true | 4 | Exec=/bin/true |
499 | 6 | Icon=softwarecenter | 5 | Icon=org.gnome.Software |
500 | 7 | Terminal=false | 6 | Terminal=false |
501 | 8 | Type=Application | 7 | Type=Application |
502 | 9 | Categories=PackageManager;GTK;System;Settings; | 8 | Categories=PackageManager;GTK;System;Settings; |
503 | 10 | 9 | ||
504 | === modified file 'tests/test_application_launcher_icon.cpp' | |||
505 | --- tests/test_application_launcher_icon.cpp 2015-12-08 14:34:55 +0000 | |||
506 | +++ tests/test_application_launcher_icon.cpp 2016-02-23 15:49:50 +0000 | |||
507 | @@ -41,7 +41,7 @@ | |||
508 | 41 | namespace | 41 | namespace |
509 | 42 | { | 42 | { |
510 | 43 | const std::string DEFAULT_EMPTY_ICON = "application-default-icon"; | 43 | const std::string DEFAULT_EMPTY_ICON = "application-default-icon"; |
512 | 44 | const std::string USC_DESKTOP = BUILDDIR"/tests/data/applications/ubuntu-software-center.desktop"; | 44 | const std::string GS_DESKTOP = BUILDDIR"/tests/data/applications/org.gnome.Software.desktop"; |
513 | 45 | const std::string UM_DESKTOP = BUILDDIR"/tests/data/applications/update-manager.desktop"; | 45 | const std::string UM_DESKTOP = BUILDDIR"/tests/data/applications/update-manager.desktop"; |
514 | 46 | const std::string NO_ICON_DESKTOP = BUILDDIR"/tests/data/applications/no-icon.desktop"; | 46 | const std::string NO_ICON_DESKTOP = BUILDDIR"/tests/data/applications/no-icon.desktop"; |
515 | 47 | 47 | ||
516 | @@ -93,9 +93,9 @@ | |||
517 | 93 | 93 | ||
518 | 94 | virtual void SetUp() override | 94 | virtual void SetUp() override |
519 | 95 | { | 95 | { |
521 | 96 | usc_app = std::make_shared<MockApplication::Nice>(USC_DESKTOP, "softwarecenter"); | 96 | usc_app = std::make_shared<MockApplication::Nice>(GS_DESKTOP, "org.gnome.Software"); |
522 | 97 | usc_icon = new MockApplicationLauncherIcon(usc_app); | 97 | usc_icon = new MockApplicationLauncherIcon(usc_app); |
524 | 98 | ASSERT_EQ(usc_icon->DesktopFile(), USC_DESKTOP); | 98 | ASSERT_EQ(usc_icon->DesktopFile(), GS_DESKTOP); |
525 | 99 | 99 | ||
526 | 100 | empty_app = std::make_shared<MockApplication::Nice>(NO_ICON_DESKTOP); | 100 | empty_app = std::make_shared<MockApplication::Nice>(NO_ICON_DESKTOP); |
527 | 101 | empty_icon = new MockApplicationLauncherIcon(empty_app); | 101 | empty_icon = new MockApplicationLauncherIcon(empty_app); |
528 | @@ -175,7 +175,7 @@ | |||
529 | 175 | 175 | ||
530 | 176 | TEST_F(TestApplicationLauncherIcon, ApplicationSignalDisconnection) | 176 | TEST_F(TestApplicationLauncherIcon, ApplicationSignalDisconnection) |
531 | 177 | { | 177 | { |
533 | 178 | std::shared_ptr<MockApplication> app = std::make_shared<MockApplication::Nice>(USC_DESKTOP); | 178 | std::shared_ptr<MockApplication> app = std::make_shared<MockApplication::Nice>(GS_DESKTOP); |
534 | 179 | { | 179 | { |
535 | 180 | MockApplicationLauncherIcon::Ptr icon(new MockApplicationLauncherIcon(app)); | 180 | MockApplicationLauncherIcon::Ptr icon(new MockApplicationLauncherIcon(app)); |
536 | 181 | EXPECT_FALSE(app->closed.empty()); | 181 | EXPECT_FALSE(app->closed.empty()); |
537 | @@ -201,7 +201,7 @@ | |||
538 | 201 | 201 | ||
539 | 202 | TEST_F(TestApplicationLauncherIcon, TestDefaultIcon) | 202 | TEST_F(TestApplicationLauncherIcon, TestDefaultIcon) |
540 | 203 | { | 203 | { |
542 | 204 | EXPECT_EQ(usc_icon->icon_name(), "softwarecenter"); | 204 | EXPECT_EQ(usc_icon->icon_name(), "org.gnome.Software"); |
543 | 205 | EXPECT_EQ(empty_icon->icon_name(), DEFAULT_EMPTY_ICON); | 205 | EXPECT_EQ(empty_icon->icon_name(), DEFAULT_EMPTY_ICON); |
544 | 206 | EXPECT_EQ(mock_icon->icon_name(), DEFAULT_EMPTY_ICON); | 206 | EXPECT_EQ(mock_icon->icon_name(), DEFAULT_EMPTY_ICON); |
545 | 207 | } | 207 | } |
546 | @@ -267,7 +267,7 @@ | |||
547 | 267 | 267 | ||
548 | 268 | TEST_F(TestApplicationLauncherIcon, StickStickedDesktopApp) | 268 | TEST_F(TestApplicationLauncherIcon, StickStickedDesktopApp) |
549 | 269 | { | 269 | { |
551 | 270 | auto app = std::make_shared<MockApplication::Nice>(USC_DESKTOP); | 270 | auto app = std::make_shared<MockApplication::Nice>(GS_DESKTOP); |
552 | 271 | app->sticky = true; | 271 | app->sticky = true; |
553 | 272 | app->desktop_file_ = UM_DESKTOP; | 272 | app->desktop_file_ = UM_DESKTOP; |
554 | 273 | MockApplicationLauncherIcon::Ptr icon(new MockApplicationLauncherIcon(app)); | 273 | MockApplicationLauncherIcon::Ptr icon(new MockApplicationLauncherIcon(app)); |
555 | @@ -542,7 +542,7 @@ | |||
556 | 542 | 542 | ||
557 | 543 | TEST_F(TestApplicationLauncherIcon, RemoteUri) | 543 | TEST_F(TestApplicationLauncherIcon, RemoteUri) |
558 | 544 | { | 544 | { |
560 | 545 | EXPECT_EQ(usc_icon->RemoteUri(), FavoriteStore::URI_PREFIX_APP + USC_DESKTOP); | 545 | EXPECT_EQ(usc_icon->RemoteUri(), FavoriteStore::URI_PREFIX_APP + GS_DESKTOP); |
561 | 546 | EXPECT_TRUE(mock_icon->RemoteUri().empty()); | 546 | EXPECT_TRUE(mock_icon->RemoteUri().empty()); |
562 | 547 | } | 547 | } |
563 | 548 | 548 | ||
564 | 549 | 549 | ||
565 | === modified file 'tests/test_desktop_utilities.cpp' | |||
566 | --- tests/test_desktop_utilities.cpp 2013-03-21 14:01:06 +0000 | |||
567 | +++ tests/test_desktop_utilities.cpp 2016-02-23 15:49:50 +0000 | |||
568 | @@ -184,17 +184,17 @@ | |||
569 | 184 | g_setenv("XDG_DATA_DIRS", LOCAL_DATA_DIR.c_str(), TRUE); | 184 | g_setenv("XDG_DATA_DIRS", LOCAL_DATA_DIR.c_str(), TRUE); |
570 | 185 | g_setenv("XDG_DATA_HOME", "UnityUserConfig", TRUE); | 185 | g_setenv("XDG_DATA_HOME", "UnityUserConfig", TRUE); |
571 | 186 | 186 | ||
573 | 187 | std::string const& file = DesktopUtilities::GetDesktopPathById("ubuntu-software-center.desktop"); | 187 | std::string const& file = DesktopUtilities::GetDesktopPathById("org.gnome.Software.desktop"); |
574 | 188 | 188 | ||
575 | 189 | g_setenv("XDG_DATA_DIRS", old_dirs.c_str(), TRUE); | 189 | g_setenv("XDG_DATA_DIRS", old_dirs.c_str(), TRUE); |
576 | 190 | g_setenv("XDG_DATA_HOME", old_dirs.c_str(), TRUE); | 190 | g_setenv("XDG_DATA_HOME", old_dirs.c_str(), TRUE); |
577 | 191 | 191 | ||
579 | 192 | EXPECT_EQ(file, LOCAL_DATA_DIR + "/applications/ubuntu-software-center.desktop"); | 192 | EXPECT_EQ(file, LOCAL_DATA_DIR + "/applications/org.gnome.Software.desktop"); |
580 | 193 | } | 193 | } |
581 | 194 | 194 | ||
582 | 195 | TEST(TestDesktopUtilities, TestGetBackgroundColor) | 195 | TEST(TestDesktopUtilities, TestGetBackgroundColor) |
583 | 196 | { | 196 | { |
585 | 197 | std::string const& color = DesktopUtilities::GetBackgroundColor(LOCAL_DATA_DIR+"/applications/ubuntu-software-center.desktop"); | 197 | std::string const& color = DesktopUtilities::GetBackgroundColor(LOCAL_DATA_DIR+"/applications/org.gnome.Software.desktop"); |
586 | 198 | 198 | ||
587 | 199 | EXPECT_EQ(color, "#aabbcc"); | 199 | EXPECT_EQ(color, "#aabbcc"); |
588 | 200 | } | 200 | } |
589 | 201 | 201 | ||
590 | === modified file 'tests/test_favorite_store.cpp' | |||
591 | --- tests/test_favorite_store.cpp 2012-09-18 15:47:49 +0000 | |||
592 | +++ tests/test_favorite_store.cpp 2016-02-23 15:49:50 +0000 | |||
593 | @@ -87,7 +87,7 @@ | |||
594 | 87 | 87 | ||
595 | 88 | TEST_F(TestFavoriteStore, ParseFavoriteFromUri) | 88 | TEST_F(TestFavoriteStore, ParseFavoriteFromUri) |
596 | 89 | { | 89 | { |
598 | 90 | const std::string VALID_DESKTOP_PATH = BUILDDIR"/tests/data/applications/ubuntu-software-center.desktop"; | 90 | const std::string VALID_DESKTOP_PATH = BUILDDIR"/tests/data/applications/org.gnome.Software.desktop"; |
599 | 91 | EXPECT_EQ(favorite_store.ParseFavoriteFromUri("file.desktop"), "application://file.desktop"); | 91 | EXPECT_EQ(favorite_store.ParseFavoriteFromUri("file.desktop"), "application://file.desktop"); |
600 | 92 | EXPECT_EQ(favorite_store.ParseFavoriteFromUri(VALID_DESKTOP_PATH), "application://"+VALID_DESKTOP_PATH); | 92 | EXPECT_EQ(favorite_store.ParseFavoriteFromUri(VALID_DESKTOP_PATH), "application://"+VALID_DESKTOP_PATH); |
601 | 93 | 93 | ||
602 | 94 | 94 | ||
603 | === modified file 'tests/test_favorite_store_gsettings.cpp' | |||
604 | --- tests/test_favorite_store_gsettings.cpp 2014-03-21 03:42:28 +0000 | |||
605 | +++ tests/test_favorite_store_gsettings.cpp 2016-02-23 15:49:50 +0000 | |||
606 | @@ -38,7 +38,7 @@ | |||
607 | 38 | const gchar* SETTINGS_KEY = "favorites"; | 38 | const gchar* SETTINGS_KEY = "favorites"; |
608 | 39 | 39 | ||
609 | 40 | const char* base_store_favs[] = { BUILDDIR"/tests/data/applications/ubuntuone-installer.desktop", | 40 | const char* base_store_favs[] = { BUILDDIR"/tests/data/applications/ubuntuone-installer.desktop", |
611 | 41 | "file://" BUILDDIR "/tests/data/applications/ubuntu-software-center.desktop", | 41 | "file://" BUILDDIR "/tests/data/applications/org.gnome.Software.desktop", |
612 | 42 | "application://" BUILDDIR "/tests/data/applications/update-manager.desktop", | 42 | "application://" BUILDDIR "/tests/data/applications/update-manager.desktop", |
613 | 43 | "unity://test-icon", | 43 | "unity://test-icon", |
614 | 44 | "device://uuid", | 44 | "device://uuid", |
615 | 45 | 45 | ||
616 | === modified file 'tests/test_launcher_controller.cpp' | |||
617 | --- tests/test_launcher_controller.cpp 2015-12-08 14:34:55 +0000 | |||
618 | +++ tests/test_launcher_controller.cpp 2016-02-23 15:49:50 +0000 | |||
619 | @@ -61,7 +61,7 @@ | |||
620 | 61 | namespace app | 61 | namespace app |
621 | 62 | { | 62 | { |
622 | 63 | const std::string UBUNTU_ONE = BUILDDIR "/tests/data/applications/ubuntuone-installer.desktop"; | 63 | const std::string UBUNTU_ONE = BUILDDIR "/tests/data/applications/ubuntuone-installer.desktop"; |
624 | 64 | const std::string SW_CENTER = BUILDDIR "/tests/data/applications/ubuntu-software-center.desktop"; | 64 | const std::string SW_CENTER = BUILDDIR "/tests/data/applications/org.gnome.Software.desktop"; |
625 | 65 | const std::string UPDATE_MANAGER = BUILDDIR "/tests/data/applications/update-manager.desktop"; | 65 | const std::string UPDATE_MANAGER = BUILDDIR "/tests/data/applications/update-manager.desktop"; |
626 | 66 | const std::string BZR_HANDLE_PATCH = BUILDDIR "/tests/data/applications/bzr-handle-patch.desktop"; | 66 | const std::string BZR_HANDLE_PATCH = BUILDDIR "/tests/data/applications/bzr-handle-patch.desktop"; |
627 | 67 | const std::string NO_ICON = BUILDDIR "/tests/data/applications/no-icon.desktop"; | 67 | const std::string NO_ICON = BUILDDIR "/tests/data/applications/no-icon.desktop"; |
628 | @@ -1321,38 +1321,6 @@ | |||
629 | 1321 | lc.launcher().remove_request.emit(device_icon); | 1321 | lc.launcher().remove_request.emit(device_icon); |
630 | 1322 | } | 1322 | } |
631 | 1323 | 1323 | ||
632 | 1324 | TEST_F(TestLauncherController, LauncherAddRequestSpecial) | ||
633 | 1325 | { | ||
634 | 1326 | std::string desktop = app::BZR_HANDLE_PATCH; | ||
635 | 1327 | std::string icon_uri = FavoriteStore::URI_PREFIX_APP + desktop; | ||
636 | 1328 | ASSERT_FALSE(lc.Impl()->GetIconByUri(icon_uri).IsValid()); | ||
637 | 1329 | EXPECT_CALL(*unity_app_, LogEvent(_, _)).Times(0); | ||
638 | 1330 | |||
639 | 1331 | lc.Impl()->OnLauncherAddRequestSpecial(desktop, "", "", 0, 0, 32); | ||
640 | 1332 | |||
641 | 1333 | auto const& sw_center_icon = lc.Impl()->GetIconByUri(icon_uri); | ||
642 | 1334 | ASSERT_TRUE(sw_center_icon.IsValid()); | ||
643 | 1335 | EXPECT_TRUE(sw_center_icon->IsSticky()); | ||
644 | 1336 | EXPECT_NE(dynamic_cast<SoftwareCenterLauncherIcon*>(sw_center_icon.GetPointer()), nullptr); | ||
645 | 1337 | } | ||
646 | 1338 | |||
647 | 1339 | TEST_F(TestLauncherController, LauncherAddRequestSpecialIgnored) | ||
648 | 1340 | { | ||
649 | 1341 | std::string desktop = app::BZR_HANDLE_PATCH; | ||
650 | 1342 | std::string icon_uri = FavoriteStore::URI_PREFIX_APP + desktop; | ||
651 | 1343 | |||
652 | 1344 | MockApplicationLauncherIcon::Ptr bamf_icon(new MockApplicationLauncherIcon::Nice(desktop)); | ||
653 | 1345 | lc.Impl()->RegisterIcon(bamf_icon, std::numeric_limits<int>::max()); | ||
654 | 1346 | ASSERT_TRUE(lc.Impl()->GetIconByUri(icon_uri).IsValid()); | ||
655 | 1347 | |||
656 | 1348 | EXPECT_CALL(*bamf_icon, Stick(false)).Times(0); | ||
657 | 1349 | |||
658 | 1350 | int previous_model_size = lc.Impl()->model_->Size(); | ||
659 | 1351 | lc.Impl()->OnLauncherAddRequestSpecial(desktop, "", "", 0, 0, 32); | ||
660 | 1352 | |||
661 | 1353 | EXPECT_EQ(previous_model_size, lc.Impl()->model_->Size()); | ||
662 | 1354 | } | ||
663 | 1355 | |||
664 | 1356 | TEST_F(TestLauncherController, SaveIconsOrder) | 1324 | TEST_F(TestLauncherController, SaveIconsOrder) |
665 | 1357 | { | 1325 | { |
666 | 1358 | favorite_store.ClearFavorites(); | 1326 | favorite_store.ClearFavorites(); |
667 | 1359 | 1327 | ||
668 | === modified file 'tests/test_software_center_launcher_icon.cpp' | |||
669 | --- tests/test_software_center_launcher_icon.cpp 2015-12-08 14:34:55 +0000 | |||
670 | +++ tests/test_software_center_launcher_icon.cpp 2016-02-23 15:49:50 +0000 | |||
671 | @@ -42,28 +42,26 @@ | |||
672 | 42 | { | 42 | { |
673 | 43 | namespace | 43 | namespace |
674 | 44 | { | 44 | { |
678 | 45 | const std::string PRE_INSTALL_ICON = "sw-center-launcher-icon"; | 45 | const std::string FINAL_ICON = "org.gnome.Software"; |
679 | 46 | const std::string FINAL_ICON = "softwarecenter"; | 46 | const std::string APP_NAME = "Software"; |
677 | 47 | const std::string APP_NAME = "Ubuntu Software Center"; | ||
680 | 48 | const std::string LOCAL_DATA_DIR = BUILDDIR"/tests/data"; | 47 | const std::string LOCAL_DATA_DIR = BUILDDIR"/tests/data"; |
683 | 49 | const std::string USC_DESKTOP = LOCAL_DATA_DIR+"/applications/ubuntu-software-center.desktop"; | 48 | const std::string GS_DESKTOP = LOCAL_DATA_DIR+"/applications/org.gnome.Software.desktop"; |
684 | 50 | const std::string USC_APP_INSTALL_DESKTOP = "/usr/share/app-install/desktop/software-center:ubuntu-software-center.desktop"; | 49 | const std::string GS_APP_INSTALL_DESKTOP = "org.gnome.Software.desktop"; |
685 | 51 | } | 50 | } |
686 | 52 | 51 | ||
687 | 53 | struct TestSoftwareCenterLauncherIcon : testmocks::TestUnityAppBase | 52 | struct TestSoftwareCenterLauncherIcon : testmocks::TestUnityAppBase |
688 | 54 | { | 53 | { |
689 | 55 | TestSoftwareCenterLauncherIcon() | 54 | TestSoftwareCenterLauncherIcon() |
692 | 56 | : usc(std::make_shared<MockApplication::Nice>(USC_APP_INSTALL_DESKTOP, FINAL_ICON, APP_NAME)) | 55 | : gs(std::make_shared<MockApplication::Nice>(GS_APP_INSTALL_DESKTOP, FINAL_ICON, APP_NAME)) |
693 | 57 | , icon(usc, "/com/canonical/unity/test/object/path", PRE_INSTALL_ICON) | 56 | , icon(gs, "/com/canonical/unity/test/object/path") |
694 | 58 | {} | 57 | {} |
695 | 59 | 58 | ||
696 | 60 | struct MockSoftwareCenterLauncherIcon : SoftwareCenterLauncherIcon | 59 | struct MockSoftwareCenterLauncherIcon : SoftwareCenterLauncherIcon |
697 | 61 | { | 60 | { |
698 | 62 | MockSoftwareCenterLauncherIcon(ApplicationPtr const& app, | 61 | MockSoftwareCenterLauncherIcon(ApplicationPtr const& app, |
701 | 63 | std::string const& aptdaemon_trans_id, | 62 | std::string const& aptdaemon_trans_id) |
700 | 64 | std::string const& icon_path) | ||
702 | 65 | : WindowedLauncherIcon(IconType::APPLICATION) | 63 | : WindowedLauncherIcon(IconType::APPLICATION) |
704 | 66 | , SoftwareCenterLauncherIcon(app, aptdaemon_trans_id, icon_path) | 64 | , SoftwareCenterLauncherIcon(app, aptdaemon_trans_id) |
705 | 67 | {} | 65 | {} |
706 | 68 | 66 | ||
707 | 69 | void LauncherIconUnstick() { LauncherIcon::UnStick(); } | 67 | void LauncherIconUnstick() { LauncherIcon::UnStick(); } |
708 | @@ -71,7 +69,6 @@ | |||
709 | 71 | using SoftwareCenterLauncherIcon::GetActualDesktopFileAfterInstall; | 69 | using SoftwareCenterLauncherIcon::GetActualDesktopFileAfterInstall; |
710 | 72 | using SoftwareCenterLauncherIcon::OnFinished; | 70 | using SoftwareCenterLauncherIcon::OnFinished; |
711 | 73 | using SoftwareCenterLauncherIcon::OnPropertyChanged; | 71 | using SoftwareCenterLauncherIcon::OnPropertyChanged; |
712 | 74 | using SoftwareCenterLauncherIcon::drag_window_; | ||
713 | 75 | using LauncherIcon::GetRemoteUri; | 72 | using LauncherIcon::GetRemoteUri; |
714 | 76 | }; | 73 | }; |
715 | 77 | 74 | ||
716 | @@ -86,7 +83,7 @@ | |||
717 | 86 | 83 | ||
718 | 87 | panel::Style panel; | 84 | panel::Style panel; |
719 | 88 | nux::ObjectPtr<MockableBaseWindow> launcher_win; | 85 | nux::ObjectPtr<MockableBaseWindow> launcher_win; |
721 | 89 | MockApplication::Ptr usc; | 86 | MockApplication::Ptr gs; |
722 | 90 | MockSoftwareCenterLauncherIcon icon; | 87 | MockSoftwareCenterLauncherIcon icon; |
723 | 91 | }; | 88 | }; |
724 | 92 | 89 | ||
725 | @@ -94,75 +91,54 @@ | |||
726 | 94 | { | 91 | { |
727 | 95 | EXPECT_FALSE(icon.IsVisible()); | 92 | EXPECT_FALSE(icon.IsVisible()); |
728 | 96 | EXPECT_TRUE(icon.IsSticky()); | 93 | EXPECT_TRUE(icon.IsSticky()); |
729 | 97 | EXPECT_EQ(AbstractLauncherIcon::Position::FLOATING, icon.position()); | ||
730 | 98 | EXPECT_EQ("Waiting to install", icon.tooltip_text()); | 94 | EXPECT_EQ("Waiting to install", icon.tooltip_text()); |
731 | 99 | EXPECT_EQ(PRE_INSTALL_ICON, icon.icon_name()); | ||
732 | 100 | } | 95 | } |
733 | 101 | 96 | ||
734 | 102 | TEST_F(TestSoftwareCenterLauncherIcon, DesktopFileTransformTrivial) | 97 | TEST_F(TestSoftwareCenterLauncherIcon, DesktopFileTransformTrivial) |
735 | 103 | { | 98 | { |
736 | 104 | // no transformation needed | 99 | // no transformation needed |
759 | 105 | usc->desktop_file_ = USC_DESKTOP; | 100 | gs->desktop_file_ = GS_DESKTOP; |
760 | 106 | EXPECT_EQ(icon.GetActualDesktopFileAfterInstall(), USC_DESKTOP); | 101 | EXPECT_EQ(icon.GetActualDesktopFileAfterInstall(), GS_DESKTOP); |
761 | 107 | } | 102 | } |
762 | 108 | 103 | ||
741 | 109 | TEST_F(TestSoftwareCenterLauncherIcon, DesktopFileTransformAppInstall) | ||
742 | 110 | { | ||
743 | 111 | // ensure that tranformation from app-install data desktop files works | ||
744 | 112 | usc->desktop_file_ = "/usr/share/app-install/desktop/pkgname:kde4__afile.desktop"; | ||
745 | 113 | EXPECT_EQ(icon.GetActualDesktopFileAfterInstall(), | ||
746 | 114 | LOCAL_DATA_DIR+"/applications/kde4/afile.desktop"); | ||
747 | 115 | } | ||
748 | 116 | |||
749 | 117 | TEST_F(TestSoftwareCenterLauncherIcon, DesktopFileTransformSCAgent) | ||
750 | 118 | { | ||
751 | 119 | // now simualte data coming from the sc-agent | ||
752 | 120 | usc->desktop_file_ = "/tmp/software-center-agent:VP2W9M:ubuntu-software-center.desktop"; | ||
753 | 121 | EXPECT_EQ(icon.GetActualDesktopFileAfterInstall(), USC_DESKTOP); | ||
754 | 122 | } | ||
755 | 123 | |||
756 | 124 | // simulate a OnFinished signal from a /usr/share/app-install location | ||
757 | 125 | // and ensure that the remote uri is updated from temp location to | ||
758 | 126 | // the real location | ||
763 | 127 | TEST_F(TestSoftwareCenterLauncherIcon, OnFinishedReplacesDesktopFile) | 104 | TEST_F(TestSoftwareCenterLauncherIcon, OnFinishedReplacesDesktopFile) |
764 | 128 | { | 105 | { |
765 | 129 | icon.OnFinished(glib::Variant(g_variant_new("(s)", "exit-success"))); | 106 | icon.OnFinished(glib::Variant(g_variant_new("(s)", "exit-success"))); |
768 | 130 | 107 | EXPECT_EQ(GS_DESKTOP, icon.DesktopFile()); | |
767 | 131 | EXPECT_EQ(USC_DESKTOP, icon.DesktopFile()); | ||
769 | 132 | } | 108 | } |
770 | 133 | 109 | ||
771 | 134 | TEST_F(TestSoftwareCenterLauncherIcon, OnFinishedUpdatesRemoteURI) | 110 | TEST_F(TestSoftwareCenterLauncherIcon, OnFinishedUpdatesRemoteURI) |
772 | 135 | { | 111 | { |
773 | 136 | icon.OnFinished(glib::Variant(g_variant_new("(s)", "exit-success"))); | 112 | icon.OnFinished(glib::Variant(g_variant_new("(s)", "exit-success"))); |
774 | 137 | 113 | ||
777 | 138 | ASSERT_EQ(USC_DESKTOP, icon.DesktopFile()); | 114 | ASSERT_EQ(GS_DESKTOP, icon.DesktopFile()); |
778 | 139 | EXPECT_EQ(FavoriteStore::URI_PREFIX_APP + USC_DESKTOP, icon.GetRemoteUri()); | 115 | EXPECT_EQ(FavoriteStore::URI_PREFIX_APP + GS_DESKTOP, icon.GetRemoteUri()); |
779 | 140 | } | 116 | } |
780 | 141 | 117 | ||
781 | 142 | TEST_F(TestSoftwareCenterLauncherIcon, DisconnectsOldAppSignals) | 118 | TEST_F(TestSoftwareCenterLauncherIcon, DisconnectsOldAppSignals) |
782 | 143 | { | 119 | { |
784 | 144 | ASSERT_FALSE(usc->closed.empty()); | 120 | ASSERT_FALSE(gs->closed.empty()); |
785 | 145 | 121 | ||
786 | 146 | icon.OnFinished(glib::Variant(g_variant_new("(s)", "exit-success"))); | 122 | icon.OnFinished(glib::Variant(g_variant_new("(s)", "exit-success"))); |
787 | 147 | 123 | ||
799 | 148 | EXPECT_TRUE(usc->closed.empty()); | 124 | EXPECT_TRUE(gs->closed.empty()); |
800 | 149 | EXPECT_TRUE(usc->window_opened.empty()); | 125 | EXPECT_TRUE(gs->window_opened.empty()); |
801 | 150 | EXPECT_TRUE(usc->window_moved.empty()); | 126 | EXPECT_TRUE(gs->window_moved.empty()); |
802 | 151 | EXPECT_TRUE(usc->window_closed.empty()); | 127 | EXPECT_TRUE(gs->window_closed.empty()); |
803 | 152 | EXPECT_TRUE(usc->visible.changed.empty()); | 128 | EXPECT_TRUE(gs->visible.changed.empty()); |
804 | 153 | EXPECT_TRUE(usc->active.changed.empty()); | 129 | EXPECT_TRUE(gs->active.changed.empty()); |
805 | 154 | EXPECT_TRUE(usc->running.changed.empty()); | 130 | EXPECT_TRUE(gs->running.changed.empty()); |
806 | 155 | EXPECT_TRUE(usc->urgent.changed.empty()); | 131 | EXPECT_TRUE(gs->urgent.changed.empty()); |
807 | 156 | EXPECT_TRUE(usc->desktop_file.changed.empty()); | 132 | EXPECT_TRUE(gs->desktop_file.changed.empty()); |
808 | 157 | EXPECT_TRUE(usc->title.changed.empty()); | 133 | EXPECT_TRUE(gs->title.changed.empty()); |
809 | 158 | EXPECT_TRUE(usc->icon.changed.empty()); | 134 | EXPECT_TRUE(gs->icon.changed.empty()); |
810 | 159 | } | 135 | } |
811 | 160 | 136 | ||
812 | 161 | TEST_F(TestSoftwareCenterLauncherIcon, OnFinishedRemoveInvalidNewAppIcon) | 137 | TEST_F(TestSoftwareCenterLauncherIcon, OnFinishedRemoveInvalidNewAppIcon) |
813 | 162 | { | 138 | { |
814 | 163 | // Using an icon ptr, to get the removed signal to be properly emitted | 139 | // Using an icon ptr, to get the removed signal to be properly emitted |
815 | 164 | nux::ObjectPtr<MockSoftwareCenterLauncherIcon> icon_ptr( | 140 | nux::ObjectPtr<MockSoftwareCenterLauncherIcon> icon_ptr( |
817 | 165 | new MockSoftwareCenterLauncherIcon(usc, "/com/canonical/unity/test/object/path", PRE_INSTALL_ICON)); | 141 | new MockSoftwareCenterLauncherIcon(gs, "/com/canonical/unity/test/object/path")); |
818 | 166 | 142 | ||
819 | 167 | bool removed = false; | 143 | bool removed = false; |
820 | 168 | auto& app_manager = unity::ApplicationManager::Default(); | 144 | auto& app_manager = unity::ApplicationManager::Default(); |
821 | @@ -201,7 +177,7 @@ | |||
822 | 201 | icon.LauncherIconUnstick(); | 177 | icon.LauncherIconUnstick(); |
823 | 202 | 178 | ||
824 | 203 | bool saved = false; | 179 | bool saved = false; |
826 | 204 | usc->sticky = true; | 180 | gs->sticky = true; |
827 | 205 | icon.position_saved.connect([&saved] {saved = true;}); | 181 | icon.position_saved.connect([&saved] {saved = true;}); |
828 | 206 | ASSERT_FALSE(icon.IsSticky()); | 182 | ASSERT_FALSE(icon.IsSticky()); |
829 | 207 | 183 | ||
830 | @@ -214,14 +190,7 @@ | |||
831 | 214 | { | 190 | { |
832 | 215 | icon.tooltip_text = "FooText"; | 191 | icon.tooltip_text = "FooText"; |
833 | 216 | icon.OnFinished(glib::Variant(g_variant_new("(s)", "exit-success"))); | 192 | icon.OnFinished(glib::Variant(g_variant_new("(s)", "exit-success"))); |
842 | 217 | EXPECT_EQ(icon.tooltip_text(), usc->title()); | 193 | EXPECT_EQ(icon.tooltip_text(), gs->title()); |
835 | 218 | } | ||
836 | 219 | |||
837 | 220 | TEST_F(TestSoftwareCenterLauncherIcon, OnFinishedUpdatesIcon) | ||
838 | 221 | { | ||
839 | 222 | icon.icon_name = "foo-icon"; | ||
840 | 223 | icon.OnFinished(glib::Variant(g_variant_new("(s)", "exit-success"))); | ||
841 | 224 | EXPECT_EQ(icon.icon_name(), usc->icon()); | ||
843 | 225 | } | 194 | } |
844 | 226 | 195 | ||
845 | 227 | TEST_F(TestSoftwareCenterLauncherIcon, OnFinishedLogsEvent) | 196 | TEST_F(TestSoftwareCenterLauncherIcon, OnFinishedLogsEvent) |
846 | @@ -230,52 +199,9 @@ | |||
847 | 230 | icon.OnFinished(glib::Variant(g_variant_new("(s)", "exit-success"))); | 199 | icon.OnFinished(glib::Variant(g_variant_new("(s)", "exit-success"))); |
848 | 231 | } | 200 | } |
849 | 232 | 201 | ||
850 | 233 | TEST_F(TestSoftwareCenterLauncherIcon, AnimateToInvalidPosition) | ||
851 | 234 | { | ||
852 | 235 | EXPECT_FALSE(icon.Animate(CreateLauncher(), 1, 2)); | ||
853 | 236 | EXPECT_FALSE(icon.IsVisible()); | ||
854 | 237 | EXPECT_EQ(PRE_INSTALL_ICON, icon.icon_name()); | ||
855 | 238 | } | ||
856 | 239 | |||
857 | 240 | TEST_F(TestSoftwareCenterLauncherIcon, AnimateFromInvalidPosition) | ||
858 | 241 | { | ||
859 | 242 | EXPECT_TRUE(icon.Animate(CreateLauncher(), 0, 0)); | ||
860 | 243 | EXPECT_TRUE(icon.IsVisible()); | ||
861 | 244 | EXPECT_EQ(PRE_INSTALL_ICON, icon.icon_name()); | ||
862 | 245 | } | ||
863 | 246 | |||
864 | 247 | #pragma GCC diagnostic push | 202 | #pragma GCC diagnostic push |
865 | 248 | #pragma GCC diagnostic ignored "-Wunused-variable" | 203 | #pragma GCC diagnostic ignored "-Wunused-variable" |
866 | 249 | 204 | ||
867 | 250 | struct MultiMonitor : TestSoftwareCenterLauncherIcon, WithParamInterface<unsigned> {}; | ||
868 | 251 | INSTANTIATE_TEST_CASE_P(TestSoftwareCenterLauncherIcon, MultiMonitor, Range<unsigned>(0, monitors::MAX, 1)); | ||
869 | 252 | |||
870 | 253 | TEST_P(/*TestSoftwareCenterLauncherIcon*/MultiMonitor, Animate) | ||
871 | 254 | { | ||
872 | 255 | auto launcher = CreateLauncher(); | ||
873 | 256 | launcher->monitor = GetParam(); | ||
874 | 257 | icon.SetCenter({1, 1, 0}, launcher->monitor()); | ||
875 | 258 | ASSERT_TRUE(icon.Animate(launcher, 2, 2)); | ||
876 | 259 | EXPECT_FALSE(icon.IsVisible()); | ||
877 | 260 | EXPECT_TRUE(icon.icon_name().empty()); | ||
878 | 261 | |||
879 | 262 | for (unsigned i = 0; i < monitors::MAX; ++i) | ||
880 | 263 | ASSERT_EQ(static_cast<int>(i) == launcher->monitor(), icon.IsVisibleOnMonitor(i)); | ||
881 | 264 | |||
882 | 265 | bool animated = false; | ||
883 | 266 | ASSERT_TRUE(icon.drag_window_); | ||
884 | 267 | icon.drag_window_->anim_completed.connect([&animated] { animated = true; }); | ||
885 | 268 | Utils::WaitUntilMSec(animated); | ||
886 | 269 | ASSERT_TRUE(animated); | ||
887 | 270 | |||
888 | 271 | EXPECT_EQ(PRE_INSTALL_ICON, icon.icon_name()); | ||
889 | 272 | EXPECT_FALSE(icon.drag_window_); | ||
890 | 273 | |||
891 | 274 | for (unsigned i = 0; i < monitors::MAX; ++i) | ||
892 | 275 | ASSERT_TRUE(icon.IsVisibleOnMonitor(i)); | ||
893 | 276 | |||
894 | 277 | EXPECT_TRUE(icon.IsVisible()); | ||
895 | 278 | } | ||
896 | 279 | 205 | ||
897 | 280 | struct InstallProgress : TestSoftwareCenterLauncherIcon, WithParamInterface<int> {}; | 206 | struct InstallProgress : TestSoftwareCenterLauncherIcon, WithParamInterface<int> {}; |
898 | 281 | INSTANTIATE_TEST_CASE_P(TestSoftwareCenterLauncherIcon, InstallProgress, Range<int>(0, 99, 10)); | 207 | INSTANTIATE_TEST_CASE_P(TestSoftwareCenterLauncherIcon, InstallProgress, Range<int>(0, 99, 10)); |
899 | 282 | 208 | ||
900 | === added file 'unity-shared/AppStreamApplication.cpp' | |||
901 | --- unity-shared/AppStreamApplication.cpp 1970-01-01 00:00:00 +0000 | |||
902 | +++ unity-shared/AppStreamApplication.cpp 2016-02-23 15:49:50 +0000 | |||
903 | @@ -0,0 +1,104 @@ | |||
904 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
905 | 2 | /* | ||
906 | 3 | * Copyright (C) 2016 Canonical Ltd | ||
907 | 4 | * | ||
908 | 5 | * This program is free software: you can redistribute it and/or modify | ||
909 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
910 | 7 | * published by the Free Software Foundation. | ||
911 | 8 | * | ||
912 | 9 | * This program is distributed in the hope that it will be useful, | ||
913 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
914 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
915 | 12 | * GNU General Public License for more details. | ||
916 | 13 | * | ||
917 | 14 | * You should have received a copy of the GNU General Public License | ||
918 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
919 | 16 | * | ||
920 | 17 | * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com> | ||
921 | 18 | */ | ||
922 | 19 | |||
923 | 20 | #include "AppStreamApplication.h" | ||
924 | 21 | |||
925 | 22 | #include <appstream-glib.h> | ||
926 | 23 | |||
927 | 24 | #include <iostream> | ||
928 | 25 | |||
929 | 26 | namespace unity | ||
930 | 27 | { | ||
931 | 28 | namespace appstream | ||
932 | 29 | { | ||
933 | 30 | |||
934 | 31 | Application::Application(std::string const& appstream_id) | ||
935 | 32 | : appstream_id_(appstream_id) | ||
936 | 33 | { | ||
937 | 34 | desktop_file.SetGetterFunction([this](){ return appstream_id_; }); | ||
938 | 35 | title.SetGetterFunction([this](){ return title_; }); | ||
939 | 36 | icon_pixbuf.SetGetterFunction([this](){ return icon_pixbuf_; }); | ||
940 | 37 | |||
941 | 38 | glib::Object<AsStore> as_store(as_store_new()); | ||
942 | 39 | g_return_if_fail(as_store); | ||
943 | 40 | |||
944 | 41 | as_store_load(as_store, AS_STORE_LOAD_FLAG_APP_INFO_SYSTEM, nullptr, nullptr); | ||
945 | 42 | |||
946 | 43 | AsApp *as_app = as_store_get_app_by_id(as_store, appstream_id_.c_str()); | ||
947 | 44 | g_return_if_fail(as_app); | ||
948 | 45 | |||
949 | 46 | title_ = glib::gchar_to_string(as_app_get_name(as_app, nullptr)); | ||
950 | 47 | |||
951 | 48 | AsIcon *as_icon = as_app_get_icon_default(as_app); | ||
952 | 49 | g_return_if_fail(as_icon); | ||
953 | 50 | |||
954 | 51 | as_icon_load(as_icon, AS_ICON_LOAD_FLAG_SEARCH_SIZE, nullptr); | ||
955 | 52 | icon_pixbuf_ = glib::Object<GdkPixbuf>(as_icon_get_pixbuf(as_icon), glib::AddRef()); | ||
956 | 53 | } | ||
957 | 54 | |||
958 | 55 | AppType Application::type() const | ||
959 | 56 | { | ||
960 | 57 | return AppType::NORMAL; | ||
961 | 58 | } | ||
962 | 59 | |||
963 | 60 | std::string Application::repr() const | ||
964 | 61 | { | ||
965 | 62 | std::ostringstream sout; | ||
966 | 63 | sout << "<AppStream::Application " << appstream_id_ << " >"; | ||
967 | 64 | return sout.str(); | ||
968 | 65 | } | ||
969 | 66 | |||
970 | 67 | WindowList const& Application::GetWindows() const | ||
971 | 68 | { | ||
972 | 69 | return window_list_; | ||
973 | 70 | } | ||
974 | 71 | |||
975 | 72 | bool Application::OwnsWindow(Window window_id) const | ||
976 | 73 | { | ||
977 | 74 | return false; | ||
978 | 75 | } | ||
979 | 76 | |||
980 | 77 | std::vector<std::string> Application::GetSupportedMimeTypes() const | ||
981 | 78 | { | ||
982 | 79 | return std::vector<std::string>(); | ||
983 | 80 | } | ||
984 | 81 | |||
985 | 82 | ApplicationWindowPtr Application::GetFocusableWindow() const | ||
986 | 83 | { | ||
987 | 84 | return nullptr; | ||
988 | 85 | } | ||
989 | 86 | |||
990 | 87 | void Application::Focus(bool show_on_visible, int monitor) const | ||
991 | 88 | {} | ||
992 | 89 | |||
993 | 90 | void Application::Quit() const | ||
994 | 91 | {} | ||
995 | 92 | |||
996 | 93 | bool Application::CreateLocalDesktopFile() const | ||
997 | 94 | { | ||
998 | 95 | return false; | ||
999 | 96 | } | ||
1000 | 97 | |||
1001 | 98 | std::string Application::desktop_id() const | ||
1002 | 99 | { | ||
1003 | 100 | return ""; | ||
1004 | 101 | } | ||
1005 | 102 | |||
1006 | 103 | } | ||
1007 | 104 | } | ||
1008 | 0 | 105 | ||
1009 | === added file 'unity-shared/AppStreamApplication.h' | |||
1010 | --- unity-shared/AppStreamApplication.h 1970-01-01 00:00:00 +0000 | |||
1011 | +++ unity-shared/AppStreamApplication.h 2016-02-23 15:49:50 +0000 | |||
1012 | @@ -0,0 +1,61 @@ | |||
1013 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
1014 | 2 | /* | ||
1015 | 3 | * Copyright (C) 2016 Canonical Ltd | ||
1016 | 4 | * | ||
1017 | 5 | * This program is free software: you can redistribute it and/or modify | ||
1018 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
1019 | 7 | * published by the Free Software Foundation. | ||
1020 | 8 | * | ||
1021 | 9 | * This program is distributed in the hope that it will be useful, | ||
1022 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1023 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1024 | 12 | * GNU General Public License for more details. | ||
1025 | 13 | * | ||
1026 | 14 | * You should have received a copy of the GNU General Public License | ||
1027 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1028 | 16 | * | ||
1029 | 17 | * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com> | ||
1030 | 18 | */ | ||
1031 | 19 | |||
1032 | 20 | #ifndef UNITYSHARED_APPSTREAM_APPLICATION_H | ||
1033 | 21 | #define UNITYSHARED_APPSTREAM_APPLICATION_H | ||
1034 | 22 | |||
1035 | 23 | #include "DesktopApplicationManager.h" | ||
1036 | 24 | |||
1037 | 25 | namespace unity | ||
1038 | 26 | { | ||
1039 | 27 | namespace appstream | ||
1040 | 28 | { | ||
1041 | 29 | |||
1042 | 30 | class Application : public desktop::Application | ||
1043 | 31 | { | ||
1044 | 32 | public: | ||
1045 | 33 | Application(std::string const& appstream_id); | ||
1046 | 34 | |||
1047 | 35 | AppType type() const override; | ||
1048 | 36 | std::string repr() const override; | ||
1049 | 37 | |||
1050 | 38 | WindowList const& GetWindows() const override; | ||
1051 | 39 | bool OwnsWindow(Window window_id) const override; | ||
1052 | 40 | |||
1053 | 41 | std::vector<std::string> GetSupportedMimeTypes() const override; | ||
1054 | 42 | |||
1055 | 43 | ApplicationWindowPtr GetFocusableWindow() const override; | ||
1056 | 44 | void Focus(bool show_on_visible, int monitor) const override; | ||
1057 | 45 | void Quit() const override; | ||
1058 | 46 | |||
1059 | 47 | bool CreateLocalDesktopFile() const override; | ||
1060 | 48 | |||
1061 | 49 | std::string desktop_id() const override; | ||
1062 | 50 | |||
1063 | 51 | private: | ||
1064 | 52 | std::string appstream_id_; | ||
1065 | 53 | std::string title_; | ||
1066 | 54 | glib::Object<_GdkPixbuf> icon_pixbuf_; | ||
1067 | 55 | WindowList window_list_; | ||
1068 | 56 | }; | ||
1069 | 57 | |||
1070 | 58 | } | ||
1071 | 59 | } | ||
1072 | 60 | |||
1073 | 61 | #endif | ||
1074 | 0 | 62 | ||
1075 | === modified file 'unity-shared/ApplicationManager.h' | |||
1076 | --- unity-shared/ApplicationManager.h 2015-11-26 00:20:23 +0000 | |||
1077 | +++ unity-shared/ApplicationManager.h 2016-02-23 15:49:50 +0000 | |||
1078 | @@ -25,8 +25,10 @@ | |||
1079 | 25 | 25 | ||
1080 | 26 | #include <sigc++/signal.h> | 26 | #include <sigc++/signal.h> |
1081 | 27 | #include <NuxCore/Property.h> | 27 | #include <NuxCore/Property.h> |
1082 | 28 | #include <UnityCore/GLibWrapper.h> | ||
1083 | 28 | #include <unity-shared/WindowManager.h> | 29 | #include <unity-shared/WindowManager.h> |
1084 | 29 | 30 | ||
1085 | 31 | struct _GdkPixbuf; | ||
1086 | 30 | 32 | ||
1087 | 31 | namespace unity | 33 | namespace unity |
1088 | 32 | { | 34 | { |
1089 | @@ -153,6 +155,7 @@ | |||
1090 | 153 | nux::ROProperty<std::string> desktop_file; | 155 | nux::ROProperty<std::string> desktop_file; |
1091 | 154 | nux::ROProperty<std::string> title; | 156 | nux::ROProperty<std::string> title; |
1092 | 155 | nux::ROProperty<std::string> icon; | 157 | nux::ROProperty<std::string> icon; |
1093 | 158 | nux::ROProperty<glib::Object<_GdkPixbuf>> icon_pixbuf; | ||
1094 | 156 | 159 | ||
1095 | 157 | // Considering using a property for the "unity-seen" quark | 160 | // Considering using a property for the "unity-seen" quark |
1096 | 158 | nux::RWProperty<bool> seen; | 161 | nux::RWProperty<bool> seen; |
1097 | 159 | 162 | ||
1098 | === modified file 'unity-shared/CMakeLists.txt' | |||
1099 | --- unity-shared/CMakeLists.txt 2015-11-06 18:05:38 +0000 | |||
1100 | +++ unity-shared/CMakeLists.txt 2016-02-23 15:49:50 +0000 | |||
1101 | @@ -18,6 +18,7 @@ | |||
1102 | 18 | # | 18 | # |
1103 | 19 | set (UNITY_SHARED_SOURCES | 19 | set (UNITY_SHARED_SOURCES |
1104 | 20 | ApplicationManager.cpp | 20 | ApplicationManager.cpp |
1105 | 21 | AppStreamApplication.cpp | ||
1106 | 21 | BGHash.cpp | 22 | BGHash.cpp |
1107 | 22 | CoverArt.cpp | 23 | CoverArt.cpp |
1108 | 23 | BackgroundEffectHelper.cpp | 24 | BackgroundEffectHelper.cpp |
1109 | 24 | 25 | ||
1110 | === modified file 'unity-shared/DesktopApplicationManager.h' | |||
1111 | --- unity-shared/DesktopApplicationManager.h 2014-01-15 14:51:10 +0000 | |||
1112 | +++ unity-shared/DesktopApplicationManager.h 2016-02-23 15:49:50 +0000 | |||
1113 | @@ -24,7 +24,7 @@ | |||
1114 | 24 | #include <UnityCore/GLibWrapper.h> | 24 | #include <UnityCore/GLibWrapper.h> |
1115 | 25 | #include <UnityCore/GLibSignal.h> | 25 | #include <UnityCore/GLibSignal.h> |
1116 | 26 | 26 | ||
1118 | 27 | #include "unity-shared/ApplicationManager.h" | 27 | #include "ApplicationManager.h" |
1119 | 28 | 28 | ||
1120 | 29 | namespace unity | 29 | namespace unity |
1121 | 30 | { | 30 | { |
FAILED: Continuous integration, rev:4070 jenkins. qa.ubuntu. com/job/ unity-ci/ 1409/ jenkins. qa.ubuntu. com/job/ unity-xenial- amd64-ci/ 59/console jenkins. qa.ubuntu. com/job/ unity-xenial- armhf-ci/ 59/console jenkins. qa.ubuntu. com/job/ unity-xenial- i386-ci/ 59/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- ci/1409/ rebuild
http://