Mercurial > snowl
changeset 316:142c648208cc
lay the collections overlay over the river view via a XUL processing instruction rather than the document.loadOverlay function to make sure the overlay is loaded before the window load event fires, which simplifies and robustifies our collections and river view initialization functions
author | Myk Melez <myk@mozilla.org> |
---|---|
date | Thu, 09 Oct 2008 15:36:28 -0700 |
parents | f577b8a8bb40 |
children | 27a89f014e81 |
files | content/collections.js content/collections.xul content/river.js content/river.xul |
diffstat | 4 files changed, 12 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/content/collections.js Thu Oct 09 15:09:07 2008 -0700 +++ b/content/collections.js Thu Oct 09 15:36:28 2008 -0700 @@ -84,9 +84,6 @@ // the collection name). // FIXME: disable this for names that can't be changed. this._tree.addEventListener("mousedown", function(aEvent) { SourcesView.onClick(aEvent) }, true); - - if (gMessageViewWindow.SnowlMessageView.onCollectionsLoaded) - gMessageViewWindow.SnowlMessageView.onCollectionsLoaded(); }, @@ -351,13 +348,4 @@ }; -// 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. -// We also load the script at the end of the collections.xul overlay, -// after the rest of the overlay has already been parsed, instead of at the top -// of the overlay, which is where scripts are usually loaded in XUL files. -// 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); +window.addEventListener("load", function() { SourcesView.init() }, true);
--- a/content/collections.xul Thu Oct 09 15:09:07 2008 -0700 +++ b/content/collections.xul Thu Oct 09 15:36:28 2008 -0700 @@ -42,6 +42,8 @@ <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <script type="application/x-javascript" src="chrome://snowl/content/collections.js"/> + <vbox id="collectionsViewBox"> <tree id="sourcesView" flex="1" context="sourcesContextMenu" editable="true" onselect="SourcesView.onSelect(event)"> @@ -55,6 +57,4 @@ <toolbar id="snowlToolbar"/> </vbox> - <script type="application/x-javascript" src="chrome://snowl/content/collections.js"/> - </overlay>
--- a/content/river.js Thu Oct 09 15:09:07 2008 -0700 +++ b/content/river.js Thu Oct 09 15:36:28 2008 -0700 @@ -171,6 +171,13 @@ // Initialization init: function() { + // Finish initializing after a brief timeout to give the collections view + // time to initialize itself. + let t = this; + window.setTimeout(function() { t._initDelayed() }, 0); + }, + + _initDelayed: function() { // Resize the content box to the initial size of the browser. this.resizeContentBox(); @@ -190,14 +197,6 @@ 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); - }, - - onCollectionsLoaded: function() { //this._collection = new SnowlCollection(); this._updateToolbar(); //this.writeContent();
--- a/content/river.xul Thu Oct 09 15:09:07 2008 -0700 +++ b/content/river.xul Thu Oct 09 15:36:28 2008 -0700 @@ -42,6 +42,8 @@ <!DOCTYPE page SYSTEM "chrome://snowl/locale/river.dtd"> +<?xul-overlay href="chrome://snowl/content/collections.xul"?> + <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml" title="&page.title;"