[sushi/wip/cosimoc/no-clutter: 60/67] spinnerBox: remove timeout



commit 2e56a7143a1089c4c504c2f04dfcfa77e881d995
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Apr 9 11:54:29 2017 -0700

    spinnerBox: remove timeout
    
    We don't want to potentially show an empty window, and now that we don't
    have any animations, the timeout does not make a lot of sense. Just
    remove it.

 src/js/ui/mainWindow.js |    2 +-
 src/js/ui/spinnerBox.js |   26 ++++----------------------
 2 files changed, 5 insertions(+), 23 deletions(-)
---
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index 5ebd791..f74848d 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -182,7 +182,7 @@ const MainWindow = new Lang.Class({
          * if the loading takes too long.
          */
         this._renderer = new SpinnerBox.SpinnerBox();
-        this._renderer.startTimeout();
+        this._renderer.start();
 
         file.query_info_async
         (Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME + ',' +
diff --git a/src/js/ui/spinnerBox.js b/src/js/ui/spinnerBox.js
index 39da3ce..e17b038 100644
--- a/src/js/ui/spinnerBox.js
+++ b/src/js/ui/spinnerBox.js
@@ -28,17 +28,13 @@ const _ = Gettext.gettext;
 const Gtk = imports.gi.Gtk;
 
 const Lang = imports.lang;
-const Mainloop = imports.mainloop;
 
 let SPINNER_SIZE = 48;
-let TIMEOUT = 500;
 
 const SpinnerBox = new Lang.Class({
     Name: 'SpinnerBox',
 
     _init : function(args) {
-        this._timeoutId = 0;
-
         this.canFullScreen = false;
         this.moveOnClick = true;
 
@@ -52,6 +48,8 @@ const SpinnerBox = new Lang.Class({
                                          spacing: 12 });
         this._spinnerBox.pack_start(this._spinner, true, true, 0);
         this._spinnerBox.pack_start(this._label, true, true, 0);
+
+        this._spinnerBox.show_all();
     },
 
     render : function() {
@@ -64,27 +62,11 @@ const SpinnerBox = new Lang.Class({
                  spinnerSize[0].height ];
     },
 
-    startTimeout : function() {
-        if (this._timeoutId)
-            return;
-
+    start : function() {
         this._spinner.start();
-        this._timeoutId = Mainloop.timeout_add(TIMEOUT,
-                                               Lang.bind(this,
-                                                         this._onTimeoutCompleted));
     },
 
     destroy : function() {
-        if (this._timeoutId) {
-            Mainloop.source_remove(this._timeoutId);
-            this._timeoutId = 0;
-        }
-
         this._spinnerBox.destroy();
-    },
-
-    _onTimeoutCompleted : function() {
-        this._timeoutId = 0;
-        this._spinnerBox.show_all();
-    },
+    }
 });


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