[gnome-documents] window: add keybindings to focus the search entry
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] window: add keybindings to focus the search entry
- Date: Fri, 2 Sep 2011 23:16:46 +0000 (UTC)
commit 2b46b44ee4f2bd1691e8c08e37b38d3dfea2b562
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Sep 2 19:09:50 2011 -0400
window: add keybindings to focus the search entry
And add a couple of keybindings for fullscreen/preview mode too.
src/mainToolbar.js | 4 ++++
src/mainWindow.js | 32 ++++++++++++++++++++++++++++++--
2 files changed, 34 insertions(+), 2 deletions(-)
---
diff --git a/src/mainToolbar.js b/src/mainToolbar.js
index 88a2b30..f4bebd3 100644
--- a/src/mainToolbar.js
+++ b/src/mainToolbar.js
@@ -209,6 +209,10 @@ MainToolbar.prototype = {
}));
this._updateModelLabels();
+ },
+
+ getSearchEntry: function() {
+ return this._searchEntry;
}
};
Signals.addSignalMethods(MainToolbar.prototype);
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 20e624f..4541923 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -131,12 +131,40 @@ MainWindow.prototype = {
return true;
}
- if ((keyval == Gdk.KEY_f) &&
- this._windowMode == WindowMode.PREVIEW) {
+ if (this._windowMode == WindowMode.PREVIEW)
+ return this._handleKeyPreview(keyval, state);
+ else
+ return this._handleKeyOverview(keyval, state);
+ },
+
+ _handleKeyPreview: function(keyval, state) {
+ if (keyval == Gdk.KEY_f) {
this._setFullscreen(!this._fullscreen);
return true;
}
+ if (keyval == Gdk.KEY_Escape && this._fullscreen) {
+ this._setFullscreen(false);
+ return true;
+ }
+
+ if (keyval == Gdk.KEY_Escape) {
+ this._setWindowMode(WindowMode.OVERVIEW);
+ return true;
+ }
+
+ return false;
+ },
+
+ _handleKeyOverview: function(keyval, state) {
+ if (((keyval == Gdk.KEY_f) &&
+ ((state & Gdk.ModifierType.CONTROL_MASK) != 0)) ||
+ ((keyval == Gdk.KEY_s) &&
+ ((state & Gdk.ModifierType.CONTROL_MASK) != 0))) {
+ this._toolbar.getSearchEntry().grab_focus();
+ return true;
+ }
+
return false;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]