[rhythmbox] plugins: move data files into resources



commit 141f175283c270fccb0daf65278346339cee9c30
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue Jul 19 21:23:27 2016 +1000

    plugins: move data files into resources

 .gitignore                                         |    1 +
 plugins/android/Makefile.am                        |   19 ++++++++----
 plugins/android/android.gresource.xml              |   10 ++++++
 plugins/android/rb-android-plugin.c                |    8 ++++-
 plugins/android/rb-android-source.c                |   16 +----------
 plugins/audiocd/Makefile.am                        |   17 ++++++++---
 plugins/audiocd/audiocd.gresource.xml              |    7 ++++
 plugins/daap/Makefile.am                           |   23 ++++++++------
 plugins/daap/daap.gresource.xml                    |    7 ++++
 plugins/daap/rb-daap-plugin.c                      |   11 +------
 plugins/daap/rb-dacp-pairing-page.c                |    7 +----
 plugins/daap/remote-icon.png                       |  Bin 4641 -> 0 bytes
 plugins/fmradio/Makefile.am                        |   16 ++++++++--
 plugins/fmradio/fmradio.gresource.xml              |    7 ++++
 plugins/generic-player/Makefile.am                 |   16 ++++++++--
 .../generic-player/generic-player.gresource.xml    |    7 ++++
 plugins/generic-player/rb-generic-player-source.c  |   16 +----------
 plugins/ipod/Makefile.am                           |   20 ++++++++++---
 plugins/ipod/ipod.gresource.xml                    |    8 +++++
 plugins/ipod/rb-ipod-source.c                      |   26 +----------------
 plugins/iradio/Makefile.am                         |   30 ++++++++++---------
 plugins/iradio/iradio.gresource.xml                |    9 ++++++
 plugins/iradio/rb-iradio-source.c                  |   18 +----------
 plugins/iradio/rb-station-properties-dialog.c      |    6 +---
 plugins/mtpdevice/Makefile.am                      |   20 ++++++++++---
 plugins/mtpdevice/mtpdevice.gresource.xml          |    7 ++++
 plugins/mtpdevice/rb-mtp-source.c                  |   16 +----------
 27 files changed, 191 insertions(+), 157 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index d850314..4428507 100644
--- a/.gitignore
+++ b/.gitignore
@@ -147,5 +147,6 @@ widgets/test-uri-dialog
 
 plugins/audiocd/test-cd
 plugins/rb/rbconfig.py
