[gnome-documents] window-mode: don't assume we have a GdkWindow



commit 99ac70aa91f7d97d662e1c45bf2ee98bdd5bb872
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Dec 13 23:41:26 2012 -0500

    window-mode: don't assume we have a GdkWindow
    
    Since this can be called also when the window has not been realized yet.

 src/windowMode.js |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/windowMode.js b/src/windowMode.js
index 63c73eb..c60eec0 100644
--- a/src/windowMode.js
+++ b/src/windowMode.js
@@ -52,9 +52,13 @@ const ModeController = new Lang.Class({
 
         this.emit('window-mode-changed', this._mode, oldMode);
 
-        if (mode == WindowMode.PREVIEW) {
-            let window = Application.application.get_active_window();
-            let gdkWindow = window.get_window();
+        if (mode != WindowMode.PREVIEW)
+            return;
+
+        let window = Application.application.get_active_window();
+        let gdkWindow = window.get_window();
+
+        if (gdkWindow) {
             let windowState = gdkWindow.get_state();
 
             if (windowState & Gdk.WindowState.MAXIMIZED)



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