From 74f500983b89f6f3c7e150db443be4fe8b6652ac Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 24 Jun 2015 16:33:31 -0500 Subject: [PATCH 1/2] Launch with autostart instead of D-Bus activation We cannot install a D-Bus service file because multiple programs can provide org.freedesktop.Notifications (gnome-shell, GNOME Flashback notification-daemon, mate-notification-daemon, Unity notify-osd, etc.) but only one can run at a given time. In order to avoid a race condition, none of them should register for D-Bus activation, but leave the session manager to launch the service provider for the given desktop. --- .gitignore | 3 +- Makefile.am | 16 ++++----- acinclude.m4 | 40 ++++++++++++++++++++++ configure.ac.in | 5 ++- po/POTFILES.in | 1 + po/POTFILES.skip | 1 + ...org.xfce.xfce4-notifyd.Notifications.service.in | 3 -- .../xfce4-notifyd-autostart.desktop.in.in | 6 ++++ 8 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 acinclude.m4 create mode 100644 po/POTFILES.skip delete mode 100644 xfce4-notifyd/org.xfce.xfce4-notifyd.Notifications.service.in create mode 100644 xfce4-notifyd/xfce4-notifyd-autostart.desktop.in.in diff --git a/.gitignore b/.gitignore index f042be0..c2889df 100644 --- a/.gitignore +++ b/.gitignore @@ -41,12 +41,13 @@ xfce4-notifyd-config/xfce4-notifyd-config.desktop xfce4-notifyd-config/xfce4-notifyd-config.ui.h xfce4-notifyd/notify-dbus.h -xfce4-notifyd/org.xfce.xfce4-notifyd.Notifications.service xfce4-notifyd/xfce-notify-enum-types.c xfce4-notifyd/xfce-notify-enum-types.h xfce4-notifyd/xfce-notify-marshal.c xfce4-notifyd/xfce-notify-marshal.h xfce4-notifyd/xfce4-notifyd +xfce4-notifyd/xfce4-notifyd-autostart.desktop +xfce4-notifyd/xfce4-notifyd-autostart.desktop.in tests/test-actions tests/test-positioning diff --git a/Makefile.am b/Makefile.am index df81bea..be5ec5a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -71,15 +71,14 @@ xfce4_notifyd_config_xfce4_notifyd_config_LDADD = \ $(LIBNOTIFY_LIBS) -servicedir = $(datadir)/dbus-1/services -service_in_files = xfce4-notifyd/org.xfce.xfce4-notifyd.Notifications.service.in -service_DATA = $(service_in_files:.service.in=.service) +autostartdir = $(sysconfdir)/xdg/autostart +autostart_in_files = xfce4-notifyd/xfce4-notifyd-autostart.desktop.in +autostart_DATA = $(autostart_in_files:.desktop.in=.desktop) dist_service = \ - $(service_in_files) \ xfce4-notifyd/notify-dbus.xml \ xfce4-notifyd/xfce-notify-marshal.list -distclean_service = $(service_DATA) +clean_service = $(autostart_DATA) dist_man1_MANS = \ xfce4-notifyd-config/xfce4-notifyd-config.1 @@ -151,12 +150,12 @@ BUILT_SOURCES = \ $(built_xfce4_notifyd_config) CLEANFILES = \ + $(clean_service) \ $(clean_xfce4_notifyd) \ $(clean_xfce4_notifyd_config) DISTCLEANFILES = \ - $(distclean_intltool) \ - $(distclean_service) + $(distclean_intltool) xfce4-notifyd/notify-dbus.h: $(srcdir)/xfce4-notifyd/notify-dbus.xml Makefile if USE_OLD_GET_SERVER_INFORMATION_SIGNATURE @@ -237,9 +236,6 @@ install-data-hook: echo "***"; \ fi -xfce4-notifyd/%.service: $(srcdir)/xfce4-notifyd/%.service.in Makefile - sed -e "s,\@notifydir\@,$(xfce4_notifyddir),g" < $< > $@ - distclean-local: -rm -rf *.cache *~ diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..0c71173 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,40 @@ +dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) +dnl +dnl example +dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) +dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local + +AC_DEFUN([AS_AC_EXPAND], +[ + EXP_VAR=[$1] + FROM_VAR=[$2] + + dnl first expand prefix and exec_prefix if necessary + prefix_save=$prefix + exec_prefix_save=$exec_prefix + + dnl if no prefix given, then use /usr/local, the default prefix + if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + fi + dnl if no exec_prefix given, then use prefix + if test "x$exec_prefix" = "xNONE"; then + exec_prefix=$prefix + fi + + full_var="$FROM_VAR" + dnl loop until it doesn't change anymore + while true; do + new_full_var="`eval echo $full_var`" + if test "x$new_full_var"="x$full_var"; then break; fi + full_var=$new_full_var + done + + dnl clean up + full_var=$new_full_var + AC_SUBST([$1], "$full_var") + + dnl restore prefix and exec_prefix + prefix=$prefix_save + exec_prefix=$exec_prefix_save +]) diff --git a/configure.ac.in b/configure.ac.in index cf5258f..cefb0e2 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -28,12 +28,14 @@ dnl init automake AM_INIT_AUTOMAKE([1.8 dist-bzip2 tar-ustar no-dist-gzip subdir-objects]) AM_MAINTAINER_MODE() +AS_AC_EXPAND(LIBDIR, $libdir) + dnl set helper path prefix AC_ARG_WITH([helper-path-prefix], [AC_HELP_STRING([--with-helper-path-prefix=PATH], [Path prefix under which helper executables will be installed (default: $libdir)])], [HELPER_PATH_PREFIX="$withval"], - [HELPER_PATH_PREFIX="$libdir"]) + [HELPER_PATH_PREFIX="$LIBDIR"]) AC_SUBST([HELPER_PATH_PREFIX]) dnl check for UNIX variants @@ -118,4 +120,5 @@ AC_OUTPUT( [ Makefile po/Makefile.in + xfce4-notifyd/xfce4-notifyd-autostart.desktop.in ]) diff --git a/po/POTFILES.in b/po/POTFILES.in index a4b0cbf..5819691 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -4,4 +4,5 @@ xfce4-notifyd/xfce-notify-window.c xfce4-notifyd-config/main.c xfce4-notifyd-config/xfce4-notifyd-config.glade # files added by intltool-prepare +xfce4-notifyd/xfce4-notifyd-autostart.desktop.in.in xfce4-notifyd-config/xfce4-notifyd-config.desktop.in diff --git a/po/POTFILES.skip b/po/POTFILES.skip new file mode 100644 index 0000000..01bc6e6 --- /dev/null +++ b/po/POTFILES.skip @@ -0,0 +1 @@ +xfce4-notifyd/xfce4-notifyd-autostart.desktop.in diff --git a/xfce4-notifyd/org.xfce.xfce4-notifyd.Notifications.service.in b/xfce4-notifyd/org.xfce.xfce4-notifyd.Notifications.service.in deleted file mode 100644 index 578a4b5..0000000 --- a/xfce4-notifyd/org.xfce.xfce4-notifyd.Notifications.service.in +++ /dev/null @@ -1,3 +0,0 @@ -[D-BUS Service] -Name=org.freedesktop.Notifications -Exec=@notifydir@/xfce4-notifyd diff --git a/xfce4-notifyd/xfce4-notifyd-autostart.desktop.in.in b/xfce4-notifyd/xfce4-notifyd-autostart.desktop.in.in new file mode 100644 index 0000000..7e224e7 --- /dev/null +++ b/xfce4-notifyd/xfce4-notifyd-autostart.desktop.in.in @@ -0,0 +1,6 @@ +[Desktop Entry] +_Name=Xfce Notify Daemon +Type=Application +Exec=@HELPER_PATH_PREFIX@/xfce4/notifyd/xfce4-notifyd +Icon=xfce4-notifyd +OnlyShowIn=XFCE; -- 2.4.4