+plugins/*/*-resources.c
 
 data/rhythmbox.appdata.xml
diff --git a/plugins/android/Makefile.am b/plugins/android/Makefile.am
index 1c8c0bc..bfa1150 100644
--- a/plugins/android/Makefile.am
+++ b/plugins/android/Makefile.am
@@ -3,6 +3,7 @@ plugindatadir = $(PLUGINDATADIR)/android
 plugin_LTLIBRARIES = libandroid.la
 
 libandroid_la_SOURCES =                                        \
+       android-resources.c                             \
        rb-android-plugin.c                             \
        rb-android-source.c                             \
        rb-android-source.h
@@ -33,11 +34,7 @@ AM_CPPFLAGS =                                                \
        $(GUDEV_CFLAGS)                                 \
        $(RHYTHMBOX_CFLAGS)
 
-gtkbuilderdir = $(plugindatadir)
-gtkbuilder_DATA = android-info.ui android-toolbar.ui
-
-mpidir = $(plugindatadir)
-mpi_DATA = android.mpi
+PLUGIN_RESOURCES = android-info.ui android-toolbar.ui android.mpi
 
 plugin_in_files = android.plugin.in
 
@@ -45,7 +42,17 @@ plugin_in_files = android.plugin.in
 
 plugin_DATA = $(plugin_in_files:.plugin.in=.plugin)
 
-EXTRA_DIST = $(gtkbuilder_DATA) $(mpi_DATA) $(plugin_in_files)
+plugin_resource_deps = $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) 
$(srcdir)/android.gresource.xml)
+android-resources.c: $(plugin_resource_deps) $(srcdir)/android.gresource.xml
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES)           \
+               --target="$@"                           \
+               --sourcedir="$(srcdir)"                 \
+               --sourcedir="$(builddir)"               \
+               --generate-source "$(srcdir)/android.gresource.xml"
+
+BUILT_SOURCES = android-resources.c
+
+EXTRA_DIST = $(PLUGIN_RESOURCES) $(plugin_in_files) android.gresource.xml
 
 CLEANFILES = $(plugin_DATA)
 DISTCLEANFILES = $(plugin_DATA)
diff --git a/plugins/android/android.gresource.xml b/plugins/android/android.gresource.xml
new file mode 100644
index 0000000..b71ae33
--- /dev/null
+++ b/plugins/android/android.gresource.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+       <gresource prefix="/org/gnome/Rhythmbox/android">
+
+               <file preprocess="xml-stripblanks">android-info.ui</file>
+               <file preprocess="xml-stripblanks">android-toolbar.ui</file>
+
+               <file>android.mpi</file>
+       </gresource>
+</gresources>
diff --git a/plugins/android/rb-android-plugin.c b/plugins/android/rb-android-plugin.c
index 97c0b13..82ac607 100644
--- a/plugins/android/rb-android-plugin.c
+++ b/plugins/android/rb-android-plugin.c
@@ -108,6 +108,7 @@ create_source_cb (RBRemovableMediaManager *rmm, GMount *mount, MPIDDevice *devic
        GSettings *settings;
        GFile *root;
        const char *device_serial;
+       const char *mpi_file;
        char *uri_prefix;
        char *name;
        char *path;
@@ -129,7 +130,12 @@ create_source_cb (RBRemovableMediaManager *rmm, GMount *mount, MPIDDevice *devic
                return NULL;
        }
 
-       device_info = mpid_device_new_from_mpi_file (rb_find_plugin_data_file (G_OBJECT (plugin), 
"android.mpi"));
+#if defined(USE_UNINSTALLED_DIRS)
+       mpi_file = rb_find_plugin_data_file (G_OBJECT (plugin), "android.mpi");
+#else
+       mpi_file = "/org/gnome/Rhythmbox/android/android.mpi";
+#endif
+       device_info = mpid_device_new_from_mpi_file (mpi_file);
 
        path = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
 
diff --git a/plugins/android/rb-android-source.c b/plugins/android/rb-android-source.c
index fcad670..2d905d2 100644
--- a/plugins/android/rb-android-source.c
+++ b/plugins/android/rb-android-source.c
@@ -489,26 +489,12 @@ impl_show_properties (RBMediaPlayerSource *source, GtkWidget *info_box, GtkWidge
        GtkBuilder *builder;
        GtkWidget *widget;
        GObject *plugin;
-       char *builder_file;
        char *text;
 
        g_object_get (source, "plugin", &plugin, NULL);
-       builder_file = rb_find_plugin_data_file (plugin, "android-info.ui");
+       builder = rb_builder_load_plugin_file (G_OBJECT (plugin), "android-info.ui", NULL);
        g_object_unref (plugin);
 
-       if (builder_file == NULL) {
-               g_warning ("Couldn't find android-info.ui");
-               return;
-       }
-
-       builder = rb_builder_load (builder_file, NULL);
-       g_free (builder_file);
-
-       if (builder == NULL) {
-               rb_debug ("Couldn't load android-info.ui");
-               return;
-       }
-
        /* 'basic' tab stuff */
 
        widget = GTK_WIDGET (gtk_builder_get_object (builder, "android-basic-info"));
diff --git a/plugins/audiocd/Makefile.am b/plugins/audiocd/Makefile.am
index a66fb5f..381c04c 100644
--- a/plugins/audiocd/Makefile.am
+++ b/plugins/audiocd/Makefile.am
@@ -3,6 +3,7 @@ plugindatadir = $(PLUGINDATADIR)/audiocd
 plugin_LTLIBRARIES = libaudiocd.la
 
 libaudiocd_la_SOURCES =                                        \
+       audiocd-resources.c                             \
        rb-audiocd-info.c                               \
        rb-audiocd-info.h                               \
        rb-audiocd-plugin.c                             \
@@ -41,11 +42,17 @@ AM_CPPFLAGS =                                               \
 
 libaudiocd_la_LIBADD += $(NULL)
 
+PLUGIN_RESOURCES = album-info.ui audiocd-toolbar.ui
 
-gtkbuilderdir = $(plugindatadir)
-gtkbuilder_DATA =                                      \
-       album-info.ui                                   \
-       audiocd-toolbar.ui
+plugin_resource_deps = $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) 
$(srcdir)/audiocd.gresource.xml)
+audiocd-resources.c: $(plugin_resource_deps) $(srcdir)/audiocd.gresource.xml
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES)           \
+               --target="$@"                           \
+               --sourcedir="$(srcdir)"                 \
+               --sourcedir="$(builddir)"               \
+               --generate-source "$(srcdir)/audiocd.gresource.xml"
+
+BUILT_SOURCES = audiocd-resources.c
 
 noinst_PROGRAMS = test-cd
 
@@ -63,7 +70,7 @@ plugin_in_files = audiocd.plugin.in
 
 plugin_DATA = $(plugin_in_files:.plugin.in=.plugin)
 
