[polari] app: Add shortcuts to navigate between rooms
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] app: Add shortcuts to navigate between rooms
- Date: Thu, 8 Aug 2013 13:10:48 +0000 (UTC)
commit 43fbadcb8afa814624cd2df5e60c7c284ede6e2b
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jul 26 10:33:02 2013 +0200
app: Add shortcuts to navigate between rooms
src/application.js | 10 +++++++++-
src/roomList.js | 25 +++++++++++++++++++++++++
2 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index a583428..cc8428b 100644
--- a/src/application.js
+++ b/src/application.js
@@ -75,7 +75,15 @@ const Application = new Lang.Class({
activate: Lang.bind(this, this._onShowAbout) },
{ name: 'quit',
activate: Lang.bind(this, this._onQuit),
- accel: '<Primary>q' }
+ accel: '<Primary>q' },
+ { name: 'next-room',
+ accel: '<Primary>Page_Down' },
+ { name: 'previous-room',
+ accel: '<Primary>Page_Up' },
+ { name: 'first-room',
+ accel: '<Primary>Home' },
+ { name: 'last-room',
+ accel: '<Primary>End' }
];
actionEntries.forEach(Lang.bind(this,
function(actionEntry) {
diff --git a/src/roomList.js b/src/roomList.js
index 795f228..93ff0f0 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -1,3 +1,4 @@
+const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const Pango = imports.gi.Pango;
@@ -98,6 +99,30 @@ const RoomList = new Lang.Class({
Lang.bind(this, this._roomRemoved));
this._roomManager.connect('active-changed',
Lang.bind(this, this._activeRoomChanged));
+
+ let app = Gio.Application.get_default();
+ let action;
+
+ action = app.lookup_action('next-room');
+ action.connect('activate', Lang.bind(this,
+ function() {
+ this._moveSelection(Gtk.MovementStep.DISPLAY_LINES, 1);
+ }));
+ action = app.lookup_action('previous-room');
+ action.connect('activate', Lang.bind(this,
+ function() {
+ this._moveSelection(Gtk.MovementStep.DISPLAY_LINES, -1);
+ }));
+ action = app.lookup_action('first-room');
+ action.connect('activate', Lang.bind(this,
+ function() {
+ this._moveSelection(Gtk.MovementStep.BUFFER_ENDS, -1);
+ }));
+ action = app.lookup_action('last-room');
+ action.connect('activate', Lang.bind(this,
+ function() {
+ this._moveSelection(Gtk.MovementStep.BUFFER_ENDS, 1);
+ }));
},
_getRowByRoom: function(room) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]