[gnome-documents] preview: don't switch to overview when fullscreen and controls visible
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] preview: don't switch to overview when fullscreen and controls visible
- Date: Thu, 13 Dec 2012 14:04:07 +0000 (UTC)
commit 970646849b9ddc983c44996ad1c835ce64e15913
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Dec 4 17:08:28 2012 -0500
preview: don't switch to overview when fullscreen and controls visible
Just hide the controls in this case.
src/embed.js | 4 ++++
src/mainWindow.js | 14 ++++++++++++--
src/preview.js | 22 +++++++++++++++++++---
3 files changed, 35 insertions(+), 5 deletions(-)
---
diff --git a/src/embed.js b/src/embed.js
index 66db62d..8d56cfc 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -530,5 +530,9 @@ const Embed = new Lang.Class({
getMainToolbar: function() {
return this._toolbar;
+ },
+
+ getPreview: function() {
+ return this._preview;
}
});
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 9c8b707..84da48a 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -157,8 +157,18 @@ const MainWindow = new Lang.Class({
let fullscreen = Application.modeController.getFullscreen();
let direction = this.window.get_direction();
- if ((fullscreen && keyval == Gdk.KEY_Escape) ||
- ((state & Gdk.ModifierType.MOD1_MASK) != 0 &&
+ if (keyval == Gdk.KEY_Escape) {
+ let preview = this._embed.getPreview();
+
+ if (preview.controlsVisible)
+ preview.controlsVisible = false;
+ else if (fullscreen)
+ Application.documentManager.setActiveItem(null);
+
+ return false;
+ }
+
+ if (((state & Gdk.ModifierType.MOD1_MASK) != 0 &&
(direction == Gtk.TextDirection.LTR && keyval == Gdk.KEY_Left) ||
(direction == Gtk.TextDirection.RTL && keyval == Gdk.KEY_Right)) ||
keyval == Gdk.KEY_Back) {
diff --git a/src/preview.js b/src/preview.js
index 2ecc59c..4465db5 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -129,9 +129,11 @@ const PreviewView = new Lang.Class({
Lang.bind(this, this._onKeyPressEvent));
},
- _flipControlsState: function() {
- this._controlsFlipId = 0;
- this._controlsVisible = !this._controlsVisible;
+ _updateControls: function(visible) {
+ if (this._controlsVisible == visible)
+ return;
+
+ this._controlsVisible = visible;
if (this._controlsVisible) {
if (Application.modeController.getFullscreen())
@@ -141,6 +143,12 @@ const PreviewView = new Lang.Class({
this._fsToolbar.hide();
this._thumbBar.hide();
}
+ },
+
+ _flipControlsState: function() {
+ this._controlsFlipId = 0;
+ let visible = !this._controlsVisible;
+ this._updateControls(visible);
return false;
},
@@ -231,6 +239,14 @@ const PreviewView = new Lang.Class({
this._model.set_rotation(rotation + offset);
},
+ get controlsVisible() {
+ return this._controlsVisible;
+ },
+
+ set controlsVisible(visible) {
+ this._updateControls(visible);
+ },
+
startSearch: function(str) {
if (!this._model)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]