[Pkg-mozext-commits] [firetray] 283/399: * add chat_icon_enable pref * fix globaluserStatus with all IM accounts disconnected * cleaning
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:23:59 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 693611c9942756432e4335a69e4b3ae79b32059f
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Sat Aug 25 21:45:00 2012 +0200
* add chat_icon_enable pref
* fix globaluserStatus with all IM accounts disconnected
* cleaning
---
src/chrome/content/options.js | 9 +++++++
src/chrome/content/options.xul | 45 ++++++++++++++++++++++-------------
src/chrome/locale/en-US/options.dtd | 36 +++++++++++++++-------------
src/defaults/preferences/prefs.js | 1 +
src/modules/FiretrayChat.jsm | 36 ++++++++++++++++++++--------
src/modules/FiretrayMessaging.jsm | 9 +++----
6 files changed, 90 insertions(+), 46 deletions(-)
diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index 96402cd..2239b53 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -5,6 +5,7 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://firetray/FiretrayHandler.jsm");
+Cu.import("resource://firetray/FiretrayChat.jsm");
Cu.import("resource://firetray/commons.js");
const TREEROW_ACCOUNT_OR_SERVER_TYPE_NAME = 0;
@@ -592,6 +593,14 @@ var firetrayUIOptions = {
if (!/\d/.test(charStr))
event.preventDefault();
}
+ },
+
+ toggleChat: function(enabled) {
+ F.LOG("Chat icon enable="+enabled);
+ if (enabled)
+ firetray.Chat.init();
+ else
+ firetray.Chat.shutdown();
}
};
diff --git a/src/chrome/content/options.xul b/src/chrome/content/options.xul
index c42002a..3fea56b 100644
--- a/src/chrome/content/options.xul
+++ b/src/chrome/content/options.xul
@@ -30,6 +30,7 @@
<preference id="pref_app_icon_filename" name="extensions.firetray.app_icon_filename" type="string"/>
<preference id="pref_scroll_hides" name="extensions.firetray.scroll_hides" type="bool" />
<preference id="pref_scroll_mode" name="extensions.firetray.scroll_mode" type="string" />
+ <preference id="pref_chat_icon_enable" name="extensions.firetray.chat_icon_enable" type="bool" />
<preference id="pref_mail_notification_enabled" name="extensions.firetray.mail_notification_enabled" type="bool" />
<preference id="pref_folder_count_recursive" name="extensions.firetray.folder_count_recursive" type="bool" />
<preference id="pref_message_count_type" name="extensions.firetray.message_count_type" type="int" />
@@ -44,6 +45,7 @@
<tab label="&windows_options;"/>
<tab label="&icon_options;"/>
<tab label="&mail_options;" id="mail_tab" />
+ <tab label="&chat_options;" />
</tabs>
<tabpanels flex="1">
@@ -51,27 +53,27 @@
<vbox pack="start" align="left" flex="1">
<checkbox id="ui_hides_on_close" preference="pref_hides_on_close"
- label="&bool_hides_on_close.label;"
- accesskey="&bool_hides_on_close.accesskey;"
+ label="&hides_on_close.label;"
+ accesskey="&hides_on_close.accesskey;"
oncommand="firetrayUIOptions.updateWindowAndIconOptions();"/>
<checkbox id="ui_hides_on_minimize" preference="pref_hides_on_minimize"
- label="&bool_hides_on_minimize.label;"
- accesskey="&bool_hides_on_minimize.accesskey;"
+ label="&hides_on_minimize.label;"
+ accesskey="&hides_on_minimize.accesskey;"
oncommand="firetrayUIOptions.updateWindowAndIconOptions();"/>
<checkbox id="ui_hides_single_window" preference="pref_hides_single_window"
- label="&bool_hides_single_window.label;"
- accesskey="&bool_hides_single_window.accesskey;"
- tooltiptext="&bool_hides_single_window.tooltip;"/>
+ label="&hides_single_window.label;"
+ accesskey="&hides_single_window.accesskey;"
+ tooltiptext="&hides_single_window.tooltip;"/>
<checkbox id="ui_start_hidden" preference="pref_start_hidden"
- label="&bool_start_hidden.label;"
- accesskey="&bool_start_hidden.accesskey;"/>
+ label="&start_hidden.label;"
+ accesskey="&start_hidden.accesskey;"/>
<checkbox id="ui_show_activates" preference="pref_show_activates"
- label="&bool_show_activates.label;"
- accesskey="&bool_show_activates.accesskey;"
- tooltiptext="&bool_show_activates.tooltip;"/>
+ label="&show_activates.label;"
+ accesskey="&show_activates.accesskey;"
+ tooltiptext="&show_activates.tooltip;"/>
<checkbox id="ui_remember_desktop" preference="pref_remember_desktop"
- label="&bool_remember_desktop.label;"
- accesskey="&bool_remember_desktop.accesskey;"/>
+ label="&remember_desktop.label;"
+ accesskey="&remember_desktop.accesskey;"/>
</vbox>
</tabpanel>
@@ -113,8 +115,8 @@
</radiogroup>
<checkbox id="ui_show_icon_on_hide" preference="pref_show_icon_on_hide"
- label="&bool_show_icon_on_hide.label;"
- accesskey="&bool_show_icon_on_hide.accesskey;"/>
+ label="&show_icon_on_hide.label;"
+ accesskey="&show_icon_on_hide.accesskey;"/>
<checkbox id="ui_scroll_hides" preference="pref_scroll_hides"
label="&enable_mouse_scroll.label;"
@@ -278,6 +280,17 @@
</vbox>
</tabpanel>
+ <tabpanel id="chat_tabpanel" flex="1">
+ <vbox align="left" flex="1">
+
+ <checkbox id="ui_chat_icon_enable" preference="pref_chat_icon_enable"
+ label="&chat_icon_enable.label;"
+ accesskey="&chat_icon_enable.accesskey;"
+ oncommand="firetrayUIOptions.toggleChat(this.checked);"/>
+
+ </vbox>
+ </tabpanel>
+
</tabpanels>
</tabbox>
diff --git a/src/chrome/locale/en-US/options.dtd b/src/chrome/locale/en-US/options.dtd
index 9dd80d1..6087848 100644
--- a/src/chrome/locale/en-US/options.dtd
+++ b/src/chrome/locale/en-US/options.dtd
@@ -7,24 +7,25 @@
<!ENTITY windows_options "Windows">
<!ENTITY icon_options "Icon">
<!ENTITY mail_options "Mail">
+<!ENTITY chat_options "Chat">
-<!ENTITY bool_hides_on_close.label "Closing window hides to tray">
-<!ENTITY bool_hides_on_close.accesskey "C">
-<!ENTITY bool_hides_on_minimize.label "Minimizing window hides to tray">
-<!ENTITY bool_hides_on_minimize.accesskey "M">
-<!ENTITY bool_hides_single_window.label "Hide windows individually">
-<!ENTITY bool_hides_single_window.tooltip "not all windows at once">
-<!ENTITY bool_hides_single_window.accesskey "H">
-<!ENTITY bool_start_hidden.label "Start application hidden to tray">
-<!ENTITY bool_start_hidden.accesskey "S">
-<!ENTITY bool_show_activates.label "Activate restored windows">
-<!ENTITY bool_show_activates.accesskey "e">
-<!ENTITY bool_show_activates.tooltip "restored windows raise on top and get focus">
-<!ENTITY bool_remember_desktop.label "Remember desktop (per-window)">
-<!ENTITY bool_remember_desktop.accesskey "R">
+<!ENTITY hides_on_close.label "Closing window hides to tray">
+<!ENTITY hides_on_close.accesskey "C">
+<!ENTITY hides_on_minimize.label "Minimizing window hides to tray">
+<!ENTITY hides_on_minimize.accesskey "M">
+<!ENTITY hides_single_window.label "Hide windows individually">
+<!ENTITY hides_single_window.tooltip "not all windows at once">
+<!ENTITY hides_single_window.accesskey "H">
+<!ENTITY start_hidden.label "Start application hidden to tray">
+<!ENTITY start_hidden.accesskey "S">
+<!ENTITY show_activates.label "Activate restored windows">
+<!ENTITY show_activates.accesskey "e">
+<!ENTITY show_activates.tooltip "restored windows raise on top and get focus">
+<!ENTITY remember_desktop.label "Remember desktop (per-window)">
+<!ENTITY remember_desktop.accesskey "R">
-<!ENTITY bool_show_icon_on_hide.label "Show tray icon only if a window is hidden">
-<!ENTITY bool_show_icon_on_hide.accesskey "w">
+<!ENTITY show_icon_on_hide.label "Show tray icon only if a window is hidden">
+<!ENTITY show_icon_on_hide.accesskey "w">
<!ENTITY app_icon_type "Application icon type">
<!ENTITY app_icon_themed.label "Default themed">
<!ENTITY app_icon_themed.accesskey "D">
@@ -77,3 +78,6 @@
<!ENTITY account_or_server_type_excluded.tooltip "Includes accounts or types into unread messages count">
<!ENTITY account_or_server_type_order "Order">
<!ENTITY account_or_server_type_order.tooltip "Order in which mail server types are displayed. Double-clic to edit.">
+
+<!ENTITY chat_icon_enable.label "Enable chat icon">
+<!ENTITY chat_icon_enable.accesskey "E">
diff --git a/src/defaults/preferences/prefs.js b/src/defaults/preferences/prefs.js
index e02085b..bdce715 100644
--- a/src/defaults/preferences/prefs.js
+++ b/src/defaults/preferences/prefs.js
@@ -20,6 +20,7 @@ pref("extensions.firetray.new_mail_icon_names", '["indicator-messages-new", "mai
pref("extensions.firetray.show_icon_on_hide", false);
pref("extensions.firetray.scroll_hides", true);
pref("extensions.firetray.scroll_mode", "down_hides");
+pref("extensions.firetray.chat_icon_enable", true);
pref("extensions.firetray.message_count_type", 0);
pref("extensions.firetray.mail_notification_enabled", true);
diff --git a/src/modules/FiretrayChat.jsm b/src/modules/FiretrayChat.jsm
index fd00b31..0f7d756 100644
--- a/src/modules/FiretrayChat.jsm
+++ b/src/modules/FiretrayChat.jsm
@@ -10,7 +10,6 @@ Cu.import("resource:///modules/imServices.jsm");
Cu.import("resource://firetray/commons.js");
Cu.import("resource://firetray/linux/FiretrayChatStatusIcon.jsm");
-// FIXME: rename to firetray.Chat
firetray.Chat = {
initialized: false,
observedTopics: {},
@@ -118,27 +117,32 @@ firetray.Chat = {
},
updateIcon: function() {
- let userStatus = Services.core.globalUserStatus.statusType;
+ let globalConnectedStatus = this.globalConnectedStatus();
+ let userStatus;
+ if (globalConnectedStatus)
+ userStatus = Services.core.globalUserStatus.statusType;
+ else
+ userStatus = Ci.imIStatusInfo.STATUS_OFFLINE;
F.LOG("IM status="+userStatus);
let iconName;
switch (userStatus) {
- case Ci.imIStatusInfo.STATUS_OFFLINE:
+ case Ci.imIStatusInfo.STATUS_OFFLINE: // 1
iconName = FIRETRAY_IM_STATUS_OFFLINE;
break;
- case Ci.imIStatusInfo.STATUS_IDLE:
- case Ci.imIStatusInfo.STATUS_AWAY:
+ case Ci.imIStatusInfo.STATUS_IDLE: // 4
+ case Ci.imIStatusInfo.STATUS_AWAY: // 5
iconName = FIRETRAY_IM_STATUS_AWAY;
break;
- case Ci.imIStatusInfo.STATUS_AVAILABLE:
+ case Ci.imIStatusInfo.STATUS_AVAILABLE: // 7
iconName = FIRETRAY_IM_STATUS_AVAILABLE;
break;
- case Ci.imIStatusInfo.STATUS_UNAVAILABLE:
+ case Ci.imIStatusInfo.STATUS_UNAVAILABLE: // 6
iconName = FIRETRAY_IM_STATUS_BUSY;
break;
- case Ci.imIStatusInfo.STATUS_UNKNOWN:
- case Ci.imIStatusInfo.STATUS_INVISIBLE:
- case Ci.imIStatusInfo.STATUS_MOBILE:
+ case Ci.imIStatusInfo.STATUS_UNKNOWN: // 0
+ case Ci.imIStatusInfo.STATUS_INVISIBLE: // 2
+ case Ci.imIStatusInfo.STATUS_MOBILE: // 3
default:
// ignore
}
@@ -146,6 +150,18 @@ firetray.Chat = {
F.LOG("IM status changed="+iconName);
if (iconName)
firetray.ChatStatusIcon.setIconImage(iconName);
+ },
+
+ globalConnectedStatus: function() {
+ let accounts = Services.accounts.getAccounts();
+ let globalConnected = false;
+ while (accounts.hasMoreElements()) {
+ let account = accounts.getNext().QueryInterface(Ci.imIAccount);
+ F.LOG("account="+account+" STATUS="+account.statusInfo.statusType+" connected="+account.connected);
+ globalConnected = globalConnected || account.connected;
+ }
+ F.LOG("globalConnected="+globalConnected);
+ return globalConnected;
}
};
diff --git a/src/modules/FiretrayMessaging.jsm b/src/modules/FiretrayMessaging.jsm
index a9f4012..8938090 100644
--- a/src/modules/FiretrayMessaging.jsm
+++ b/src/modules/FiretrayMessaging.jsm
@@ -43,8 +43,9 @@ firetray.Messaging = {
MailServices.mailSession.AddFolderListener(that.mailSessionListener,
that.mailSessionListener.notificationFlags);
- // FIXME: add im-icon pref
- if (Services.prefs.getBoolPref("mail.chat.enabled") && this.existsIMAccount())
+ if (Services.prefs.getBoolPref("mail.chat.enabled") &&
+ firetray.Utils.prefService.getBoolPref("chat_icon_enable") &&
+ this.existsChatAccount())
firetray.Chat.init();
this.initialized = true;
@@ -68,7 +69,7 @@ firetray.Messaging = {
// this._items is undefined' when calling method:
// [nsISimpleEnumerator::hasMoreElements]"), and we're unsure if we should
// initAccounts() ourselves...
- existsIMAccount: function() {
+ existsChatAccount: function() {
let accounts = new this.Accounts();
for (let accountServer in accounts)
if (accountServer.type === 'im') {
@@ -84,7 +85,7 @@ firetray.Messaging = {
switch (topic) {
case "account-removed":
this.cleanExcludedAccounts();
- if (subject.QueryInterface(Ci.imIAccount) && !this.existsIMAccount())
+ if (subject.QueryInterface(Ci.imIAccount) && !this.existsChatAccount())
firetray.Chat.shutdown();
break;
case "account-added":
--
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