Merge lp:~ted/ubuntu-app-launch/icon-basepath into lp:ubuntu-app-launch/16.10

Proposed by Ted Gould
Status: Superseded
Proposed branch: lp:~ted/ubuntu-app-launch/icon-basepath
Merge into: lp:ubuntu-app-launch/16.10
Prerequisite: lp:~larryprice/ubuntu-app-launch/recursive-libertine-app-dirs
Diff against target: 1229 lines (+118/-702)
18 files modified
debian/changelog (+13/-6)
libubuntu-app-launch/application-impl-base.cpp (+8/-1)
libubuntu-app-launch/application-impl-click.cpp (+2/-12)
libubuntu-app-launch/application-impl-legacy.cpp (+7/-2)
libubuntu-app-launch/application-impl-libertine.cpp (+12/-8)
libubuntu-app-launch/application-impl-libertine.h (+4/-1)
libubuntu-app-launch/application-impl-snap.cpp (+1/-0)
libubuntu-app-launch/application-info-desktop.cpp (+18/-6)
libubuntu-app-launch/application-info-desktop.h (+2/-0)
libubuntu-app-launch/click-exec.c.THIS (+0/-170)
libubuntu-app-launch/click-exec.h.THIS (+0/-25)
libubuntu-app-launch/desktop-exec.c.THIS (+0/-218)
libubuntu-app-launch/desktop-exec.h.THIS (+0/-26)
libubuntu-app-launch/registry-impl.cpp (+0/-7)
libubuntu-app-launch/registry-impl.h (+3/-6)
libubuntu-app-launch/ubuntu-app-launch.cpp (+0/-181)
tests/application-info-desktop.cpp (+47/-32)
upstart-jobs/application-snap.conf.in (+1/-1)
To merge this branch: bzr merge lp:~ted/ubuntu-app-launch/icon-basepath
Reviewer Review Type Date Requested Status
Unity API Team Pending
Review via email: mp+305617@code.launchpad.net

This proposal has been superseded by a proposal from 2016-09-14.

Commit message

Set a base directory for icons that have a full path specified in their desktop file

To post a comment you must log in.
256. By Ted Gould

Switching to be a UAL variable

257. By Ted Gould

Merging with release branch

258. By Ted Gould

Fix a NULL

259. By Ted Gould

Clean up a TODO for the container path

260. By Ted Gould

Make it so that we use filename on full filenames even if we have a registry

261. By Ted Gould

