[sushi/wip/cosimoc/no-clutter: 42/66] spinnerBox: simplify code



commit f76884b0d58d8d4dde3f3767c89b9287f7d086e9
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Apr 9 11:59:11 2017 -0700

    spinnerBox: simplify code
    
    Make it use the same render/destroy API that other renderers use.

 src/js/ui/mainWindow.js | 4 ----
 src/js/ui/spinnerBox.js | 9 +--------
 2 files changed, 1 insertion(+), 12 deletions(-)
---
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index e1e52a5..4ff5f2c 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -173,7 +173,6 @@ var MainWindow = new Lang.Class({
          * if the loading takes too long.
          */
         this._renderer = new SpinnerBox.SpinnerBox();
-        this._renderer.start();
 
         file.query_info_async
         (Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME + ',' +
@@ -196,9 +195,6 @@ var MainWindow = new Lang.Class({
     },
 
     _onRendererPrepared : function() {
-        /* destroy the spinner renderer */
-        this._renderer.destroy();
-
         this._renderer = this._pendingRenderer;
         this._pendingRenderer = null;
 
diff --git a/src/js/ui/spinnerBox.js b/src/js/ui/spinnerBox.js
index 7490052..0db678e 100644
--- a/src/js/ui/spinnerBox.js
+++ b/src/js/ui/spinnerBox.js
@@ -54,6 +54,7 @@ var SpinnerBox = new Lang.Class({
     },
 
     render : function() {
+        this._spinner.start();
         return this._spinnerBox;
     },
 
@@ -61,13 +62,5 @@ var SpinnerBox = new Lang.Class({
         let spinnerSize = this._spinnerBox.get_preferred_size();
         return [ spinnerSize[0].width,
                  spinnerSize[0].height ];
-    },
-
-    start : function() {
-        this._spinner.start();
-    },
-
-    destroy : function() {
-        this._spinnerBox.destroy();
     }
 });


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