Fix to the protocol image animation to that it cleans the timer cleanly once the animation isn't displayed anymore.

This commit is contained in:
Florian Quèze 2007-08-17 01:31:00 +02:00
Родитель 8c144f5c9f
Коммит 3522456215
3 изменённых файлов: 29 добавлений и 10 удалений

Просмотреть файл

@ -34,7 +34,8 @@
</xul:vbox>
<xul:vbox align="center">
<xul:image xbl:inherits="src=prplicon" class="accountIcon"/>
<xul:image xbl:inherits="src=prplicon" class="accountIconAnim"/>
<xul:image xbl:inherits="src=prplicon" class="accountIconAnim"
anonid="prplicon"/>
<xul:label xbl:inherits="value=protocol" class="prplName"/>
</xul:vbox>
</xul:hbox>

Просмотреть файл

@ -85,6 +85,14 @@ var gAccountManager = {
boolean attribute |deleting| to purpleIAccount? */
return;
}
/* handle protocol icon animation while connecting */
var icon = document.getAnonymousElementByAttribute(elt, "anonid", "prplicon")
if (aTopic == "account-connecting")
icon.animate();
else
icon.stop();
elt.setAttribute("state", stateEvents[aTopic]);
}
},

Просмотреть файл

@ -11,15 +11,6 @@
<binding id="anim" extends="chrome://global/content/bindings/general.xml#image">
<implementation implements="nsITimerCallback">
<constructor>
<![CDATA[
const Ci = Components.interfaces;
this._animateTimer = Components.classes["@mozilla.org/timer;1"]
.createInstance(Ci.nsITimer);
this._animateTimer.initWithCallback(this, this._animateDelay,
Ci.nsITimer.TYPE_REPEATING_SLACK);
]]>
</constructor>
<destructor>
<![CDATA[
if (this._animateTimer) {
@ -65,6 +56,25 @@
}
]]></body>
</method>
<method name="animate">
<body><![CDATA[
const Ci = Components.interfaces;
this._animateTimer = Components.classes["@mozilla.org/timer;1"]
.createInstance(Ci.nsITimer);
this._animateTimer.initWithCallback(this, this._animateDelay,
Ci.nsITimer.TYPE_REPEATING_SLACK);
]]></body>
</method>
<method name="stop">
<body><![CDATA[
if (this._animateTimer) {
this._animateTimer.cancel();
this._animateTimer = null;
}
]]></body>
</method>
</implementation>
</binding>
</bindings>