-EXTRA_DIST = $(gtkbuilder_DATA) $(plugin_in_files)
+EXTRA_DIST = $(PLUGIN_RESOURCES) $(plugin_in_files) audiocd.gresource.xml
 
 CLEANFILES = $(plugin_DATA)
 DISTCLEANFILES = $(plugin_DATA)
diff --git a/plugins/audiocd/audiocd.gresource.xml b/plugins/audiocd/audiocd.gresource.xml
new file mode 100644
index 0000000..2734974
--- /dev/null
+++ b/plugins/audiocd/audiocd.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+       <gresource prefix="/org/gnome/Rhythmbox/audiocd">
+               <file preprocess="xml-stripblanks">album-info.ui</file>
+               <file preprocess="xml-stripblanks">audiocd-toolbar.ui</file>
+       </gresource>
+</gresources>
diff --git a/plugins/daap/Makefile.am b/plugins/daap/Makefile.am
index 738bd75..81d6610 100644
--- a/plugins/daap/Makefile.am
+++ b/plugins/daap/Makefile.am
@@ -5,6 +5,7 @@ plugindatadir = $(PLUGINDATADIR)/daap
 plugin_LTLIBRARIES = libdaap.la
 
 libdaap_la_SOURCES = \
+       daap-resources.c                          \
        rb-daap-container-record.c                \
        rb-daap-container-record.h                \
        rb-daap-plugin.c                          \
@@ -67,8 +68,15 @@ libdaap_la_LIBADD += $(LIBSECRET_LIBS)
 AM_CPPFLAGS += $(LIBSECRET_CFLAGS)
 endif
 
-gtkbuilderdir = $(plugindatadir)
-gtkbuilder_DATA = daap-prefs.ui daap-toolbar.ui
+PLUGIN_RESOURCES = daap-prefs.ui daap-toolbar.ui
+
+plugin_resource_deps = $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) 
$(srcdir)/daap.gresource.xml)
+daap-resources.c: $(plugin_resource_deps) $(srcdir)/daap.gresource.xml
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES)           \
+               --target="$@"                           \
+               --sourcedir="$(srcdir)"                 \
+               --sourcedir="$(builddir)"               \
+               --generate-source "$(srcdir)/daap.gresource.xml"
 
 plugin_in_files = daap.plugin.in
 
@@ -76,19 +84,14 @@ plugin_in_files = daap.plugin.in
 
 plugin_files = $(plugin_in_files:.plugin.in=.plugin)
 
-BUILT_SOURCES = $(plugin_files)
+BUILT_SOURCES = daap-resources.c $(plugin_files)
 
 plugin_DATA = $(plugin_files)
 
-plugindata_DATA =                                      \
-       $(top_srcdir)/plugins/daap/remote-icon.png      \
-       $(NULL)
-
 EXTRA_DIST =                                           \
-       $(gtkbuilder_DATA)                              \
-       $(top_srcdir)/plugins/daap/remote-icon.png      \
-       $(uixml_DATA)           \
+       $(PLUGIN_RESOURCES)                             \
        $(plugin_in_files)      \
+       daap.gresource.xml      \
        $(NULL)
 
 CLEANFILES =                   \
diff --git a/plugins/daap/daap.gresource.xml b/plugins/daap/daap.gresource.xml
new file mode 100644
index 0000000..f9bd0cb
--- /dev/null
+++ b/plugins/daap/daap.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+       <gresource prefix="/org/gnome/Rhythmbox/daap">
+               <file preprocess="xml-stripblanks">daap-prefs.ui</file>
+               <file preprocess="xml-stripblanks">daap-toolbar.ui</file>
+       </gresource>
+</gresources>
diff --git a/plugins/daap/rb-daap-plugin.c b/plugins/daap/rb-daap-plugin.c
index 6f7119d..5e5af17 100644
--- a/plugins/daap/rb-daap-plugin.c
+++ b/plugins/daap/rb-daap-plugin.c
@@ -746,18 +746,11 @@ update_config_widget (RBDaapPlugin *plugin)
 static GtkWidget *
 impl_create_configure_widget (PeasGtkConfigurable *bplugin)
 {
-       char *builder_file;
        RBDaapPlugin *plugin = RB_DAAP_PLUGIN (bplugin);
 
-       builder_file = rb_find_plugin_data_file (G_OBJECT (plugin), "daap-prefs.ui");
-       if (builder_file == NULL) {
-               return NULL;
-       }
-
-       plugin->builder = rb_builder_load (builder_file, NULL);
-       g_free (builder_file);
-
+       plugin->builder = rb_builder_load_plugin_file (G_OBJECT (plugin), "daap-prefs.ui", NULL);
        update_config_widget (plugin);
+
        return GTK_WIDGET (gtk_builder_get_object (plugin->builder, "daap_vbox"));
 }
 
