diff --git a/src/Makefile.am b/src/Makefile.am index 64f773e..ce49b17 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,13 @@ +BUILT_SOURCES = \ + iio-sensor-proxy-resources.c \ + iio-sensor-proxy-resources.h + +resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/iio-sensor-proxy.gresource.xml) +iio-sensor-proxy-resources.c: iio-sensor-proxy.gresource.xml $(resource_files) + $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name iio_sensor_proxy $< +iio-sensor-proxy-resources.h: iio-sensor-proxy.gresource.xml $(resource_files) + $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name iio_sensor_proxy $< + sbin_PROGRAMS = iio-sensor-proxy iio_sensor_proxy_SOURCES = \ @@ -13,7 +23,8 @@ iio_sensor_proxy_SOURCES = \ drv-hwmon-light.c \ drv-iio-buffer-light.c \ iio-buffer-utils.h \ - iio-buffer-utils.c + iio-buffer-utils.c \ + $(BUILT_SOURCES) iio_sensor_proxy_CPPFLAGS = \ $(IIO_SENSOR_PROXY_CFLAGS) \ @@ -41,4 +52,7 @@ monitor_sensor_CPPFLAGS = \ $(WARN_CFLAGS) monitor_sensor_LDADD = $(IIO_SENSOR_PROXY_LIBS) -EXTRA_DIST = test-orientation.c +EXTRA_DIST = \ + test-orientation.c \ + $(resource_files) \ + iio-sensor-proxy.gresource.xml diff --git a/src/iio-sensor-proxy.c b/src/iio-sensor-proxy.c index f472e32..9902b02 100644 --- a/src/iio-sensor-proxy.c +++ b/src/iio-sensor-proxy.c @@ -47,26 +47,11 @@ #include "drivers.h" #include "orientation.h" +#include "iio-sensor-proxy-resources.h" + #define SENSOR_PROXY_DBUS_NAME "net.hadess.SensorProxy" #define SENSOR_PROXY_DBUS_PATH "/net/hadess/SensorProxy" -static const gchar introspection_xml[] = -"" -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -""; - #define NUM_SENSOR_TYPES DRIVER_TYPE_LIGHT + 1 typedef struct { @@ -484,7 +469,13 @@ name_acquired_handler (GDBusConnection *connection, static gboolean setup_dbus (SensorData *data) { - data->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); + GBytes *bytes; + + bytes = g_resources_lookup_data ("/net/hadess/SensorProxy/net.hadess.SensorProxy.xml", + G_RESOURCE_LOOKUP_FLAGS_NONE, + NULL); + data->introspection_data = g_dbus_node_info_new_for_xml (g_bytes_get_data (bytes, NULL), NULL); + g_bytes_unref (bytes); g_assert (data->introspection_data != NULL); data->name_id = g_bus_own_name (G_BUS_TYPE_SYSTEM,