[Pkg-mozext-commits] [firetray] 141/399: * begin scroll-event handling on icon * polish timer definitions * set FIRETRAY_BROWSER_NEW_WINDOW_DELAY_MILLISECONDS = 0

David Prévot taffit at alioth.debian.org
Tue Oct 29 18:23:30 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 2ee8fc1a91645c01b788bad5c14b5d18b4a14ef6
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Mon Jan 16 21:36:02 2012 +0100

    * begin scroll-event handling on icon
    * polish timer definitions
    * set FIRETRAY_BROWSER_NEW_WINDOW_DELAY_MILLISECONDS = 0
---
 src/modules/FiretrayHandler.jsm         |   34 +++++++++++++++++--------------
 src/modules/commons.js                  |    2 +-
 src/modules/ctypes/gtk.jsm              |    3 +++
 src/modules/gtk2/FiretrayStatusIcon.jsm |   10 ++++++++-
 4 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index 8c3afd6..c035ca1 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -27,14 +27,16 @@ if ("undefined" == typeof(firetray)) {
 // other global functions
 // (https://developer.mozilla.org/en/XUL_School/JavaScript_Object_Management)
 firetray.Handler = {
-  initialized: false,
-  appNameOriginal: null,
   FILENAME_DEFAULT: null,
   FILENAME_SUFFIX: "32.png",
   FILENAME_BLANK: null,
   FILENAME_NEWMAIL: null,
+
+  initialized: false,
+  appNameOriginal: null,
+  appStarted: false,
+  appId: null,
   runtimeOS: null,
-  mozAppId: null,
   inMailApp: false,
   inBrowserApp: false,
   windows: {},
@@ -67,10 +69,10 @@ firetray.Handler = {
       return false;
     }
 
-    this.mozAppId = Services.appinfo.ID;
-    if (this.mozAppId === THUNDERBIRD_ID || this.mozAppId === SEAMONKEY_ID)
+    this.appId = Services.appinfo.ID;
+    if (this.appId === THUNDERBIRD_ID || this.appId === SEAMONKEY_ID)
       this.inMailApp = true;
-    if (this.mozAppId === FIREFOX_ID || this.mozAppId === SEAMONKEY_ID)
+    if (this.appId === FIREFOX_ID || this.appId === SEAMONKEY_ID)
       this.inBrowserApp = true;
     LOG('inMailApp: '+this.inMailApp+', inBrowserApp: '+this.inBrowserApp);
 
@@ -92,7 +94,7 @@ firetray.Handler = {
       }
     }
 
-    Services.obs.addObserver(this, this.getAppStartupTopic(this.mozAppId), false);
+    Services.obs.addObserver(this, this.getAppStartupTopic(this.appId), false);
     Services.obs.addObserver(this, "xpcom-will-shutdown", false);
 
     this.initialized = true;
@@ -107,9 +109,11 @@ firetray.Handler = {
 
     firetray.Utils.tryCloseLibs([gobject, glib, gtk]);
 
-    Services.obs.removeObserver(this, this.getAppStartupTopic(this.mozAppId), false);
+    Services.obs.removeObserver(this, this.getAppStartupTopic(this.appId), false);
     Services.obs.removeObserver(this, "xpcom-will-shutdown", false);
 
+    this.appStarted = false;
+    this.initialized = false;
     return true;
   },
 
@@ -122,10 +126,10 @@ firetray.Handler = {
       // sessionstore-windows-restored does not come after the realization of
       // all windows... so we wait a little
       var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
-      timer.initWithCallback(function() {
+      timer.initWithCallback({ notify: function() {
         firetray.Handler.appStarted = true;
         LOG("*** appStarted ***");
-      }, FIRETRAY_BROWSER_STARTUP_DELAY_MILLISECONDS, Ci.nsITimer.TYPE_ONE_SHOT);
+      }}, FIRETRAY_BROWSER_STARTUP_DELAY_MILLISECONDS, Ci.nsITimer.TYPE_ONE_SHOT);
       break;
     case "xpcom-will-shutdown":
       LOG("xpcom-will-shutdown");
@@ -201,9 +205,9 @@ firetray.Handler = {
   },
 
   _getBrowserProperties: function() {
-    if (firetray.Handler.mozAppId === FIREFOX_ID)
+    if (firetray.Handler.appId === FIREFOX_ID)
       return "chrome://branding/locale/browserconfig.properties";
-    else if (firetray.Handler.mozAppId === SEAMONKEY_ID)
+    else if (firetray.Handler.appId === SEAMONKEY_ID)
       return "chrome://navigator-region/locale/region.properties";
     else return null;
   },
@@ -235,10 +239,10 @@ firetray.Handler = {
       // FIXME: obviously we need to wait to avoid seg fault on jsapi.cpp:827
       // 827         if (t->data.requestDepth) {
       var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
-      timer.initWithCallback(function() {
+      timer.initWithCallback({ notify: function() {
         for(var key in firetray.Handler.windows) break;
         firetray.Handler.windows[key].chromeWin.open(home);
-      }, FIRETRAY_BROWSER_NEW_WINDOW_DELAY_MILLISECONDS, Ci.nsITimer.TYPE_ONE_SHOT);
+      }}, FIRETRAY_BROWSER_NEW_WINDOW_DELAY_MILLISECONDS, Ci.nsITimer.TYPE_ONE_SHOT);
     } catch (x) { ERROR(x); }
   },
 
@@ -247,7 +251,7 @@ firetray.Handler = {
       var aURI = Services.io.newURI("mailto:", null, null);
       var msgComposeService = Cc["@mozilla.org/messengercompose;1"]
         .getService(Ci.nsIMsgComposeService);
-      msgComposeService.OpenComposeWindowWithURI (null, aURI);
+      msgComposeService.OpenComposeWindowWithURI(null, aURI);
     } catch (x) { ERROR(x); }
   },
 
