[gnome-weather/wip/gjs-experiments: 1/6] Move resource loading to package
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-weather/wip/gjs-experiments: 1/6] Move resource loading to package
- Date: Sat, 9 Mar 2013 14:07:38 +0000 (UTC)
commit 3ea99370de2aae78542ae71956b0dd252ddb648e
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Wed Mar 6 20:20:29 2013 +0100
Move resource loading to package
Resource loading is useful for all applications, so let's move there
so we can remember of it when package is moved into gjs.
src/main.js | 3 +--
src/package.js | 6 ++++++
2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/main.js b/src/main.js
index 8435071..0ca33cb 100644
--- a/src/main.js
+++ b/src/main.js
@@ -59,8 +59,7 @@ const Application = new Lang.Class({
vfunc_startup: function() {
this.parent();
- let resource = Gio.Resource.load(pkg.pkgdatadir + '/gnome-weather.gresource');
- resource._register();
+ pkg.loadResource();
Util.loadStyleSheet(Gio.file_new_for_uri('resource:///org/gnome/weather/application.css'));
diff --git a/src/package.js b/src/package.js
index 67d98d1..117a9ee 100644
--- a/src/package.js
+++ b/src/package.js
@@ -280,3 +280,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]