aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2013-10-31 17:57:31 +0000
committerTarmac <Unknown>2013-10-31 17:57:31 +0000
commitf2ce0ee87fb8191e4fc07766f23d10badd2ec775 (patch)
tree76335695257cf5128fcfdd2a86543c657a8c1a84
parentda34f0cbe9eb05dcaf25fc0a502b4ae15d40ae27 (diff)
parent96efd3b86974e72d1c23a328e6892cacefc79e8c (diff)
downloadayatana-indicator-application-f2ce0ee87fb8191e4fc07766f23d10badd2ec775.tar.gz
ayatana-indicator-application-f2ce0ee87fb8191e4fc07766f23d10badd2ec775.tar.bz2
ayatana-indicator-application-f2ce0ee87fb8191e4fc07766f23d10badd2ec775.zip
Switch indicator application over to having an upstart job for managing the service. Also make it emit it's own event for when application indicators should be started so we can clean up the boot sequence. Fixes: https://bugs.launchpad.net/bugs/1185565.
Approved by PS Jenkins bot, Charles Kerr.
-rw-r--r--.bzrignore2
-rw-r--r--configure.ac11
-rw-r--r--data/Makefile.am17
-rw-r--r--data/indicator-application.conf.in15
-rw-r--r--data/indicator-application.desktop.in9
-rw-r--r--data/indicator-application.service.in3
-rw-r--r--src/application-service-watcher.c31
7 files changed, 69 insertions, 19 deletions
diff --git a/.bzrignore b/.bzrignore
index f73cbd7..317a187 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -110,3 +110,5 @@ bindings/mono/policy.0.0.appindicator-sharp.config
bindings/mono/policy.0.0.appindicator-sharp.dll
src/libapplication_la-generate-id.lo
src/libappindicator_la-generate-id.lo
+indicator-application.conf
+indicator-application.desktop
diff --git a/configure.ac b/configure.ac
index 1cc1811..2d1ccc0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,17 +89,6 @@ AC_SUBST(INDICATORDIR)
AC_SUBST(INDICATORICONSDIR)
###########################
-# DBus Service Info
-###########################
-
-if test "x$with_localinstall" = "xyes"; then
- DBUSSERVICEDIR="${datadir}/dbus-1/services/"
-else
- DBUSSERVICEDIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`
-fi
-AC_SUBST(DBUSSERVICEDIR)
-
-###########################
# Files
###########################
diff --git a/data/Makefile.am b/data/Makefile.am
index c142c4e..77ec71d 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,17 +1,24 @@
-dbus_servicesdir = $(DBUSSERVICEDIR)
-dbus_services_DATA = indicator-application.service
+upstart_jobsdir = $(datadir)/upstart/sessions/
+upstart_jobs_DATA = indicator-application.conf
-%.service: %.service.in
+%.conf: %.conf.in
+ sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
+
+xdg_autostartdir = /etc/xdg/autostart
+xdg_autostart_DATA = indicator-application.desktop
+
+%.desktop: %.desktop.in
sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
overridedir = $(pkgdatadir)
override_DATA = ordering-override.keyfile
EXTRA_DIST = \
- indicator-application.service.in \
+ indicator-application.desktop.in \
+ indicator-application.conf.in \
ordering-override.keyfile
CLEANFILES = \
- indicator-application.service
+ indicator-application.conf
diff --git a/data/indicator-application.conf.in b/data/indicator-application.conf.in
new file mode 100644
index 0000000..ddc803c
--- /dev/null
+++ b/data/indicator-application.conf.in
@@ -0,0 +1,15 @@
+description "Indicator Application Service"
+
+# NOTE: Limiting only to Unity 7 right now as it's still using
+# dbusmenu. That can be lifted after it is ported to GMenu
+
+start on (indicators-loaded or indicator-services-start) and xsession SESSION=ubuntu
+stop on desktop-end or indicator-services-end
+
+emits appindicators-start appindicators-end
+
+respawn
+
+exec @libexecdir@/indicator-application-service
+
+pre-stop exec initctl emit appindicators-end
diff --git a/data/indicator-application.desktop.in b/data/indicator-application.desktop.in
new file mode 100644
index 0000000..61d3c4d
--- /dev/null
+++ b/data/indicator-application.desktop.in
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Application
+Name=Indicator Application
+Exec=@libexecdir@/indicator-application-service
+NotShowIn=Unity;
+NoDisplay=true
+StartupNotify=false
+Terminal=false
+
diff --git a/data/indicator-application.service.in b/data/indicator-application.service.in
deleted file mode 100644
index f6ceee3..0000000
--- a/data/indicator-application.service.in
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=com.canonical.indicator.application
-Exec=@libexecdir@/indicator-application-service
diff --git a/src/application-service-watcher.c b/src/application-service-watcher.c
index 006f3aa..13280ba 100644
--- a/src/application-service-watcher.c
+++ b/src/application-service-watcher.c
@@ -288,5 +288,36 @@ get_name_cb (DBusGProxy * proxy, guint status, GError * error, gpointer data)
return;
}
+ /* After we've got the name we can request upstart to trigger
+ the jobs of any application indicators that need to start
+ at desktop init time. */
+
+ GError * spawn_error = NULL;
+ gchar * argv[] = {
+ "initctl",
+ "--session",
+ "--user",
+ "emit",
+ "--no-wait",
+ "appindicators-start",
+ NULL,
+ };
+
+ g_spawn_async(NULL, /* Working Directory */
+ argv,
+ NULL, /* environment */
+ G_SPAWN_SEARCH_PATH,
+ NULL, NULL, /* child setup function */
+ NULL, /* Pid */
+ &spawn_error);
+
+ if (spawn_error != NULL) {
+ /* NOTE: When we get to the point where we can start
+ assuming upstart user sessions this can be escillated
+ to a warning or higher */
+ g_debug("Unable to signal appindicators-start to upstart: %s", spawn_error->message);
+ g_error_free(spawn_error);
+ }
+
return;
}