[Pkg-mozext-commits] [firetray] 25/38: Fix 'nomail_hides_icon' preference.

David Prévot taffit at moszumanska.debian.org
Mon Apr 6 15:58:22 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 1b995d854676e21f3d7ddf2f6fffe1016c3dd9a4
Author: foudfou <foudil.newbie+git at gmail.com>
Date:   Tue Mar 10 02:54:07 2015 +0100

    Fix 'nomail_hides_icon' preference.
    
    'nomail_hides_icon' and 'show_icon_on_hide' are mutually exclusive.
---
 src/chrome/content/options.js       |  2 +-
 src/chrome/content/options.xul      |  4 +++-
 src/chrome/locale/de-DE/options.dtd |  5 +++--
 src/chrome/locale/en-US/options.dtd |  5 +++--
 src/chrome/locale/es-AR/options.dtd |  3 +++
 src/chrome/locale/fr/options.dtd    | 11 +++++++----
 src/chrome/locale/hr-HR/options.dtd |  3 +++
 src/chrome/locale/it/options.dtd    |  3 +++
 src/chrome/locale/nl/options.dtd    |  3 +++
 src/chrome/locale/pl-PL/options.dtd |  1 +
 src/chrome/locale/ru-RU/options.dtd |  1 +
 src/chrome/locale/sk-SK/options.dtd |  1 +
 src/chrome/locale/uk-UA/options.dtd |  1 +
 src/chrome/locale/zh-CN/options.dtd |  3 +++
 src/chrome/locale/zh-TW/options.dtd |  3 +++
 src/modules/FiretrayHandler.jsm     | 35 ++++++++++++++++++++++++++++-------
 src/modules/FiretrayMessaging.jsm   | 10 +++-------
 17 files changed, 70 insertions(+), 24 deletions(-)

diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index 811a66b..b909585 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -385,7 +385,7 @@ var firetrayUIOptions = {
   },
 
   toggleChatIconBlink: function(enabled) {
-      this.disableElementsRecursive(document.getElementById("ui_chat_icon_blink_style"), !enabled);
+    this.disableElementsRecursive(document.getElementById("ui_chat_icon_blink_style"), !enabled);
   },
 
   chooseAppIconFile: function() {
diff --git a/src/chrome/content/options.xul b/src/chrome/content/options.xul
index 56a5cc0..8066eae 100644
--- a/src/chrome/content/options.xul
+++ b/src/chrome/content/options.xul
@@ -110,7 +110,8 @@
 
       <checkbox id="ui_show_icon_on_hide" preference="pref_show_icon_on_hide"
                 label="&show_icon_on_hide.label;"
-                accesskey="&show_icon_on_hide.accesskey;"/>
+                accesskey="&show_icon_on_hide.accesskey;"
+                tooltiptext="&exclusive.tooltip;"/>
 
       <checkbox id="ui_scroll_hides" preference="pref_scroll_hides"
                 label="&enable_mouse_scroll.label;"
@@ -324,6 +325,7 @@
       <checkbox id="ui_nomail_hides_icon"
                 label="&nomail_hides_icon.label;"
                 accesskey="&nomail_hides_icon.accesskey;"
+                tooltiptext="&exclusive.tooltip;"
                 preference="pref_nomail_hides_icon"
                 observes="broadcaster-notification-disabled"/>
 
diff --git a/src/chrome/locale/de-DE/options.dtd b/src/chrome/locale/de-DE/options.dtd
index 26cdba7..760968b 100644
--- a/src/chrome/locale/de-DE/options.dtd
+++ b/src/chrome/locale/de-DE/options.dtd
@@ -2,6 +2,7 @@
 <!ENTITY prefwindow.title "Einstellungen von FireTray">
 
 <!ENTITY NOT_IMPLEMENTED_YET "NOCH NICHT IMPLEMENTIERT">
+<!ENTITY exclusive.tooltip "exclusive option">
 
 <!ENTITY windows_options "Windows">
 <!ENTITY icon_options "Icon">
@@ -92,8 +93,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 nomail_hides_icon.label "Tray-Icon nur anzeigen, falls neue Mail">
+<!ENTITY nomail_hides_icon.accesskey "u">
 
 <!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 47797c4..543f97b 100644
--- a/src/chrome/locale/en-US/options.dtd
+++ b/src/chrome/locale/en-US/options.dtd
@@ -2,6 +2,7 @@
 <!ENTITY prefwindow.title "FireTray preferences">
 
 <!ENTITY NOT_IMPLEMENTED_YET "NOT IMPLEMENTED YET">
+<!ENTITY exclusive.tooltip "exclusive option">
 
 <!ENTITY windows_options "Windows">
 <!ENTITY icon_options "Icon">
@@ -93,8 +94,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 nomail_hides_icon.label "Show tray icon only when new mail">
+<!ENTITY nomail_hides_icon.accesskey "t">
 
 <!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 7f63a19..432cacc 100644
--- a/src/chrome/locale/es-AR/options.dtd
+++ b/src/chrome/locale/es-AR/options.dtd
@@ -1,10 +1,13 @@
 <!-- if you need multiline/carriage return, use a .properties -->
 <!ENTITY prefwindow.title "FireTray preferencias">
 <!ENTITY NOT_IMPLEMENTED_YET "NO IMPLEMENTADO AUN">
+<!ENTITY exclusive.tooltip "exclusive option">
+
 <!ENTITY windows_options "Ventanas">
 <!ENTITY icon_options "Icono">
 <!ENTITY mail_options "Correo">
 <!ENTITY chat_options "Chat">
+
 <!ENTITY hides_on_close.label "Cerrar la ventana a la bandeja">
 <!ENTITY hides_on_close.accesskey "C">
 <!ENTITY hides_on_minimize.label "Minimizar ventana a la bandeja">
diff --git a/src/chrome/locale/fr/options.dtd b/src/chrome/locale/fr/options.dtd
index ab59579..769e605 100644
--- a/src/chrome/locale/fr/options.dtd
+++ b/src/chrome/locale/fr/options.dtd
@@ -1,10 +1,13 @@
 <!-- if you need multiline/carriage return, use a .properties -->
 <!ENTITY prefwindow.title "Préférences de l'extension FireTray">
 <!ENTITY NOT_IMPLEMENTED_YET "Fonctionnalité pas encore implémentée">
+<!ENTITY exclusive.tooltip "option exclusive">
+
 <!ENTITY windows_options "Fenêtres">
 <!ENTITY icon_options "Icône">
 <!ENTITY mail_options "Courrier">
 <!ENTITY chat_options "Chat">
+
 <!ENTITY hides_on_close.label "Fermer la fenêtre la cache dans la zone de notification">
 <!ENTITY hides_on_close.accesskey "F">
 <!ENTITY hides_on_minimize.label "Réduire la fenêtre la cache dans la zone de notification">
@@ -22,7 +25,7 @@
 <!ENTITY show_activates.tooltip "les fenêtres restaurées se déploient depuis le haut et sont au premier plan">
 <!ENTITY remember_desktop.label "Se souvenir du bureau">
 <!ENTITY remember_desktop.accesskey "b">
-<!ENTITY show_icon_on_hide.label "N'afficher que l'icône de la zone de notification quand une fenêtre est masquée">
+<!ENTITY show_icon_on_hide.label "Afficher l'icône de la zone de notification uniquement quand une fenêtre est masquée">
 <!ENTITY show_icon_on_hide.accesskey "i">
 <!ENTITY app_icon_type "Type d'icône de l'application">
 <!ENTITY app_icon_themed.label "Adopter le thème par défaut">
@@ -42,7 +45,7 @@
 <!ENTITY middle_click.accesskey "m" >
 <!ENTITY show_hide "Masquer/Restaurer" >
 <!ENTITY activate_last "Activer la dernière fenêtre ouverte" >
-<!ENTITY mail_notification_enabled.label "Autoriser la notification des courriers">
+<!ENTITY mail_notification_enabled.label "Activer la notification des courriers">
 <!ENTITY mail_notification_enabled.accesskey "A">
 <!ENTITY message_count_type.label "compter les messages :">
 <!ENTITY message_count_type.accesskey "c">
@@ -83,8 +86,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 nomail_hides_icon.label "Afficher l'icône qu'en cas de nouveaux messages">
+<!ENTITY nomail_hides_icon.accesskey "q">
 <!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 0d40aea..6780c50 100644
--- a/src/chrome/locale/hr-HR/options.dtd
+++ b/src/chrome/locale/hr-HR/options.dtd
@@ -1,10 +1,13 @@
 <!-- if you need multiline/carriage return, use a .properties -->
 <!ENTITY prefwindow.title "FireTray osobitosti">
 <!ENTITY NOT_IMPLEMENTED_YET "JOŠ NIJE IMPLEMENTIRANO">
+<!ENTITY exclusive.tooltip "exclusive option">
+
 <!ENTITY windows_options "Prozori">
 <!ENTITY icon_options "Ikona">
 <!ENTITY mail_options "Pošta">
 <!ENTITY chat_options "Čavrljanje">
+
 <!ENTITY hides_on_close.label "Zatvaranjem se prozor sakriva u traku sustava">
 <!ENTITY hides_on_close.accesskey "C">
 <!ENTITY hides_on_minimize.label "Smanjivanjem se prozor sakriva u traku sustava">
diff --git a/src/chrome/locale/it/options.dtd b/src/chrome/locale/it/options.dtd
index 764c85f..74d735d 100644
--- a/src/chrome/locale/it/options.dtd
+++ b/src/chrome/locale/it/options.dtd
@@ -1,10 +1,13 @@
 <!-- if you need multiline/carriage return, use a .properties -->
 <!ENTITY prefwindow.title "Preferenze di FireTray">
 <!ENTITY NOT_IMPLEMENTED_YET "Non ancora implementato">
+<!ENTITY exclusive.tooltip "exclusive option">
+
 <!ENTITY windows_options "Finestre">
 <!ENTITY icon_options "Icona">
 <!ENTITY mail_options "Posta">
 <!ENTITY chat_options "Chat">
+
 <!ENTITY hides_on_close.label "Riduci a icona quando si chiude il programma">
 <!ENTITY hides_on_close.accesskey "C">
 <!ENTITY hides_on_minimize.label "Riduci a icona quando si riduce la finestra">
diff --git a/src/chrome/locale/nl/options.dtd b/src/chrome/locale/nl/options.dtd
index 03a8bcb..a644698 100644
--- a/src/chrome/locale/nl/options.dtd
+++ b/src/chrome/locale/nl/options.dtd
@@ -1,10 +1,13 @@
 <!-- if you need multiline/carriage return, use a .properties -->
 <!ENTITY prefwindow.title "FireTray-voorkeuren">
 <!ENTITY NOT_IMPLEMENTED_YET "NOG NIET GEÏMPLEMENTEERD">
+<!ENTITY exclusive.tooltip "exclusive option">
+
 <!ENTITY windows_options "Vensters">
 <!ENTITY icon_options "Pictogram">
 <!ENTITY mail_options "E-mail">
 <!ENTITY chat_options "Chatten">
+
 <!ENTITY hides_on_close.label "Venster sluiten verbergt naar systeemvak">
 <!ENTITY hides_on_close.accesskey "u">
 <!ENTITY hides_on_minimize.label "Venster minimaliseren verbergt naar systeemvak">
diff --git a/src/chrome/locale/pl-PL/options.dtd b/src/chrome/locale/pl-PL/options.dtd
index 987223d..78ac740 100644
--- a/src/chrome/locale/pl-PL/options.dtd
+++ b/src/chrome/locale/pl-PL/options.dtd
@@ -2,6 +2,7 @@
 <!ENTITY prefwindow.title "Ustawienia FireTray">
 
 <!ENTITY NOT_IMPLEMENTED_YET "JESZCZE NIE ZAIMPLEMENTOWANO">
+<!ENTITY exclusive.tooltip "exclusive option">
 
 <!ENTITY windows_options "Okna">
 <!ENTITY icon_options "Ikona">
diff --git a/src/chrome/locale/ru-RU/options.dtd b/src/chrome/locale/ru-RU/options.dtd
index 155fb30..373b700 100644
--- a/src/chrome/locale/ru-RU/options.dtd
+++ b/src/chrome/locale/ru-RU/options.dtd
@@ -2,6 +2,7 @@
 <!ENTITY prefwindow.title "Настройки FireTray">
 
 <!ENTITY NOT_IMPLEMENTED_YET "ЕЩЕ НЕ РЕАЛИЗОВАНО">
+<!ENTITY exclusive.tooltip "exclusive option">
 
 <!ENTITY windows_options "Окна">
 <!ENTITY icon_options "Значок">
diff --git a/src/chrome/locale/sk-SK/options.dtd b/src/chrome/locale/sk-SK/options.dtd
index 54d7e4c..182ed84 100644
--- a/src/chrome/locale/sk-SK/options.dtd
+++ b/src/chrome/locale/sk-SK/options.dtd
@@ -2,6 +2,7 @@
 <!ENTITY prefwindow.title "Nastavenia FireTray">
 
 <!ENTITY NOT_IMPLEMENTED_YET "ZATIAĽ NEIMPLEMENTOVANÉ">
+<!ENTITY exclusive.tooltip "exclusive option">
 
 <!ENTITY windows_options "Okno">
 <!ENTITY icon_options "Ikona">
diff --git a/src/chrome/locale/uk-UA/options.dtd b/src/chrome/locale/uk-UA/options.dtd
index 8fa6633..6e568cc 100644
--- a/src/chrome/locale/uk-UA/options.dtd
+++ b/src/chrome/locale/uk-UA/options.dtd
@@ -2,6 +2,7 @@
 <!ENTITY prefwindow.title "FireTray вподобання">
 
 <!ENTITY NOT_IMPLEMENTED_YET "ЩЕ НЕ РЕАЛІЗОВАНО.">
+<!ENTITY exclusive.tooltip "exclusive option">
 
 <!ENTITY windows_options "Вікна">
 <!ENTITY icon_options "Піктограма">
diff --git a/src/chrome/locale/zh-CN/options.dtd b/src/chrome/locale/zh-CN/options.dtd
index b817532..2935df6 100644
--- a/src/chrome/locale/zh-CN/options.dtd
+++ b/src/chrome/locale/zh-CN/options.dtd
@@ -1,10 +1,13 @@
 <!-- if you need multiline/carriage return, use a .properties -->
 <!ENTITY prefwindow.title "FireTray 首选项">
 <!ENTITY NOT_IMPLEMENTED_YET "尚未实现">
+<!ENTITY exclusive.tooltip "exclusive option">
+
 <!ENTITY windows_options "窗口">
 <!ENTITY icon_options "图标">
 <!ENTITY mail_options "邮件">
 <!ENTITY chat_options "聊天">
+
 <!ENTITY hides_on_close.label "关闭窗口时隐藏到托盘">
 <!ENTITY hides_on_close.accesskey "C">
 <!ENTITY hides_on_minimize.label "最小化窗口时隐藏到托盘">
diff --git a/src/chrome/locale/zh-TW/options.dtd b/src/chrome/locale/zh-TW/options.dtd
index 23d3de6..9e65039 100644
--- a/src/chrome/locale/zh-TW/options.dtd
+++ b/src/chrome/locale/zh-TW/options.dtd
@@ -1,10 +1,13 @@
 <!-- if you need multiline/carriage return, use a .properties -->
 <!ENTITY prefwindow.title "FireTray 偏好設定">
 <!ENTITY NOT_IMPLEMENTED_YET "NOT IMPLEMENTED YET">
+<!ENTITY exclusive.tooltip "exclusive option">
+
 <!ENTITY windows_options "視窗">
 <!ENTITY icon_options "圖示">
 <!ENTITY mail_options "郵件">
 <!ENTITY chat_options "聊天">
+
 <!ENTITY hides_on_close.label "關閉視窗時隱藏至系統列">
 <!ENTITY hides_on_close.accesskey "C">
 <!ENTITY hides_on_minimize.label "視窗最小化時隱藏至系統列">
diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index 6503ad1..45b1592 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -390,12 +390,22 @@ firetray.Handler = {
     return hidden;
   },
 
-  showHideIcon: function() {
-    if (firetray.Utils.prefService.getBoolPref('show_icon_on_hide'))
-      firetray.Handler.setIconVisibility(
-        (firetray.Handler.visibleWindowsCount !== firetray.Handler.windowsCount));
-    else
-      firetray.Handler.setIconVisibility(true);
+  showHideIcon: function(msgCount) {
+    let allWindowsVisible = true;
+    if (firetray.Utils.prefService.getBoolPref('show_icon_on_hide')) {
+      allWindowsVisible =
+        (firetray.Handler.visibleWindowsCount !== firetray.Handler.windowsCount);
+    }
+
+    let msgCountPositive = true;
+    if (firetray.Utils.prefService.getBoolPref('nomail_hides_icon') &&
+        ("undefined" !== typeof(msgCount))) {
+      msgCountPositive = (msgCount > 0);
+      log.info("__msgCountPositive="+msgCountPositive);
+    }
+
+    log.debug("allWindowsVisible="+allWindowsVisible+" msgCountPositive="+msgCountPositive);
+    firetray.Handler.setIconVisibility(allWindowsVisible && msgCountPositive);
   },
 
   /** nsIBaseWindow, nsIXULWindow, ... */
@@ -527,6 +537,13 @@ firetray.Handler = {
       branch.setBoolPref(pref.pref, pref.bak);
       log.debug(pref.pref+" restored to: "+pref.bak);
     });
+  },
+
+  excludeOtherShowIconPrefs: function(prefName) {
+    if (prefName !== 'nomail_hides_icon')
+      firetray.Utils.prefService.setBoolPref('nomail_hides_icon', false);
+    if (prefName !== 'show_icon_on_hide')
+      firetray.Utils.prefService.setBoolPref('show_icon_on_hide', false);
   }
 
 }; // firetray.Handler
