[gnome-documents] embed: don't fire a flashspot at startup



commit a10aabc199fc56eefa55e71f0e6e175ddca36bb4
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Mar 12 21:25:17 2012 -0400

    embed: don't fire a flashspot at startup
    
    Only flash if the previous window mode is != NONE.

 src/embed.js      |   10 ++++------
 src/windowMode.js |    6 ++++--
 2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/embed.js b/src/embed.js
index e9eb929..51e5d85 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -157,7 +157,6 @@ ViewEmbed.prototype  = {
         Global.documentManager.connect('active-changed',
                                        Lang.bind(this, this._onActiveItemChanged));
 
-        this._onWindowModeChanged();
         this._onQueryStatusChanged();
     },
 
@@ -244,15 +243,14 @@ ViewEmbed.prototype  = {
         this._moveOutBackground();
     },
 
-    _onWindowModeChanged: function() {
-        let mode = Global.modeController.getWindowMode();
-
-        if (mode == WindowMode.WindowMode.OVERVIEW)
+    _onWindowModeChanged: function(object, newMode, oldMode) {
+        if (newMode == WindowMode.WindowMode.OVERVIEW)
             this._prepareForOverview();
         else
             this._prepareForPreview();
 
-        this._windowModeChangeFlash();
+        if (oldMode != WindowMode.WindowMode.NONE)
+            this._windowModeChangeFlash();
     },
 
     _destroyScrollPreviewChild: function() {
diff --git a/src/windowMode.js b/src/windowMode.js
index 6e6b32e..b489163 100644
--- a/src/windowMode.js
+++ b/src/windowMode.js
@@ -39,14 +39,16 @@ ModeController.prototype = {
     },
 
     setWindowMode: function(mode) {
-        if (this._mode == mode)
+        let oldMode = this._mode;
+
+        if (oldMode == mode)
             return;
 
         if (mode == WindowMode.OVERVIEW)
             this.setCanFullscreen(false);
 
         this._mode = mode;
-        this.emit('window-mode-changed', this._mode);
+        this.emit('window-mode-changed', this._mode, oldMode);
     },
 
     getWindowMode: function() {



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