Merge lp:~ted/ubuntu-app-launch/session-bus into lp:ubuntu-app-launch/14.04

Proposed by Ted Gould
Status: Merged
Approved by: Charles Kerr
Approved revision: 91
Merged at revision: 89
Proposed branch: lp:~ted/ubuntu-app-launch/session-bus
Merge into: lp:ubuntu-app-launch/14.04
Diff against target: 112 lines (+7/-39)
4 files modified
debian/control (+2/-0)
libupstart-app-launch/upstart-app-launch.c (+4/-36)
test-conffile.sh (+1/-1)
tests/libual-test.cc (+0/-2)
To merge this branch: bzr merge lp:~ted/ubuntu-app-launch/session-bus
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+196549@code.launchpad.net

Commit message

Use Upstart on the session bus instead of the private bus

Description of the change

Upstart 1.11 connects to the session bus so we can use it there without having another connection. Way better. Let's do that!

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
91. By Ted Gould

Upstart only has two numbers

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

WfM on the phone, and it's always nice to drop out pieces of code. :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2013-11-19 03:35:22 +0000
+++ debian/control 2013-11-25 16:27:39 +0000
@@ -17,6 +17,7 @@
17 libupstart-dev,17 libupstart-dev,
18 libzeitgeist-2.0-dev,18 libzeitgeist-2.0-dev,
19 python3-dbusmock,19 python3-dbusmock,
20 upstart (>= 1.11),
20Standards-Version: 3.9.421Standards-Version: 3.9.4
21Homepage: http://launchpad.net/upstart-app-launch22Homepage: http://launchpad.net/upstart-app-launch
22# If you aren't a member of ~indicator-applet-developers but need to upload packaging changes,23# If you aren't a member of ~indicator-applet-developers but need to upload packaging changes,
@@ -30,6 +31,7 @@
30 ${misc:Depends},31 ${misc:Depends},
31 click (>= 0.4.9),32 click (>= 0.4.9),
32 click-apparmor,33 click-apparmor,
34 upstart (>= 1.11),
33 zeitgeist,35 zeitgeist,
34Description: Upstart Job for Launching Applications36Description: Upstart Job for Launching Applications
35 Upstart Job file and associated utilities that is used to launch37 Upstart Job file and associated utilities that is used to launch
3638
=== modified file 'libupstart-app-launch/upstart-app-launch.c'
--- libupstart-app-launch/upstart-app-launch.c 2013-11-19 02:56:47 +0000
+++ libupstart-app-launch/upstart-app-launch.c 2013-11-25 16:27:39 +0000
@@ -34,26 +34,11 @@
34 DBusConnection * conn;34 DBusConnection * conn;
35 DBusError error;35 DBusError error;
36 const gchar * bus_name = NULL;36 const gchar * bus_name = NULL;
37 gboolean use_private = FALSE;
3837
39 dbus_error_init(&error);38 dbus_error_init(&error);
40 use_private = (g_getenv("UPSTART_APP_LAUNCH_USE_SESSION") == NULL);39
4140 conn = dbus_bus_get(DBUS_BUS_SESSION, &error);
42 if (use_private) {41 bus_name = "com.ubuntu.Upstart";
43 const gchar * upstart_session;
44
45 upstart_session = g_getenv("UPSTART_SESSION");
46 if (upstart_session == NULL) {
47 g_warning("Not running under Upstart User Session");
48 dbus_error_free(&error);
49 return NULL;
50 }
51
52 conn = dbus_connection_open(upstart_session, &error);
53 } else {
54 conn = dbus_bus_get(DBUS_BUS_SESSION, &error);
55 bus_name = "com.ubuntu.Upstart";
56 }
5742
58 if (conn == NULL) {43 if (conn == NULL) {
59 g_warning("Unable to connect to the Upstart Session: %s", error.message);44 g_warning("Unable to connect to the Upstart Session: %s", error.message);
@@ -70,8 +55,6 @@
7055
71 if (upstart == NULL) {56 if (upstart == NULL) {
72 g_warning("Unable to build proxy to Upstart");57 g_warning("Unable to build proxy to Upstart");
73 if (use_private)
74 dbus_connection_close(conn);
75 dbus_connection_unref(conn);58 dbus_connection_unref(conn);
76 return NULL;59 return NULL;
77 }60 }
@@ -251,22 +234,7 @@
251 }234 }
252235
253 GError * error = NULL;236 GError * error = NULL;
254237 gdbus_upstart = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
255 if (g_getenv("UPSTART_APP_LAUNCH_USE_SESSION") == NULL) {
256 const gchar * upstart_addr = g_getenv("UPSTART_SESSION");
257 if (upstart_addr == NULL) {
258 g_print("Doesn't appear to be an upstart user session\n");
259 return NULL;
260 }
261
262 gdbus_upstart = g_dbus_connection_new_for_address_sync(upstart_addr,
263 G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
264 NULL, /* auth */
265 NULL, /* cancel */
266 &error);
267 } else {
268 gdbus_upstart = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
269 }
270238
271 if (error != NULL) {239 if (error != NULL) {
272 g_warning("Unable to connect to Upstart bus: %s", error->message);240 g_warning("Unable to connect to Upstart bus: %s", error->message);
273241
=== modified file 'test-conffile.sh'
--- test-conffile.sh 2013-07-02 17:17:08 +0000
+++ test-conffile.sh 2013-11-25 16:27:39 +0000
@@ -5,7 +5,7 @@
5# Only test on newer versions of Upstart, like not the5# Only test on newer versions of Upstart, like not the
6# versions on the builders6# versions on the builders
7if [ ${UPSTARTVERSION} -gt 7 ] ; then7if [ ${UPSTARTVERSION} -gt 7 ] ; then
8 init-checkconf $18 dbus-test-runner --task init-checkconf --parameter "$1" --task-name init-checkconf
9else9else
10 echo "Upstart Version: $UPSTARTVERSION"10 echo "Upstart Version: $UPSTARTVERSION"
11 echo " ....Skipping Tests"11 echo " ....Skipping Tests"
1212
=== modified file 'tests/libual-test.cc'
--- tests/libual-test.cc 2013-11-19 03:02:31 +0000
+++ tests/libual-test.cc 2013-11-25 16:27:39 +0000
@@ -48,8 +48,6 @@
48 }48 }
4949
50 virtual void SetUp() {50 virtual void SetUp() {
51 g_setenv("UPSTART_APP_LAUNCH_USE_SESSION", "1", TRUE);
52
53 service = dbus_test_service_new(NULL);51 service = dbus_test_service_new(NULL);
5452
55 debugConnection();53 debugConnection();

Subscribers

People subscribed via source and target branches