diff --git a/plugins/daap/rb-dacp-pairing-page.c b/plugins/daap/rb-dacp-pairing-page.c
index 6928909..93a5f98 100644
--- a/plugins/daap/rb-dacp-pairing-page.c
+++ b/plugins/daap/rb-dacp-pairing-page.c
@@ -242,7 +242,6 @@ static void
 impl_constructed (GObject *object)
 {
        RBDACPPairingPage *page = RB_DACP_PAIRING_PAGE (object);
-       char *builder_filename;
        GtkWidget *passcode_widget;
        GtkWidget *close_pairing_button;
        PangoFontDescription *font;
@@ -251,11 +250,7 @@ impl_constructed (GObject *object)
 
        g_object_get (page, "plugin", &plugin, NULL);
 
-       builder_filename = rb_find_plugin_data_file (G_OBJECT (plugin), "daap-prefs.ui");
-       g_assert (builder_filename != NULL);
-
-       page->priv->builder = rb_builder_load (builder_filename, NULL);
-       g_free (builder_filename);
+       page->priv->builder = rb_builder_load_plugin_file (G_OBJECT (plugin), "daap-prefs.ui", NULL);
 
        passcode_widget = GTK_WIDGET (gtk_builder_get_object (page->priv->builder, "passcode_widget"));
        gtk_container_add (GTK_CONTAINER (page), passcode_widget);
diff --git a/plugins/fmradio/Makefile.am b/plugins/fmradio/Makefile.am
index 869d1d6..426abb9 100644
--- a/plugins/fmradio/Makefile.am
+++ b/plugins/fmradio/Makefile.am
@@ -4,6 +4,7 @@ plugindatadir = $(PLUGINDATADIR)/fmradio
 plugin_LTLIBRARIES = libfmradio.la
 
 libfmradio_la_SOURCES = \
+  fmradio-resources.c \
   rb-fm-radio-plugin.c \
   rb-fm-radio-source.c \
   rb-fm-radio-source.h \
@@ -37,12 +38,21 @@ AM_CPPFLAGS = \
 plugin_in_files = fmradio.plugin.in
 %.plugin: %.plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) 
$(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
 
-gtkbuilderdir = $(plugindatadir)
-gtkbuilder_DATA = fmradio-toolbar.ui fmradio-popup.ui
+PLUGIN_RESOURCES = fmradio-toolbar.ui fmradio-popup.ui
+
+plugin_resource_deps = $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) 
$(srcdir)/fmradio.gresource.xml)
+fmradio-resources.c: $(plugin_resource_deps) $(srcdir)/fmradio.gresource.xml
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES)           \
+               --target="$@"                           \
+               --sourcedir="$(srcdir)"                 \
+               --sourcedir="$(builddir)"               \
+               --generate-source "$(srcdir)/fmradio.gresource.xml"
+
+BUILT_SOURCES = fmradio-resources.c
 
 plugin_DATA = $(plugin_in_files:.plugin.in=.plugin)
 
-EXTRA_DIST = $(gtkbuilder_DATA) $(plugin_in_files)
+EXTRA_DIST = $(PLUGIN_RESOURCES) $(plugin_in_files) fmradio.gresource.xml
 
 CLEANFILES = $(plugin_DATA)
 DISTCLEANFILES = $(plugin_DATA)
diff --git a/plugins/fmradio/fmradio.gresource.xml b/plugins/fmradio/fmradio.gresource.xml
new file mode 100644
index 0000000..e4da970
--- /dev/null
+++ b/plugins/fmradio/fmradio.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+       <gresource prefix="/org/gnome/Rhythmbox/fmradio">
+               <file preprocess="xml-stripblanks">fmradio-popup.ui</file>
+               <file preprocess="xml-stripblanks">fmradio-toolbar.ui</file>
+       </gresource>
+</gresources>
diff --git a/plugins/generic-player/Makefile.am b/plugins/generic-player/Makefile.am
index c5e5191..1b2ac84 100644
--- a/plugins/generic-player/Makefile.am
+++ b/plugins/generic-player/Makefile.am
@@ -3,6 +3,7 @@ plugindatadir = $(PLUGINDATADIR)/generic-player
 plugin_LTLIBRARIES = libgeneric-player.la
 
 libgeneric_player_la_SOURCES =                         \
+       generic-player-resources.c                      \
        rb-generic-player-plugin.c                      \
        rb-generic-player-source.c                      \
        rb-generic-player-source.h                      \
@@ -39,8 +40,17 @@ AM_CPPFLAGS =                                                \
        $(TOTEM_PLPARSER_CFLAGS)                        \
        $(RHYTHMBOX_CFLAGS)
 
-gtkbuilderdir = $(plugindatadir)
-gtkbuilder_DATA = generic-player-info.ui generic-player-toolbar.ui
+PLUGIN_RESOURCES = generic-player-info.ui generic-player-toolbar.ui
+
+plugin_resource_deps = $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) 
$(srcdir)/generic-player.gresource.xml)
+generic-player-resources.c: $(plugin_resource_deps) $(srcdir)/generic-player.gresource.xml
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES)           \
+               --target="$@"                           \
+               --sourcedir="$(srcdir)"                 \
+               --sourcedir="$(builddir)"               \
+               --generate-source "$(srcdir)/generic-player.gresource.xml"
+
+BUILT_SOURCES = generic-player-resources.c
 
 plugin_in_files = generic-player.plugin.in
 
@@ -48,7 +58,7 @@ plugin_in_files = generic-player.plugin.in
 
 plugin_DATA = $(plugin_in_files:.plugin.in=.plugin)
 
-EXTRA_DIST = $(gtkbuilder_DATA) $(plugin_in_files)
+EXTRA_DIST = $(PLUGIN_RESOURCES) $(plugin_in_files) generic-player.gresource.xml
 
 CLEANFILES = $(plugin_DATA)
 DISTCLEANFILES = $(plugin_DATA)
diff --git a/plugins/generic-player/generic-player.gresource.xml 
b/plugins/generic-player/generic-player.gresource.xml
new file mode 100644
index 0000000..feda8e5
--- /dev/null
+++ b/plugins/generic-player/generic-player.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+       <gresource prefix="/org/gnome/Rhythmbox/generic-player">
+               <file preprocess="xml-stripblanks">generic-player-info.ui</file>
+               <file preprocess="xml-stripblanks">generic-player-toolbar.ui</file>
+       </gresource>
+</gresources>
diff --git a/plugins/generic-player/rb-generic-player-source.c 
b/plugins/generic-player/rb-generic-player-source.c
index ade8938..4256704 100644
--- a/plugins/generic-player/rb-generic-player-source.c
+++ b/plugins/generic-player/rb-generic-player-source.c
@@ -1320,7 +1320,6 @@ impl_show_properties (RBMediaPlayerSource *source, GtkWidget *info_box, GtkWidge
        GtkWidget *widget;
        GString *str;
        char *device_name;
-       char *builder_file;
        char *vendor_name;
        char *model_name;
        char *serial_id;
@@ -1330,22 +1329,9 @@ impl_show_properties (RBMediaPlayerSource *source, GtkWidget *info_box, GtkWidge
        GList *t;
 
        g_object_get (source, "plugin", &plugin, NULL);
-       builder_file = rb_find_plugin_data_file (plugin, "generic-player-info.ui");
+       builder = rb_builder_load_plugin_file (plugin, "generic-player-info.ui", NULL);
        g_object_unref (plugin);
 
-       if (builder_file == NULL) {
-               g_warning ("Couldn't find generic-player-info.ui");
-               return;
-       }
-
-       builder = rb_builder_load (builder_file, NULL);
-       g_free (builder_file);
-
-       if (builder == NULL) {
-               rb_debug ("Couldn't load generic-player-info.ui");
-               return;
-       }
-
        /* 'basic' tab stuff */
 
        widget = GTK_WIDGET (gtk_builder_get_object (builder, "generic-player-basic-info"));
diff --git a/plugins/ipod/Makefile.am b/plugins/ipod/Makefile.am
index eb6e925..3b204de 100644
--- a/plugins/ipod/Makefile.am
+++ b/plugins/ipod/Makefile.am
@@ -3,6 +3,7 @@ plugindatadir = $(PLUGINDATADIR)/ipod
 plugin_LTLIBRARIES = libipod.la
 
 libipod_la_SOURCES = \
+       ipod-resources.c                        \
        rb-ipod-db.c                            \
        rb-ipod-db.h                            \
        rb-ipod-helpers.c                       \
@@ -45,13 +46,22 @@ plugin_in_files = ipod.plugin.in
 
 plugin_DATA = $(plugin_in_files:.plugin.in=.plugin)
 
-gtkbuilderdir = $(plugindatadir)
-gtkbuilder_DATA =                                      \
+PLUGIN_RESOURCES =                                     \
        ipod-info.ui                                    \
        ipod-init.ui                                    \
        ipod-toolbar.ui
 
-EXTRA_DIST = $(uixml_DATA) $(plugin_in_files) $(gtkbuilder_DATA)
+plugin_resource_deps = $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) 
$(srcdir)/ipod.gresource.xml)
+ipod-resources.c: $(plugin_resource_deps) $(srcdir)/ipod.gresource.xml
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES)           \
+               --target="$@"                           \
+               --sourcedir="$(srcdir)"                 \
+               --sourcedir="$(builddir)"               \
+               --generate-source "$(srcdir)/ipod.gresource.xml"
 
-CLEANFILES = $(plugin_DATA)
-DISTCLEANFILES = $(plugin_DATA)
+BUILT_SOURCES = ipod-resources.c $(plugin_DATA)
+
+EXTRA_DIST = $(PLUGIN_RESOURCES) $(plugin_in_files) ipod.gresource.xml
+
+CLEANFILES = $(BUILT_SOURCES)
+DISTCLEANFILES = $(BUILT_SOURCES)
diff --git a/plugins/ipod/ipod.gresource.xml b/plugins/ipod/ipod.gresource.xml
new file mode 100644
index 0000000..4abcc1e
--- /dev/null
+++ b/plugins/ipod/ipod.gresource.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+       <gresource prefix="/org/gnome/Rhythmbox/ipod">
+               <file preprocess="xml-stripblanks">ipod-info.ui</file>
+               <file preprocess="xml-stripblanks">ipod-init.ui</file>
+               <file preprocess="xml-stripblanks">ipod-toolbar.ui</file>
+       </gresource>
+</gresources>
diff --git a/plugins/ipod/rb-ipod-source.c b/plugins/ipod/rb-ipod-source.c
index e6be715..8a02890 100644
--- a/plugins/ipod/rb-ipod-source.c
+++ b/plugins/ipod/rb-ipod-source.c
@@ -474,7 +474,6 @@ create_init_dialog (RBiPodSource *source)
 {
        GFile *root;
        char *mountpoint;
-       char *builder_file;
        GtkBuilder *builder;
        GObject *plugin;
        RBiPodSourcePrivate *priv = IPOD_SOURCE_GET_PRIVATE (source);
@@ -491,16 +490,9 @@ create_init_dialog (RBiPodSource *source)
        }
 
        g_object_get (source, "plugin", &plugin, NULL);
-       builder_file = rb_find_plugin_data_file (G_OBJECT (plugin), "ipod-init.ui");
+       builder = rb_builder_load_plugin_file (G_OBJECT (plugin), "ipod-init.ui", NULL);
        g_object_unref (plugin);
 
-       builder = rb_builder_load (builder_file, NULL);
-       g_free (builder_file);
-       if (builder == NULL) {
-               g_free (mountpoint);
-               return FALSE;
-       }
-
        priv->init_dialog = GTK_WIDGET (gtk_builder_get_object (builder, "ipod_init"));
        priv->model_combo = GTK_WIDGET (gtk_builder_get_object (builder, "model_combo"));
        priv->name_entry = GTK_WIDGET (gtk_builder_get_object (builder, "name_entry"));
@@ -2007,7 +1999,6 @@ impl_show_properties (RBMediaPlayerSource *source, GtkWidget *info_box, GtkWidge
        GtkWidget *widget;
        char *text;
        const gchar *mp;
-       char *builder_file;
        Itdb_Device *ipod_dev;
        GObject *plugin;
        GList *output_formats;
@@ -2022,22 +2013,9 @@ impl_show_properties (RBMediaPlayerSource *source, GtkWidget *info_box, GtkWidge
        }
 
        g_object_get (source, "plugin", &plugin, NULL);
-       builder_file = rb_find_plugin_data_file (plugin, "ipod-info.ui");
+       builder = rb_builder_load_plugin_file (plugin, "ipod-info.ui", NULL);
        g_object_unref (plugin);
 
-       if (builder_file == NULL) {
-               g_warning ("Couldn't find ipod-info.ui");
-               return;
-       }
-
-       builder = rb_builder_load (builder_file, NULL);
-       g_free (builder_file);
-
-       if (builder == NULL) {
-               rb_debug ("Couldn't load ipod-info.ui");
-               return;
-       }
-
        ipod_dev = rb_ipod_db_get_device (priv->ipod_db);
 
        /* basic tab stuff */
diff --git a/plugins/iradio/Makefile.am b/plugins/iradio/Makefile.am
index 6d9a385..98f1477 100644
--- a/plugins/iradio/Makefile.am
+++ b/plugins/iradio/Makefile.am
@@ -5,6 +5,7 @@ plugindatadir = $(PLUGINDATADIR)/iradio
 plugin_LTLIBRARIES = libiradio.la
 
 libiradio_la_SOURCES =                                         \
+       iradio-resources.c                              \
        rb-iradio-plugin.c                              \
        rb-iradio-source.c                              \
        rb-iradio-source.h                              \
@@ -38,32 +39,33 @@ AM_CPPFLAGS =                                               \
        $(RHYTHMBOX_CFLAGS)                             \
        $(TOTEM_PLPARSER_CFLAGS)
 
-gtkbuilderdir = $(plugindatadir)
-gtkbuilder_DATA =                                      \
+PLUGIN_RESOURCES =                                     \
+       iradio-initial.xspf                             \
        iradio-popup.ui                                 \
        iradio-toolbar.ui                               \
        station-properties.ui
 
-xspfdir = $(plugindatadir)
-xspf_DATA = iradio-initial.xspf
+plugin_resource_deps = $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) 
$(srcdir)/iradio.gresource.xml)
+iradio-resources.c: $(plugin_resource_deps) $(srcdir)/iradio.gresource.xml
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES)           \
+               --target="$@"                           \
+               --sourcedir="$(srcdir)"                 \
+               --sourcedir="$(builddir)"               \
+               --generate-source "$(srcdir)/iradio.gresource.xml"
+
+BUILT_SOURCES = iradio-resources.c
 
 plugin_in_files = iradio.plugin.in
 
 %.plugin: %.plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) 
