[Pkg-mozext-commits] [firetray] 98/399: options UI: use boradcaster for disabling UI when notification disabled
David Prévot
taffit at alioth.debian.org
Tue Oct 29 18:23:21 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 052d813502b9b96c6b6705c88190aa2940927574
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Thu Nov 24 21:27:23 2011 +0100
options UI: use boradcaster for disabling UI when notification disabled
---
src/chrome/content/options.js | 24 ++++++++----------------
src/chrome/content/options.xul | 20 ++++++++++++++------
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js
index c2b47ac..d1f11d3 100644
--- a/src/chrome/content/options.js
+++ b/src/chrome/content/options.js
@@ -69,9 +69,9 @@ firetray.UIOptions = {
},
initMailControls: function() {
- this.initNotificationSettings();
this.populateExcludedFoldersList();
this.populateTreeAccountsOrServerTypes();
+ this.initNotificationSettings();
},
initNotificationSettings: function() {
@@ -100,21 +100,13 @@ firetray.UIOptions = {
let isNotificationDisabled = (notificationSetting === NOTIFICATION_DISABLED);
- // update UI
- // NOTE: groupbox and caption don't have a 'disabled' attribute !!
- let excludedFoldersList = document.getElementById('excluded_folders_list');
- excludedFoldersList.disabled = isNotificationDisabled;
- let folderGroupboxCaption = document.getElementById('unread_count_folder_exceptions_caption_label');
- folderGroupboxCaption.disabled = isNotificationDisabled;
- this.disableGroup(excludedFoldersList, isNotificationDisabled); // disable listitems also
- let mailAccountsTree = document.getElementById('ui_tree_mail_accounts');
- mailAccountsTree.disabled = isNotificationDisabled;
- let accountsGroupboxCaption = document.getElementById('unread_count_account_exceptions_caption_label');
- accountsGroupboxCaption.disabled = isNotificationDisabled;
-
- if (isNotificationDisabled)
+ if (isNotificationDisabled) {
+ document.getElementById("broadcaster-notification-disabled")
+ .setAttribute("disabled", "true"); // UI update
firetray.Messaging.disable();
- else {
+ } else {
+ document.getElementById("broadcaster-notification-disabled")
+ .removeAttribute("disabled"); // UI update (enables!)
firetray.Messaging.enable();
firetray.Messaging.updateUnreadMsgCount();
}
@@ -148,8 +140,8 @@ firetray.UIOptions = {
.getIntPref("excluded_folders_flags");
for(let folderType in FLDRS_UNINTERESTING) {
let localizedFolderType = this.strings.getString(folderType);
-
let item = excludedFoldersList.appendItem(localizedFolderType, folderType);
+ item.setAttribute("observes", "broadcaster-notification-disabled");
LOG("folder: "+folderType);
if (FLDRS_UNINTERESTING[folderType] & prefExcludedFoldersFlags)
excludedFoldersList.addItemToSelection(item); // doesn't trigger onselect
diff --git a/src/chrome/content/options.xul b/src/chrome/content/options.xul
index 80e9c93..c9f9349 100644
--- a/src/chrome/content/options.xul
+++ b/src/chrome/content/options.xul
@@ -12,6 +12,10 @@
<stringbundle id="firetray-options-strings" src="chrome://firetray/locale/options.properties"/>
</stringbundleset>
+ <broadcasterset>
+ <broadcaster id="broadcaster-notification-disabled" disabled="false" />
+ </broadcasterset>
+
<prefpane id="pane1" label="&pane1.title;">
<preferences>
@@ -22,7 +26,6 @@
<preference id="pref_string_mail_accounts" name="extensions.firetray.mail_accounts" type="string"/>
</preferences>
-
<tabbox>
<tabs>
<tab label="&general_options;"/>
@@ -88,31 +91,36 @@
</radiogroup>
</groupbox>
+ <!-- NOTE: groupbox and caption don't have a 'disabled' attribute !! -->
<groupbox id="unread_count_folder_exceptions" flex="1">
<!-- label extracted from caption so we can disable it -->
<caption tooltiptext="&unread_count_folder_exceptions.tooltip;">
<label id="unread_count_folder_exceptions_caption_label"
- value="&unread_count_folder_exceptions.label;" />
+ value="&unread_count_folder_exceptions.label;"
+ observes="broadcaster-notification-disabled" />
</caption>
-
<listbox id="excluded_folders_list" rows="7" flex="1" seltype="multiple"
tooltiptext="&excluded_folders_list.tooltip;"
- onselect="firetray.UIOptions.updateExcludedFoldersPref()"/>
+ onselect="firetray.UIOptions.updateExcludedFoldersPref()"
+ observes="broadcaster-notification-disabled" />
</groupbox>
<groupbox id="unread_count_account_exceptions" flex="1">
<!-- label extracted from caption so we can disable it -->
<caption tooltiptext="&unread_count_account_exceptions.tooltip;">
<label id="unread_count_account_exceptions_caption_label"
- value="&unread_count_account_exceptions.label;" />
+ value="&unread_count_account_exceptions.label;"
+ observes="broadcaster-notification-disabled" />
</caption>
<tree id="ui_tree_mail_accounts" flex="1" rows="10" minwidth="400"
seltype="single" editable="true" hidecolumnpicker="false"
preference-editable="true"
preference="pref_string_mail_accounts"
- onsynctopreference="return firetray.UIOptions.saveTreeAccountsOrServerTypes();">
+ onsynctopreference="return
+ firetray.UIOptions.saveTreeAccountsOrServerTypes();"
+ observes="broadcaster-notification-disabled">
<treecols>
<treecol id="account_or_server_type_name" editable="false" flex="2"
persist="width" primary="true" label="&account_or_server_type_name;"
--
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