[gnome-sound-recorder/wip/jtojnar/run: 12/14] build: pack application.css into gresource
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder/wip/jtojnar/run: 12/14] build: pack application.css into gresource
- Date: Fri, 1 Feb 2019 01:43:52 +0000 (UTC)
commit 90ebc8208b9a4106c2e23141ae6e19ed3e0f2884
Author: Jan Tojnar <jtojnar gmail com>
Date: Fri Jan 18 02:58:35 2019 +0100
build: pack application.css into gresource
This will allow the app to easily find the stylesheet.
data/meson.build | 9 ++++++---
data/org.gnome.SoundRecorder.data.gresource.xml | 6 ++++++
src/util.js | 7 +++----
3 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 4b17e4b..ae11f53 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -30,9 +30,12 @@ configure_file(
install_dir: sound_recorder_schemadir
)
-install_data(
- 'application.css',
- install_dir: sound_recoder_pkgdatadir
+gnome.compile_resources(
+ '@0@.data'.format(application_id),
+ '@0 data gresource xml'.format(application_id),
+ gresource_bundle: true,
+ install: true,
+ install_dir: sound_recoder_pkgdatadir,
)
subdir('appdata')
diff --git a/data/org.gnome.SoundRecorder.data.gresource.xml b/data/org.gnome.SoundRecorder.data.gresource.xml
new file mode 100644
index 0000000..1c19787
--- /dev/null
+++ b/data/org.gnome.SoundRecorder.data.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/SoundRecorder">
+ <file alias="css/application.css">application.css</file>
+ </gresource>
+</gresources>
diff --git a/src/util.js b/src/util.js
index 33a7269..854058b 100644
--- a/src/util.js
+++ b/src/util.js
@@ -26,14 +26,13 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var Gdk = imports.gi.Gdk;
-var GLib = imports.gi.GLib;
+var Gio = imports.gi.Gio;
var Gtk = imports.gi.Gtk;
function loadStyleSheet() {
- var file = 'application.css';
+ var uri = 'resource:///org/gnome/SoundRecorder/css/application.css';
var provider = new Gtk.CssProvider();
- provider.load_from_path(GLib.build_filenamev([pkg.pkgdatadir,
- file]));
+ provider.load_from_file(Gio.File.new_for_uri(uri));
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]