Blob Blame History Raw
diff -uNrp a/nemo-preview/src/js/ui/application.js b/nemo-preview/src/js/ui/application.js
--- a/nemo-preview/src/js/ui/application.js	2014-04-12 16:25:12.000000000 +0100
+++ b/nemo-preview/src/js/ui/application.js	2014-10-19 14:56:53.000000000 +0100
@@ -41,15 +41,17 @@ const MainWindow = imports.ui.mainWindow
 const NEMO_PREVIEW_DBUS_PATH = '/org/nemo/Preview';
 const NEMO_PREVIEW_DBUS_NAME = 'org.nemo.Preview';
 
-const NemoPreviewIface = <interface name={NEMO_PREVIEW_DBUS_NAME}>
-<method name="ShowFile">
-    <arg type="s" direction="in" name="uri" />
-    <arg type="i" direction="in" name="xid" />
-    <arg type="b" direction="in" name="closeIfAlreadyShown" />
-</method>
-<method name="Close">
-</method>
-</interface>;
+const NemoPreviewIface = '<node> \
+<interface name="org.nemo.Preview"> \
+<method name="ShowFile"> \
+    <arg type="s" direction="in" name="uri" /> \
+    <arg type="i" direction="in" name="xid" /> \
+    <arg type="b" direction="in" name="closeIfAlreadyShown" /> \
+</method> \
+<method name="Close"> \
+</method> \
+</interface> \
+</node>';
 
 const Application = new Lang.Class({
     Name: 'Application',
diff -uNrp a/nemo-preview/src/js/ui/fallbackRenderer.js b/nemo-preview/src/js/ui/fallbackRenderer.js
--- a/nemo-preview/src/js/ui/fallbackRenderer.js	2014-04-12 16:25:12.000000000 +0100
+++ b/nemo-preview/src/js/ui/fallbackRenderer.js	2014-10-19 14:56:53.000000000 +0100
@@ -25,14 +25,17 @@
  *
  */
 
-let Gtk = imports.gi.Gtk;
-let NemoPreview = imports.gi.NemoPreview;
+const Gio = imports.gi.Gio;
+const Gtk = imports.gi.Gtk;
+const GtkClutter = imports.gi.GtkClutter;
+const NemoPreview = imports.gi.NemoPreview;
 
-let Gettext = imports.gettext.domain('nemo-preview');
-let _ = Gettext.gettext;
+const Gettext = imports.gettext.domain('nemo-preview');
+const _ = Gettext.gettext;
+const Lang = imports.lang;
 
-let Constants = imports.util.constants;
-let Utils = imports.ui.utils;
+const Constants = imports.util.constants;
+const Utils = imports.ui.utils;
 
 function FallbackRenderer(args) {
     this._init(args);
diff -uNrp a/nemo-preview/src/js/ui/mainWindow.js b/nemo-preview/src/js/ui/mainWindow.js
--- a/nemo-preview/src/js/ui/mainWindow.js	2014-04-12 16:25:12.000000000 +0100
+++ b/nemo-preview/src/js/ui/mainWindow.js	2014-10-19 14:56:53.000000000 +0100
@@ -25,9 +25,19 @@
  *
  */
 
+const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
 const Gdk = imports.gi.Gdk;
+
+screen = Gdk.Screen.get_default()
+mon = screen.get_primary_monitor()
+s = screen.get_monitor_scale_factor(mon)
+
+// TODO: This is the only way to tell clutter what scale to use until
+// our next clutter version
+GLib.setenv("CLUTTER_SCALE", Math.max(s, 1).toString(), true);
+
 const GdkX11 = imports.gi.GdkX11;
 const GdkPixbuf = imports.gi.GdkPixbuf;
 const Gtk = imports.gi.Gtk;
@@ -102,6 +112,8 @@ MainWindow.prototype = {
     },
 
     _createClutterEmbed : function() {
+        let scale = this._gtkWindow.get_scale_factor();
+
         this._clutterEmbed = new GtkClutter.Embed();
         this._gtkWindow.add(this._clutterEmbed);
 
@@ -316,6 +328,7 @@ MainWindow.prototype = {
                             this._pendingRenderer.prepare(file, this, Lang.bind(this, this._onRendererPrepared));
                         } catch(e) {
                             /* FIXME: report the error */
+                            logError(e, 'Error calling prepare() on viewer');
                         }}));
     },
 
