changeset 187:dc76bd76b8bc

make the collections view load into the river view even when query params have been altered
author Myk Melez <myk@mozilla.org>
date Sun, 20 Jul 2008 22:05:44 -0700
parents b6726c6c287b
children 80a852729881
files extension/chrome.manifest extension/content/collections.js extension/content/collections.xul extension/content/river.js
diffstat 4 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/extension/chrome.manifest	Sun Jul 20 21:11:26 2008 -0700
+++ b/extension/chrome.manifest	Sun Jul 20 22:05:44 2008 -0700
@@ -2,5 +2,4 @@
 locale  snowl en-US locale/en-US/
 overlay chrome://browser/content/browser.xul chrome://snowl/content/snowl.xul
 overlay chrome://snowl/content/sidebar.xul chrome://snowl/content/collections.xul
-overlay chrome://snowl/content/river.xul chrome://snowl/content/collections.xul
 resource snowl ./
--- a/extension/content/collections.js	Sun Jul 20 21:11:26 2008 -0700
+++ b/extension/content/collections.js	Sun Jul 20 22:05:44 2008 -0700
@@ -7,7 +7,7 @@
 Cu.import("resource://snowl/modules/identity.js");
 Cu.import("resource://snowl/modules/collection.js");
 
-SourcesView = {
+let SourcesView = {
   _log: null,
 
   // Observer Service
@@ -404,4 +404,10 @@
 
 };
 
-window.addEventListener("load", function() { SourcesView.init() }, false);
+// We can't listen for load and initialize then because load has already
+// happened when we get overlaid onto the river view, so we just set a timeout
+// by which time we hope the overlay has been loaded enough for this to work.
+// FIXME: figure out a better solution here.  In theory we should be able
+// to make the river view observe xul-overlay-merged and then initialize us,
+// but that doesn't work because of bug 392515.
+window.setTimeout(function() { SourcesView.init() }, 100);
--- a/extension/content/collections.xul	Sun Jul 20 21:11:26 2008 -0700
+++ b/extension/content/collections.xul	Sun Jul 20 22:05:44 2008 -0700
@@ -62,7 +62,7 @@
                      image="chrome://snowl/content/icons/opml-icon-16x16.png"
                      oncommand="SourcesView.exportOPML()"/>
     </toolbar>
-  
+
     <tree id="sourcesView" flex="1" context="sourcesContextMenu" editable="true"
           onselect="SourcesView.onSelect(event)">
       <treecols>
--- a/extension/content/river.js	Sun Jul 20 21:11:26 2008 -0700
+++ b/extension/content/river.js	Sun Jul 20 22:05:44 2008 -0700
@@ -188,6 +188,12 @@
     this._window = new XPCNativeWrapper(window);
     this._document = this._window.document;
 
+    // We have to load the overlay manually because we modify the query params
+    // of the river view URL to reflect the selected collection and filters,
+    // and chrome.manifest overlay instructions only work on exact matches
+    // of the entire URL.
+    document.loadOverlay("chrome://snowl/content/collections.xul", null);
+
     this._collection = new SnowlCollection();
     this._updateToolbar();
     this.writeContent();