[gnome-documents] preview: search next when Enter is pressed in preview mode
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] preview: search next when Enter is pressed in preview mode
- Date: Wed, 24 Dec 2014 09:30:35 +0000 (UTC)
commit 294f3059629076a5c21af7c3da97826f55a7abe8
Author: Cosimo Cecchi <cosimo endlesm com>
Date: Wed Dec 24 17:28:47 2014 +0800
preview: search next when Enter is pressed in preview mode
This makes it consistent with other applications.
https://bugzilla.gnome.org/show_bug.cgi?id=733191
src/embed.js | 9 ++++++---
src/preview.js | 4 ++++
src/view.js | 8 +++++++-
3 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/src/embed.js b/src/embed.js
index a1b37a8..b14b64c 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -284,9 +284,12 @@ const Embed = new Lang.Class({
},
_onActivateResult: function() {
- let doc = this._view.getFirstDocument();
- if (doc)
- Application.documentManager.setActiveItem(doc)
+ let windowMode = Application.modeController.getWindowMode();
+
+ if (windowMode == WindowMode.WindowMode.OVERVIEW)
+ this._view.activateResult();
+ else if (windowMode == WindowMode.WindowMode.PREVIEW)
+ this._preview.activateResult();
},
_onQueryStatusChanged: function() {
diff --git a/src/preview.js b/src/preview.js
index fde4c95..cf21cf4 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -480,6 +480,10 @@ const PreviewView = new Lang.Class({
this._syncControlsVisible();
},
+ activateResult: function() {
+ this.view.find_next();
+ },
+
startSearch: function(str) {
if (!this._model)
return;
diff --git a/src/view.js b/src/view.js
index 39c6c3e..40dbffe 100644
--- a/src/view.js
+++ b/src/view.js
@@ -175,7 +175,13 @@ const ViewContainer = new Lang.Class({
this._addListRenderers();
},
- getFirstDocument: function() {
+ activateResult: function() {
+ let doc = this._getFirstDocument();
+ if (doc)
+ Application.documentManager.setActiveItem(doc)
+ },
+
+ _getFirstDocument: function() {
let doc = null;
let iter = this._model.model.get_iter_first()[1];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]