@@ -619,11 +632,23 @@ MainWindow.prototype = {
         Tweener.addTween(this._mainGroup,
                          { opacity: 255,
                            time: 0.3,
-                           transition: 'easeOutQuad' });
+                           transition: 'easeOutQuad',
+                           onComplete: function() {
+                               this._onMotionEvent();
+                               this._mainGroup.queue_relayout();
+                           },
+                           onCompleteScope: this
+                         });
         Tweener.addTween(this._titleGroup,
                          { opacity: 255,
                            time: 0.3,
-                           transition: 'easeOutQuad' });
+                           transition: 'easeOutQuad',
+                           onComplete: function() {
+                               this._onMotionEvent()
+                               this._titleGroup.queue_relayout();
+                           },
+                           onCompleteScope: this
+                         });
     },
 
     _fadeOutWindow : function() {
@@ -659,7 +684,8 @@ MainWindow.prototype = {
     setParent : function(xid) {
         this._parent = NemoPreview.create_foreign_window(xid);
         this._gtkWindow.realize();
-        this._gtkWindow.get_window().set_transient_for(this._parent);
+        if (this._parent)
+            this._gtkWindow.get_window().set_transient_for(this._parent);
         this._gtkWindow.show_all();
 
         this._gtkWindow.get_window().move_to_current_desktop();
diff -uNrp a/nemo-preview/src/js/ui/mimeHandler.js b/nemo-preview/src/js/ui/mimeHandler.js
--- a/nemo-preview/src/js/ui/mimeHandler.js	2014-04-12 16:25:12.000000000 +0100
+++ b/nemo-preview/src/js/ui/mimeHandler.js	2014-10-19 14:56:53.000000000 +0100
@@ -27,7 +27,7 @@
 
 const FallbackRenderer = imports.ui.fallbackRenderer;
 
-let Gio = imports.gi.Gio;
+const Gio = imports.gi.Gio;
 
 let _mimeHandler = null;
 
diff -uNrp a/nemo-preview/src/js/ui/spinnerBox.js b/nemo-preview/src/js/ui/spinnerBox.js
--- a/nemo-preview/src/js/ui/spinnerBox.js	2014-04-12 16:25:12.000000000 +0100
+++ b/nemo-preview/src/js/ui/spinnerBox.js	2014-10-19 14:56:53.000000000 +0100
@@ -25,11 +25,14 @@
  *
  */
 
-let Clutter = imports.gi.Clutter;
-let Gtk = imports.gi.Gtk;
-
-let Tweener = imports.ui.tweener;
-let Mainloop = imports.mainloop;
+const Gettext = imports.gettext.domain('nemo-preview');
+const _ = Gettext.gettext;
+const Gtk = imports.gi.Gtk;
+const GtkClutter = imports.gi.GtkClutter;
+
+const Tweener = imports.ui.tweener;
+const Lang = imports.lang;
+const Mainloop = imports.mainloop;
 
 let SPINNER_SIZE = 48;
 let TIMEOUT = 500;
@@ -108,4 +111,4 @@ SpinnerBox.prototype = {
                            transition: 'easeOutQuad'
                          });
     },
-}
\ No newline at end of file
+}
diff -uNrp a/nemo-preview/src/js/ui/utils.js b/nemo-preview/src/js/ui/utils.js
--- a/nemo-preview/src/js/ui/utils.js	2014-04-12 16:25:12.000000000 +0100
+++ b/nemo-preview/src/js/ui/utils.js	2014-10-19 14:56:53.000000000 +0100
@@ -25,7 +25,12 @@
  *
  */
 
-let Constants = imports.util.constants;
+const Gdk = imports.gi.Gdk;
+const Gtk = imports.gi.Gtk;
+
+const Lang = imports.lang;
+
+const Constants = imports.util.constants;
 
 let slowDownFactor = 0;
 
diff -uNrp a/nemo-preview/src/js/viewers/audio.js b/nemo-preview/src/js/viewers/audio.js
--- a/nemo-preview/src/js/viewers/audio.js	2014-04-12 16:25:12.000000000 +0100
+++ b/nemo-preview/src/js/viewers/audio.js	2014-10-19 14:56:53.000000000 +0100
@@ -25,17 +25,20 @@
  *
  */
 
