diff content/stream.js @ 358:c00b3db58dcf

add 'snowl' to all observer topics to avoid conflicts with other extensions/core code; use the Observers component everywhere
author Myk Melez <myk@mozilla.org>
date Tue, 04 Nov 2008 12:11:07 -0800
parents e9d7087abad1
children 57bbbcb76b0b
line wrap: on
line diff
--- a/content/stream.js	Mon Nov 03 18:02:27 2008 -0800
+++ b/content/stream.js	Tue Nov 04 12:11:07 2008 -0800
@@ -42,10 +42,10 @@
 // modules that come with Firefox
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
-// modules that should come with Firefox
+// modules that are generic
 Cu.import("resource://snowl/modules/log4moz.js");
+Cu.import("resource://snowl/modules/Observers.js");
 Cu.import("resource://snowl/modules/URI.js");
-Cu.import("resource://snowl/modules/Observers.js");
 
 // modules that are Snowl-specific
 Cu.import("resource://snowl/modules/datastore.js");
@@ -85,15 +85,6 @@
     return this._faviconSvc;
   },
 
-  // Observer Service
-  get _obsSvc() {
-    let obsSvc = Cc["@mozilla.org/observer-service;1"].
-                 getService(Ci.nsIObserverService);
-    delete this._obsSvc;
-    this._obsSvc = obsSvc;
-    return this._obsSvc;
-  },
-
   _window: null,
   _document: null,
 
@@ -139,16 +130,13 @@
     return this._linkifyRegex = regex;
   },
 
-  // nsISupports
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
-                                         Ci.nsISupportsWeakReference]),
-
 
   //**************************************************************************//
   // Initialization & Destruction
 
   onLoad: function() {
     Observers.add(this, "snowl:message:added");
+    Observers.add(this, "snowl:sources:changed");
 
     this.onResize();
 
@@ -198,6 +186,9 @@
       case "snowl:message:added":
         this._onMessageAdded(subject);
         break;
+      case "snowl:sources:changed":
+        this._onSourcesChanged();
+        break;
     }
   },
 
@@ -234,6 +225,10 @@
     this._contentSandbox.messageBox = null;
   },
 
+  _onSourcesChanged: function() {
+    this._rebuildView();
+  },
+
   onToggleGroup: function(event) {
     event.target.nextSibling.style.display = event.target.checked ? "block" : "none";
   },