[gnome-weather/wip/systemd-service] Switch to use systemd for service and DBus activation



commit a8ebd2fcb0c1042875ee3933517d41afe2d3a537
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Jan 1 14:57:23 2014 +0100

    Switch to use systemd for service and DBus activation
    
    The future is systemd running off kdbus, which means that
    legacy DBus service files get replaced by a combination of
    systemd .service and .busname.

 configure.ac                                  |    1 +
 data/Makefile.am                              |   11 +++++++++--
 data/org.gnome.Weather.Application.busname    |   11 +++++++++++
 data/org.gnome.Weather.Application.service.in |   12 +++++++++---
 4 files changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d55edc5..724541d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,6 +39,7 @@ PKG_CHECK_MODULES([DEPS], [gdk-3.0
                            gweather-3.0 >= 3.9.5])
 
 AC_PATH_PROG([GJS],[gjs])
+AC_PATH_PROG([GAPPLICATION], [gapplication])
 
 GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
 AC_SUBST(GLIB_COMPILE_RESOURCES)
diff --git a/data/Makefile.am b/data/Makefile.am
index 232b0b6..923f4c3 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -28,11 +28,18 @@ $(PACKAGE_NAME).service: $(PACKAGE_NAME).service.in
                -e "s|[ ]PACKAGE_NAME@|$(PACKAGE_NAME)|g" \
                -e "s|[ ]pkgdatadir@|$(pkgdatadir)|g" \
                -e "s|[ ]pkglibdir@|$(pkglibdir)|g" \
+               -e "s|[ ]GAPPLICATION@|$(GAPPLICATION)|g" \
                $< > $@
 
+servicedir = $(prefix)/lib/systemd/user
+service_DATA = $(PACKAGE_NAME).service $(PACKAGE_NAME).busname
 
-servicedir = $(datadir)/dbus-1/services
-service_DATA = $(PACKAGE_NAME).service
+install-data-hook:
+       $(MKDIR_P) $(DESTDIR)$(servicedir)/busnames.target.wants
+       $(LN_S) ../$(PACKAGE_NAME).busname 
$(DESTDIR)$(servicedir)/busnames.target.wants/$(PACKAGE_NAME).busname
+
+uninstall-hook:
+       rm -f $(DESTDIR)$(servicedir)/busnames.target.wants/$(PACKAGE_NAME).busname
 
 searchproviderdir = $(datadir)/gnome-shell/search-providers
 dist_searchprovider_DATA = org.gnome.Weather.Application.search-provider.ini
diff --git a/data/org.gnome.Weather.Application.busname b/data/org.gnome.Weather.Application.busname
new file mode 100644
index 0000000..09c5a82
--- /dev/null
+++ b/data/org.gnome.Weather.Application.busname
@@ -0,0 +1,11 @@
+[Unit]
+# Optional
+Description=org.gnome.Weather.Application
+# Optional (obviously)
+Documentation=https://wiki.gnome.org/Apps/Weather
+
+[BusName]
+# Optional
+Name=org.gnome.Weather.Application
+# Optional
+Service=org.gnome.Weather.Application.service
\ No newline at end of file
diff --git a/data/org.gnome.Weather.Application.service.in b/data/org.gnome.Weather.Application.service.in
index 2f615d9..d170f60 100644
--- a/data/org.gnome.Weather.Application.service.in
+++ b/data/org.gnome.Weather.Application.service.in
@@ -1,3 +1,9 @@
-[D-BUS Service]
-Name= PACKAGE_NAME@
-Exec= pkgdatadir@/@PACKAGE_NAME@
\ No newline at end of file
+[Unit]
+Description=GNOME Weather
+Documentation=https://wiki.gnome.org/Apps/Weather
+
+[Service]
+BusName=org.gnome.Weather.Application
+ExecStart= pkgdatadir@/org.gnome.Weather.Application
+#Type=application
+ExecStop= GAPPLICATION@ action org.gnome.Weather.Application quit


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]