Commit d9ed6c2e authored by Jens Georg's avatar Jens Georg

wip

parent 746cbb2f
......@@ -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>
......
<?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>
......@@ -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')
......@@ -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);
......
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])
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment