[Pkg-mozext-commits] [firetray] 13/38: Add nomail_hides_icon.

David Prévot taffit at moszumanska.debian.org
Mon Apr 6 15:58:20 UTC 2015


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

taffit pushed a commit to branch master
in repository firetray.

commit 59320d5b2bbe53896b350a935603f55233097c06
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Sun Feb 15 22:46:50 2015 +0100

    Add nomail_hides_icon.
---
 src/chrome/content/options.xul           |  7 +++++++
 src/chrome/locale/de-DE/options.dtd      |  2 ++
 src/chrome/locale/en-US/options.dtd      |  2 ++
 src/chrome/locale/es-AR/options.dtd      |  2 ++
 src/chrome/locale/fr/options.dtd         |  2 ++
 src/chrome/locale/hr-HR/options.dtd      |  2 ++
 src/chrome/locale/it/options.dtd         |  2 ++
 src/chrome/locale/nl/options.dtd         |  2 ++
 src/chrome/locale/pl-PL/options.dtd      |  2 ++
 src/chrome/locale/ru-RU/options.dtd      |  2 ++
 src/chrome/locale/sk-SK/options.dtd      |  2 ++
 src/chrome/locale/uk-UA/options.dtd      |  2 ++
 src/chrome/locale/zh-CN/options.dtd      |  2 ++
 src/chrome/locale/zh-TW/options.dtd      |  2 ++
 src/defaults/preferences/prefs.js        |  1 +
 src/modules/FiretrayHandler.jsm          |  5 +++++
 src/modules/FiretrayMessaging.jsm        |  7 +++++++
 src/modules/ctypes/winnt/shell32.jsm     |  4 ++++
 src/modules/winnt/FiretrayStatusIcon.jsm | 14 ++++++++++++--
 19 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/src/chrome/content/options.xul b/src/chrome/content/options.xul
index e01be25..56a5cc0 100644
--- a/src/chrome/content/options.xul
+++ b/src/chrome/content/options.xul
@@ -150,6 +150,7 @@
       <preference id="pref_only_favorite_folders" name="extensions.firetray.only_favorite_folders" type="bool" />
       <preference id="pref_mail_change_trigger" name="extensions.firetray.mail_change_trigger" type="string" />
       <preference id="pref_mail_get_attention" name="extensions.firetray.mail_get_attention" type="bool" />
+      <preference id="pref_nomail_hides_icon" name="extensions.firetray.nomail_hides_icon" type="bool" />
     </preferences>
 
     <vbox align="left" flex="1">
@@ -320,6 +321,12 @@
                 preference="pref_mail_get_attention"
                 observes="broadcaster-notification-disabled"/>
 
+      <checkbox id="ui_nomail_hides_icon"
+                label="&nomail_hides_icon.label;"
+                accesskey="&nomail_hides_icon.accesskey;"
+                preference="pref_nomail_hides_icon"
+                observes="broadcaster-notification-disabled"/>
+
     </vbox>
 
   </prefpane>
diff --git a/src/chrome/locale/de-DE/options.dtd b/src/chrome/locale/de-DE/options.dtd
index c540eae..26cdba7 100644
--- a/src/chrome/locale/de-DE/options.dtd
+++ b/src/chrome/locale/de-DE/options.dtd
@@ -92,6 +92,8 @@
 <!ENTITY mail_change_trigger.tooltip "absoluter Pfad eines Executables, das aufgerufen wird, falls sich die Anzahl der Mails ändert; die (neue) Anzahl der Mails wird als Argument übergeben.">
 <!ENTITY mail_get_attention.label "»X11 urgency hint« absetzen">
 <!ENTITY mail_get_attention.accesskey "X">
+<!ENTITY nomail_hides_icon.label "Icon verstecken, wenn keine neue Mail">
+<!ENTITY nomail_hides_icon.accesskey "H">
 
 <!ENTITY chat_icon_enable.label "Chat-Icon aktivieren">
 <!ENTITY chat_icon_enable.accesskey "A">
diff --git a/src/chrome/locale/en-US/options.dtd b/src/chrome/locale/en-US/options.dtd
index b88d4b9..47797c4 100644
--- a/src/chrome/locale/en-US/options.dtd
+++ b/src/chrome/locale/en-US/options.dtd
@@ -93,6 +93,8 @@
 <!ENTITY mail_change_trigger.tooltip "Absolute path of the program to run when the message count changes. This program will get the new message count as the first argument.">
 <!ENTITY mail_get_attention.label "Window draws attention on new messages">
 <!ENTITY mail_get_attention.accesskey "g">
+<!ENTITY nomail_hides_icon.label "Hide icon when no mail">
+<!ENTITY nomail_hides_icon.accesskey "H">
 
 <!ENTITY chat_icon_enable.label "Enable chat icon">
 <!ENTITY chat_icon_enable.accesskey "E">
diff --git a/src/chrome/locale/es-AR/options.dtd b/src/chrome/locale/es-AR/options.dtd
index 6bc9a41..7f63a19 100644
--- a/src/chrome/locale/es-AR/options.dtd
+++ b/src/chrome/locale/es-AR/options.dtd
@@ -83,6 +83,8 @@
 <!ENTITY mail_change_trigger.tooltip "Ruta absoluta del programa para correr cuando la cuenta de mensajes cambia. Este programa obtendrá recibira el contador de nuevos mensajes como primer argumento.">
 <!ENTITY mail_get_attention.label "Window draws attention on new messages">
 <!ENTITY mail_get_attention.accesskey "g">
+<!ENTITY nomail_hides_icon.label "Hide icon when no mail">
+<!ENTITY nomail_hides_icon.accesskey "H">
 <!ENTITY chat_icon_enable.label "Habilitar ícono de chat">
 <!ENTITY chat_icon_enable.accesskey "H">
 <!ENTITY chat_icon_blink.label "Icono de chat parpadea con mensajes nuevos.">
diff --git a/src/chrome/locale/fr/options.dtd b/src/chrome/locale/fr/options.dtd
index befbd1a..ab59579 100644
--- a/src/chrome/locale/fr/options.dtd
+++ b/src/chrome/locale/fr/options.dtd
@@ -83,6 +83,8 @@
 <!ENTITY mail_change_trigger.tooltip "Chemin absolu du programme à lancer lorsque le compte des messages a changé. Ce programme prendra pour base le nouveau décompte de messages">
 <!ENTITY mail_get_attention.label "La fenêtre attire l'attention lors de nouveaux messages">
 <!ENTITY mail_get_attention.accesskey "e">
+<!ENTITY nomail_hides_icon.label "Cache l'icône lorsqu'aucun nouveau message">
+<!ENTITY nomail_hides_icon.accesskey "H">
 <!ENTITY chat_icon_enable.label "Activer l'icône du chat">
 <!ENTITY chat_icon_enable.accesskey "h">
 <!ENTITY chat_icon_blink.label "L'icône du chat clignote à l'arrivée de nouveaux messages">
diff --git a/src/chrome/locale/hr-HR/options.dtd b/src/chrome/locale/hr-HR/options.dtd
index 1acc906..0d40aea 100644
--- a/src/chrome/locale/hr-HR/options.dtd
+++ b/src/chrome/locale/hr-HR/options.dtd
@@ -83,6 +83,8 @@
 <!ENTITY mail_change_trigger.tooltip "Potpuna putanja programa koji će se pokrenuti kada se broj poruka promijeni. Taj program će dobiti novi broj poruka kao prvi argument.">
 <!ENTITY mail_get_attention.label "Postavi X11 napomenu hitnosti">
 <!ENTITY mail_get_attention.accesskey "X">
+<!ENTITY nomail_hides_icon.label "Hide icon when no mail">
+<!ENTITY nomail_hides_icon.accesskey "H">
 <!ENTITY chat_icon_enable.label "Omogući ikonu čavrljanja">
 <!ENTITY chat_icon_enable.accesskey "E">
 <!ENTITY chat_icon_blink.label "Ikona čavrljanja blinka kod pristigle poruke">
diff --git a/src/chrome/locale/it/options.dtd b/src/chrome/locale/it/options.dtd
index 22a6192..764c85f 100644
--- a/src/chrome/locale/it/options.dtd
+++ b/src/chrome/locale/it/options.dtd
@@ -83,6 +83,8 @@
 <!ENTITY mail_change_trigger.tooltip "Percorso assoluto del programma da lanciare quando viene incrementato il contatore dei messaggi non letti. Il programma utilizzerà il contatore dei nuovi messaggi come primo argomento.">
 <!ENTITY mail_get_attention.label "Window draws attention on new messages">
 <!ENTITY mail_get_attention.accesskey "g">
