diff options
author | Jens Georg <jens.georg@desy.de> | 2018-06-29 16:21:30 +0200 |
---|---|---|
committer | Jens Georg <jens.georg@desy.de> | 2018-06-29 16:21:48 +0200 |
commit | d9ed6c2e1adf59b50ca8a044f2c16df7a928f6a9 (patch) | |
tree | d59a81eed5d6437fee95ed79af1923264d757cad | |
parent | 746cbb2f2297921767ab686d74ba1f1ca902c5c9 (diff) | |
download | gupnp-tools-wip/phako/meson.tar.gz |
-rw-r--r-- | data/org.gupnp.Tools.Common.gresource.xml | 4 | ||||
-rw-r--r-- | data/org.gupnp.Tools.Network-Light.gresource.xml | 10 | ||||
-rw-r--r-- | src/meson.build | 4 | ||||
-rw-r--r-- | src/network-light/gui.c | 18 | ||||
-rw-r--r-- | src/network-light/meson.build | 15 | ||||
-rw-r--r-- | src/network-light/upnp.c | 19 |
6 files changed, 53 insertions, 17 deletions
diff --git a/data/org.gupnp.Tools.Common.gresource.xml b/data/org.gupnp.Tools.Common.gresource.xml index ef38144..88a4c95 100644 --- a/data/org.gupnp.Tools.Common.gresource.xml +++ b/data/org.gupnp.Tools.Common.gresource.xml @@ -3,10 +3,6 @@ <gresource prefix='/org/gupnp/Tools/Common'> <file>pixmaps/av-cp.png</file> <file>pixmaps/media-renderer.png</file> - <file>pixmaps/network-light-22x22.png</file> - <file>pixmaps/network-light-256x256.png</file> - <file>pixmaps/network-light-off.png</file> - <file>pixmaps/network-light-on.png</file> <file>pixmaps/upnp-action-arg-in.png</file> <file>pixmaps/upnp-action-arg-out.png</file> <file>pixmaps/upnp-device.png</file> diff --git a/data/org.gupnp.Tools.Network-Light.gresource.xml b/data/org.gupnp.Tools.Network-Light.gresource.xml new file mode 100644 index 0000000..2b7e65d --- /dev/null +++ b/data/org.gupnp.Tools.Network-Light.gresource.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix='/org/gupnp/Tools/Network-Light'> + <file preprocess='xml-stripblanks'>gupnp-network-light.ui</file> + <file>pixmaps/network-light-256x256.png</file> + <file>pixmaps/network-light-on.png</file> + <file>pixmaps/network-light-off.png</file> + <file>xml/network-light-desc.xml</file> + </gresource> +</gresources> diff --git a/src/meson.build b/src/meson.build index b97c8ea..29d871d 100644 --- a/src/meson.build +++ b/src/meson.build @@ -3,7 +3,7 @@ subdir('common') # subdir('av-cp') #endif -#subdir('discover') -#subdir('network-light') +subdir('discover') +subdir('network-light') subdir('universal-cp') #subdir('upload') diff --git a/src/network-light/gui.c b/src/network-light/gui.c index 7259801..3eea8d8 100644 --- a/src/network-light/gui.c +++ b/src/network-light/gui.c @@ -20,7 +20,9 @@ #include <string.h> #include <stdlib.h> +#ifdef HAVE_CONFIG_H #include <config.h> +#endif #include <gmodule.h> #include "gui.h" @@ -28,10 +30,10 @@ #include "upnp.h" #include "main.h" -#define UI_FILE DATA_DIR "/gupnp-network-light.ui" -#define ICON_FILE "pixmaps/network-light-256x256.png" -#define OFF_FILE "pixmaps/network-light-off.png" -#define ON_FILE "pixmaps/network-light-on.png" +#define UI_FILE "/org/gupnp/Tools/Network-Light/gupnp-network-light.ui" +#define ICON_FILE "/org/gupnp/Tools/Network-Light/pixmaps/network-light-256x256.png" +#define OFF_FILE "/org/gupnp/Tools/Network-Light/pixmaps/network-light-off.png" +#define ON_FILE "/org/gupnp/Tools/Network-Light/pixmaps/network-light-on.png" static GtkBuilder *builder; static GtkWidget *main_window; @@ -224,7 +226,7 @@ init_ui (gint *argc, g_assert (builder != NULL); gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE); - if (!gtk_builder_add_from_file (builder, UI_FILE, &error)) { + if (!gtk_builder_add_from_resource (builder, UI_FILE, &error)) { g_critical ("Unable to load the GUI file %s: %s", UI_FILE, error->message); @@ -245,17 +247,17 @@ init_ui (gint *argc, "about-dialog")); g_assert (about_dialog != NULL); - on_pixbuf = load_pixbuf_file (ON_FILE); + on_pixbuf = gdk_pixbuf_new_from_resource (ON_FILE, NULL); if (on_pixbuf == NULL) return FALSE; - off_pixbuf = load_pixbuf_file (OFF_FILE); + off_pixbuf = gdk_pixbuf_new_from_resource (OFF_FILE, NULL); if (off_pixbuf == NULL) { g_object_unref (on_pixbuf); return FALSE; } - icon_pixbuf = load_pixbuf_file (ICON_FILE); + icon_pixbuf = gdk_pixbuf_new_from_resource (ICON_FILE, NULL); if (icon_pixbuf == NULL) { g_object_unref (on_pixbuf); g_object_unref (off_pixbuf); diff --git a/src/network-light/meson.build b/src/network-light/meson.build new file mode 100644 index 0000000..2987dfc --- /dev/null +++ b/src/network-light/meson.build @@ -0,0 +1,15 @@ +network_light_resource = gnome.compile_resources('network-light-resource', + join_paths(resource_data, 'org.gupnp.Tools.Network-Light.gresource.xml'), + source_dir : resource_data) + +executable('gupnp-network-light', + [ + 'gui.c', + 'gui.h', + 'main.c', + 'main.h', + 'upnp.c', + 'upnp.h' + ] + network_light_resource, + export_dynamic: true, + dependencies : [gupnp, gtk, util, gssdp]) diff --git a/src/network-light/upnp.c b/src/network-light/upnp.c index e913028..b9397fe 100644 --- a/src/network-light/upnp.c +++ b/src/network-light/upnp.c @@ -32,7 +32,7 @@ #include "upnp.h" #include "main.h" -#define DESCRIPTION_DOC "xml/network-light-desc.xml" +#define DESCRIPTION_DOC "/org/gupnp/Tools/Network-Light/xml/network-light-desc.xml" #define DIMMING_SERVICE "urn:schemas-upnp-org:service:Dimming:1" #define SWITCH_SERVICE "urn:schemas-upnp-org:service:SwitchPower:1" #define NETWORK_LIGHT "urn:schemas-upnp-org:device:DimmableLight:1" @@ -633,9 +633,22 @@ static gboolean prepare_desc (gchar *name) { GError *error = NULL; + GBytes *data = NULL; + xmlDoc *xml = NULL; - doc = gupnp_xml_doc_new_from_path (DATA_DIR "/" DESCRIPTION_DOC, - &error); + data = g_resources_lookup_data (DESCRIPTION_DOC, G_RESOURCE_LOOKUP_FLAGS_NONE, &error); + + if (data == NULL) { + g_critical ("Unable to load the XML description: %s", error->message); + + g_error_free (error); + + return FALSE; + } + + xml = xmlParseMemory(g_bytes_get_data (data, NULL), g_bytes_get_size (data)); + + doc = gupnp_xml_doc_new (xml); if (doc == NULL) { g_critical ("Unable to load the XML description file: %s", error->message); |