@@ -543,6 +560,8 @@ firetray.PrefListener = new PrefListener(
       firetray.Handler.showHidePopupMenuItems();
       break;
     case 'show_icon_on_hide':
+      if (firetray.Utils.prefService.getBoolPref(name))
+        firetray.Handler.excludeOtherShowIconPrefs(name);
       firetray.Handler.showHideIcon();
       break;
     case 'mail_notification_enabled':
@@ -568,7 +587,9 @@ firetray.PrefListener = new PrefListener(
       firetray.Messaging.updateMsgCountWithCb();
       break;
     case 'nomail_hides_icon':
-      if (!firetray.Utils.prefService.getBoolPref('nomail_hides_icon'))
+      if (firetray.Utils.prefService.getBoolPref(name))
+        firetray.Handler.excludeOtherShowIconPrefs(name);
+      else
         firetray.Handler.setIconVisibility(true);
       firetray.Messaging.updateMsgCountWithCb();
       break;
diff --git a/src/modules/FiretrayMessaging.jsm b/src/modules/FiretrayMessaging.jsm
index 81ad7ac..57f4231 100644
--- a/src/modules/FiretrayMessaging.jsm
+++ b/src/modules/FiretrayMessaging.jsm
@@ -223,9 +223,6 @@ firetray.Messaging = {
 
     if (msgCount == 0) {
 
-      if (firetray.Utils.prefService.getBoolPref('nomail_hides_icon'))
-        firetray.Handler.setIconVisibility(false);
-
       firetray.Handler.setIconImageDefault();
       firetray.Handler.setIconTooltipDefault();
 
@@ -249,12 +246,11 @@ 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
     }
+
+    firetray.Handler.showHideIcon(msgCount);
   },
 
   /**
@@ -365,7 +361,7 @@ firetray.Messaging = {
 
 /**
  * Accounts Iterator/Generator for iterating over all account servers.
- * NOTE: MailServices.accounts.allServers exludes hidden and IM servers
+ * NOTE: MailServices.accounts.allServers excludes hidden and IM servers
  * @param sortByTypeAndName: boolean
  * @return a generator over all nsIMsgIncomingServer including hidden and IM ones
  */

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