[gnome-documents] application: make fullscreen action follow the canFullscreen property



commit dde726eaeb0634ab16e872d05201a3da3af867d0
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Mar 5 15:07:09 2012 -0500

    application: make fullscreen action follow the canFullscreen property
    
    Instead of just following the window mode.

 src/application.js |    6 +++---
 src/windowMode.js  |    7 +++++++
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 1e85850..d5dfee8 100644
--- a/src/application.js
+++ b/src/application.js
@@ -99,10 +99,10 @@ Application.prototype = {
             function() {
                 Global.modeController.toggleFullscreen();
             }));
-        Global.modeController.connect('window-mode-changed', Lang.bind(this,
+        Global.modeController.connect('can-fullscreen-changed', Lang.bind(this,
             function() {
-                let mode = Global.modeController.getWindowMode();
-                fsAction.set_enabled(mode == WindowMode.WindowMode.PREVIEW);
+                let canFullscreen = Global.modeController.getCanFullscreen();
+                fsAction.set_enabled(canFullscreen);
             }));
         this.application.add_action(fsAction);
 
diff --git a/src/windowMode.js b/src/windowMode.js
index 7ba2d29..6e6b32e 100644
--- a/src/windowMode.js
+++ b/src/windowMode.js
@@ -35,6 +35,7 @@ ModeController.prototype = {
     _init: function() {
         this._mode = WindowMode.NONE;
         this._fullscreen = false;
+        this._canFullscreen = false;
     },
 
     setWindowMode: function(mode) {
@@ -57,6 +58,8 @@ ModeController.prototype = {
 
         if (!this._canFullscreen && this._fullscreen)
             this.setFullscreen(false);
+
+        this.emit('can-fullscreen-changed');
     },
 
     setFullscreen: function(fullscreen) {
@@ -79,6 +82,10 @@ ModeController.prototype = {
 
     getFullscreen: function() {
         return this._fullscreen;
+    },
+
+    getCanFullscreen: function() {
+        return this._canFullscreen;
     }
 };
 Signals.addSignalMethods(ModeController.prototype);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]