Changeset b96555


Ignore:
Timestamp:
Jul 8, 2014, 11:12:55 AM (6 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
8d283f
Parents:
51bd40
Message:

update notification settings without restart

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/vI_log.js

    r51bd40 rb96555  
    213213}
    214214
     215function UpdateSmartReplyNotification() {
     216    if (vIprefs.get("smart_reply_notification")) {
     217        SmartReplyAppender = new NotificationOutputAppender(myNotificationFormatter);
     218        SmartReplyAppender.level = Log4Moz.Level["All"];
     219        SmartReplyNotification.addAppender(SmartReplyAppender);
     220    }
     221    else {
     222        SmartReplyNotification.removeAppender(SmartReplyAppender);
     223    }
     224}
     225
     226function UpdateStorageNotification() {
     227    if (vIprefs.get("storage_notification")) {
     228        StorageAppender = new NotificationOutputAppender(myNotificationFormatter);
     229        StorageAppender.level = Log4Moz.Level["All"];
     230        StorageNotification.addAppender(StorageAppender);
     231    }
     232    else {
     233        StorageNotification.removeAppender(StorageAppender);
     234    }
     235}
     236
     237function UpdateGetHeaderNotification() {
     238    if (vIprefs.get("get_header_notification")) {
     239        GetHeaderAppender = new NotificationOutputAppender(myNotificationFormatter);
     240        GetHeaderAppender.level = Log4Moz.Level["All"];
     241        GetHeaderNotification.addAppender(GetHeaderAppender);
     242    }
     243    else {
     244        GetHeaderNotification.removeAppender(GetHeaderAppender);
     245    }
     246}
     247
     248
    215249let logRoot = "virtualIdentity";
    216250let MyLog = setupFullLogging(logRoot);
    217251
    218252let myNotificationFormatter = new NotificationFormatter();
     253
     254let SmartReplyAppender;
    219255let SmartReplyNotification = Log4Moz.repository.getLogger("virtualIdentity.SmartReply");
    220 if (vIprefs.get("smart_reply_notification")) {
    221   let napp = new NotificationOutputAppender(myNotificationFormatter);
    222   napp.level = Log4Moz.Level["All"];
    223   SmartReplyNotification.addAppender(napp);
    224 }
     256
     257let StorageAppender;
    225258let StorageNotification = Log4Moz.repository.getLogger("virtualIdentity.StorageNotification");
    226 if (vIprefs.get("storage_notification")) {
    227   let napp = new NotificationOutputAppender(myNotificationFormatter);
    228   napp.level = Log4Moz.Level["All"];
    229   StorageNotification.addAppender(napp);
    230 }
     259
     260let GetHeaderAppender;
    231261let GetHeaderNotification = Log4Moz.repository.getLogger("virtualIdentity.GetHeaderNotification");
    232 if (vIprefs.get("get_header_notification")) {
    233   let napp = new NotificationOutputAppender(myNotificationFormatter);
    234   napp.level = Log4Moz.Level["All"];
    235   GetHeaderNotification.addAppender(napp);
    236 }
     262
     263UpdateSmartReplyNotification();
     264UpdateStorageNotification();
     265UpdateGetHeaderNotification();
     266
     267vIprefs.addObserver("smart_reply_notification", UpdateSmartReplyNotification, this);
     268vIprefs.addObserver("storage_notification", UpdateStorageNotification, this);
     269vIprefs.addObserver("get_header_notification", UpdateGetHeaderNotification, this);
Note: See TracChangeset for help on using the changeset viewer.