summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2016-09-04 22:49:16 +0200
committerJens Georg <mail@jensge.org>2016-12-17 09:47:54 +0100
commitc166b3a1b2ed6e5427ce32e0d8802a8b1244f4a8 (patch)
tree23969a399be71d309fa65e46671b521f028a11af
parente417ba7fc59a1c5234ccefc7ce12e4fd8d02a190 (diff)
downloadgupnp-tools-c166b3a1b2ed6e5427ce32e0d8802a8b1244f4a8.tar.gz
av-cp: Use gresource for UI files
Signed-off-by: Jens Georg <mail@jensge.org>
-rw-r--r--data/org.gupnp.Tools.AV-CP.gresource.xml1
-rw-r--r--src/av-cp/search-dialog.c20
2 files changed, 5 insertions, 16 deletions
diff --git a/data/org.gupnp.Tools.AV-CP.gresource.xml b/data/org.gupnp.Tools.AV-CP.gresource.xml
index 09467ee..abe7151 100644
--- a/data/org.gupnp.Tools.AV-CP.gresource.xml
+++ b/data/org.gupnp.Tools.AV-CP.gresource.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix='/org/gupnp/Tools/AV-CP'>
+ <file preprocess='xml-stripblanks'>search-dialog.ui</file>
<file preprocess='xml-stripblanks'>gupnp-av-cp.ui</file>
</gresource>
</gresources>
diff --git a/src/av-cp/search-dialog.c b/src/av-cp/search-dialog.c
index 0405f52..0015966 100644
--- a/src/av-cp/search-dialog.c
+++ b/src/av-cp/search-dialog.c
@@ -36,6 +36,8 @@
#define DEFAULT_SEARCH_FILTER "upnp:class,dc:title"
+#define DIALOG_RESOURCE_PATH "/org/gupnp/Tools/AV-CP/search-dialog.ui"
+
typedef struct _SearchTask SearchTask;
struct _SearchDialog {
@@ -326,23 +328,9 @@ search_dialog_class_init (SearchDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- GError *error = NULL;
- gchar *data = NULL;
- gsize size = -1;
- GBytes *bytes;
-
- g_file_get_contents (DATA_DIR "/search-dialog.ui", &data, &size, &error);
- if (error != NULL) {
- g_critical ("Failed to load ui file: %s", error->message);
- g_error_free (error);
-
- return;
- }
-
- bytes = g_bytes_new_take (data, size);
- gtk_widget_class_set_template (widget_class, bytes);
- g_bytes_unref (bytes);
+ gtk_widget_class_set_template_from_resource (widget_class,
+ DIALOG_RESOURCE_PATH);
gtk_widget_class_bind_template_child_private (widget_class,
SearchDialog,
search_dialog_liststore);