[gnome-documents/wip/cosimoc/view-rework: 13/28] embed: refactor clearing edit URI



commit 440b790983411254af0c7bb7eadfae502ef25744
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Jul 31 21:24:44 2016 -0700

    embed: refactor clearing edit URI

 src/embed.js |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/embed.js b/src/embed.js
index 9a34a92..e8c072d 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -377,11 +377,13 @@ const Embed = new Lang.Class({
             }));
     },
 
-    _clearPreview: function() {
+    _clearViewState: function() {
         if (this._preview) {
             this._preview.destroy();
             this._preview = null;
         }
+        if (this._edit)
+            this._edit.setUri(null);
 
         this._window.insert_action_group('view', null);
     },
@@ -408,9 +410,7 @@ const Embed = new Lang.Class({
             break;
         }
 
-        this._clearPreview();
-        if (this._edit)
-            this._edit.setUri(null);
+        this._clearViewState();
 
         if (createToolbar) {
             if (this._toolbar)
@@ -426,9 +426,7 @@ const Embed = new Lang.Class({
     },
 
     _prepareForPreview: function(constructor) {
-        this._clearPreview();
-        if (this._edit)
-            this._edit.setUri(null);
+        this._clearViewState();
         if (this._toolbar)
             this._toolbar.destroy();
 
@@ -444,7 +442,7 @@ const Embed = new Lang.Class({
     },
 
     _prepareForEdit: function() {
-        this._clearPreview();
+        this._clearViewState();
         if (this._toolbar)
             this._toolbar.destroy();
 


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