+<!ENTITY nomail_hides_icon.label "Hide icon when no mail">
+<!ENTITY nomail_hides_icon.accesskey "H">
 <!ENTITY chat_icon_enable.label "Attiva icona della chat">
 <!ENTITY chat_icon_enable.accesskey "E">
 <!ENTITY chat_icon_blink.label "Lampeggiamento dell'icona della chat per nuovi messaggi">
diff --git a/src/chrome/locale/nl/options.dtd b/src/chrome/locale/nl/options.dtd
index 15504d0..03a8bcb 100644
--- a/src/chrome/locale/nl/options.dtd
+++ b/src/chrome/locale/nl/options.dtd
@@ -83,6 +83,8 @@
 <!ENTITY mail_change_trigger.tooltip "Absoluut pad van het uit te voeren programma wanneer het aantal wijzigt. Dit programma krijgt het aantal nieuwe berichten als het eerste argument.">
 <!ENTITY mail_get_attention.label "Window draws attention on new messages">
 <!ENTITY mail_get_attention.accesskey "g">
+<!ENTITY nomail_hides_icon.label "Hide icon when no mail">
+<!ENTITY nomail_hides_icon.accesskey "H">
 <!ENTITY chat_icon_enable.label "Chatpictogram inschakelen">
 <!ENTITY chat_icon_enable.accesskey "s">
 <!ENTITY chat_icon_blink.label "Chatpictogram knippert bij nieuwe berichten">
diff --git a/src/chrome/locale/pl-PL/options.dtd b/src/chrome/locale/pl-PL/options.dtd
index b30732b..987223d 100644
--- a/src/chrome/locale/pl-PL/options.dtd
+++ b/src/chrome/locale/pl-PL/options.dtd
@@ -93,6 +93,8 @@
 <!ENTITY mail_change_trigger.tooltip "Absolutna ścieżka do programu, który uruchomić gdy licznik wiadomośći się zmieni. Ten program otrzyma ilość nowych wiadomośći jako pierwszy argument.">
 <!ENTITY mail_get_attention.label "Okno przyciąga uwagę przy nowej wiadomośći">
 <!ENTITY mail_get_attention.accesskey "y">
+<!ENTITY nomail_hides_icon.label "Hide icon when no mail">
+<!ENTITY nomail_hides_icon.accesskey "H">
 
 <!ENTITY chat_icon_enable.label "Włącz ikonę czatu">
 <!ENTITY chat_icon_enable.accesskey "u">
diff --git a/src/chrome/locale/ru-RU/options.dtd b/src/chrome/locale/ru-RU/options.dtd
index 19461f5..155fb30 100644
--- a/src/chrome/locale/ru-RU/options.dtd
+++ b/src/chrome/locale/ru-RU/options.dtd
@@ -93,6 +93,8 @@
 <!ENTITY mail_change_trigger.tooltip "Абсолютный путь к программе. В качестве первого аргумента будет передано количество сообщений">
 <!ENTITY mail_get_attention.label "Установить срочное оповещение X11">
 <!ENTITY mail_get_attention.accesskey "X">
+<!ENTITY nomail_hides_icon.label "Hide icon when no mail">
+<!ENTITY nomail_hides_icon.accesskey "H">
 
 <!ENTITY chat_icon_enable.label "Включить значок чата">
 <!ENTITY chat_icon_enable.accesskey "E">
diff --git a/src/chrome/locale/sk-SK/options.dtd b/src/chrome/locale/sk-SK/options.dtd
index 7566d09..54d7e4c 100644
--- a/src/chrome/locale/sk-SK/options.dtd
+++ b/src/chrome/locale/sk-SK/options.dtd
@@ -93,6 +93,8 @@
 <!ENTITY mail_change_trigger.tooltip "Absolútna cesta programu, ktorý bude spustený pri zmene počtu správ. Prvý argument je počet nových správ.">
 <!ENTITY mail_get_attention.label "Window draws attention on new messages">
 <!ENTITY mail_get_attention.accesskey "g">
+<!ENTITY nomail_hides_icon.label "Hide icon when no mail">
+<!ENTITY nomail_hides_icon.accesskey "H">
 
 <!ENTITY chat_icon_enable.label "Zapnúť ikonu chatu">
 <!ENTITY chat_icon_enable.accesskey "E">
