diff --git a/nemo-preview/src/js/ui/application.js b/nemo-preview/src/js/ui/application.js index 35bbce03..d257ef29 100644 --- a/nemo-preview/src/js/ui/application.js +++ b/nemo-preview/src/js/ui/application.js @@ -42,15 +42,18 @@ const NEMO_PREVIEW_DBUS_PATH = '/org/nemo/Preview'; const NEMO_PREVIEW_DBUS_NAME = 'org.nemo.Preview'; const NemoPreviewIface = ' \ - \ - \ - \ - \ - \ - \ - \ - \ - \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ '; var Application = new Lang.Class({ @@ -94,15 +97,23 @@ var Application = new Lang.Class({ this._mainWindow.close(); }, - ShowFile : function(uri, xid, closeIfAlreadyShown) { - let file = Gio.file_new_for_uri(uri); - if (closeIfAlreadyShown && - this._mainWindow.file && - this._mainWindow.file.equal(file)) { - this._mainWindow.close(); - return; - } + ShowFile: function(uri, xid, closeIfAlreadyShown) { + let file = Gio.file_new_for_uri(uri); + if (closeIfAlreadyShown && + this._mainWindow.file && + this._mainWindow.file.equal(file) + ) { + this._mainWindow.close(); + return; + } this._mainWindow.setParent(xid); this._mainWindow.setFile(file); + }, + + emitSelectionEvent(direction) { + this._dbusImpl.emit_signal( + 'SelectionEvent', + new GLib.Variant('(u)', [direction]) + ); } }); diff --git a/nemo-preview/src/js/ui/mainWindow.js b/nemo-preview/src/js/ui/mainWindow.js index f70c3060..e298ca39 100644 --- a/nemo-preview/src/js/ui/mainWindow.js +++ b/nemo-preview/src/js/ui/mainWindow.js @@ -200,6 +200,19 @@ MainWindow.prototype = { key == Gdk.KEY_F11) this.toggleFullScreen(); + if (key == Gdk.KEY_Down) { + this._application.emitSelectionEvent(Gtk.DirectionType.DOWN); + } + else if (key == Gdk.KEY_Up) { + this._application.emitSelectionEvent(Gtk.DirectionType.UP); + } + else if (key == Gdk.KEY_Left) { + this._application.emitSelectionEvent(Gtk.DirectionType.LEFT); + } + else if (key == Gdk.KEY_Right) { + this._application.emitSelectionEvent(Gtk.DirectionType.RIGHT); + } + return false; },