Changeset 8f2802


Ignore:
Timestamp:
Jan 30, 2008, 1:43:26 PM (14 years ago)
Author:
rene <rene@…>
Branches:
master
Children:
29f98c
Parents:
542f05
Message:

added observer to show or hide smtp-Menu dynamically

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chrome/content/v_identity/vI_smtpSelector.js

    r542f05 r8f2802  
    3939        vI_smtpSelector.__loadSMTP_server_list();
    4040        vI_smtpSelector.__selectUsedSMTPServer();
    41         if (vI.preferences.getBoolPref("show_smtp"))
    42                 vI_smtpSelector.elements.Area_SMTPServerList.setAttribute("hidden", "false");
     41        vI_smtpSelector.addObserver();
     42        vI_smtpSelector.observe(); // just do it once to initialize the status
     43    },
     44
     45    observe: function() {
     46        vI_smtpSelector.elements.Area_SMTPServerList.setAttribute("hidden",
     47            !vI.preferences.getBoolPref("show_smtp"));
     48    },
     49   
     50    addObserver: function() {
     51        vI_storage.prefroot.addObserver("extensions.virtualIdentity.show_smtp", vI_smtpSelector, false);
     52    },
     53   
     54    removeObserver: function() {
     55        vI_storage.prefroot.removeObserver("extensions.virtualIdentity.show_smtp", vI_smtpSelector);
    4356    },
    4457
     
    143156    }
    144157}
     158window.addEventListener("unload", function(e) { try {vI_smtpSelector.removeObserver();} catch (ex) { } }, false);
Note: See TracChangeset for help on using the changeset viewer.