<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Gareth Hunt &#187; Howto</title>
	<atom:link href="http://www.garethhunt.com/category/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.garethhunt.com</link>
	<description>Firefox Addons, Mobile Web and living in the USA</description>
	<lastBuildDate>Fri, 19 Mar 2010 05:12:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using XUL prefwindow and prefpanes</title>
		<link>http://www.garethhunt.com/2010/03/18/using-xul-prefwindow-and-prefpanes/</link>
		<comments>http://www.garethhunt.com/2010/03/18/using-xul-prefwindow-and-prefpanes/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 05:12:36 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://www.garethhunt.com/?p=60</guid>
		<description><![CDATA[
pre {
  margin: 0 20px 10px 20px;
  background-color: #ddd;
}

The combination of &#60;prefwindow&#62; and &#60;prefpane&#62;'s provides Firefox addon developers with an effective mechanism for creating a preferences dialog.  The best example of &#60;prefwindow&#62; usage is the Firefox options dialog.
This tech note will focus on getting all the elements of the &#60;prefwindow&#62; framework right [...]]]></description>
			<content:encoded><![CDATA[<style>
pre {
  margin: 0 20px 10px 20px;
  background-color: #ddd;
}
</style>
<p>The combination of <code>&lt;prefwindow&gt;</code> and <code>&lt;prefpane&gt;</code>'s provides Firefox addon developers with an effective mechanism for creating a preferences dialog.  The best example of <code>&lt;prefwindow&gt;</code> usage is the Firefox options dialog.</p>
<p>This tech note will focus on getting all the elements of the <code>&lt;prefwindow&gt;</code> framework right as it is fairly easy to miss one small element, leaving you scratching your head.  Below is a screenshot of the end result.</p>
<p><a href="http://www.garethhunt.com/wp-content/uploads/2010/03/preferences.png"><img src="http://www.garethhunt.com/wp-content/uploads/2010/03/preferences-300x186.png" alt="" title="XUL prefwindow" width="300" height="186" class="alignnone size-medium wp-image-72" /></a></p>
<h3>Setting up the <code>&lt;prefwindow&gt;</code></h3>
<p>The code below a minimal <code>&lt;prefwindow&gt;</code> page with two <code>&lt;prefpane&gt;</code>'s.  If only one <code>&lt;prefpane&gt;</code> is used, the navigation bar is not displayed.  When two or more <code>&lt;prefpane&gt;</code>'s are used, a navigation bar is added at the top of the page.</p>
<pre>
&lt;?xml version="1.0"?&gt;
&lt;?xml-stylesheet href="chrome://global/skin/global.css"?&gt;

&lt;prefwindow id="modifyheadersPreferences"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    style="width: 42em; min-height: 37.5em;"&gt;

    &lt;prefpane id="paneProfiles" label="Profiles"
        src="chrome://modifyheaders/content/profiles.xul"/&gt;
    &lt;prefpane id="paneHeaders" label="Headers"
        src="chrome://modifyheaders/content/headers.xul"/&gt;
&lt;/prefwindow&gt;
</pre>
<p>For this example, the contents of each <code>&lt;prefpane&gt;</code> are contained in external files, but you can place content directly between <code>&lt;prefpane&gt;</code> start and end tags.  No content should appear above between the opening <code>&lt;prefwindow&gt;</code> element and the <code>&lt;prefpane&gt;</code> elements.  If any scripts or other content must be defined, place them after the last <code>&lt;prefpane&gt;</code>.</p>
<h3>Defining <code>&lt;prefpane&gt;</code> panels</h3>
<p>There are several rules for defining <code>&lt;prefpane&gt;</code>s in external files:</p>
<ol>
<li>The root tag must be an <code>&lt;overlay&gt;</code>.</li>
<li>The id of the <code>&lt;prefpane&gt;</code> must match the id specified in the <code>&lt;prefwindow&gt;</code></li>
<li>A <code>&lt;preferences&gt;</code> element must be specified, even if it is empty</li>
</ol>
<p>Here is an example for the <code>&lt;prefpane&gt;</code> with <code>id="paneProfiles"</code>.</p>
<pre>
&lt;?xml version="1.0"?&gt;
&lt;overlay id="modifyheaders-profiles-overlay"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    &lt;prefpane id="paneProfiles" label="Profiles"&gt;
        &lt;preferences/&gt;
        &lt;vbox id="modifyheaders-profiles"&gt;
            &lt;description&gt;Edit Site Profiles&lt;/description&gt;
        &lt;/vbox&gt;
    &lt;/prefpane&gt;
&lt;/overlay&gt;
</pre>
<p>This markup is repeated for each <code>&lt;prefpane&gt;</code> you need to define.  Only the id attribute must be unique.</p>
<h3>Opening the <code>&lt;prefwindow&gt;</code> using javascript</h3>
<p>This is the bit that caught me out.  You have to be careful about which features are specified for the window.  Typically for a XUL dialog, you would use:</p>
<pre>
window.openDialog("chrome://modifyheaders/content/dialog.xul", "modifyheadersDialog", "resizable,dialog,centerscreen,modal", this);
</pre>
<p>The third argument lists the features for the dialog. In this case: resizable, dialog, centerscreen, modal.  For a <code>&lt;prefwindow&gt;</code>, you have to make sure the <em>toolbar</em> feature is specified.  Resizeable can be ignored as it seems to have no affect on this type of window:</p>
<pre>
window.openDialog("chrome://modifyheaders/content/preferences.xul", "modifyheadersPreferences", "chrome,titlebar,toolbar,centerscreen,modal", this);
</pre>
<p>That about wraps it up.  As you can see, it is straightforward enough.  For further information, here are some further references from MDC:</p>
<ul>
<li><a href="https://developer.mozilla.org/en/XUL/prefwindow"><code>&lt;prefwindow&gt;</code></a></li>
<li><a href="https://developer.mozilla.org/en/XUL/prefpane"><code>&lt;prefpane&gt;</code></a></li>
<li><a href="https://developer.mozilla.org/en/XUL/preferences"><code>&lt;preferences&gt;</code></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.garethhunt.com/2010/03/18/using-xul-prefwindow-and-prefpanes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cygwin: died waiting for dll loading</title>
		<link>http://www.garethhunt.com/2008/02/11/cygwin-died-waiting-for-dll-loading/</link>
		<comments>http://www.garethhunt.com/2008/02/11/cygwin-died-waiting-for-dll-loading/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 02:18:58 +0000</pubDate>
		<dc:creator>Gareth</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[cygwin]]></category>

		<guid isPermaLink="false">http://www.garethhunt.com/index.php/2008/02/11/cygwin-died-waiting-for-dll-loading/</guid>
		<description><![CDATA[Over the weekend I was trying to use mod_rewrite with apache 2 webserver for cygwin and kept getting the following error:
11086085 [main] httpd2 4492 fork: child 5492 - died waiting for dll loading, errno 11
It seemed obvious that cygwin was unable to load some dependency for mod_rewrite.  After a little googling, I found a [...]]]></description>
			<content:encoded><![CDATA[<p>Over the weekend I was trying to use mod_rewrite with apache 2 webserver for cygwin and kept getting the following error:</p>
<p><code>11086085 [main] httpd2 4492 fork: child 5492 - died waiting for dll loading, errno 11</code></p>
<p>It seemed obvious that cygwin was unable to load some dependency for mod_rewrite.  After a little googling, I found a suggestion to rebase cygwin.  The procedure is as follows:</p>
<ol>
<li>Shutdown cygserver (if running): <strong>net stop cygserver</strong>.</li>
<li>Close all cygwin windows.</li>
<li>Open <strong>Start-&gt;Run</strong></li>
<li>rebase has to be run from an ash shell, so type <strong>C:\path\to\cygwin\bin\ash.exe</strong></li>
<li>Once the shell window in open: <strong>$ cd /bin</strong></li>
<li><strong>$ ./rebaseall</strong></li>
<li><strong>$ exit</strong> to close the window</li>
</ol>
<p>After this, I restarted the cygserver service and apache and mod_rewrite worked perfectly.</p>
<p><!--adsensestart--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.garethhunt.com/2008/02/11/cygwin-died-waiting-for-dll-loading/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
