diff --git a/Makefile b/Makefile index e1f4a54..a08418c 100644 --- a/Makefile +++ b/Makefile @@ -128,6 +128,7 @@ dist: clean build-manpages ${PROJECT}.1.rst ${PROJECT}rc.5.rst ${OSOURCE} ${HEADER} ${PROJECT}.pc.in \ ${PROJECT}.desktop version.h.in \ ${PROJECT}.1 ${PROJECT}rc.5 \ + org.pwmt.zathura.synxtex.xml \ ${PROJECT}-${VERSION} $(QUIET)cp tests/Makefile tests/config.mk tests/*.c \ ${PROJECT}-${VERSION}/tests @@ -184,7 +185,12 @@ install-headers: ${PROJECT}.pc $(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}/pkgconfig $(QUIET)install -m 644 ${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig -install: all install-headers install-manpages +install-dbus: + $(ECHO) installing D-Bus interface definitions + $(QUIET)mkdir -m 755 -p $(DESTDIR)$(DBUSINTERFACEDIR) + $(QUIET)install -m 644 org.pwmt.zathura.synxtex.xml $(DESTDIR)$(DBUSINTERFACEDIR) + +install: all install-headers install-manpages install-dbus $(ECHO) installing executable file $(QUIET)mkdir -m 755 -p ${DESTDIR}${PREFIX}/bin $(QUIET)install -m 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin diff --git a/config.mk b/config.mk index 620faa7..e167660 100644 --- a/config.mk +++ b/config.mk @@ -43,6 +43,7 @@ MANPREFIX ?= ${PREFIX}/share/man DESKTOPPREFIX ?= ${PREFIX}/share/applications LIBDIR ?= ${PREFIX}/lib INCLUDEDIR ?= ${PREFIX}/include +DBUSINTERFACEDIR =? ${PREFIX}/share/dbus-1/interfaces # plugin directory PLUGINDIR ?= ${LIBDIR}/zathura diff --git a/synctex-dbus.c b/synctex-dbus.c index 4de17da..6d003f8 100644 --- a/synctex-dbus.c +++ b/synctex-dbus.c @@ -14,8 +14,10 @@ G_DEFINE_TYPE(ZathuraSynctexDbus, zathura_synctex_dbus, G_TYPE_OBJECT) /* template for bus name */ static const char DBUS_NAME_TEMPLATE[] = "org.pwmt.zathura.PID-%d"; -/* template for object path */ -const char DBUS_OBJPATH[] = "/org/pwmt/zathura/synctex"; +/* object path */ +static const char DBUS_OBJPATH[] = "/org/pwmt/zathura/synctex"; +/* interface name */ +static const char DBUS_INTERFACE[] = "org.pwmt.zathura.synctex"; typedef struct private_s { zathura_t* zathura; @@ -32,7 +34,7 @@ typedef struct private_s { /* Introspection data for the service we are exporting */ static const char SYNCTEX_DBUS_INTROSPECTION[] = "\n" - " \n" + " \n" " \n" " \n" " \n" @@ -270,7 +272,7 @@ synctex_forward_position(const char* filename, const char* position) GVariant* vfilename = g_dbus_connection_call_sync(connection, name, DBUS_OBJPATH, "org.freedesktop.DBus.Properties", - "Get", g_variant_new("(ss)", "org.pwmt.zathura.Synctex", "filename"), + "Get", g_variant_new("(ss)", DBUS_INTERFACE, "filename"), G_VARIANT_TYPE("(v)"), G_DBUS_CALL_FLAGS_NONE, TIMEOUT, NULL, &error); if (vfilename == NULL) { @@ -296,7 +298,7 @@ synctex_forward_position(const char* filename, const char* position) found_one = true; GVariant* ret = g_dbus_connection_call_sync(connection, - name, DBUS_OBJPATH, "org.pwmt.zathura.Synctex", "View", + name, DBUS_OBJPATH, DBUS_INTERFACE, "View", g_variant_new("(s)", position), G_VARIANT_TYPE("(b)"), G_DBUS_CALL_FLAGS_NONE, TIMEOUT, NULL, &error); if (ret == NULL) {