diff --git a/src/chrome/locale/uk-UA/options.dtd b/src/chrome/locale/uk-UA/options.dtd
index 4b88543..8fa6633 100644
--- a/src/chrome/locale/uk-UA/options.dtd
+++ b/src/chrome/locale/uk-UA/options.dtd
@@ -93,6 +93,8 @@
 <!ENTITY mail_change_trigger.tooltip "Абсолютний шлях запуску програми при зміні кількості повідомлень. Ця програма буде отримувати нову кількість повідомлень як перший аргумент.">
 <!ENTITY mail_get_attention.label "Вікно концентрується на нових повідомленнях">
 <!ENTITY mail_get_attention.accesskey "х">
+<!ENTITY nomail_hides_icon.label "Hide icon when no mail">
+<!ENTITY nomail_hides_icon.accesskey "H">
 
 
 <!ENTITY chat_icon_enable.label "Включити значок чату">
diff --git a/src/chrome/locale/zh-CN/options.dtd b/src/chrome/locale/zh-CN/options.dtd
index 3b9a302..b817532 100644
--- a/src/chrome/locale/zh-CN/options.dtd
+++ b/src/chrome/locale/zh-CN/options.dtd
@@ -83,6 +83,8 @@
 <!ENTITY mail_change_trigger.tooltip "消息数量变化时要运行的进程的绝对路径。此进程将在首个参数获得新消息的数量。">
 <!ENTITY mail_get_attention.label "有新消息时窗口提醒注意">
 <!ENTITY mail_get_attention.accesskey "g">
+<!ENTITY nomail_hides_icon.label "Hide icon when no mail">
+<!ENTITY nomail_hides_icon.accesskey "H">
 <!ENTITY chat_icon_enable.label "启用聊天图标">
 <!ENTITY chat_icon_enable.accesskey "E">
 <!ENTITY chat_icon_blink.label "有新消息时闪动聊天图标">
diff --git a/src/chrome/locale/zh-TW/options.dtd b/src/chrome/locale/zh-TW/options.dtd
index 910ead7..23d3de6 100644
--- a/src/chrome/locale/zh-TW/options.dtd
+++ b/src/chrome/locale/zh-TW/options.dtd
@@ -83,6 +83,8 @@
 <!ENTITY mail_change_trigger.tooltip "要在訊息數改變時執行程式的絕對路徑。程式會將新的訊息數作為第一個參數。">
 <!ENTITY mail_get_attention.label "Window draws attention on new messages">
 <!ENTITY mail_get_attention.accesskey "g">
+<!ENTITY nomail_hides_icon.label "Hide icon when no mail">
+<!ENTITY nomail_hides_icon.accesskey "H">
 <!ENTITY chat_icon_enable.label "啟用聊天圖示">
 <!ENTITY chat_icon_enable.accesskey "E">
 <!ENTITY chat_icon_blink.label "有新訊息時閃爍聊天圖示">
diff --git a/src/defaults/preferences/prefs.js b/src/defaults/preferences/prefs.js
index 7750808..ba4a1ed 100644
--- a/src/defaults/preferences/prefs.js
+++ b/src/defaults/preferences/prefs.js
@@ -27,6 +27,7 @@ pref("extensions.firetray.chat_icon_blink", true);
 pref("extensions.firetray.chat_icon_blink_style", 0);
 
 pref("extensions.firetray.mail_get_attention", true);
+pref("extensions.firetray.nomail_hides_icon", false);
 pref("extensions.firetray.message_count_type", 0);
 pref("extensions.firetray.mail_notification_enabled", true);
 pref("extensions.firetray.mail_notification_type", 0);
diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index 9c7cf82..7c14b02 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -558,6 +558,11 @@ firetray.PrefListener = new PrefListener(
     case 'only_favorite_folders':
       firetray.Messaging.updateMsgCountWithCb();
       break;
+    case 'nomail_hides_icon':
+      if (!firetray.Utils.prefService.getBoolPref('nomail_hides_icon'))
+        firetray.Handler.setIconVisibility(true);
+      firetray.Messaging.updateMsgCountWithCb();
+      break;
     case 'app_mail_icon_names':
     case 'app_browser_icon_names':
     case 'app_default_icon_names':
diff --git a/src/modules/FiretrayMessaging.jsm b/src/modules/FiretrayMessaging.jsm
index 786250c..81ad7ac 100644
--- a/src/modules/FiretrayMessaging.jsm
+++ b/src/modules/FiretrayMessaging.jsm
@@ -222,6 +222,10 @@ firetray.Messaging = {
       log.error('unknown message count type');
 
     if (msgCount == 0) {
+
+      if (firetray.Utils.prefService.getBoolPref('nomail_hides_icon'))
+        firetray.Handler.setIconVisibility(false);
+
       firetray.Handler.setIconImageDefault();
       firetray.Handler.setIconTooltipDefault();
 
@@ -245,6 +249,9 @@ firetray.Messaging = {
 
       firetray.Handler.setIconTooltip(localizedTooltip);
 
+      if (firetray.Utils.prefService.getBoolPref('nomail_hides_icon'))
+        firetray.Handler.setIconVisibility(true);
+
     } else {
       throw "negative message count"; // should never happen
     }
diff --git a/src/modules/ctypes/winnt/shell32.jsm b/src/modules/ctypes/winnt/shell32.jsm
index 83fb805..8922d4c 100644
--- a/src/modules/ctypes/winnt/shell32.jsm
+++ b/src/modules/ctypes/winnt/shell32.jsm
@@ -89,6 +89,10 @@ function shell32_defines(lib) {
   this.NIF_REALTIME = 0x00000040;
   this.NIF_SHOWTIP  = 0x00000080;
 
+  // for NOTIFYICONDATAW.dwState
+  this.NIS_HIDDEN     = 0x00000001;
+  this.NIS_SHAREDICON = 0x00000002;
+
   lib.lazy_bind("ExtractIconW", win32.HICON, win32.HINSTANCE, win32.LPCTSTR, win32.UINT);
   lib.lazy_bind("ExtractIconExW", win32.UINT, win32.LPCTSTR, ctypes.int, win32.HICON.ptr, win32.HICON.ptr, win32.UINT);
 }
diff --git a/src/modules/winnt/FiretrayStatusIcon.jsm b/src/modules/winnt/FiretrayStatusIcon.jsm
index 51be569..95e6cc5 100644
--- a/src/modules/winnt/FiretrayStatusIcon.jsm
+++ b/src/modules/winnt/FiretrayStatusIcon.jsm
@@ -186,7 +186,8 @@ firetray.StatusIcon = {
     nid.hIcon = this.icons.get('app');
     nid.hWnd = hwnd_hidden;
     nid.uCallbackMessage = firetray.Win32.WM_TRAYMESSAGE;
-    nid.uFlags = shell32.NIF_ICON | shell32.NIF_MESSAGE | shell32.NIF_TIP;
+    nid.uFlags = shell32.NIF_MESSAGE | shell32.NIF_ICON | shell32.NIF_TIP |
+      shell32.NIF_STATE;
     nid.uVersion = shell32.NOTIFYICON_VERSION_4;
 
     // Install the icon
@@ -336,7 +337,7 @@ firetray.StatusIcon = {
       nid.hIcon = iconinfo.hicon;
     if (iconinfo.tip)
       nid.szTip = iconinfo.tip;
-    rv = shell32.Shell_NotifyIconW(shell32.NIM_MODIFY, nid.address());
+    let rv = shell32.Shell_NotifyIconW(shell32.NIM_MODIFY, nid.address());
     log.debug("Shell_NotifyIcon MODIFY="+rv+" winLastError="+ctypes.winLastError);
   },
 
@@ -506,4 +507,13 @@ firetray.Handler.setIconText = function(text, color) {
 };
 
 firetray.Handler.setIconVisibility = function(visible) {
+  log.debug("setIconVisibility="+visible);
+  let nid = firetray.StatusIcon.notifyIconData;
+  if (visible)
+    nid.dwState = 0;
+  else
+    nid.dwState = shell32.NIS_HIDDEN;
+  nid.dwStateMask = shell32.NIS_HIDDEN;
+  let rv = shell32.Shell_NotifyIconW(shell32.NIM_MODIFY, nid.address());
+  log.warn("Shell_NotifyIcon MODIFY="+rv+" winLastError="+ctypes.winLastError);
 };

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