-let MimeHandler = imports.ui.mimeHandler;
-let Gst = imports.gi.Gst;
-let Gio = imports.gi.Gio;
+const Gio = imports.gi.Gio;
+const Gst = imports.gi.Gst;
+const Gtk = imports.gi.Gtk;
+const GtkClutter = imports.gi.GtkClutter;
+const NemoPreview = imports.gi.NemoPreview;
 
-let Gettext = imports.gettext.domain('nemo-preview');
-let _ = Gettext.gettext;
+const Gettext = imports.gettext.domain('nemo-preview');
+const _ = Gettext.gettext;
+const Lang = imports.lang;
 
-let Constants = imports.util.constants;
-let TotemMimeTypes = imports.util.totemMimeTypes;
-
-let Utils = imports.ui.utils;
+const Constants = imports.util.constants;
+const MimeHandler = imports.ui.mimeHandler;
+const TotemMimeTypes = imports.util.totemMimeTypes;
+const Utils = imports.ui.utils;
 
 function AudioRenderer(args) {
     this._init(args);
diff -uNrp a/nemo-preview/src/js/viewers/evince.js b/nemo-preview/src/js/viewers/evince.js
--- a/nemo-preview/src/js/viewers/evince.js	2014-04-12 16:25:12.000000000 +0100
+++ b/nemo-preview/src/js/viewers/evince.js	2014-10-19 14:56:53.000000000 +0100
@@ -25,16 +25,19 @@
  *
  */
 
-let MimeHandler = imports.ui.mimeHandler;
-let EvDoc = imports.gi.EvinceDocument;
-let EvView = imports.gi.EvinceView;
+const EvDoc = imports.gi.EvinceDocument;
+const EvView = imports.gi.EvinceView;
+const Gtk = imports.gi.Gtk;
+const GtkClutter = imports.gi.GtkClutter;
+const NemoPreview = imports.gi.NemoPreview;
 
-let NemoPreview = imports.gi.NemoPreview;
+const Gettext = imports.gettext.domain('nemo-preview');
+const _ = Gettext.gettext;
+const Lang = imports.lang;
 
-let Gettext = imports.gettext.domain('nemo-preview');
-let _ = Gettext.gettext;
-
-let Utils = imports.ui.utils;
+const Constants = imports.util.constants;
+const MimeHandler = imports.ui.mimeHandler;
+const Utils = imports.ui.utils;
 
 function EvinceRenderer(args) {
     this._init(args);
diff -uNrp a/nemo-preview/src/js/viewers/font.js b/nemo-preview/src/js/viewers/font.js
--- a/nemo-preview/src/js/viewers/font.js	2014-04-12 16:25:12.000000000 +0100
+++ b/nemo-preview/src/js/viewers/font.js	2014-10-19 14:56:53.000000000 +0100
@@ -25,12 +25,15 @@
  *
  */
 
-let MimeHandler = imports.ui.mimeHandler;
-let GtkClutter = imports.gi.GtkClutter;
-let Gtk = imports.gi.Gtk;
-let GLib = imports.gi.GLib;
+const MimeHandler = imports.ui.mimeHandler;
+const Utils = imports.ui.utils;
 
-let NemoPreview = imports.gi.NemoPreview;
+const Lang = imports.lang;
+
+const GtkClutter = imports.gi.GtkClutter;
+const Gtk = imports.gi.Gtk;
+const GLib = imports.gi.GLib;
+const NemoPreview = imports.gi.NemoPreview;
 
 function FontRenderer(args) {
     this._init(args);
diff -uNrp a/nemo-preview/src/js/viewers/gst.js b/nemo-preview/src/js/viewers/gst.js
--- a/nemo-preview/src/js/viewers/gst.js	2014-04-12 16:25:12.000000000 +0100
+++ b/nemo-preview/src/js/viewers/gst.js	2014-10-19 14:56:53.000000000 +0100
@@ -26,18 +26,19 @@
  */
 
 imports.gi.versions.ClutterGst = '2.0';
-let ClutterGst = imports.gi.ClutterGst;
+const ClutterGst = imports.gi.ClutterGst;
+const Clutter = imports.gi.Clutter;
+const Gdk = imports.gi.Gdk;
+const GObject = imports.gi.GObject;
+const Gtk = imports.gi.Gtk;
+const GtkClutter = imports.gi.GtkClutter;
 
-let MimeHandler = imports.ui.mimeHandler;
-let Clutter = imports.gi.Clutter;
-let Gdk = imports.gi.Gdk;
-let GObject = imports.gi.GObject;
+const Lang = imports.lang;
 
-let Lang = imports.lang;
-
-let Utils = imports.ui.utils;
-let Constants = imports.util.constants;
-let TotemMimeTypes = imports.util.totemMimeTypes;
+const Constants = imports.util.constants;
+const MimeHandler = imports.ui.mimeHandler;
+const TotemMimeTypes = imports.util.totemMimeTypes;
+const Utils = imports.ui.utils;
 
 function GstRenderer(args) {
     this._init(args);
diff -uNrp a/nemo-preview/src/js/viewers/html.js b/nemo-preview/src/js/viewers/html.js
--- a/nemo-preview/src/js/viewers/html.js	2014-04-12 16:25:12.000000000 +0100
+++ b/nemo-preview/src/js/viewers/html.js	2014-10-19 14:56:53.000000000 +0100
@@ -25,15 +25,14 @@
  *
  */
 
-let MimeHandler = imports.ui.mimeHandler;
-let GtkClutter = imports.gi.GtkClutter;
-let Gtk = imports.gi.Gtk;
-let GLib = imports.gi.GLib;
-let WebKit = imports.gi.WebKit;
+const GtkClutter = imports.gi.GtkClutter;
+const Gtk = imports.gi.Gtk;
+const GLib = imports.gi.GLib;
+const WebKit = imports.gi.WebKit;
+const NemoPreview = imports.gi.NemoPreview;
 
-let NemoPreview = imports.gi.NemoPreview;
-
-let Utils = imports.ui.utils;
+const MimeHandler = imports.ui.mimeHandler;
+const Utils = imports.ui.utils;
 
 function HTMLRenderer(args) {
     this._init(args);
diff -uNrp a/nemo-preview/src/js/viewers/image.js b/nemo-preview/src/js/viewers/image.js
--- a/nemo-preview/src/js/viewers/image.js	2014-04-12 16:25:12.000000000 +0100
+++ b/nemo-preview/src/js/viewers/image.js	2014-10-19 14:56:53.000000000 +0100
@@ -25,16 +25,17 @@
  *
  */
 
-let MimeHandler = imports.ui.mimeHandler;
-let GdkPixbuf = imports.gi.GdkPixbuf;
-let GtkClutter = imports.gi.GtkClutter;
-let Gtk = imports.gi.Gtk;
-let GLib = imports.gi.GLib;
+const GdkPixbuf = imports.gi.GdkPixbuf;
+const GtkClutter = imports.gi.GtkClutter;
+const Gtk = imports.gi.Gtk;
+const GLib = imports.gi.GLib;
 
-let Gettext = imports.gettext.domain('nemo-preview');
-let _ = Gettext.gettext;
+const Gettext = imports.gettext.domain('nemo-preview');
+const _ = Gettext.gettext;
+const Lang = imports.lang;
 
-let Utils = imports.ui.utils;
+const MimeHandler = imports.ui.mimeHandler;
+const Utils = imports.ui.utils;
 
 function ImageRenderer(args) {
     this._init(args);
diff -uNrp a/nemo-preview/src/js/viewers/text.js b/nemo-preview/src/js/viewers/text.js
--- a/nemo-preview/src/js/viewers/text.js	2014-04-12 16:25:12.000000000 +0100
+++ b/nemo-preview/src/js/viewers/text.js	2014-10-19 14:56:53.000000000 +0100
@@ -25,16 +25,17 @@
  *
  */
 
-let MimeHandler = imports.ui.mimeHandler;
-let GtkClutter = imports.gi.GtkClutter;
-let Gtk = imports.gi.Gtk;
-let GLib = imports.gi.GLib;
-let GtkSource = imports.gi.GtkSource;
-let Gio = imports.gi.Gio;
+const GtkClutter = imports.gi.GtkClutter;
+const Gtk = imports.gi.Gtk;
+const GLib = imports.gi.GLib;
+const GtkSource = imports.gi.GtkSource;
+const Gio = imports.gi.Gio;
+const NemoPreview = imports.gi.NemoPreview;
 
-let NemoPreview = imports.gi.NemoPreview;
+const MimeHandler = imports.ui.mimeHandler;
+const Utils = imports.ui.utils;
 
-let Utils = imports.ui.utils;
+const Lang = imports.lang;
 
 function TextRenderer(args) {
     this._init(args);