Merge lp:~azzar1/unity/gs-integration into lp:unity

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
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-glib-dev as build dependency on debian/control.

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