$(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
 
-BUILT_SOURCES =                                                        \
-       $(plugin_in_files:.plugin.in=.plugin)   \
-       $(NULL)
-
-plugin_DATA =                  \
-       $(BUILT_SOURCES)        \
-       $(NULL)
+plugin_DATA = $(plugin_in_files:.plugin.in=.plugin)
+BUILT_SOURCES += $(plugin_DATA)
 
 EXTRA_DIST =                   \
-       $(gtkbuilder_DATA)      \
-       $(uixml_DATA)           \
+       $(PLUGIN_RESOURCES)     \
        $(plugin_in_files)      \
-       $(xspf_DATA)            \
+       iradio.gresource.xml    \
        $(NULL)
 
 CLEANFILES =                   \
diff --git a/plugins/iradio/iradio.gresource.xml b/plugins/iradio/iradio.gresource.xml
new file mode 100644
index 0000000..354aac1
--- /dev/null
+++ b/plugins/iradio/iradio.gresource.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+       <gresource prefix="/org/gnome/Rhythmbox/iradio">
+               <file preprocess="xml-stripblanks">iradio-popup.ui</file>
+               <file preprocess="xml-stripblanks">iradio-toolbar.ui</file>
+               <file preprocess="xml-stripblanks">station-properties.ui</file>
+               <file preprocess="xml-stripblanks">iradio-initial.xspf</file>
+       </gresource>
+</gresources>
diff --git a/plugins/iradio/rb-iradio-source.c b/plugins/iradio/rb-iradio-source.c
index 2af91e8..898bc9a 100644
--- a/plugins/iradio/rb-iradio-source.c
+++ b/plugins/iradio/rb-iradio-source.c
@@ -289,22 +289,8 @@ rb_iradio_source_constructed (GObject *object)
 
        settings = g_settings_new ("org.gnome.rhythmbox.plugins.iradio");
        if (g_settings_get_boolean (settings, "initial-stations-loaded") == FALSE) {
-               GObject *plugin;
-               char *file;
-
-               g_object_get (source, "plugin", &plugin, NULL);
-               file = rb_find_plugin_data_file (plugin, "iradio-initial.xspf");
-               if (file != NULL) {
-                       char *uri = g_filename_to_uri (file, NULL, NULL);
-                       if (uri != NULL) {
-                               rb_iradio_source_add_from_playlist (source, uri);
-                               g_free (uri);
-
-                               g_settings_set_boolean (settings, "initial-stations-loaded", TRUE);
-                       }
-               }
-               g_free (file);
-               g_object_unref (plugin);
+               rb_iradio_source_add_from_playlist (source, 
"resource:///org/gnome/Rhythmbox/iradio/iradio-initial.xspf");
+               g_settings_set_boolean (settings, "initial-stations-loaded", TRUE);
        }
 
        _rb_add_display_page_actions (G_ACTION_MAP (g_application_get_default ()), G_OBJECT (shell), actions, 
G_N_ELEMENTS (actions));
diff --git a/plugins/iradio/rb-station-properties-dialog.c b/plugins/iradio/rb-station-properties-dialog.c
index 91d1276..1c14aa9 100644
--- a/plugins/iradio/rb-station-properties-dialog.c
+++ b/plugins/iradio/rb-station-properties-dialog.c
@@ -158,7 +158,6 @@ rb_station_properties_dialog_constructed (GObject *object)
        RBStationPropertiesDialog *dialog;
        GtkWidget *content_area;
        GtkBuilder *builder;
-       char *builder_file;
        AtkObject *lobj, *robj;
 
        RB_CHAIN_GOBJECT_METHOD (rb_station_properties_dialog_parent_class, constructed, object);
@@ -174,10 +173,7 @@ rb_station_properties_dialog_constructed (GObject *object)
        gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
        gtk_box_set_spacing (GTK_BOX (content_area), 2);
 
-       builder_file = rb_find_plugin_data_file (dialog->priv->plugin, "station-properties.ui");
-       g_assert (builder_file != NULL);
-       builder = rb_builder_load (builder_file, dialog);
-       g_free (builder_file);
+       builder = rb_builder_load_plugin_file (dialog->priv->plugin, "station-properties.ui", dialog);
 
        gtk_container_add (GTK_CONTAINER (content_area),
                           GTK_WIDGET (gtk_builder_get_object (builder, "stationproperties")));
diff --git a/plugins/mtpdevice/Makefile.am b/plugins/mtpdevice/Makefile.am
index a90c9f2..b5ae159 100644
--- a/plugins/mtpdevice/Makefile.am
+++ b/plugins/mtpdevice/Makefile.am
@@ -5,6 +5,7 @@ plugindatadir = $(PLUGINDATADIR)/mtpdevice
 plugin_LTLIBRARIES = libmtpdevice.la
 
 libmtpdevice_la_SOURCES = \
+       mtpdevice-resources.c \
        rb-mtp-plugin.c \
        rb-mtp-gst.c \
        rb-mtp-gst.h \
@@ -52,12 +53,21 @@ plugin_in_files = mtpdevice.plugin.in
 
 plugin_DATA = $(plugin_in_files:.plugin.in=.plugin)
 
-gtkbuilderdir = $(plugindatadir)
-gtkbuilder_DATA =                                      \
+PLUGIN_RESOURCES =                                     \
        mtp-info.ui                                     \
        mtp-toolbar.ui
 
-EXTRA_DIST = $(plugin_in_files) $(gtkbuilder_DATA)
+plugin_resource_deps = $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) 
$(srcdir)/mtpdevice.gresource.xml)
+mtpdevice-resources.c: $(plugin_resource_deps) $(srcdir)/mtpdevice.gresource.xml
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES)           \
+               --target="$@"                           \
+               --sourcedir="$(srcdir)"                 \
+               --sourcedir="$(builddir)"               \
+               --generate-source "$(srcdir)/mtpdevice.gresource.xml"
 
