Add deferred work system

Previously we had various things watching for notify::mapped so
we could be more lazy about updating non-visible actors, but it
was fairly ad-hoc.

The deferred work system unifies these callbacks, and also adds
a timeout so that we don't delay changes arbitrarily; this way we
avoid a storm of work if you stay out of the overview for a while,
then go in.

https://bugzilla.gnome.org/show_bug.cgi?id=603522
This commit is contained in:
Colin Walters
2009-12-03 12:19:38 -05:00
parent b03fa1ebf7
commit d624db18c5
3 changed files with 130 additions and 34 deletions

View File

@ -318,7 +318,7 @@ ErrorLog.prototype = {
this.text = new St.Label();
this.actor.add(this.text);
this.text.clutter_text.line_wrap = true;
this.text.connect('notify::mapped', Lang.bind(this, this._onMappedNotify));
this.actor.connect('notify::mapped', Lang.bind(this, this._renderText));
},
_formatTime: function(d){
@ -331,8 +331,8 @@ ErrorLog.prototype = {
+ pad(d.getUTCSeconds())+'Z'
},
_onMappedNotify: function() {
if (!(this.actor.mapped && Main._errorLogStack.length > 0))
_renderText: function() {
if (!this.actor.mapped)
return;
let text = this.text.text;
let stack = Main._getAndClearErrorStack();