[gnome-sound-recorder] Adapt for the package.js which is shipped by gjs



commit f5dbb47ef6c18a2d95a1416c125ffb68e5238d52
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Fri Jun 27 22:30:39 2014 +0200

    Adapt for the package.js which is shipped by gjs
    
    package.js requires the launched script to be named after the
    app it launches (otherwise pkg.name reports wrong values).
    Also, the sources need to be compiled in GResource now,
    and imports are no longer automagic.
    
    This does not affect the command line (because a symlink is
    installed in $(bindir) as "gnome-sound-recorder") and does
    not affect launching from srcdir (the real JS files are loaded)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732847

 src/Makefile.am                               |   53 ++---
 src/application.js                            |   10 +-
 src/audioProfile.js                           |    4 +-
 src/fileUtil.js                               |    6 +-
 src/info.js                                   |    1 +
 src/listview.js                               |    4 +-
 src/main.js                                   |   11 +-
 src/mainWindow.js                             |    6 +-
 src/org.gnome.SoundRecorder.in                |    6 +
 src/org.gnome.SoundRecorder.src.gresource.xml |   18 ++
 src/package.js                                |  309 -------------------------
 src/play.js                                   |    6 +-
 src/preferences.js                            |    1 +
 src/record.js                                 |    5 +-
 src/util.js                                   |    4 +
 src/waveform.js                               |    3 +-
 16 files changed, 81 insertions(+), 366 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 5caae1b..83d1ecc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,35 +1,18 @@
-## Process this file with automake to produce Makefile.in
+NULL =
 
-## Created by Anjuta 
-NULL = 
+appdir = $(pkgdatadir)
+nodist_app_SCRIPTS = org.gnome.SoundRecorder
 
-nodist_bin_SCRIPTS = gnome-sound-recorder 
+app_resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies 
$(srcdir)/org.gnome.SoundRecorder.src.gresource.xml)
+org.gnome.SoundRecorder.src.gresource: org.gnome.SoundRecorder.src.gresource.xml $(app_resource_files)
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) $<
 
+resourcedir = $(pkgdatadir)
+resource_DATA = org.gnome.SoundRecorder.src.gresource
 
-jsdir = $(pkgdatadir)
-dist_js_DATA = \
-    util.js    \
-    application.js \
-    audioProfile.js \
-    fileUtil.js \
-    info.js \
-    listview.js \
-    main.js \
-    mainWindow.js \
-    package.js \
-    params.js \
-    play.js \
-    preferences.js \
-    record.js \
-    waveform.js\
-    $(NULL)
-
-
-
-$(PACKAGE_NAME): $(PACKAGE_NAME).in
+org.gnome.SoundRecorder: org.gnome.SoundRecorder.in
        $(AM_V_GEN) sed \
                -e "s|[ ]GJS@|$(GJS)|g" \
-               -e "s|[ ]PACKAGE_NAME@|$(PACKAGE_NAME)|g" \
                -e "s|[ ]PACKAGE_VERSION@|$(PACKAGE_VERSION)|g" \
                -e "s|[ ]prefix@|$(prefix)|g" \
                -e "s|[ ]libdir@|$(libdir)|g" \
@@ -37,7 +20,21 @@ $(PACKAGE_NAME): $(PACKAGE_NAME).in
                $< > $@
        @chmod +x $@
 
-EXTRA_DIST = gnome-sound-recorder.in 
-DISTCLEANFILES = gnome-sound-recorder
+EXTRA_DIST = \
+       org.gnome.SoundRecorder.in \
+       org.gnome.SoundRecorder.src.gresource.xml \
+       $(app_resource_files) \
+       $(NULL)
+
+CLEANFILES = \
+       org.gnome.SoundRecorder \
+       org.gnome.SoundRecorder.src.gresource \
+       $(NULL)
+
+install-exec-hook:
+       $(MKDIR_P) $(DESTDIR)$(bindir)
+       $(LN_S) $(appdir)/org.gnome.SoundRecorder $(DESTDIR)$(bindir)/$(PACKAGE_TARNAME)
+uninstall-hook:
+       -rm -f $(DESTDIR)$(bindir)/$(PACKAGE_TARNAME)
 
 -include $(top_srcdir)/git.mk
diff --git a/src/application.js b/src/application.js
index fc2e4e8..e34d641 100644
--- a/src/application.js
+++ b/src/application.js
@@ -17,13 +17,15 @@
 *
 */
 
-const Util = imports.util;
 const Gio = imports.gi.Gio;
-const Gst = imports.gi.Gst;
 const GLib = imports.gi.GLib;
+const Gst = imports.gi.Gst;
+const Gtk = imports.gi.Gtk;
+const Lang = imports.lang;
 
 const MainWindow = imports.mainWindow;
 const Preferences = imports.preferences;
