[the-board] [ui] Change setCurrentPage method to be private in MainWindow



commit 2bffe48c961b4f2870ccea4151955c19fb6024e1
Author: Lucas Rocha <lucasr gnome org>
Date:   Mon Feb 7 23:52:04 2011 +0000

    [ui] Change setCurrentPage method to be private in MainWindow
    
    As it's not supposed to be used from outside anymore.

 src/js/ui/mainWindow.js |  136 +++++++++++++++++++++++-----------------------
 1 files changed, 68 insertions(+), 68 deletions(-)
---
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index 5f569cb..b65273d 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -620,10 +620,76 @@ MainWindow.prototype = {
 
     _doAction : function(actionName, actionArgs) {
         if (actionName == "setCurrentPage") {
-            this.setCurrentPage(actionArgs.pageModel);
+            this._setCurrentPage(actionArgs.pageModel);
         }
     },
 
+    _setCurrentPage : function(pageModel) {
+        if (this._currentPage &&
+            this._currentPage.model.id == pageModel.id) {
+            return;
+        }
+
+        let oldCurrentPage = this._currentPage;
+
+        if (oldCurrentPage) {
+            oldCurrentPage.disconnect(this._pageActiveThingChangedId);
+            delete this._pageActiveThingChangedId;
+
+            oldCurrentPage.disconnect(this._pageClickedId);
+            delete this._pageClickedId;
+
+            oldCurrentPage.disconnect(this._pageLoadedChangedId);
+            delete this._pageLoadedChangedId;
+
+            oldCurrentPage.disconnect(this._pageSelectedThingsChangedId);
+            delete this._pageSelectedThingsChangedId;
+        }
+
+        this._currentPage = new Page.Page({ context: this._context,
+                                            model: pageModel });
+
+        this._mainToolbar.toolBoxPages.setCurrentPage(pageModel);
+
+        this._currentPage.actor.depth = _LAYER_PAGE;
+
+        this._pageActiveThingChangedId =
+            this._currentPage.connect("active-thing-changed",
+                                      Lang.bind(this, this._onPageActiveThingChanged));
+
+        this._pageClickedId =
+            this._currentPage.connect("clicked",
+                                      Lang.bind(this, this._onPageClicked));
+
+        this._pageLoadedChangedId =
+            this._currentPage.connect("loaded-changed",
+                                      Lang.bind(this, this._onPageLoadedChanged));
+
+        this._pageSelectedThingsChangedId =
+            this._currentPage.connect("selected-things-changed",
+                                      Lang.bind(this, this._onPageSelectedThingsChanged));
+
+        if (oldCurrentPage) {
+            let onModelSaved = function() {
+                this._setSavingOldCurrentPage(false);
+
+                if (this._currentPage.model.id > oldCurrentPage.model.id) {
+                    this._animateNextPage(this._currentPage, oldCurrentPage);
+                } else {
+                    this._animatePreviousPage(this._currentPage, oldCurrentPage);
+                }
+            };
+
+            this._setSavingOldCurrentPage(true);
+            oldCurrentPage.model.save(Lang.bind(this, onModelSaved));
+        } else {
+            this._contentBox.append(this._currentPage.actor,
+                                    Tb.BoxPackFlags.EXPAND);
+        }
+
+        this._updateLoadingState();
+    },
+
     _quitApp : function() {
         let onModelSaved = function() {
             this._setSavingOldCurrentPage(false);
@@ -776,7 +842,7 @@ MainWindow.prototype = {
                 pageModel = this._pageManager.addPageModel();
             }
 
-            this.setCurrentPage(pageModel);
+            this._setCurrentPage(pageModel);
         }
     },
 
@@ -810,72 +876,6 @@ MainWindow.prototype = {
         this._updateActiveToolbar();
     },
 
-    setCurrentPage : function(pageModel) {
-        if (this._currentPage &&
-            this._currentPage.model.id == pageModel.id) {
-            return;
-        }
-
-        let oldCurrentPage = this._currentPage;
-
-        if (oldCurrentPage) {
-            oldCurrentPage.disconnect(this._pageActiveThingChangedId);
-            delete this._pageActiveThingChangedId;
-
-            oldCurrentPage.disconnect(this._pageClickedId);
-            delete this._pageClickedId;
-
-            oldCurrentPage.disconnect(this._pageLoadedChangedId);
-            delete this._pageLoadedChangedId;
-
-            oldCurrentPage.disconnect(this._pageSelectedThingsChangedId);
-            delete this._pageSelectedThingsChangedId;
-        }
-
-        this._currentPage = new Page.Page({ context: this._context,
-                                            model: pageModel });
-
-        this._mainToolbar.toolBoxPages.setCurrentPage(pageModel);
-
-        this._currentPage.actor.depth = _LAYER_PAGE;
-
-        this._pageActiveThingChangedId =
-            this._currentPage.connect("active-thing-changed",
-                                      Lang.bind(this, this._onPageActiveThingChanged));
-
-        this._pageClickedId =
-            this._currentPage.connect("clicked",
-                                      Lang.bind(this, this._onPageClicked));
-
-        this._pageLoadedChangedId =
-            this._currentPage.connect("loaded-changed",
-                                      Lang.bind(this, this._onPageLoadedChanged));
-
-        this._pageSelectedThingsChangedId =
-            this._currentPage.connect("selected-things-changed",
-                                      Lang.bind(this, this._onPageSelectedThingsChanged));
-
-        if (oldCurrentPage) {
-            let onModelSaved = function() {
-                this._setSavingOldCurrentPage(false);
-
-                if (this._currentPage.model.id > oldCurrentPage.model.id) {
-                    this._animateNextPage(this._currentPage, oldCurrentPage);
-                } else {
-                    this._animatePreviousPage(this._currentPage, oldCurrentPage);
-                }
-            };
-
-            this._setSavingOldCurrentPage(true);
-            oldCurrentPage.model.save(Lang.bind(this, onModelSaved));
-        } else {
-            this._contentBox.append(this._currentPage.actor,
-                                    Tb.BoxPackFlags.EXPAND);
-        }
-
-        this._updateLoadingState();
-    },
-
     showAll : function() {
         this._gtkWindow.show_all();
     },



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