diff --git a/src/modules/commons.js b/src/modules/commons.js
index 6f6a890..4759423 100644
--- a/src/modules/commons.js
+++ b/src/modules/commons.js
@@ -30,7 +30,7 @@ const FT_NOTIFICATION_NEWMAIL_ICON = 2;
 const FT_NOTIFICATION_CUSTOM_ICON = 3;
 
 const FIRETRAY_BROWSER_STARTUP_DELAY_MILLISECONDS = 500;
-const FIRETRAY_BROWSER_NEW_WINDOW_DELAY_MILLISECONDS = 50;
+const FIRETRAY_BROWSER_NEW_WINDOW_DELAY_MILLISECONDS = 0;
 
 /**
  * firetray namespace.
diff --git a/src/modules/ctypes/gtk.jsm b/src/modules/ctypes/gtk.jsm
index 60a3f31..74d5ecf 100644
--- a/src/modules/ctypes/gtk.jsm
+++ b/src/modules/ctypes/gtk.jsm
@@ -61,6 +61,9 @@ function gtk_defines(lib) {
     ctypes.default_abi, ctypes.void_t,
     [this.GtkStatusIcon.ptr, gobject.guint, gobject.guint,
      gobject.gpointer]).ptr;
+  this.GCallbackOnScroll_t = ctypes.FunctionType(
+    ctypes.default_abi, gobject.gboolean,
+    [this.GtkStatusIcon.ptr, gdk.GdkEvent.ptr, gobject.gpointer]).ptr;
   this.GCallbackGenericEvent_t = ctypes.FunctionType(
     ctypes.default_abi, gobject.gboolean,
     [this.GtkWidget.ptr, gdk.GdkEvent.ptr, gobject.gpointer]).ptr;
diff --git a/src/modules/gtk2/FiretrayStatusIcon.jsm b/src/modules/gtk2/FiretrayStatusIcon.jsm
index 3e619d0..4e59bd5 100644
--- a/src/modules/gtk2/FiretrayStatusIcon.jsm
+++ b/src/modules/gtk2/FiretrayStatusIcon.jsm
@@ -128,10 +128,13 @@ firetray.StatusIcon = {
     this.callbacks.popupMenu = gtk.GCallbackMenuPopup_t(that.popupMenu);
     gobject.g_signal_connect(this.trayIcon, "popup-menu",
       firetray.StatusIcon.callbacks.popupMenu, this.menu);
+    this.callbacks.onScroll = gtk.GCallbackOnScroll_t(that.onScroll);
+    gobject.g_signal_connect(this.trayIcon, "scroll-event",
+      firetray.StatusIcon.callbacks.onScroll, null);
   },
 
   popupMenu: function(icon, button, activateTime, menu) {
-    LOG("MENU POPUP");
+    LOG("menu-popup");
     LOG("ARGS="+icon+", "+button+", "+activateTime+", "+menu);
 
     try {
@@ -143,6 +146,11 @@ firetray.StatusIcon = {
     } catch (x) {
       ERROR(x);
     }
+  },
+
+  onScroll: function(icon, event, data) {
+    LOG("scroll-event");
+        // TODO:
   }
 
 }; // firetray.StatusIcon

-- 
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