Merge lp:~ken-vandine/ubuntu-system-settings/lp1501428 into lp:ubuntu-system-settings

Proposed by Ken VanDine
Status: Rejected
Rejected by: Ken VanDine
Proposed branch: lp:~ken-vandine/ubuntu-system-settings/lp1501428
Merge into: lp:ubuntu-system-settings
Diff against target: 112 lines (+25/-21)
4 files modified
debian/control (+1/-0)
plugins/security-privacy/CMakeLists.txt (+3/-0)
plugins/security-privacy/trust-store-model.cpp (+18/-19)
tests/plugins/security-privacy/CMakeLists.txt (+3/-2)
To merge this branch: bzr merge lp:~ken-vandine/ubuntu-system-settings/lp1501428
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Touch System Settings Pending
Review via email: mp+273066@code.launchpad.net

Commit message

Use ubuntu_app_launch_application_info to get the proper desktop file

Description of the change

Use ubuntu_app_launch_application_info to get the proper desktop file

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
Jonas G. Drange (jonas-drange) wrote :

I think there has to be a changelog for the debian/ changes.

Unmerged revisions

1540. By Ken VanDine

convert short id to proper app_id

1539. By Ken VanDine

Build depend on libubuntu-app-launch2-dev

1538. By Ken VanDine

Use ubuntu_app_launch_application_info to get the proper desktop file

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-09-18 14:20:22 +0000
3+++ debian/control 2015-10-01 13:50:39 +0000
4@@ -20,6 +20,7 @@
5 libqmenumodel-dev,
6 libtimezonemap1-dev (>= 0.4.1),
7 libtrust-store-dev,
8+ libubuntu-app-launch2-dev,
9 libunity-api-dev,
10 libupower-glib-dev,
11 pkg-config,
12
13=== modified file 'plugins/security-privacy/CMakeLists.txt'
14--- plugins/security-privacy/CMakeLists.txt 2015-05-21 13:32:41 +0000
15+++ plugins/security-privacy/CMakeLists.txt 2015-10-01 13:50:39 +0000
16@@ -47,10 +47,12 @@
17 qt5_use_modules(UbuntuSecurityPrivacyPanel Qml Quick DBus)
18
19 pkg_check_modules(TRUST_STORE REQUIRED trust-store)
20+pkg_check_modules(UBUNTU_LAUNCH REQUIRED ubuntu-app-launch-2)
21
22 include_directories(
23 ${CMAKE_CURRENT_BINARY_DIR}
24 ${TRUST_STORE_INCLUDE_DIRS}
25+ ${UBUNTU_LAUNCH_INCLUDE_DIRS}
26 ${GLIB_INCLUDE_DIRS}
27 )
28
29@@ -60,6 +62,7 @@
30 ${ACCOUNTSSERVICE_LDFLAGS}
31 ${GOBJECT_LDFLAGS}
32 ${TRUST_STORE_LDFLAGS}
33+ ${UBUNTU_LAUNCH_LDFLAGS}
34 ${GLIB_LDFLAGS}
35 )
36 install(TARGETS UbuntuSecurityPrivacyPanel UbuntuSecurityPrivacyHelper DESTINATION ${PLUG_DIR})
37
38=== modified file 'plugins/security-privacy/trust-store-model.cpp'
39--- plugins/security-privacy/trust-store-model.cpp 2015-03-16 13:51:36 +0000
40+++ plugins/security-privacy/trust-store-model.cpp 2015-10-01 13:50:39 +0000
41@@ -31,6 +31,7 @@
42 #include <core/trust/store.h>
43
44 #include <glib.h>
45+#include <ubuntu-app-launch.h>
46
47 class Application
48 {
49@@ -83,27 +84,25 @@
50 }
51
52 QString resolveDesktopFilename(const QString &id) {
53- QString localShare =
54- QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
55- QString desktopFilename(QString("%1/applications/%2.desktop").
56- arg(localShare).arg(id));
57- if (QFile(desktopFilename).exists())
58- return desktopFilename;
59-
60- /* search the directory for a matching filename */
61- QDir dir(QString("%1/applications").arg(localShare));
62- dir.setFilter(QDir::Files);
63- QStringList fileList = dir.entryList();
64- QString pattern = QString("%1*.desktop").arg(id);
65- for (int i = 0; i < fileList.count(); i++) {
66- /* stop at the first match */
67- if (QDir::match(pattern, fileList[i])) {
68- return QString("%1/applications/%2").arg(localShare).arg(fileList[i]);
69- }
70+ char * dir = nullptr;
71+ char * file = nullptr;
72+
73+ QString fileName;
74+ std::string appId;
75+
76+ appId = std::string(ubuntu_app_launch_triplet_to_app_id(id.toStdString().c_str(),
77+ "first-listed-app",
78+ "current-user-version"));
79+
80+ if (ubuntu_app_launch_application_info(appId.c_str(), &dir, &file)) {
81+ fileName = QString::fromUtf8(g_strjoin("/", dir, file, NULL));
82+ } else {
83+ qWarning() << "No desktop file found for app id: " << id;
84 }
85
86- qWarning() << "No desktop file found for app id: " << id;
87- return QString();
88+ g_free (dir);
89+ g_free (file);
90+ return fileName;
91 }
92
93 QString resolveIcon(const QString &iconName, const QString &basePath) {
94
95=== modified file 'tests/plugins/security-privacy/CMakeLists.txt'
96--- tests/plugins/security-privacy/CMakeLists.txt 2014-09-29 11:02:28 +0000
97+++ tests/plugins/security-privacy/CMakeLists.txt 2015-10-01 13:50:39 +0000
98@@ -1,11 +1,12 @@
99 set(XVFB_CMD xvfb-run -a -s "-screen 0 640x480x24")
100-include_directories(${CMAKE_CURRENT_BINARY_DIR} ../../../plugins/security-privacy ${GLIB_INCLUDE_DIRS})
101+pkg_check_modules(UBUNTU_LAUNCH REQUIRED ubuntu-app-launch-2)
102+include_directories(${CMAKE_CURRENT_BINARY_DIR} ../../../plugins/security-privacy ${GLIB_INCLUDE_DIRS} ${UBUNTU_LAUNCH_INCLUDE_DIRS})
103 add_definitions(-DTESTS)
104
105 add_executable(tst-trust-store-model
106 tst_trust_store_model.cpp
107 ../../../plugins/security-privacy/trust-store-model.cpp
108 )
109-target_link_libraries (tst-trust-store-model ${GLIB_LDFLAGS})
110+target_link_libraries (tst-trust-store-model ${GLIB_LDFLAGS} ${UBUNTU_LAUNCH_LDFLAGS})
111 qt5_use_modules(tst-trust-store-model Core Gui DBus Qml Test)
112 add_test(NAME tst-trust-store-model COMMAND ${XVFB_CMD} ${CMAKE_CURRENT_BINARY_DIR}/tst-trust-store-model)

Subscribers

People subscribed via source and target branches