Merge lp:~kyrofa/go-ual/add_tripet_to_app_id into lp:go-ual

Proposed by Kyle Fazzari
Status: Merged
Approved by: dobey
Approved revision: 7
Merged at revision: 7
Proposed branch: lp:~kyrofa/go-ual/add_tripet_to_app_id
Merge into: lp:go-ual
Diff against target: 43 lines (+33/-0)
1 file modified
ual/ubuntu_app_launch.go (+33/-0)
To merge this branch: bzr merge lp:~kyrofa/go-ual/add_tripet_to_app_id
Reviewer Review Type Date Requested Status
dobey (community) Approve
Review via email: mp+273147@code.launchpad.net

Commit message

Implement binding for ubuntu_app_launch_triplet_to_app_id().

Description of the change

Implement binding for ubuntu_app_launch_triplet_to_app_id().

To post a comment you must log in.
Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ual/ubuntu_app_launch.go'
2--- ual/ubuntu_app_launch.go 2015-09-22 14:12:47 +0000
3+++ ual/ubuntu_app_launch.go 2015-10-01 22:05:36 +0000
4@@ -58,6 +58,39 @@
5 return uint32(C.ubuntu_app_launch_get_primary_pid(appIdCstring))
6 }
7
8+// TripletToAppId constructs an application ID from package, app, and version
9+// triplet. Wildcards are allowed for the appName and version parameters.
10+//
11+// For the appName parameters, the wildcards are "first-listed-app",
12+// "last-listed-app", and "only-listed-app." An empty string will default to
13+// the first listed app.
14+//
15+// For the version parameter, the only wildcard is "current-user-version." An
16+// empty string will default to current user version.
17+func TripletToAppId(packageName string, appName string, version string) string {
18+ packageNameCstring := (*C.gchar)(nil)
19+ appNameCstring := (*C.gchar)(nil)
20+ versionCstring := (*C.gchar)(nil)
21+
22+ if packageName != "" {
23+ packageNameCstring = (*C.gchar)(C.CString(packageName))
24+ defer C.free(unsafe.Pointer(packageNameCstring))
25+ }
26+
27+ if appName != "" {
28+ appNameCstring = (*C.gchar)(C.CString(appName))
29+ defer C.free(unsafe.Pointer(appNameCstring))
30+ }
31+
32+ if version != "" {
33+ versionCstring = (*C.gchar)(C.CString(version))
34+ defer C.free(unsafe.Pointer(versionCstring))
35+ }
36+
37+ return C.GoString((*C.char)(C.ubuntu_app_launch_triplet_to_app_id(
38+ packageNameCstring, appNameCstring, versionCstring)))
39+}
40+
41 // StartSessionHelper starts an untrusted helper for a specific type of a given
42 // appid running under a Mir Trusted Prompt Session. The helper's MIR_SOCKET
43 // environment variable will be set appropriately so that the helper will draw

Subscribers

People subscribed via source and target branches

to all changes: