[gnome-music] Fix accessing data files



commit 2c9360f06cc0c76e5bace8c441c8c797c00bbed8
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Tue Apr 2 19:08:47 2013 +0200

    Fix accessing data files
    
    The standard path for all data files is data/ when using a package.js
    layout. Also, we need to load GtkBuilder definitions from resources,
    not files.

 Makefile.am                                        |    2 +-
 configure.ac                                       |    1 +
 {src/resources => data}/app-menu.ui                |    0
 .../gnome-music.gresource.xml                      |    0
 {src/resources => data}/lp.jpg                     |  Bin 20663 -> 20663 bytes
 .../org.gnome.Music.gschema.xml                    |   20 ++++++++++----------
 src/application.js                                 |    6 ++++--
 7 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 25c551b..1f51274 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
 ACLOCAL_AMFLAGS = -I m4 -I libgd
 
-SUBDIRS = libgd src
+SUBDIRS = libgd src data
 
 MAINTAINERCLEANFILES = \
        $(srcdir)/INSTALL \
diff --git a/configure.ac b/configure.ac
index 7f0fdfc..a6c561e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,7 @@ AC_SUBST(GLIB_COMPILE_RESOURCES)
 
 AC_CONFIG_FILES([
   Makefile
+  data/Makefile
   libgd/Makefile
   src/Makefile
 ])
diff --git a/src/resources/app-menu.ui b/data/app-menu.ui
similarity index 100%
rename from src/resources/app-menu.ui
rename to data/app-menu.ui
diff --git a/src/resources/music.gresource.xml b/data/gnome-music.gresource.xml
similarity index 100%
rename from src/resources/music.gresource.xml
rename to data/gnome-music.gresource.xml
diff --git a/src/resources/lp.jpg b/data/lp.jpg
similarity index 100%
rename from src/resources/lp.jpg
rename to data/lp.jpg
diff --git a/src/resources/org.gnome.Music.gschema.xml.in b/data/org.gnome.Music.gschema.xml
similarity index 51%
rename from src/resources/org.gnome.Music.gschema.xml.in
rename to data/org.gnome.Music.gschema.xml
index 817181e..3146f55 100644
--- a/src/resources/org.gnome.Music.gschema.xml.in
+++ b/data/org.gnome.Music.gschema.xml
@@ -3,28 +3,28 @@
     <schema path="/org/gnome/Music/" id="org.gnome.Music" gettext-domain="gnome-music">
         <key name="window-size" type="ai">
             <default>[768, 600]</default>
-            <_summary>Window size</_summary>
-            <_description>Window size (width and height).</_description>
+            <summary>Window size</summary>
+            <description>Window size (width and height).</description>
         </key>
         <key name="window-position" type="ai">
             <default>[]</default>
-            <_summary>Window position</_summary>
-            <_description>Window position (x and y).</_description>
+            <summary>Window position</summary>
+            <description>Window position (x and y).</description>
         </key>
         <key name="window-maximized" type="b">
             <default>true</default>
-            <_summary>Window maximized</_summary>
-            <_description>Window maximized state</_description>
+            <summary>Window maximized</summary>
+            <description>Window maximized state</description>
         </key>
         <key name="shuffle" type="b">
             <default>false</default>
-            <_summary>Shuffle playback</_summary>
-            <_description>If true, do randomized playback through the collection</_description>
+            <summary>Shuffle playback</summary>
+            <description>If true, do randomized playback through the collection</description>
         </key>
         <key name="search" type="b">
             <default>false</default>
-            <_summary>Search mode</_summary>
-            <_description>If true, the search bar is shown</_description>
+            <summary>Search mode</summary>
+            <description>If true, the search bar is shown</description>
         </key>
     </schema>
 </schemalist>
diff --git a/src/application.js b/src/application.js
index f9e324e..676c25b 100644
--- a/src/application.js
+++ b/src/application.js
@@ -58,16 +58,18 @@ const Application = new Lang.Class({
             menu;
 
         builder = new Gtk.Builder();
-        builder.add_from_file('resources/app-menu.ui'); //fix this
+        builder.add_from_resource('/org/gnome/music/app-menu.ui');
 
         menu = builder.get_object('app-menu');
         this.set_app_menu(menu);
     },
 
     vfunc_startup: function() {
-        Gtk.init(null);
         this.parent();
 
+        let resource = Gio.Resource.load(pkg.pkgdatadir + '/gnome-music.gresource');
+        resource._register();
+
         this._window = new Window.MainWindow(this);
         this._buildAppMenu();
     },


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