[gjs/wip/package: 8/8] Package: add resources support



commit 87fd42fc55c8c7857f7c6cac29fe157435b0d927
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Mar 6 20:16:00 2013 +0100

    Package: add resources support
    
    More automagic handling of useful stuff.

 modules/package.js |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/modules/package.js b/modules/package.js
index 3586532..84628c2 100644
--- a/modules/package.js
+++ b/modules/package.js
@@ -24,6 +24,7 @@
  */
 
 const GLib = imports.gi.GLib;
+const Gio = imports.gi.Gio;
 const GjsPrivate = imports.gi.GjsPrivate;
 const GIRepository = imports.gi.GIRepository;
 const System = imports.system;
@@ -276,3 +277,9 @@ function initSubmodule(name) {
         // Running installed, submodule is in $(pkglibdir), nothing to do
     }
 }
+
+function loadResource(name) {
+    name = (name || this.name) + '.gresource';
+
+    Gio.Resource.load(GLib.build_filenamev([pkg.pkgdatadir, name]))._register();
+}


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