diff options
author | Jens Georg <mail@jensge.org> | 2016-12-16 16:53:08 +0100 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2016-12-16 17:06:19 +0100 |
commit | 4ce06cfe8137107671e12dec66049a5c6111f676 (patch) | |
tree | 805b9aa0ed33657404664ccd605e6aca5d3abedc | |
parent | 57c398e537e2a3f20adcedfba17d5d7f48a271e8 (diff) | |
download | gupnp-tools-4ce06cfe8137107671e12dec66049a5c6111f676.tar.gz |
common: Move icons into resource
Signed-off-by: Jens Georg <mail@jensge.org>
-rw-r--r-- | data/org.gupnp.Tools.Common.gresource.xml | 12 | ||||
-rw-r--r-- | src/common/Makefile.am | 21 | ||||
-rw-r--r-- | src/common/icons.c | 11 |
3 files changed, 40 insertions, 4 deletions
diff --git a/data/org.gupnp.Tools.Common.gresource.xml b/data/org.gupnp.Tools.Common.gresource.xml new file mode 100644 index 0000000..6849b66 --- /dev/null +++ b/data/org.gupnp.Tools.Common.gresource.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix='/org/gupnp/Tools/Common'> + <file>pixmaps/av-cp.png</file> + <file>pixmaps/upnp-device.png</file> + <file>pixmaps/upnp-service.png</file> + <file>pixmaps/upnp-state-variable.png</file> + <file>pixmaps/upnp-action-arg-in.png</file> + <file>pixmaps/upnp-action-arg-out.png</file> + <file>pixmaps/media-renderer.png</file> + </gresource> +</gresources> diff --git a/src/common/Makefile.am b/src/common/Makefile.am index c6e4709..554c89f 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -10,9 +10,28 @@ AM_CFLAGS = $(LIBGUPNP_CFLAGS) $(GTK_CFLAGS) -I$(top_srcdir) \ noinst_LIBRARIES = libutil.a -libutil_a_SOURCES = icons.c \ +libutil_a_SOURCES = \ + resource.c \ + icons.c \ icons.h \ pretty-print.c \ pretty-print.h MAINTAINERCLEANFILES = Makefile.in + +RESOURCEFILE = $(top_srcdir)/data/org.gupnp.Tools.Common.gresource.xml + +resource_depends = \ + $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies \ + --sourcedir=$(abs_top_srcdir)/data \ + $(RESOURCEFILE)) + + + +resource.c: $(RESOURCEFILE) $(resource_depends) + $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES)\ + --target=$@ \ + --sourcedir=$(abs_top_srcdir)/data \ + --generate $(RESOURCEFILE) \ + --manual-register \ + --c-name gupnp_tools_common diff --git a/src/common/icons.c b/src/common/icons.c index 7987fab..44df362 100644 --- a/src/common/icons.c +++ b/src/common/icons.c @@ -248,16 +248,19 @@ load_pixbuf_file (const char *file_name) GdkPixbuf *pixbuf; char *path; - path = g_build_filename (DATA_DIR, file_name, NULL); - pixbuf = gdk_pixbuf_new_from_file (path, NULL); + path = g_build_path ("/", "/org/gupnp/Tools/Common", file_name, NULL); + pixbuf = gdk_pixbuf_new_from_resource (path, NULL); if (pixbuf == NULL) - g_critical ("failed to get image %s\n", file_name); + g_critical ("failed to get image %s\n", path); g_free (path); return pixbuf; } +extern void gupnp_tools_common_unregister_resource (void); +extern void gupnp_tools_common_register_resource (void); + void init_icons (void) { @@ -285,6 +288,7 @@ init_icons (void) "image-x-generic", /* ICON_IMAGE_ITEM */ "text-x-generic", /* ICON_TEXT_ITEM */ }; + gupnp_tools_common_register_resource (); for (i = 0; i < ICON_MISSING; i++) { icons[i] = load_pixbuf_file (file_names[i]); @@ -321,5 +325,6 @@ deinit_icons (void) for (i = 0; i < ICON_LAST; i++) { g_object_unref (icons[i]); } + gupnp_tools_common_unregister_resource (); } |