[gnome-sound-recorder/wip/jtojnar/run] build: Add run target



commit ffc5363dbc5b9ca8b894c1140be1875ae4882194
Author: Jan Tojnar <jtojnar gmail com>
Date:   Fri Jan 18 02:58:35 2019 +0100

    build: Add run target
    
    This will allow developers to run the application with `ninja -C build run`
    without installation.

 data/meson.build                              |  5 -----
 meson.build                                   |  2 +-
 src/meson.build                               | 12 ++++++++++--
 src/org.gnome.SoundRecorder.src.gresource.xml |  3 +++
 src/util.js                                   |  7 +++----
 5 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 4b17e4b..47b89b2 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -30,9 +30,4 @@ configure_file(
   install_dir: sound_recorder_schemadir
 )
 
-install_data(
-  'application.css',
-  install_dir: sound_recoder_pkgdatadir
-)
-
 subdir('appdata')
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..a655526 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,4 +1,5 @@
 sound_recorder_sources = files(
+  '../data/application.css',
   'application.js',
   'audioProfile.js',
   'fileUtil.js',
@@ -28,7 +29,7 @@ configure_file(
   configuration: app_conf
 )
 
-gnome.compile_resources(
+resources = gnome.compile_resources(
   application_id + '.src',
   'org.gnome.SoundRecorder.src.gresource.xml',
   source_dir: '.',
@@ -36,4 +37,11 @@ gnome.compile_resources(
   gresource_bundle: true,
   install: true,
   install_dir: sound_recoder_pkgdatadir
-)
\ No newline at end of file
+)
+
+run_target('run',
+  command: join_paths(meson.build_root(), 'src', application_id),
+  depends: [
+    resources,
+  ]
+)
diff --git a/src/org.gnome.SoundRecorder.src.gresource.xml b/src/org.gnome.SoundRecorder.src.gresource.xml
index 5ed3acc..001d408 100644
--- a/src/org.gnome.SoundRecorder.src.gresource.xml
+++ b/src/org.gnome.SoundRecorder.src.gresource.xml
@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
+  <gresource prefix="/org/gnome/SoundRecorder/css">
+    <file alias="application.css">../data/application.css</file>
+  </gresource>
   <gresource prefix="/org/gnome/SoundRecorder/js">
     <file>application.js</file>
     <file>audioProfile.js</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]