[gnome-documents/wip/ui-changes] 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/wip/ui-changes] preview: don't switch to overview when fullscreen and controls visible
- Date: Tue, 4 Dec 2012 22:12:28 +0000 (UTC)
commit 860149a60f757cc603c500d3d4bfebd202a45db1
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 09b1823..10caab0 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -526,5 +526,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 cc0b702..6767584 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -157,8 +157,18 @@ const MainWindow = new Lang.Class({
let fullscreen = Global.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)
+ Global.documentManager.setActiveItem(null);
+
+ return true;
+ }
+
+ 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 a8fde8b..5433b62 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -123,9 +123,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 (Global.modeController.getFullscreen())
@@ -135,6 +137,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;
},
@@ -224,6 +232,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]