Skip to content

Commit 8dc2004

Browse files
committed
wip
1 parent f245b61 commit 8dc2004

File tree

2 files changed

+35
-9
lines changed

2 files changed

+35
-9
lines changed

nemo-preview/src/js/ui/application.js

+19-9
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,18 @@ const NEMO_PREVIEW_DBUS_PATH = '/org/nemo/Preview';
4242
const NEMO_PREVIEW_DBUS_NAME = 'org.nemo.Preview';
4343

4444
const NemoPreviewIface = '<node> \
45-
<interface name="org.nemo.Preview"> \
46-
<method name="ShowFile"> \
47-
<arg type="s" direction="in" name="uri" /> \
48-
<arg type="i" direction="in" name="xid" /> \
49-
<arg type="b" direction="in" name="closeIfAlreadyShown" /> \
50-
</method> \
51-
<method name="Close"> \
52-
</method> \
53-
</interface> \
45+
<interface name="org.nemo.Preview"> \
46+
<method name="ShowFile"> \
47+
<arg type="s" direction="in" name="uri" /> \
48+
<arg type="i" direction="in" name="xid" /> \
49+
<arg type="b" direction="in" name="closeIfAlreadyShown" /> \
50+
</method> \
51+
<method name="Close"> \
52+
</method> \
53+
<signal name="SelectionEvent"> \
54+
<arg type="q" name="direction" /> \
55+
</signal> \
56+
</interface> \
5457
</node>';
5558

5659
var Application = new Lang.Class({
@@ -105,5 +108,12 @@ var Application = new Lang.Class({
105108
}
106109
this._mainWindow.setParent(xid);
107110
this._mainWindow.setFile(file);
111+
},
112+
113+
emitSelectionEvent(direction) {
114+
this._dbusImpl.emit_signal(
115+
'SelectionEvent',
116+
new GLib.Variant('(u)', [direction])
117+
);
108118
}
109119
});

nemo-preview/src/js/ui/mainWindow.js

+16
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,22 @@ MainWindow.prototype = {
200200
key == Gdk.KEY_F11)
201201
this.toggleFullScreen();
202202

203+
if (key == 65364 /* Gdk.KEY_Down */) {
204+
log('down ' + Gtk.DirectionType.DOWN);
205+
this._application.emitSelectionEvent(Gtk.DirectionType.DOWN);
206+
}
207+
else if (key == 65362) {
208+
log('up ' + Gtk.DirectionType.UP);
209+
this._application.emitSelectionEvent(Gtk.DirectionType.UP);
210+
}
211+
else if (key == 65361) {
212+
log('left ' + Gtk.DirectionType.LEFT);
213+
this._application.emitSelectionEvent(Gtk.DirectionType.LEFT);
214+
}
215+
else if (key == 65363) {
216+
log('right ' + Gtk.DirectionType.RIGHT);
217+
this._application.emitSelectionEvent(Gtk.DirectionType.RIGHT);
218+
}
203219
return false;
204220
},
205221

0 commit comments

Comments
 (0)