Make sure that we are using a root that makes sense

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2016-09-14 15:32:39 +0000
3+++ debian/changelog 2016-09-14 15:32:40 +0000
4@@ -1,3 +1,16 @@
5+ubuntu-app-launch (0.9+16.10.20160913.1-0ubuntu1) yakkety; urgency=medium
6+
7+ [ Larry Price ]
8+ * Recursively sweep for desktop files for libertine applications.
9+
10+ [ Ted Gould ]
11+ * Fixes, tools and tests related to listing applications
12+ * Migrate starting and stopping applications to new classes
13+ * Make find and discover use the application implementation functions.
14+ * Support launching applications installed as snaps (LP: #1590445)
15+
16+ -- Ted Gould <ted@gould.cx> Tue, 13 Sep 2016 17:43:33 +0000
17+
18 ubuntu-app-launch (0.9+16.10.20160902-0ubuntu1) yakkety; urgency=medium
19
20 * Disable handshake wait with clients doing handshaking (LP: #1618540)
21@@ -48,12 +61,6 @@
22
23 -- Rodney Dawes <rodney.dawes@canonical.com> Wed, 03 Aug 2016 14:10:45 +0000
24
25-ubuntu-app-launch (0.9+16.04.20160730-0ubuntu1) UNRELEASED; urgency=medium
26-
27- * Introducing Snappy backend
28-
29- -- Ted Gould <ted@ubuntu.com> Fri, 29 Jul 2016 11:05:47 -0500
30-
31 ubuntu-app-launch (0.9+16.04.20160510.2-0ubuntu1) xenial; urgency=medium
32
33 * Allow invalid desktop files for OTA11 quick fix (LP: #1580092)
34
35=== modified file 'libubuntu-app-launch/application-impl-base.cpp'
36--- libubuntu-app-launch/application-impl-base.cpp 2016-09-14 15:32:39 +0000
37+++ libubuntu-app-launch/application-impl-base.cpp 2016-09-14 15:32:40 +0000
38@@ -739,7 +739,14 @@
39 g_debug("Initializing params for an new UpstartInstance for: %s", appIdStr.c_str());
40
41 tracepoint(ubuntu_app_launch, libual_start, appIdStr.c_str());
42- auto handshake = starting_handshake_start(appIdStr.c_str());
43+
44+ int timeout = 1;
45+ if (ubuntu::app_launch::Registry::Impl::isWatchingAppStarting())
46+ {
47+ timeout = 0;
48+ }
49+
50+ auto handshake = starting_handshake_start(appIdStr.c_str(), timeout);
51 if (handshake == nullptr)
52 {
53 g_warning("Unable to setup starting handshake");
54
55=== modified file 'libubuntu-app-launch/application-impl-click.cpp'
56--- libubuntu-app-launch/application-impl-click.cpp 2016-09-14 15:32:39 +0000
57+++ libubuntu-app-launch/application-impl-click.cpp 2016-09-14 15:32:40 +0000
58@@ -171,7 +171,8 @@
59 {
60 if (!_info)
61 {
62- _info = std::make_shared<app_info::Desktop>(_keyfile, _clickDir, app_info::DesktopFlags::NONE, nullptr);
63+ _info =
64+ std::make_shared<app_info::Desktop>(_keyfile, _clickDir, _clickDir, app_info::DesktopFlags::NONE, nullptr);
65 }
66
67 return _info;
68@@ -228,25 +229,15 @@
69 const std::string& app,
70 const std::string& clickDir)
71 {
72-<<<<<<< TREE
73- JsonObject* hooks = nullptr;
74-=======
75 if (!manifest)
76 {
77 throw std::runtime_error("No manifest for package '" + package + "'");
78 }
79
80 JsonObject* hooks = nullptr;
81->>>>>>> MERGE-SOURCE
82 if (!json_object_has_member(manifest.get(), "hooks") ||
83 (hooks = json_object_get_object_member(manifest.get(), "hooks")) == nullptr)
84 {
85-<<<<<<< TREE
86- throw std::runtime_error("Manifest for application '" + app + "' does not have a 'hooks' field");
87- }
88-
89- JsonObject* hooklist = nullptr;
90-=======
91 throw std::runtime_error("Manifest for application '" + app + "' does not have a 'hooks' field: " +
92 Registry::Impl::printJson(manifest));
93 }
94@@ -262,7 +253,6 @@
95 }
96
97 JsonObject* hooklist = nullptr;
98->>>>>>> MERGE-SOURCE
99 if (!json_object_has_member(hooks, app.c_str()) ||
100 (hooklist = json_object_get_object_member(hooks, app.c_str())) == nullptr)
101 {
102
103=== modified file 'libubuntu-app-launch/application-impl-legacy.cpp'
104--- libubuntu-app-launch/application-impl-legacy.cpp 2016-09-14 15:32:39 +0000
105+++ libubuntu-app-launch/application-impl-legacy.cpp 2016-09-14 15:32:40 +0000
106@@ -54,8 +54,13 @@
107 {
108 std::tie(_basedir, _keyfile, desktopPath_) = keyfileForApp(appname);
109
110- appinfo_ =
111- std::make_shared<app_info::Desktop>(_keyfile, _basedir, app_info::DesktopFlags::ALLOW_NO_DISPLAY, _registry);
112+ std::string rootDir = "";
113+ auto rootenv = g_getenv("UBUNTU_APP_LAUNCH_LEGACY_ROOT");
114+ if (rootenv != nullptr)
115+ rootDir = rootenv;
116+
117+ appinfo_ = std::make_shared<app_info::Desktop>(_keyfile, _basedir, rootDir,
118+ app_info::DesktopFlags::ALLOW_NO_DISPLAY, _registry);
119
120 if (!_keyfile)
121 {
122
123=== modified file 'libubuntu-app-launch/application-impl-libertine.cpp'
124--- libubuntu-app-launch/application-impl-libertine.cpp 2016-09-14 15:32:39 +0000
125+++ libubuntu-app-launch/application-impl-libertine.cpp 2016-09-14 15:32:40 +0000
126@@ -27,7 +27,7 @@
127 {
128 namespace app_impls
129 {
130-
131+
132 Libertine::Libertine(const AppID::Package& container,
133 const AppID::AppName& appname,
134 const std::shared_ptr<Registry>& registry)
135@@ -35,13 +35,14 @@
136 , _container(container)
137 , _appname(appname)
138 {
139+ /** TODO: Handle nullptr */
140+ _container_path = libertine_container_path(container.value().c_str());
141+
142 if (!_keyfile)
143 {
144- auto container_path = libertine_container_path(container.value().c_str());
145- auto system_app_path = g_build_filename(container_path, "usr", "share", nullptr);
146+ auto system_app_path = g_build_filename(_container_path.c_str(), "usr", "share", nullptr);
147 _basedir = system_app_path;
148 g_free(system_app_path);
149- g_free(container_path);
150
151 _keyfile = findDesktopFile(_basedir, "applications", appname.value() + ".desktop");
152 }
153@@ -83,7 +84,9 @@
154 return keyfile;
155 }
156
157-std::shared_ptr<GKeyFile> Libertine::findDesktopFile(const std::string& basepath, const std::string& subpath, const std::string& filename)
158+std::shared_ptr<GKeyFile> Libertine::findDesktopFile(const std::string& basepath,
159+ const std::string& subpath,
160+ const std::string& filename)
161 {
162 auto fullpath = g_build_filename(basepath.c_str(), subpath.c_str(), filename.c_str(), nullptr);
163 std::string sfullpath(fullpath);
164@@ -97,7 +100,8 @@
165 GError* error = nullptr;
166 auto dirpath = g_build_filename(basepath.c_str(), subpath.c_str(), nullptr);
167 GDir* dir = g_dir_open(dirpath, 0, &error);
168- if (error != NULL) {
169+ if (error != NULL)
170+ {
171 g_error_free(error);
172 g_free(dirpath);
173 return {};
174@@ -252,8 +256,8 @@
175 {
176 if (!appinfo_)
177 {
178- appinfo_ =
179- std::make_shared<app_info::Desktop>(_keyfile, _basedir, app_info::DesktopFlags::XMIR_DEFAULT, _registry);
180+ appinfo_ = std::make_shared<app_info::Desktop>(_keyfile, _basedir, _container_path,
181+ app_info::DesktopFlags::XMIR_DEFAULT, _registry);
182 }
183 return appinfo_;
184 }
185
186=== modified file 'libubuntu-app-launch/application-impl-libertine.h'
187--- libubuntu-app-launch/application-impl-libertine.h 2016-09-14 15:32:39 +0000
188+++ libubuntu-app-launch/application-impl-libertine.h 2016-09-14 15:32:40 +0000
189@@ -84,13 +84,16 @@
190 private:
191 AppID::Package _container;
192 AppID::AppName _appname;
193+ std::string _container_path;
194 std::shared_ptr<GKeyFile> _keyfile;
195 std::string _basedir;
196 std::shared_ptr<app_info::Desktop> appinfo_;
197
198 std::list<std::pair<std::string, std::string>> launchEnv();
199 static std::shared_ptr<GKeyFile> keyfileFromPath(const std::string& pathname);
200- static std::shared_ptr<GKeyFile> findDesktopFile(const std::string& basepath, const std::string& subpath, const std::string& filename);
201+ static std::shared_ptr<GKeyFile> findDesktopFile(const std::string& basepath,
202+ const std::string& subpath,
203+ const std::string& filename);
204 };
205
206 } // namespace app_impls
207
208=== modified file 'libubuntu-app-launch/application-impl-snap.cpp'
209--- libubuntu-app-launch/application-impl-snap.cpp 2016-09-14 15:32:39 +0000
210+++ libubuntu-app-launch/application-impl-snap.cpp 2016-09-14 15:32:40 +0000
211@@ -80,6 +80,7 @@
212 return keyfile;
213 }(),
214 snapDir,
215+ snapDir,
216 app_info::DesktopFlags::NONE,
217 registry)
218 , interface_(interface)
219
220=== modified file 'libubuntu-app-launch/application-info-desktop.cpp'
221--- libubuntu-app-launch/application-info-desktop.cpp 2016-09-14 15:32:39 +0000
222+++ libubuntu-app-launch/application-info-desktop.cpp 2016-09-14 15:32:40 +0000
223@@ -67,7 +67,8 @@
224
225 template <typename T>
226 auto fileFromKeyfile(std::shared_ptr<GKeyFile> keyfile,
227- const std::string basePath,
228+ const std::string& basePath,
229+ const std::string& rootDir,
230 const std::string& key,
231 const std::string& exceptionText = {}) -> T
232 {
233@@ -89,6 +90,14 @@
234 if (keyval[0] == '/')
235 {
236 T retval = T::from_raw(keyval);
237+
238+ if (!rootDir.empty())
239+ {
240+ auto fullpath = g_build_filename(rootDir.c_str(), keyval, nullptr);
241+ retval = T::from_raw(fullpath);
242+ g_free(fullpath);
243+ }
244+
245 g_free(keyval);
246 return retval;
247 }
248@@ -187,6 +196,7 @@
249
250 Desktop::Desktop(std::shared_ptr<GKeyFile> keyfile,
251 const std::string& basePath,
252+ const std::string& rootDir,
253 std::bitset<2> flags,
254 std::shared_ptr<Registry> registry)
255 : _keyfile([keyfile, flags]() {
256@@ -222,26 +232,28 @@
257 return keyfile;
258 }())
259 , _basePath(basePath)
260+ , _rootDir(rootDir)
261 , _name(stringFromKeyfile<Application::Info::Name>(keyfile, "Name", "Unable to get name from keyfile"))
262 , _description(stringFromKeyfile<Application::Info::Description>(keyfile, "Comment"))
263- , _iconPath([keyfile, basePath, registry]() {
264+ , _iconPath([keyfile, basePath, rootDir, registry]() {
265 if (registry != nullptr)
266 {
267 auto iconName =
268 stringFromKeyfile<Application::Info::IconPath>(keyfile, "Icon", "Missing icon for desktop file");
269 return registry->impl->getIconFinder(basePath)->find(iconName);
270 }
271- return fileFromKeyfile<Application::Info::IconPath>(keyfile, basePath, "Icon", "Missing icon for desktop file");
272+ return fileFromKeyfile<Application::Info::IconPath>(keyfile, basePath, rootDir, "Icon",
273+ "Missing icon for desktop file");
274 }())
275 , _defaultDepartment(
276 stringFromKeyfile<Application::Info::DefaultDepartment>(keyfile, "X-Ubuntu-Default-Department-ID"))
277- , _screenshotPath([keyfile, basePath]() {
278- return fileFromKeyfile<Application::Info::IconPath>(keyfile, basePath, "X-Screenshot");
279+ , _screenshotPath([keyfile, basePath, rootDir]() {
280+ return fileFromKeyfile<Application::Info::IconPath>(keyfile, basePath, rootDir, "X-Screenshot");
281 }())
282 , _keywords(stringlistFromKeyfile<Application::Info::Keywords>(keyfile, "Keywords"))
283 , _splashInfo(
284 {stringFromKeyfile<Application::Info::Splash::Title>(keyfile, "X-Ubuntu-Splash-Title"),
285- fileFromKeyfile<Application::Info::Splash::Image>(keyfile, basePath, "X-Ubuntu-Splash-Image"),
286+ fileFromKeyfile<Application::Info::Splash::Image>(keyfile, basePath, rootDir, "X-Ubuntu-Splash-Image"),
287 stringFromKeyfile<Application::Info::Splash::Color>(keyfile, "X-Ubuntu-Splash-Color"),
288 stringFromKeyfile<Application::Info::Splash::Color>(keyfile, "X-Ubuntu-Splash-Color-Header"),
289 stringFromKeyfile<Application::Info::Splash::Color>(keyfile, "X-Ubuntu-Splash-Color-Footer"),
290
291=== modified file 'libubuntu-app-launch/application-info-desktop.h'
292--- libubuntu-app-launch/application-info-desktop.h 2016-09-14 15:32:39 +0000
293+++ libubuntu-app-launch/application-info-desktop.h 2016-09-14 15:32:40 +0000
294@@ -43,6 +43,7 @@
295 public:
296 Desktop(std::shared_ptr<GKeyFile> keyfile,
297 const std::string& basePath,
298+ const std::string& rootDir,
299 std::bitset<2> flags,
300 std::shared_ptr<Registry> registry);
301
302@@ -108,6 +109,7 @@
303 protected:
304 std::shared_ptr<GKeyFile> _keyfile;
305 std::string _basePath;
306+ std::string _rootDir;
307
308 Application::Info::Name _name;
309 Application::Info::Description _description;
310
311=== removed file 'libubuntu-app-launch/click-exec.c.THIS'
312--- libubuntu-app-launch/click-exec.c.THIS 2016-09-14 15:32:39 +0000
313+++ libubuntu-app-launch/click-exec.c.THIS 1970-01-01 00:00:00 +0000
314@@ -1,170 +0,0 @@
315-/*
316- * Copyright 2013 Canonical Ltd.
317- *
318- * This program is free software: you can redistribute it and/or modify it
319- * under the terms of the GNU General Public License version 3, as published
320- * by the Free Software Foundation.
321- *
322- * This program is distributed in the hope that it will be useful, but
323- * WITHOUT ANY WARRANTY; without even the implied warranties of
324- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
325- * PURPOSE. See the GNU General Public License for more details.
326- *
327- * You should have received a copy of the GNU General Public License along
328- * with this program. If not, see <http://www.gnu.org/licenses/>.
329- *
330- * Authors:
331- * Ted Gould <ted.gould@canonical.com>
332- */
333-
334-#include <gio/gio.h>
335-#include <click.h>
336-#include "helpers.h"
337-#include "ubuntu-app-launch-trace.h"
338-#include "ual-tracepoint.h"
339-
340-/*
341-
342-INTRODUCTION:
343-
344-This is the utility that executes a click package based on the Application ID.
345-Actually it just determines what needs to be executed, and asks Upstart to execute
346-it so that it can be tracked better. This process runs OUTSIDE of the app armor
347-confinement for the application. It also DOES NOT use any files that can be modified
348-by the user. So things like the desktop file in ~/.local/share/applications are
349-all off limits.
350-
351-For information on Click packages and the manifest look at the Click package documentation:
352-
353-https://click.readthedocs.org/en/latest/
354-
355-*/
356-
357-gboolean
358-click_task_setup (GDBusConnection * bus, const gchar * app_id, EnvHandle * handle, int timeout_s)
359-{
360- g_return_val_if_fail(bus != NULL, FALSE);
361- g_return_val_if_fail(app_id != NULL, FALSE);
362- g_return_val_if_fail(handle != NULL, FALSE);
363-
364- ual_tracepoint(click_start, app_id);
365-
366- GError * error = NULL;
367-
368- handshake_t * handshake = starting_handshake_start(app_id, timeout_s);
369- if (handshake == NULL) {
370- g_warning("Unable to setup starting handshake");
371- }
372-
373- ual_tracepoint(click_starting_sent, app_id);
374-
375- gchar * package = NULL;
376- /* 'Parse' the App ID */
377- if (!app_id_to_triplet(app_id, &package, NULL, NULL)) {
378- g_warning("Unable to parse App ID: '%s'", app_id);
379- return FALSE;
380- }
381-
382- /* Check click to find out where the files are */
383- ClickDB * db = click_db_new();
384- /* If TEST_CLICK_DB is unset, this reads the system database. */
385- click_db_read(db, g_getenv("TEST_CLICK_DB"), &error);
386- if (error != NULL) {
387- g_warning("Unable to read Click database: %s", error->message);
388- g_error_free(error);
389- g_free(package);
390- return FALSE;
391- }
392- /* If TEST_CLICK_USER is unset, this uses the current user name. */
393- ClickUser * user = click_user_new_for_user(db, g_getenv("TEST_CLICK_USER"), &error);
394- if (error != NULL) {
395- g_warning("Unable to read Click database: %s", error->message);
396- g_error_free(error);
397- g_free(package);
398- g_object_unref(db);
399- return FALSE;
400- }
401- gchar * pkgdir = click_user_get_path(user, package, &error);
402- if (error != NULL) {
403- g_warning("Unable to get the Click package directory for %s: %s", package, error->message);
404- g_error_free(error);
405- g_free(package);
406- g_object_unref(user);
407- g_object_unref(db);
408- return FALSE;
409- }
410- g_object_unref(user);
411- g_object_unref(db);
412-
413- ual_tracepoint(click_found_pkgdir, app_id);
414-
415- if (!g_file_test(pkgdir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
416- g_warning("Application directory '%s' doesn't exist", pkgdir);
417- g_free(pkgdir);
418- g_free(package);
419- return FALSE;
420- }
421-
422- g_debug("Setting 'APP_DIR' to '%s'", pkgdir);
423- env_handle_add(handle, "APP_DIR", pkgdir);
424-
425- set_confined_envvars(handle, package, pkgdir);
426-
427- ual_tracepoint(click_configured_env, app_id);
428-
429- gchar * desktopfile = manifest_to_desktop(pkgdir, app_id);
430-
431- g_free(pkgdir);
432- g_free(package);
433-
434- if (desktopfile == NULL) {
435- g_warning("Desktop file unable to be found");
436- return FALSE;
437- }
438-
439- ual_tracepoint(click_read_manifest, app_id);
440-
441- GKeyFile * keyfile = g_key_file_new();
442-
443- env_handle_add(handle, "APP_DESKTOP_FILE_PATH", desktopfile);
444- g_key_file_load_from_file(keyfile, desktopfile, 0, &error);
445- if (error != NULL) {
446- g_warning("Unable to load desktop file '%s': %s", desktopfile, error->message);
447- g_error_free(error);
448- g_key_file_free(keyfile);
449- g_free(desktopfile);
450- return FALSE;
451- }
452-
453- if (g_key_file_has_key(keyfile, "Desktop Entry", "X-Ubuntu-XMir-Enable", NULL)) {
454- if (g_key_file_get_boolean(keyfile, "Desktop Entry", "X-Ubuntu-XMir-Enable", NULL)) {
455- env_handle_add(handle, "APP_XMIR_ENABLE", "1");
456- } else {
457- env_handle_add(handle, "APP_XMIR_ENABLE", "0");
458- }
459- }
460-
461- /* This string is quoted using desktop file quoting:
462- http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables */
463- gchar * exec = desktop_to_exec(keyfile, desktopfile);
464- if (exec == NULL) {
465- return FALSE;
466- }
467-
468- ual_tracepoint(click_read_desktop, app_id);
469-
470- g_debug("Setting 'APP_EXEC' to '%s'", exec);
471- env_handle_add(handle, "APP_EXEC", exec);
472-
473- g_free(exec);
474- g_key_file_unref(keyfile);
475- g_free(desktopfile);
476-
477- ual_tracepoint(handshake_wait, app_id);
478-
479- starting_handshake_wait(handshake);
480-
481- ual_tracepoint(handshake_complete, app_id);
482-
483- return TRUE;
484-}
485
486=== removed file 'libubuntu-app-launch/click-exec.h.THIS'
487--- libubuntu-app-launch/click-exec.h.THIS 2016-09-14 15:32:39 +0000
488+++ libubuntu-app-launch/click-exec.h.THIS 1970-01-01 00:00:00 +0000
489@@ -1,25 +0,0 @@
490-/*
491- * Copyright © 2014 Canonical Ltd.
492- *
493- * This program is free software: you can redistribute it and/or modify it
494- * under the terms of the GNU General Public License version 3, as published
495- * by the Free Software Foundation.
496- *
497- * This program is distributed in the hope that it will be useful, but
498- * WITHOUT ANY WARRANTY; without even the implied warranties of
499- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
500- * PURPOSE. See the GNU General Public License for more details.
501- *
502- * You should have received a copy of the GNU General Public License along
503- * with this program. If not, see <http://www.gnu.org/licenses/>.
504- *
505- * Authors:
506- * Ted Gould <ted.gould@canonical.com>
507- */
508-
509-#include <glib.h>
510-#include "helpers.h"
511-
512-gboolean click_task_setup (GDBusConnection * bus, const gchar * app_id, EnvHandle * envhandle, int timeout_s);
513-
514-
515
516=== removed file 'libubuntu-app-launch/desktop-exec.c.THIS'
517--- libubuntu-app-launch/desktop-exec.c.THIS 2016-09-14 15:32:39 +0000
518+++ libubuntu-app-launch/desktop-exec.c.THIS 1970-01-01 00:00:00 +0000
519@@ -1,218 +0,0 @@
520-/*
521- * Copyright 2013 Canonical Ltd.
522- *
523- * This program is free software: you can redistribute it and/or modify it
524- * under the terms of the GNU General Public License version 3, as published
525- * by the Free Software Foundation.
526- *
527- * This program is distributed in the hope that it will be useful, but
528- * WITHOUT ANY WARRANTY; without even the implied warranties of
529- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
530- * PURPOSE. See the GNU General Public License for more details.
531- *
532- * You should have received a copy of the GNU General Public License along
533- * with this program. If not, see <http://www.gnu.org/licenses/>.
534- *
535- * Authors:
536- * Ted Gould <ted.gould@canonical.com>
537- */
538-
539-#include <unistd.h>
540-#include <errno.h>
541-#include <string.h>
542-#include <glib.h>
543-#include <gio/gio.h>
544-
545-#include "helpers.h"
546-#include "ubuntu-app-launch-trace.h"
547-#include "recoverable-problem.h"
548-#include "ual-tracepoint.h"
549-#include "ubuntu-app-launch.h"
550-#include "app-info.h"
551-
552-/* Reports an error on the caller of UAL so that we can track
553- who is trying to launch bad AppIDs, and then fix their bug
554- so that we get better reporting upstream. */
555-void
556-report_error_on_caller (const gchar * app_id) {
557- g_warning("Unable to find keyfile for application '%s'", app_id);
558-
559- const gchar * props[3] = {
560- "AppId", NULL,
561- NULL
562- };
563- props[1] = app_id;
564-
565- GPid pid = getpid();
566-
567- /* Checking to see if we're using the command line tool to create
568- the appid. Chances are in that case it's a user error, and we
569- don't need to automatically record it, the user mistyped. */
570- gboolean debugtool = FALSE;
571- if (pid != 0) {
572- const gchar * cmdpath = "/proc/self/cmdline";
573- gchar * cmdline = NULL;
574-
575- if (g_file_get_contents(cmdpath, &cmdline, NULL, NULL)) {
576- if (g_strstr_len(cmdline, -1, "ubuntu-app-launch") != NULL) {
577- debugtool = TRUE;
578- }
579-
580- g_free(cmdline);
581- } else {
582- /* The caller has already exited, probably a debug tool */
583- debugtool = TRUE;
584- }
585- }
586-
587- if (!debugtool) {
588- report_recoverable_problem("ubuntu-app-launch-invalid-appid", pid, TRUE, props);
589- } else {
590- g_debug("Suppressing appid recoverable error for debug tool");
591- }
592-}
593-
594-/* Get the keyfile object for a libertine container based application. Look into
595- the container's filesystem on disk and find it in /usr/share/applications in there.
596- Those are currently the only apps that we look at today. We're not ensuring anything
597- about the file other than it has basic sanity. */
598-GKeyFile *
599-keyfile_for_libertine (const gchar * appid, gchar ** outcontainer)
600-{
601- gchar * desktopfile = NULL;
602- gchar * desktopdir = NULL;
603-
604- if (!app_info_libertine(appid, &desktopdir, &desktopfile)) {
605- return NULL;
606- }
607-
608- gchar * desktopfull = g_build_filename(desktopdir, desktopfile, NULL);
609- g_debug("Desktop full: %s", desktopfull);
610- g_free(desktopdir);
611- g_free(desktopfile);
612-
613- /* We now think we have a valid 'desktopfile' path */
614- GKeyFile * keyfile = g_key_file_new();
615- gboolean loaded = g_key_file_load_from_file(keyfile, desktopfull, G_KEY_FILE_NONE, NULL);
616-
617- if (!loaded) {
618- g_free(desktopfull);
619- g_key_file_free(keyfile);
620- return NULL;
621- }
622-
623- if (!verify_keyfile(keyfile, desktopfull)) {
624- g_free(desktopfull);
625- g_key_file_free(keyfile);
626- return NULL;
627- }
628-
629- g_free(desktopfull);
630-
631- if (outcontainer != NULL) {
632- ubuntu_app_launch_app_id_parse(appid, outcontainer, NULL, NULL);
633- }
634-
635- return keyfile;
636-}
637-
638-gboolean
639-desktop_task_setup (GDBusConnection * bus, const gchar * app_id, EnvHandle * handle, gboolean is_libertine, int timeout_s)
640-{
641- if (app_id == NULL) {
642- g_error("No APP_ID environment variable defined");
643- return FALSE;
644- }
645-
646- ual_tracepoint(desktop_start, app_id);
647-
648- handshake_t * handshake = starting_handshake_start(app_id, timeout_s);
649- if (handshake == NULL) {
650- g_warning("Unable to setup starting handshake");
651- }
652-
653- ual_tracepoint(desktop_starting_sent, app_id);
654-
655- gchar * desktopfilename = NULL;
656- GKeyFile * keyfile = NULL;
657- gchar * libertinecontainer = NULL;
658- if (is_libertine) {
659- /* desktopfilename not set, not useful in this context */
660- keyfile = keyfile_for_libertine(app_id, &libertinecontainer);
661- } else {
662- keyfile = keyfile_for_appid(app_id, &desktopfilename);
663- }
664-
665- if (keyfile == NULL) {
666- report_error_on_caller(app_id);
667- g_free(libertinecontainer);
668- return FALSE;
669- }
670-
671- ual_tracepoint(desktop_found, app_id);
672-
673- /* Desktop file name so that libs can get other info from it */
674- if (desktopfilename != NULL) {
675- env_handle_add(handle, "APP_DESKTOP_FILE_PATH", desktopfilename);
676- g_free(desktopfilename);
677- }
678-
679- if (g_key_file_has_key(keyfile, "Desktop Entry", "Path", NULL)) {
680- gchar * path = g_key_file_get_string(keyfile, "Desktop Entry", "Path", NULL);
681- env_handle_add(handle, "APP_DIR", path);
682- g_free(path);
683- }
684-
685- gchar * apparmor = g_key_file_get_string(keyfile, "Desktop Entry", "X-Ubuntu-AppArmor-Profile", NULL);
686- if (apparmor != NULL) {
687- env_handle_add(handle, "APP_EXEC_POLICY", apparmor);
688- set_confined_envvars(handle, app_id, "/usr/share");
689- g_free(apparmor);
690- } else {
691- env_handle_add(handle, "APP_EXEC_POLICY", "unconfined");
692- }
693-
694- if (g_key_file_has_key(keyfile, "Desktop Entry", "X-Ubuntu-XMir-Enable", NULL)) {
695- if (g_key_file_get_boolean(keyfile, "Desktop Entry", "X-Ubuntu-XMir-Enable", NULL)) {
696- env_handle_add(handle, "APP_XMIR_ENABLE", "1");
697- } else {
698- env_handle_add(handle, "APP_XMIR_ENABLE", "0");
699- }
700- } else if (is_libertine) {
701- /* Default to X for libertine stuff */
702- env_handle_add(handle, "APP_XMIR_ENABLE", "1");
703- }
704-
705- /* This string is quoted using desktop file quoting:
706- http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables */
707- gchar * execline = desktop_to_exec(keyfile, app_id);
708- g_return_val_if_fail(execline != NULL, FALSE);
709-
710- if (is_libertine) {
711- static const gchar * libertine_launch = NULL;
712- if (G_UNLIKELY(libertine_launch == NULL)) {
713- libertine_launch = g_getenv("UBUNTU_APP_LAUNCH_LIBERTINE_LAUNCH");
714- if (libertine_launch == NULL) {
715- libertine_launch = LIBERTINE_LAUNCH;
716- }
717- }
718-
719- gchar * libexec = g_strdup_printf("%s \"%s\" %s", libertine_launch, libertinecontainer, execline);
720- g_free(execline);
721- execline = libexec;
722- }
723- g_free(libertinecontainer); /* Handles NULL, let's be sure it goes away */
724-
725- env_handle_add(handle, "APP_EXEC", execline);
726- g_free(execline);
727-
728- g_key_file_free(keyfile);
729-
730- ual_tracepoint(handshake_wait, app_id);
731-
732- starting_handshake_wait(handshake);
733-
734- ual_tracepoint(handshake_complete, app_id);
735-
736- return TRUE;
737-}
738
739=== removed file 'libubuntu-app-launch/desktop-exec.h.THIS'
740--- libubuntu-app-launch/desktop-exec.h.THIS 2016-09-14 15:32:39 +0000
741+++ libubuntu-app-launch/desktop-exec.h.THIS 1970-01-01 00:00:00 +0000
742@@ -1,26 +0,0 @@
743-/*
744- * Copyright © 2014 Canonical Ltd.
745- *
746- * This program is free software: you can redistribute it and/or modify it
747- * under the terms of the GNU General Public License version 3, as published
748- * by the Free Software Foundation.
749- *
750- * This program is distributed in the hope that it will be useful, but
751- * WITHOUT ANY WARRANTY; without even the implied warranties of
752- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
753- * PURPOSE. See the GNU General Public License for more details.
754- *
755- * You should have received a copy of the GNU General Public License along
756- * with this program. If not, see <http://www.gnu.org/licenses/>.
757- *
758- * Authors:
759- * Ted Gould <ted.gould@canonical.com>
760- */
761-
762-#pragma once
763-
764-#include <glib.h>
765-#include "helpers.h"
766-
767-gboolean desktop_task_setup (GDBusConnection * bus, const gchar * appid, EnvHandle * envhandle, gboolean is_libertine, int timeout_s);
768-
769
770=== modified file 'libubuntu-app-launch/registry-impl.cpp'
771--- libubuntu-app-launch/registry-impl.cpp 2016-09-14 15:32:39 +0000
772+++ libubuntu-app-launch/registry-impl.cpp 2016-09-14 15:32:40 +0000
773@@ -154,14 +154,7 @@
774
775 auto retval = std::shared_ptr<JsonObject>(json_node_dup_object(node), json_object_unref);
776
777-<<<<<<< TREE
778-#if JSON_CHECK_VERSION(1, 1, 2)
779- // Not available in json-glib 1.0, so must leak there.
780- json_node_unref(node);
781-#endif
782-=======
783 json_node_free(node);
784->>>>>>> MERGE-SOURCE
785
786 return retval;
787 });
788
789=== modified file 'libubuntu-app-launch/registry-impl.h'
790--- libubuntu-app-launch/registry-impl.h 2016-09-14 15:32:39 +0000
791+++ libubuntu-app-launch/registry-impl.h 2016-09-14 15:32:40 +0000
792@@ -79,18 +79,15 @@
793 std::list<std::string> upstartInstancesForJob(const std::string& job);
794 std::string upstartJobPath(const std::string& job);
795
796-<<<<<<< TREE
797+ static std::string printJson(std::shared_ptr<JsonObject> jsonobj);
798+ static std::string printJson(std::shared_ptr<JsonNode> jsonnode);
799+
800 /* Signal Hints */
801 /* NOTE: Static because we don't have registry instances in the C
802 code right now. We want these to not be static in the future */
803 static void watchingAppStarting(bool rWatching);
804 static bool isWatchingAppStarting();
805
806-=======
807- static std::string printJson(std::shared_ptr<JsonObject> jsonobj);
808- static std::string printJson(std::shared_ptr<JsonNode> jsonnode);
809-
810->>>>>>> MERGE-SOURCE
811 private:
812 Registry* _registry;
813 #if 0
814
815=== modified file 'libubuntu-app-launch/ubuntu-app-launch.cpp'
816--- libubuntu-app-launch/ubuntu-app-launch.cpp 2016-09-14 15:32:39 +0000
817+++ libubuntu-app-launch/ubuntu-app-launch.cpp 2016-09-14 15:32:40 +0000
818@@ -110,187 +110,6 @@
819 return job_path;
820 }
821
822-<<<<<<< TREE
823-/* Check to see if a legacy app wants us to manage whether they're
824- single instance or not */
825-static gboolean
826-legacy_single_instance (const gchar * appid)
827-{
828- ual_tracepoint(desktop_single_start, appid);
829-
830- GKeyFile * keyfile = keyfile_for_appid(appid, NULL);
831-
832- if (keyfile == NULL) {
833- g_warning("Unable to find keyfile for application '%s'", appid);
834- return FALSE;
835- }
836-
837- ual_tracepoint(desktop_single_found, appid);
838-
839- gboolean singleinstance = FALSE;
840-
841- if (g_key_file_has_key(keyfile, "Desktop Entry", "X-Ubuntu-Single-Instance", NULL)) {
842- GError * error = NULL;
843-
844- singleinstance = g_key_file_get_boolean(keyfile, "Desktop Entry", "X-Ubuntu-Single-Instance", &error);
845-
846- if (error != NULL) {
847- g_warning("Unable to get single instance key for app '%s': %s", appid, error->message);
848- g_error_free(error);
849- /* Ensure that if we got an error, we assume standard case */
850- singleinstance = FALSE;
851- }
852- }
853-
854- g_key_file_free(keyfile);
855-
856- ual_tracepoint(desktop_single_finished, appid, singleinstance ? "single" : "unmanaged");
857-
858- return singleinstance;
859-}
860-
861-/* Determine whether it's a click package by looking for the symlink
862- that is created by the desktop hook */
863-static gboolean
864-is_click (const gchar * appid)
865-{
866- gchar * appiddesktop = g_strdup_printf("%s.desktop", appid);
867- gchar * click_link = NULL;
868- const gchar * link_farm_dir = g_getenv("UBUNTU_APP_LAUNCH_LINK_FARM");
869- if (G_LIKELY(link_farm_dir == NULL)) {
870- click_link = g_build_filename(g_get_home_dir(), ".cache", "ubuntu-app-launch", "desktop", appiddesktop, NULL);
871- } else {
872- click_link = g_build_filename(link_farm_dir, appiddesktop, NULL);
873- }
874- g_free(appiddesktop);
875- gboolean click = g_file_test(click_link, G_FILE_TEST_EXISTS);
876- g_free(click_link);
877-
878- return click;
879-}
880-
881-/* Determine whether an AppId is realated to a Libertine container by
882- checking the container and program name. */
883-static gboolean
884-is_libertine (const gchar * appid)
885-{
886- if (app_info_libertine(appid, NULL, NULL)) {
887- g_debug("Libertine application detected: %s", appid);
888- return TRUE;
889- } else {
890- return FALSE;
891- }
892-}
893-
894-gboolean
895-start_application_core (GDBusConnection * con, GCancellable * cancel, const gchar * appid, const gchar * const * uris, gboolean test)
896-{
897- ual_tracepoint(libual_start, appid);
898-
899- g_return_val_if_fail(appid != NULL, FALSE);
900-
901- gboolean click = is_click(appid);
902- ual_tracepoint(libual_determine_type, appid, click ? "click" : "legacy");
903-
904- /* Figure out if it is libertine */
905- gboolean libertine = FALSE;
906- if (!click) {
907- libertine = is_libertine(appid);
908- }
909-
910- ual_tracepoint(libual_determine_libertine, appid, libertine ? "container" : "host");
911-
912- /* Figure out the DBus path for the job */
913- const gchar * jobpath = NULL;
914- if (click) {
915- jobpath = get_jobpath(con, "application-click");
916- } else {
917- jobpath = get_jobpath(con, "application-legacy");
918- }
919-
920- if (jobpath == NULL) {
921- g_object_unref(con);
922- g_warning("Unable to get job path");
923- return FALSE;
924- }
925-
926- ual_tracepoint(libual_job_path_determined, appid, jobpath);
927-
928- /* Callback data */
929- app_start_t * app_start_data = g_new0(app_start_t, 1);
930- app_start_data->appid = g_strdup(appid);
931- app_start_data->con = G_DBUS_CONNECTION(g_object_ref(con));
932- app_start_data->cancel = cancel ? G_CANCELLABLE(g_object_ref(cancel)) : nullptr;
933-
934- /* Build up our environment */
935- GVariantBuilder builder;
936- g_variant_builder_init(&builder, G_VARIANT_TYPE_TUPLE);
937-
938- g_variant_builder_open(&builder, G_VARIANT_TYPE_ARRAY);
939-
940- g_variant_builder_add_value(&builder, g_variant_new_take_string(g_strdup_printf("APP_ID=%s", appid)));
941- g_variant_builder_add_value(&builder, g_variant_new_take_string(g_strdup_printf("APP_LAUNCHER_PID=%d", getpid())));
942-
943- if (uris != NULL) {
944- gchar * urisjoin = app_uris_string(uris);
945- gchar * urienv = g_strdup_printf("APP_URIS=%s", urisjoin);
946- app_start_data->uris = urisjoin;
947- g_variant_builder_add_value(&builder, g_variant_new_take_string(urienv));
948- }
949-
950- if (!click) {
951- if (libertine || legacy_single_instance(appid)) {
952- g_variant_builder_add_value(&builder, g_variant_new_string("INSTANCE_ID="));
953- } else {
954- gchar * instanceid = g_strdup_printf("INSTANCE_ID=%" G_GUINT64_FORMAT, g_get_real_time());
955- g_variant_builder_add_value(&builder, g_variant_new_take_string(instanceid));
956- }
957- }
958-
959- if (test) {
960- g_variant_builder_add_value(&builder, g_variant_new_string("QT_LOAD_TESTABILITY=1"));
961- }
962-
963- int timeout = 1;
964- if (ubuntu::app_launch::Registry::Impl::isWatchingAppStarting()) {
965- timeout = 0;
966- }
967-
968- gboolean setup_complete = FALSE;
969- if (click) {
970- setup_complete = click_task_setup(con, appid, (EnvHandle*)&builder, timeout);
971- } else {
972- setup_complete = desktop_task_setup(con, appid, (EnvHandle*)&builder, libertine, timeout);
973- }
974-
975- if (setup_complete) {
976- g_variant_builder_close(&builder);
977- g_variant_builder_add_value(&builder, g_variant_new_boolean(TRUE));
978-
979- /* Call the job start function */
980- g_dbus_connection_call(con,
981- DBUS_SERVICE_UPSTART,
982- jobpath,
983- DBUS_INTERFACE_UPSTART_JOB,
984- "Start",
985- g_variant_builder_end(&builder),
986- NULL,
987- G_DBUS_CALL_FLAGS_NONE,
988- -1,
989- cancel, /* cancelable */
990- application_start_cb,
991- app_start_data);
992-
993- ual_tracepoint(libual_start_message_sent, appid);
994- } else {
995- g_variant_builder_clear(&builder);
996- }
997-
998- return setup_complete;
999-}
1000-
1001-=======
1002->>>>>>> MERGE-SOURCE
1003 gboolean
1004 ubuntu_app_launch_start_application (const gchar * appid, const gchar * const * uris)
1005 {
1006
1007=== modified file 'tests/application-info-desktop.cpp'
1008--- tests/application-info-desktop.cpp 2016-09-14 15:32:39 +0000
1009+++ tests/application-info-desktop.cpp 2016-09-14 15:32:40 +0000
1010@@ -59,7 +59,7 @@
1011
1012 TEST_F(ApplicationInfoDesktop, DefaultState)
1013 {
1014- auto appinfo = ubuntu::app_launch::app_info::Desktop(defaultKeyfile(), "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr);
1015+ auto appinfo = ubuntu::app_launch::app_info::Desktop(defaultKeyfile(), "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr);
1016
1017 EXPECT_EQ("Foo App", appinfo.name().value());
1018 EXPECT_EQ("", appinfo.description().value());
1019@@ -86,33 +86,33 @@
1020 TEST_F(ApplicationInfoDesktop, KeyfileErrors)
1021 {
1022 // empty
1023- EXPECT_THROW(ubuntu::app_launch::app_info::Desktop({}, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
1024+ EXPECT_THROW(ubuntu::app_launch::app_info::Desktop({}, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
1025
1026 // empty name
1027 auto noname = defaultKeyfile();
1028 g_key_file_remove_key(noname.get(), DESKTOP, "Name", nullptr);
1029- EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(noname, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
1030+ EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(noname, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
1031
1032 // empty icon
1033 auto noicon = defaultKeyfile();
1034 g_key_file_remove_key(noicon.get(), DESKTOP, "Icon", nullptr);
1035- EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(noicon, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
1036+ EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(noicon, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
1037
1038 // wrong type
1039 auto wrongtype = defaultKeyfile();
1040 g_key_file_set_string(wrongtype.get(), DESKTOP, "Type", "MimeType");
1041- EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(wrongtype, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
1042+ EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(wrongtype, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
1043
1044 // not displayable
1045 auto nodisplay = defaultKeyfile();
1046 g_key_file_set_boolean(nodisplay.get(), DESKTOP, "NoDisplay", TRUE);
1047- EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(nodisplay, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
1048- EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(nodisplay, "/", ubuntu::app_launch::app_info::DesktopFlags::ALLOW_NO_DISPLAY, nullptr));
1049+ EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(nodisplay, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
1050+ EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(nodisplay, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::ALLOW_NO_DISPLAY, nullptr));
1051
1052 // hidden
1053 auto hidden = defaultKeyfile();
1054 g_key_file_set_string(hidden.get(), DESKTOP, "Hidden", "true");
1055- EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(hidden, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
1056+ EXPECT_THROW(ubuntu::app_launch::app_info::Desktop(hidden, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr), std::runtime_error);
1057
1058 /* Disabling for OTA11 */
1059 #if 0
1060@@ -128,18 +128,33 @@
1061 #endif
1062 }
1063
1064+TEST_F(ApplicationInfoDesktop, KeyfileIconPatterns)
1065+{
1066+ auto defkeyfile = defaultKeyfile();
1067+ std::string datadir = "/foo/usr/share";
1068+ std::string basedir = "/foo";
1069+
1070+ auto defappinfo = ubuntu::app_launch::app_info::Desktop(defkeyfile, datadir, basedir, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr);
1071+ EXPECT_EQ("/foo/usr/share/foo.png", defappinfo.iconPath().value());
1072+
1073+ auto rootkeyfile = defaultKeyfile();
1074+ g_key_file_set_string(rootkeyfile.get(), DESKTOP, "Icon", "/bar/foo.png");
1075+ auto rootappinfo = ubuntu::app_launch::app_info::Desktop(rootkeyfile, datadir, basedir, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr);
1076+ EXPECT_EQ("/foo/bar/foo.png", rootappinfo.iconPath().value());
1077+}
1078+
1079 TEST_F(ApplicationInfoDesktop, KeyfileDefaultDepartment)
1080 {
1081 auto keyfile = defaultKeyfile();
1082 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Default-Department-ID", "foo");
1083- EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
1084+ EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
1085 }
1086
1087 TEST_F(ApplicationInfoDesktop, KeyfileScreenshotPath)
1088 {
1089 auto keyfile = defaultKeyfile();
1090 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Screenshot", "foo.png");
1091- EXPECT_EQ("/foo.png", ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).screenshotPath().value());
1092+ EXPECT_EQ("/foo.png", ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).screenshotPath().value());
1093 }
1094
1095 TEST_F(ApplicationInfoDesktop, KeyfileKeywords)
1096@@ -148,7 +163,7 @@
1097
1098 auto keyfile = defaultKeyfile();
1099 g_key_file_set_string(keyfile.get(), DESKTOP, "Keywords", "foo;bar;baz;");
1100- EXPECT_EQ(expectedKeywords, ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).keywords().value());
1101+ EXPECT_EQ(expectedKeywords, ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).keywords().value());
1102 }
1103
1104 TEST_F(ApplicationInfoDesktop, KeyfileShowListEdgeCases)
1105@@ -156,17 +171,17 @@
1106 // Not appearing in not show list
1107 auto notshowin = defaultKeyfile();
1108 g_key_file_set_string(notshowin.get(), DESKTOP, "NotShowIn", "Gnome;KDE;");
1109- EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(notshowin, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
1110+ EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(notshowin, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
1111
1112 // Appearing explicitly in only show list
1113 auto onlyshowin = defaultKeyfile();
1114 g_key_file_set_string(onlyshowin.get(), DESKTOP, "OnlyShowIn", (test_dekstop_env + ";Gnome;").c_str());
1115- EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(onlyshowin, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
1116+ EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(onlyshowin, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
1117
1118 // Appearing explicitly in only show list not first
1119 auto onlyshowinmiddle = defaultKeyfile();
1120 g_key_file_set_string(onlyshowinmiddle.get(), DESKTOP, "OnlyShowIn", ("Gnome;" + test_dekstop_env + ";KDE;").c_str());
1121- EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(onlyshowinmiddle, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
1122+ EXPECT_NO_THROW(ubuntu::app_launch::app_info::Desktop(onlyshowinmiddle, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr));
1123 }
1124
1125 TEST_F(ApplicationInfoDesktop, Orientations)
1126@@ -185,72 +200,72 @@
1127
1128 auto keyfile = defaultKeyfile();
1129
1130- EXPECT_EQ(defaultOrientations, ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1131+ EXPECT_EQ(defaultOrientations, ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1132
1133 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "this should not parse");
1134- EXPECT_EQ(defaultOrientations, ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1135+ EXPECT_EQ(defaultOrientations, ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1136
1137 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "this;should;not;parse;");
1138- EXPECT_EQ(defaultOrientations, ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1139+ EXPECT_EQ(defaultOrientations, ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1140
1141 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "portrait;");
1142 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: false, invertedPortrait: false, invertedLandscape: false}),
1143- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1144+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1145
1146 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "landscape;portrait;");
1147 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: true, invertedPortrait: false, invertedLandscape: false}),
1148- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1149+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1150
1151 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "landscape ; portrait; invertedPortrait");
1152 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: true, invertedPortrait: true, invertedLandscape: false}),
1153- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1154+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1155
1156 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "portrait;landscape;");
1157 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: true, invertedPortrait: false, invertedLandscape: false}),
1158- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1159+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1160
1161 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "portrait;landscape;invertedportrait;invertedlandscape;");
1162 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: true, invertedPortrait: true, invertedLandscape: true}),
1163- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1164+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1165
1166 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "PORTRAIT;");
1167 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: false, invertedPortrait: false, invertedLandscape: false}),
1168- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1169+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1170
1171 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "pOrTraIt;lANDscApE;inVErtEDpORtrAit;iNVErtEDLAnDsCapE;");
1172 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: true, landscape: true, invertedPortrait: true, invertedLandscape: true}),
1173- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1174+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1175
1176 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "primary;");
1177 EXPECT_EQ((ubuntu::app_launch::Application::Info::Orientations {portrait: false, landscape: false, invertedPortrait: false, invertedLandscape: false}),
1178- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1179+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1180
1181 g_key_file_set_string(keyfile.get(), DESKTOP, "X-Ubuntu-Supported-Orientations", "foobar;primary;");
1182 EXPECT_EQ(defaultOrientations,
1183- ubuntu::app_launch::app_info::Desktop(keyfile, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1184+ ubuntu::app_launch::app_info::Desktop(keyfile, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).supportedOrientations());
1185 }
1186
1187 TEST_F(ApplicationInfoDesktop, XMirCases)
1188 {
1189 auto xmirunset = defaultKeyfile();
1190 EXPECT_FALSE(
1191- ubuntu::app_launch::app_info::Desktop(xmirunset, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).xMirEnable().value());
1192+ ubuntu::app_launch::app_info::Desktop(xmirunset, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).xMirEnable().value());
1193 EXPECT_TRUE(
1194- ubuntu::app_launch::app_info::Desktop(xmirunset, "/", ubuntu::app_launch::app_info::DesktopFlags::XMIR_DEFAULT, nullptr).xMirEnable().value());
1195+ ubuntu::app_launch::app_info::Desktop(xmirunset, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::XMIR_DEFAULT, nullptr).xMirEnable().value());
1196
1197 auto xmirtrue = defaultKeyfile();
1198 g_key_file_set_boolean(xmirtrue.get(), DESKTOP, "X-Ubuntu-XMir-Enable", TRUE);
1199 EXPECT_TRUE(
1200- ubuntu::app_launch::app_info::Desktop(xmirtrue, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).xMirEnable().value());
1201+ ubuntu::app_launch::app_info::Desktop(xmirtrue, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).xMirEnable().value());
1202 EXPECT_TRUE(
1203- ubuntu::app_launch::app_info::Desktop(xmirtrue, "/", ubuntu::app_launch::app_info::DesktopFlags::XMIR_DEFAULT, nullptr).xMirEnable().value());
1204+ ubuntu::app_launch::app_info::Desktop(xmirtrue, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::XMIR_DEFAULT, nullptr).xMirEnable().value());
1205
1206 auto xmirfalse = defaultKeyfile();
1207 g_key_file_set_boolean(xmirfalse.get(), DESKTOP, "X-Ubuntu-XMir-Enable", FALSE);
1208 EXPECT_FALSE(
1209- ubuntu::app_launch::app_info::Desktop(xmirfalse, "/", ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).xMirEnable().value());
1210+ ubuntu::app_launch::app_info::Desktop(xmirfalse, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::NONE, nullptr).xMirEnable().value());
1211 EXPECT_FALSE(
1212- ubuntu::app_launch::app_info::Desktop(xmirfalse, "/", ubuntu::app_launch::app_info::DesktopFlags::XMIR_DEFAULT, nullptr).xMirEnable().value());
1213+ ubuntu::app_launch::app_info::Desktop(xmirfalse, "/", {}, ubuntu::app_launch::app_info::DesktopFlags::XMIR_DEFAULT, nullptr).xMirEnable().value());
1214 }
1215
1216 } //anonymous namespace
1217
1218=== modified file 'upstart-jobs/application-snap.conf.in'
1219--- upstart-jobs/application-snap.conf.in 2016-09-14 15:32:39 +0000
1220+++ upstart-jobs/application-snap.conf.in 2016-09-14 15:32:40 +0000
1221@@ -12,7 +12,7 @@
1222 env APP_DIR
1223 env APP_DESKTOP_FILE_PATH
1224 env APP_XMIR_ENABLE
1225-evn INSTANCE_ID=""
1226+env INSTANCE_ID=""
1227
1228 env UBUNTU_APP_LAUNCH_ARCH="@ubuntu_app_launch_arch@"
1229 export UBUNTU_APP_LAUNCH_ARCH

Subscribers

People subscribed via source and target branches