mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-02-27 07:14:38 +01:00
Include interface specification in resource
This commit essentially reverts
4ee323a89a
. We now duplicate the data
again, but loading the interface specification from somewhere else does
not make much sense, since the specification must match the actually
implemented interface.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
e28598a07d
commit
0fb57ad15c
4 changed files with 13 additions and 28 deletions
7
Makefile
7
Makefile
|
@ -36,13 +36,6 @@ endif
|
||||||
ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS}))
|
ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS}))
|
||||||
CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\"
|
CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\"
|
||||||
endif
|
endif
|
||||||
ifeq (,$(findstring -DDBUSINTERFACEDIR,${CPPFLAGS}))
|
|
||||||
ifneq ($(WITH_LOCAL_DBUS_XML),0)
|
|
||||||
CPPFLAGS += -DDBUSINTERFACEDIR=\"$(abspath data)\"
|
|
||||||
else
|
|
||||||
CPPFLAGS += -DDBUSINTERFACEDIR=\"${DBUSINTERFACEDIR}\"
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
SOURCE = $(filter-out $(SOURCE_FILTER),$(OSOURCE))
|
SOURCE = $(filter-out $(SOURCE_FILTER),$(OSOURCE))
|
||||||
OBJECTS = $(addprefix ${BUILDDIR_RELEASE}/,${SOURCE:.c=.o})
|
OBJECTS = $(addprefix ${BUILDDIR_RELEASE}/,${SOURCE:.c=.o})
|
||||||
|
|
|
@ -47,11 +47,6 @@ WITH_SYNCTEX ?= $(shell (${PKG_CONFIG} synctex && echo 1) || echo 0)
|
||||||
# To disable support for mimetype detction with libmagic set WITH_MAGIC to 0.
|
# To disable support for mimetype detction with libmagic set WITH_MAGIC to 0.
|
||||||
WITH_MAGIC ?= 1
|
WITH_MAGIC ?= 1
|
||||||
|
|
||||||
# use local D-Bus interface
|
|
||||||
# Enable this if the D-Bus interface XML from data should be used (useful for
|
|
||||||
# development).
|
|
||||||
WITH_LOCAL_DBUS_XML ?= 0
|
|
||||||
|
|
||||||
# paths
|
# paths
|
||||||
PREFIX ?= /usr
|
PREFIX ?= /usr
|
||||||
MANPREFIX ?= ${PREFIX}/share/man
|
MANPREFIX ?= ${PREFIX}/share/man
|
||||||
|
|
|
@ -3,4 +3,7 @@
|
||||||
<gresource prefix="/org/pwmt/zathura/CSS">
|
<gresource prefix="/org/pwmt/zathura/CSS">
|
||||||
<file compressed="true">zathura.css_t</file>
|
<file compressed="true">zathura.css_t</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
|
<gresource prefix="/org/pwmt/zathura/DBus">
|
||||||
|
<file compressed="true">org.pwmt.zathura.xml</file>
|
||||||
|
</gresource>
|
||||||
</gresources>
|
</gresources>
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "document.h"
|
#include "document.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "adjustment.h"
|
#include "adjustment.h"
|
||||||
|
#include "resources.h"
|
||||||
|
|
||||||
#include <girara/session.h>
|
#include <girara/session.h>
|
||||||
#include <girara/utils.h>
|
#include <girara/utils.h>
|
||||||
|
@ -16,24 +17,17 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
static const char DBUS_XML_FILENAME[] = "org.pwmt.zathura.xml";
|
static const char DBUS_XML_FILENAME[] = "/org/pwmt/zathura/DBus/org.pwmt.zathura.xml";
|
||||||
|
|
||||||
static char* load_xml_data(void)
|
static GBytes* load_xml_data(void)
|
||||||
{
|
{
|
||||||
#ifdef DBUSINTERFACEDIR
|
GResource* resource = zathura_resources_get_resource();
|
||||||
char* file_path = g_build_filename(DBUSINTERFACEDIR, DBUS_XML_FILENAME, NULL);
|
if (resource != NULL) {
|
||||||
if (file_path == NULL) {
|
return g_resource_lookup_data(resource, DBUS_XML_FILENAME,
|
||||||
return NULL;
|
G_RESOURCE_LOOKUP_FLAGS_NONE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
girara_debug("Loading D-Bus interface data from %s.", file_path);
|
|
||||||
char* content = girara_file_read(file_path);
|
|
||||||
g_free(file_path);
|
|
||||||
return content;
|
|
||||||
#else
|
|
||||||
girara_error("DBUSINTERFACEDIR is not defined. D-Bus interface will not be available.");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
G_DEFINE_TYPE(ZathuraDbus, zathura_dbus, G_TYPE_OBJECT)
|
G_DEFINE_TYPE(ZathuraDbus, zathura_dbus, G_TYPE_OBJECT)
|
||||||
|
@ -163,7 +157,7 @@ zathura_dbus_new(zathura_t* zathura)
|
||||||
private_t* priv = GET_PRIVATE(dbus);
|
private_t* priv = GET_PRIVATE(dbus);
|
||||||
priv->zathura = zathura;
|
priv->zathura = zathura;
|
||||||
|
|
||||||
char* xml_data = load_xml_data();
|
GBytes* xml_data = load_xml_data();
|
||||||
if (xml_data == NULL)
|
if (xml_data == NULL)
|
||||||
{
|
{
|
||||||
girara_warning("Failed to load introspection data.");
|
girara_warning("Failed to load introspection data.");
|
||||||
|
@ -172,8 +166,8 @@ zathura_dbus_new(zathura_t* zathura)
|
||||||
}
|
}
|
||||||
|
|
||||||
GError* error = NULL;
|
GError* error = NULL;
|
||||||
priv->introspection_data = g_dbus_node_info_new_for_xml(xml_data, &error);
|
priv->introspection_data = g_dbus_node_info_new_for_xml((const char*) g_bytes_get_data(xml_data, NULL), &error);
|
||||||
g_free(xml_data);
|
g_bytes_unref(xml_data);
|
||||||
|
|
||||||
if (priv->introspection_data == NULL) {
|
if (priv->introspection_data == NULL) {
|
||||||
girara_warning("Failed to parse introspection data: %s", error->message);
|
girara_warning("Failed to parse introspection data: %s", error->message);
|
||||||
|
|
Loading…
Add table
Reference in a new issue