[Pkg-mozext-commits] [firetray] 356/399: do chat icon blinking ourselves

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:24:13 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch dfsg-clean
in repository firetray.

commit f3a988444e303eb0ac7c0f88fef9d9f20ddf6020
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Sat Mar 30 12:29:38 2013 +0100

    do chat icon blinking ourselves
    
    gtk_status_icon_set_blinking() deprecated deprecated since version 2.22,
    removed in GTK+ 3
---
 src/modules/FiretrayChat.jsm                 |    4 ++--
 src/modules/linux/FiretrayChatStatusIcon.jsm |   22 +++++++++++++++++++---
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/modules/FiretrayChat.jsm b/src/modules/FiretrayChat.jsm
index 29b27c9..2046905 100644
--- a/src/modules/FiretrayChat.jsm
+++ b/src/modules/FiretrayChat.jsm
@@ -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;
     }
   },
diff --git a/src/modules/linux/FiretrayChatStatusIcon.jsm b/src/modules/linux/FiretrayChatStatusIcon.jsm
index 775af45..8c3e920 100644
--- a/src/modules/linux/FiretrayChatStatusIcon.jsm
+++ b/src/modules/linux/FiretrayChatStatusIcon.jsm
@@ -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) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git



More information about the Pkg-mozext-commits mailing list