+const Util = imports.util;
 
 const SIGINT = 2;
 const SIGTERM = 15;
@@ -37,7 +39,7 @@ const Application = new Lang.Class({
     Extends: Gtk.Application,
 
     _init: function() {
-        this.parent({ application_id: "org.gnome.SoundRecorder"}); 
+        this.parent({ application_id: pkg.name }); 
         GLib.set_application_name(_("SoundRecorder"));         
     },
     
@@ -154,7 +156,7 @@ const Application = new Lang.Class({
         aboutDialog.copyright = 'Copyright ' + String.fromCharCode(0x00A9) + ' 2013' + 
String.fromCharCode(0x2013) + 'Meg Ford';
         aboutDialog.license_type = Gtk.License.GPL_2_0;
         aboutDialog.logo_icon_name = 'audio-input-microphone';
-        aboutDialog.version = '3.12.1';
+        aboutDialog.version = pkg.version;
         aboutDialog.website = 'http://live.gnome.org/GnomeSoundRecorder';
         aboutDialog.wrap_license = true;
         aboutDialog.modal = true;
diff --git a/src/audioProfile.js b/src/audioProfile.js
index efbbdc5..6547285 100644
--- a/src/audioProfile.js
+++ b/src/audioProfile.js
@@ -16,14 +16,12 @@
  *  Author: Meg Ford <megford gnome org>
  *
  */
- 
-imports.gi.versions.Gst = '1.0';
 
 const _ = imports.gettext.gettext;
 const Gio = imports.gi.Gio;
 const Gst = imports.gi.Gst;
 const GstPbutils = imports.gi.GstPbutils;
-
+const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
 const MainWindow = imports.mainWindow;
diff --git a/src/fileUtil.js b/src/fileUtil.js
index 62c126e..25d1b4a 100644
--- a/src/fileUtil.js
+++ b/src/fileUtil.js
@@ -16,17 +16,15 @@
  * Author: Meg Ford <megford gnome org>
  *
  */
- 
-imports.gi.versions.Gst = '1.0';
 
 const Gettext = imports.gettext;
 const _ = imports.gettext.gettext;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject; 
+const GObject = imports.gi.GObject;
 const Gst = imports.gi.Gst;
 const GstPbutils = imports.gi.GstPbutils;
-
+const Lang = imports.lang;
 const Signals = imports.signals;
 
 const Listview = imports.listview;
diff --git a/src/info.js b/src/info.js
index b80a3ca..58b90ac 100644
--- a/src/info.js
+++ b/src/info.js
@@ -21,6 +21,7 @@
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const Gtk = imports.gi.Gtk;
+const Lang = imports.lang;
 
 const _ = imports.gettext.gettext;
 const C_ = imports.gettext.pgettext;
diff --git a/src/listview.js b/src/listview.js
index b115cdb..3bce9ed 100644
--- a/src/listview.js
+++ b/src/listview.js
@@ -17,8 +17,6 @@
  * Author: Meg Ford <megford gnome org>
  *
  */
- 
-imports.gi.versions.Gst = '1.0';
 
 const _ = imports.gettext.gettext;
 const Gio = imports.gi.Gio;
@@ -26,7 +24,7 @@ const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject; 
 const Gst = imports.gi.Gst;
 const GstPbutils = imports.gi.GstPbutils;
-
+const Lang = imports.lang;
 const Signals = imports.signals;
 
 const AudioProfile = imports.audioProfile;
diff --git a/src/main.js b/src/main.js
index 3c75886..a491434 100644
--- a/src/main.js
+++ b/src/main.js
@@ -30,15 +30,14 @@ pkg.initGettext();
 pkg.initFormat();
 pkg.require({ 'Gd': '1.0',
               'Gdk': '3.0',
+              'GdkPixbuf': '2.0',
               'GLib': '2.0',
               'GObject': '2.0',
               'Gtk': '3.0',
-              'Lang': '',
-              'Mainloop': '',
-              'Params': '1.0',
-              'System': '' });
-              
-imports.gi.versions.Gst = '1.0';
+              'Gst': '1.0',
+              'GstAudio': '1.0',
+              'GstPbutils': '1.0' });
+
 const Application = imports.application;
 
 function main(argv) {
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 273cc75..7c6300d 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -16,15 +16,16 @@
 * Author: Meg Ford <megford gnome org>
 *
 */
- 
-imports.gi.versions.Gst = '1.0';
 
 const Gettext = imports.gettext;
 const _ = imports.gettext.gettext;
 const Gdk = imports.gi.Gdk;
 const GdkPixbuf = imports.gi.GdkPixbuf;
 const Gio = imports.gi.Gio;
+const GLib = imports.gi.GLib;
 const Gst = imports.gi.Gst;
+const Gtk = imports.gi.Gtk;
+const Lang = imports.lang;
 const Pango = imports.gi.Pango;
 
 const Application = imports.application;
@@ -32,6 +33,7 @@ const AudioProfile = imports.audioProfile;
 const FileUtil = imports.fileUtil;
 const Info = imports.info;
 const Listview = imports.listview;
+const Params = imports.params;
 const Play = imports.play;
 const Preferences = imports.preferences;
 const Record = imports.record;
diff --git a/src/org.gnome.SoundRecorder.in b/src/org.gnome.SoundRecorder.in
new file mode 100644
index 0000000..25eee28
--- /dev/null
+++ b/src/org.gnome.SoundRecorder.in
@@ -0,0 +1,6 @@
+#! GJS@
+imports.package.init({ name: "gnome-sound-recorder",
+                        version: "@PACKAGE_VERSION@",
+                        prefix: "@prefix@",
+                        libdir: "@libdir@" });
+imports.package.run(imports.main);
\ No newline at end of file
diff --git a/src/org.gnome.SoundRecorder.src.gresource.xml b/src/org.gnome.SoundRecorder.src.gresource.xml
new file mode 100644
index 0000000..5ed3acc
--- /dev/null
+++ b/src/org.gnome.SoundRecorder.src.gresource.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/SoundRecorder/js">
+    <file>application.js</file>
+    <file>audioProfile.js</file>
+    <file>fileUtil.js</file>
+    <file>info.js</file>
+    <file>listview.js</file>
+    <file>main.js</file>
+    <file>mainWindow.js</file>
+    <file>params.js</file>
+    <file>play.js</file>
+    <file>preferences.js</file>
+    <file>record.js</file>
+    <file>util.js</file>
+    <file>waveform.js</file>
+  </gresource>
+</gresources>
diff --git a/src/play.js b/src/play.js
index 6fa7d7f..6485e96 100644
--- a/src/play.js
+++ b/src/play.js
@@ -17,14 +17,14 @@
  *
  */
 
-imports.gi.versions.Gst = '1.0';
-
 const _ = imports.gettext.gettext;
 const Gio = imports.gi.Gio;
+const GLib = imports.gi.GLib;
 const Gst = imports.gi.Gst;
 const GstAudio = imports.gi.GstAudio;
 const GstPbutils = imports.gi.GstPbutils;
-
+const Gtk = imports.gi.Gtk;
+const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
 const Application = imports.application;
diff --git a/src/preferences.js b/src/preferences.js
index 6f56b51..ff9edfe 100644
--- a/src/preferences.js
+++ b/src/preferences.js
@@ -20,6 +20,7 @@
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const Gtk = imports.gi.Gtk;
+const Lang = imports.lang;
 
 const _ = imports.gettext.gettext;
 const C_ = imports.gettext.pgettext;
diff --git a/src/record.js b/src/record.js
index b69ec41..3fd4111 100644
--- a/src/record.js
+++ b/src/record.js
@@ -17,8 +17,6 @@
  *
  */
 
-imports.gi.versions.Gst = '1.0';
-
 const _ = imports.gettext.gettext;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
@@ -26,8 +24,9 @@ const GObject = imports.gi.GObject;
 const Gst = imports.gi.Gst;
 const GstAudio = imports.gi.GstAudio;
 const GstPbutils = imports.gi.GstPbutils;
+const Gtk = imports.gi.Gtk;
 const Pango = imports.gi.Pango;
-
+const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const Signals = imports.signals;
 
diff --git a/src/util.js b/src/util.js
index 78ca673..a398f7e 100644
--- a/src/util.js
+++ b/src/util.js
@@ -25,6 +25,10 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+const Gdk = imports.gi.Gdk;
+const GLib = imports.gi.GLib;
+const Gtk = imports.gi.Gtk;
+
 function loadStyleSheet() {
     let file = 'application.css';
     let provider = new Gtk.CssProvider();
diff --git a/src/waveform.js b/src/waveform.js
index c58f74b..23aabac 100644
--- a/src/waveform.js
+++ b/src/waveform.js
@@ -26,10 +26,11 @@ const GObject = imports.gi.GObject;
 const Gst = imports.gi.Gst;
 const GstAudio = imports.gi.GstAudio;
 const Gtk = imports.gi.Gtk;
+const Lang = imports.lang;
+const Mainloop = imports.mainloop;
 
 const _ = imports.gettext.gettext;
 const C_ = imports.gettext.pgettext;
-const Mainloop = imports.mainloop;
 
 const MainWindow = imports.mainWindow;
 const Application = imports.application;


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