[the-board] [things] Remove unnecessary timeouts to save texts in all elements



commit 3cc7e165270a82f448c86ec3df608af178724b7d
Author: Lucas Rocha <lucasr gnome org>
Date:   Thu Dec 16 22:20:31 2010 +0000

    [things] Remove unnecessary timeouts to save texts in all elements
    
    The PageManager does control excessive saves with a timeout. Those
    timeouts on the thing-side are redudant.

 src/js/ui/things/photo.js |   21 ---------------------
 src/js/ui/things/text.js  |   22 ----------------------
 src/js/ui/things/video.js |   21 ---------------------
 3 files changed, 0 insertions(+), 64 deletions(-)
---
diff --git a/src/js/ui/things/photo.js b/src/js/ui/things/photo.js
index 91d9ac1..83713f1 100644
--- a/src/js/ui/things/photo.js
+++ b/src/js/ui/things/photo.js
@@ -278,23 +278,7 @@ PhotoThing.prototype = {
     },
 
     _onCaptionTextChanged : function() {
-        if (this._saveTextTimeoutId) {
-            return;
-        }
-
-        this._saveTextTimeoutId =
-            Mainloop.timeout_add_seconds(_SAVE_TEXT_TIMEOUT,
-                                         Lang.bind(this,
-                                                   this._onSaveTextTimeout));
-    },
-
-    _onSaveTextTimeout : function() {
-        Mainloop.source_remove(this._saveTextTimeoutId);
-        delete this._saveTextTimeoutId;
-
         this.emit('save');
-
-        return false;
     },
 
     _onPhotoSizeChange : function(photo, width, height) {
@@ -386,11 +370,6 @@ PhotoThing.prototype = {
     destroy : function() {
         this._disconnectPhotoSignals();
 
-        if (this._saveTextTimeoutId) {
-            Mainloop.source_remove(this._saveTextTimeoutId);
-            delete this._saveTextTimeoutId;
-        }
-
         if (this._photoBox) {
             this._photoBox.destroy();
             delete this._photoBox;
diff --git a/src/js/ui/things/text.js b/src/js/ui/things/text.js
index 872558c..6e1a82b 100644
--- a/src/js/ui/things/text.js
+++ b/src/js/ui/things/text.js
@@ -250,24 +250,7 @@ TextThing.prototype = {
 
     _onTextChanged : function() {
         this._maybeUpdateSizeFromText();
-
-        if (this._saveTimeoutId) {
-            return;
-        }
-
-        this._saveTimeoutId =
-            Mainloop.timeout_add_seconds(_SAVE_TEXT_TIMEOUT,
-                                         Lang.bind(this,
-                                                   this._onSaveTimeout));
-    },
-
-    _onSaveTimeout : function() {
-        Mainloop.source_remove(this._saveTimeoutId);
-        delete this._saveTimeoutId;
-
         this.emit('save');
-
-        return false;
     },
 
     activate : function() {
@@ -313,11 +296,6 @@ TextThing.prototype = {
     },
 
     destroy : function() {
-        if (this._saveTimeoutId) {
-            Mainloop.source_remove(this._saveTimeoutId);
-            delete this._saveTimeoutId;
-        }
-
         if (this._bgBox) {
             this._bgBox.destroy();
             delete this._bgBox;
diff --git a/src/js/ui/things/video.js b/src/js/ui/things/video.js
index 3585b12..3a57e40 100644
--- a/src/js/ui/things/video.js
+++ b/src/js/ui/things/video.js
@@ -502,23 +502,7 @@ VideoThing.prototype = {
     },
 
     _onCaptionTextChanged : function() {
-        if (this._saveTextTimeoutId) {
-            return;
-        }
-
-        this._saveTextTimeoutId =
-            Mainloop.timeout_add_seconds(_SAVE_TEXT_TIMEOUT,
-                                         Lang.bind(this,
-                                                   this._onSaveTextTimeout));
-    },
-
-    _onSaveTextTimeout : function() {
-        Mainloop.source_remove(this._saveTextTimeoutId);
-        delete this._saveTextTimeoutId;
-
         this.emit('save');
-
-        return false;
     },
 
     _onPlayButtonToggled : function() {
@@ -623,11 +607,6 @@ VideoThing.prototype = {
 
         this._disconnectVideoSignals();
 
-        if (this._saveTextTimeoutId) {
-            Mainloop.source_remove(this._saveTextTimeoutId);
-            delete this._saveTextTimeoutId;
-        }
-
         if (this._videoBox) {
             this._videoBox.destroy();
             delete this._videoBox;



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