Merge lp:~larryprice/libertine/recurse-apps-dir into lp:libertine

Proposed by Larry Price
Status: Merged
Approved by: Christopher Townsend
Approved revision: 276
Merged at revision: 279
Proposed branch: lp:~larryprice/libertine/recurse-apps-dir
Merge into: lp:libertine
Diff against target: 86 lines (+16/-4)
2 files modified
liblibertine/libertine.cpp (+14/-2)
liblibertine/libertine.h (+2/-2)
To merge this branch: bzr merge lp:~larryprice/libertine/recurse-apps-dir
Reviewer Review Type Date Requested Status
Christopher Townsend Approve
Libertine CI Bot continuous-integration Approve
Review via email: mp+301694@code.launchpad.net

Commit message

Add API method for finding application desktop files, and extend desktop file search to recurse directories.

Description of the change

Add API method for finding application desktop files, and extend desktop file search to recurse directories.

I also have an impending MP for ubuntu-app-launch which will use this new endpoint, and I will have a quick MP to add a few new apps to the blacklist for libertine-scope.

To post a comment you must log in.
Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :

PASSED: Continuous integration, rev:274
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/65/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/libertine/job/build/231
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=default/188
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=default/188
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=default/188
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=vivid+overlay,testname=default/188
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=xenial+overlay,testname=default/188
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=yakkety,testname=default/188
    None: https://jenkins.canonical.com/libertine/job/lp-generic-update-mp/175/console
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-0-fetch/234
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-1-sourcepkg/release=vivid+overlay/219
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-1-sourcepkg/release=xenial+overlay/219
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-1-sourcepkg/release=yakkety/219
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=vivid+overlay/212
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=vivid+overlay/212/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/212
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/212/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=yakkety/212
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=yakkety/212/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=vivid+overlay/212
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=vivid+overlay/212/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/212
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/212/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=yakkety/212
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=yakkety/212/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/65/rebuild

review: Approve (continuous-integration)
Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :

PASSED: Continuous integration, rev:275
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/66/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/libertine/job/build/233
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=default/190
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=default/190
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=default/190
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=vivid+overlay,testname=default/190
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=xenial+overlay,testname=default/190
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=yakkety,testname=default/190
    None: https://jenkins.canonical.com/libertine/job/lp-generic-update-mp/177/console
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-0-fetch/236
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-1-sourcepkg/release=vivid+overlay/221
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-1-sourcepkg/release=xenial+overlay/221
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-1-sourcepkg/release=yakkety/221
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=vivid+overlay/214
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=vivid+overlay/214/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/214
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/214/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=yakkety/214
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=yakkety/214/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=vivid+overlay/214
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=vivid+overlay/214/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/214
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/214/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=yakkety/214
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=yakkety/214/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/66/rebuild

review: Approve (continuous-integration)
Revision history for this message
Larry Price (larryprice) wrote :

Need to rework this again to ensure we're not duplicating too much code here and in libu-a-l.

Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :

PASSED: Continuous integration, rev:276
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/67/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/libertine/job/build/236
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=default/193
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=default/193
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=default/193
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=vivid+overlay,testname=default/193
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=xenial+overlay,testname=default/193
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=yakkety,testname=default/193
    None: https://jenkins.canonical.com/libertine/job/lp-generic-update-mp/179/console
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-0-fetch/239
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-1-sourcepkg/release=vivid+overlay/224
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-1-sourcepkg/release=xenial+overlay/224
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-1-sourcepkg/release=yakkety/224
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=vivid+overlay/217
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=vivid+overlay/217/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/217
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/217/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=yakkety/217
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=yakkety/217/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=vivid+overlay/217
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=vivid+overlay/217/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/217
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/217/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=yakkety/217
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=yakkety/217/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/libertine/job/lp-libertine-ci/67/rebuild

review: Approve (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

Ok, looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'liblibertine/libertine.cpp'
2--- liblibertine/libertine.cpp 2016-05-06 20:06:43 +0000
3+++ liblibertine/libertine.cpp 2016-08-03 17:21:14 +0000
4@@ -21,17 +21,19 @@
5 #include "libertine/ContainerConfigList.h"
6 #include "libertine/LibertineConfig.h"
7
8+
9 namespace
10 {
11 constexpr auto DESKTOP_EXTENSION = ".desktop";
12 constexpr auto GLOBAL_APPLICATIONS = "usr/share/applications";
13 constexpr auto LOCAL_APPLICATIONS = ".local/share/applications";
14
15+
16 GError*
17 list_apps_from_path(gchar* path, const gchar* container_id, GArray* apps)
18 {
19 GError* error = nullptr;
20- GDir * dir = g_dir_open(path, 0, &error);
21+ GDir* dir = g_dir_open(path, 0, &error);
22 if (error != nullptr)
23 {
24 return error;
25@@ -50,6 +52,14 @@
26 g_array_append_val(apps, app_id);
27 g_free(name);
28 }
29+ else if (g_file_test(file, G_FILE_TEST_IS_DIR))
30+ {
31+ error = list_apps_from_path(file, container_id, apps);
32+ if (error != nullptr)
33+ {
34+ return error;
35+ }
36+ }
37 g_free(file);
38 }
39
40@@ -58,6 +68,7 @@
41 }
42 }
43
44+
45 gchar**
46 libertine_list_apps_for_container(const gchar* container_id)
47 {
48@@ -92,6 +103,7 @@
49 return (gchar**)g_array_free(apps, FALSE);
50 }
51
52+
53 gchar **
54 libertine_list_containers(void)
55 {
56@@ -106,7 +118,7 @@
57
58 for (i = 0; i < container_count; ++i)
59 {
60- id = container_list.data(container_list.index(i, 0), (int)ContainerConfigList::DataRole::ContainerId);
61+ id = container_list.data(container_list.index(i, 0), (int)ContainerConfigList::DataRole::ContainerId);
62 gchar * container_id = g_strdup((gchar *)id.toString().toStdString().c_str());
63 g_array_append_val(containers, container_id);
64 }
65
66=== modified file 'liblibertine/libertine.h'
67--- liblibertine/libertine.h 2015-09-21 19:13:40 +0000
68+++ liblibertine/libertine.h 2016-08-03 17:21:14 +0000
69@@ -24,7 +24,7 @@
70
71 /**
72 * libertine_list_containers:
73- *
74+ *
75 * Gets the list of existing containers for the user.
76 *
77 * Return value: (transfer full): A NULL terminated list of
78@@ -68,7 +68,7 @@
79 /**
80 * libertine_list_apps_for_container:
81 * @container_id: ID of the container
82- *
83+ *
84 * Gets the list of existing apps installed in a container.
85 *
86 * Return value: (transfer full): A NULL terminated list of

Subscribers

People subscribed via source and target branches