-CLEANFILES = $(plugin_DATA)
-DISTCLEANFILES = $(plugin_DATA)
+BUILT_SOURCES = $(plugin_DATA) mtpdevice-resources.c
+
+EXTRA_DIST = $(plugin_in_files) $(PLUGIN_RESOURCES) mtpdevice.gresource.xml
+
+CLEANFILES = $(BUILT_SOURCES)
+DISTCLEANFILES = $(BUILT_SOURCES)
diff --git a/plugins/mtpdevice/mtpdevice.gresource.xml b/plugins/mtpdevice/mtpdevice.gresource.xml
new file mode 100644
index 0000000..8dbbb90
--- /dev/null
+++ b/plugins/mtpdevice/mtpdevice.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+       <gresource prefix="/org/gnome/Rhythmbox/mtpdevice">
+               <file preprocess="xml-stripblanks">mtp-info.ui</file>
+               <file preprocess="xml-stripblanks">mtp-toolbar.ui</file>
+       </gresource>
+</gresources>
diff --git a/plugins/mtpdevice/rb-mtp-source.c b/plugins/mtpdevice/rb-mtp-source.c
index 4640dfe..83104a1 100644
--- a/plugins/mtpdevice/rb-mtp-source.c
+++ b/plugins/mtpdevice/rb-mtp-source.c
@@ -1551,7 +1551,6 @@ impl_show_properties (RBMediaPlayerSource *source, GtkWidget *info_box, GtkWidge
        gpointer key, value;
        int num_podcasts;
        char *device_name;
-       char *builder_file;
        GObject *plugin;
        char *text;
        GList *output_formats;
@@ -1559,22 +1558,9 @@ impl_show_properties (RBMediaPlayerSource *source, GtkWidget *info_box, GtkWidge
        GString *str;
 
        g_object_get (source, "plugin", &plugin, NULL);
-       builder_file = rb_find_plugin_data_file (G_OBJECT (plugin), "mtp-info.ui");
+       builder = rb_builder_load_plugin_file (G_OBJECT (plugin), "mtp-info.ui", NULL);
        g_object_unref (plugin);
 
-       if (builder_file == NULL) {
-               g_warning ("Couldn't find mtp-info.ui");
-               return;
-       }
-
-       builder = rb_builder_load (builder_file, NULL);
-       g_free (builder_file);
-
-       if (builder == NULL) {
-               rb_debug ("Couldn't load mtp-info.ui");
-               return;
-       }
-
        /* 'basic' tab stuff */
 
        widget = GTK_WIDGET (gtk_builder_get_object (builder, "mtp-basic-info"));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]