[gupnp-tools/wip/search: 29/33] av-cp: Use gresource for UI files
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-tools/wip/search: 29/33] av-cp: Use gresource for UI files
- Date: Sat, 17 Dec 2016 09:47:30 +0000 (UTC)
commit c166b3a1b2ed6e5427ce32e0d8802a8b1244f4a8
Author: Jens Georg <mail jensge org>
Date: Sun Sep 4 22:49:16 2016 +0200
av-cp: Use gresource for UI files
Signed-off-by: Jens Georg <mail jensge org>
data/org.gupnp.Tools.AV-CP.gresource.xml | 1 +
src/av-cp/search-dialog.c | 20 ++++----------------
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]