[gnome-sound-recorder/wip/jtojnar/run: 1/3] 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: 1/3] build: Pack application.css into gresource
- Date: Fri, 18 Jan 2019 02:23:18 +0000 (UTC)
commit 424e99f58961afb6821e26709bffaad5aa049cc9
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 ++++++
meson.build | 2 +-
src/meson.build | 4 ++--
src/util.js | 7 +++----
5 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 4b17e4b..1979659 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
+data_res = 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/meson.build b/meson.build
index 49bfd55..95b8672 100644
--- a/meson.build
+++ b/meson.build
@@ -29,8 +29,8 @@ i18n = import('i18n')
po_dir = join_paths(meson.source_root(), 'po')
-subdir('src')
subdir('data')
+subdir('src')
subdir('po')
meson.add_install_script(
diff --git a/src/meson.build b/src/meson.build
index e14efe6..ac7bcb2 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -28,7 +28,7 @@ configure_file(
configuration: app_conf
)
-gnome.compile_resources(
+src_res = gnome.compile_resources(
application_id + '.src',
'org.gnome.SoundRecorder.src.gresource.xml',
source_dir: '.',
@@ -36,4 +36,4 @@ gnome.compile_resources(
gresource_bundle: true,
install: true,
install_dir: sound_recoder_pkgdatadir
-)
\ No newline at end of file
+)
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]