do chat icon blinking ourselves

gtk_status_icon_set_blinking() deprecated deprecated since version 2.22,
removed in GTK+ 3
This commit is contained in:
foudfou 2013-03-30 12:29:38 +01:00
parent 3aca4f64f1
commit f3a988444e
2 changed files with 21 additions and 5 deletions

View File

@ -103,7 +103,7 @@ firetray.Chat = {
}
}
firetray.ChatStatusIcon.setIconBlinking(true);
firetray.ChatStatusIcon.startIconBlinking();
}
},
@ -120,7 +120,7 @@ firetray.Chat = {
if (this.acknowledgeOnFocus.must && convIsCurrentlyShown) {
firetray.ChatStatusIcon.setUrgency(xid, false);
firetray.ChatStatusIcon.setIconBlinking(false);
firetray.ChatStatusIcon.stopIconBlinking();
this.acknowledgeOnFocus.must = false;
}
},

View File

@ -37,7 +37,9 @@ firetray.ChatStatusIcon = {
o[FIRETRAY_IM_STATUS_OFFLINE] = null;
return o;
})(),
themedIconNameCurrent: null,
signals: {'focus-in': {callback: {}, handler: {}}},
timers: {},
init: function() {
if (!firetray.Handler.inMailApp) throw "ChatStatusIcon for mail app only";
@ -78,12 +80,26 @@ firetray.ChatStatusIcon = {
},
setIconImage: function(name) {
this.themedIconNameCurrent = name;
this.setIconImageFromGIcon(this.themedIcons[name]);
},
// TODO: handle blinking ourselves (gtk_status_icon_set_blinking deprecated)
setIconBlinking: function(blink) {
gtk.gtk_status_icon_set_blinking(this.trayIcon, blink);
startIconBlinking: function() { // gtk_status_icon_set_blinking deprecated
this.on = true;
firetray.ChatStatusIcon.timers['blink'] = firetray.Utils.timer(
500, Ci.nsITimer.TYPE_REPEATING_SLACK, function() {
if (firetray.ChatStatusIcon.on)
gtk.gtk_status_icon_set_from_pixbuf(firetray.ChatStatusIcon.trayIcon, null);
else
firetray.ChatStatusIcon.setIconImage(firetray.ChatStatusIcon.themedIconNameCurrent);
firetray.ChatStatusIcon.on = !firetray.ChatStatusIcon.on;
});
},
stopIconBlinking: function() {
this.timers['blink'].cancel();
this.setIconImage(firetray.ChatStatusIcon.themedIconNameCurrent);
this.on = false;
},
setUrgency: function(xid, urgent) {