Index: jhbuild/utils/trayicon.py
===================================================================
--- jhbuild/utils/trayicon.py	(revision 1719)
+++ jhbuild/utils/trayicon.py	(working copy)
@@ -24,7 +24,10 @@
 class TrayIcon:
     proc = None
 
-    def __init__(self):
+    def __init__(self, config):
+        self.proc = None
+        if config and config.notrayicon:
+            return
         if not os.environ.get('DISPLAY'):
             return
         self._run_zenity()
Index: jhbuild/utils/download.py
===================================================================
--- jhbuild/utils/download.py	(revision 0)
+++ jhbuild/utils/download.py	(revision 0)
@@ -0,0 +1,45 @@
+# Copyright (C) 2007  John 
+#
+#   download.py: helper functions for downloading urls
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+import urllib, urllib2
+from jhbuild.utils import httpcache
+from jhbuild.utils.cmds import has_command
+
+def _download_status_hook(count, blockSize, totalSize):
+    if totalSize:
+        progress = 100.0*float(count*blockSize)/float(totalSize)
+    else:
+        progress = 100.0
+    print 'Downloading: %2.1f%%' % progress
+
+def download_file(buildscript, url, localfile, nonetwork=False, cache=False):
+    try:
+        if cache == True:
+            localfile = httpcache.load(url, nonetwork=nonetwork)
+        else:
+            if has_command('wget'):
+                res = buildscript.execute(['wget', url, '-O', localfile])
+            elif has_command('curl'):
+                res = buildscript.execute(['curl', '-L', url, '-o', localfile])
+            else:
+                urllib.urlretrieve(url, localfile, _download_status_hook)
+    except urllib2.URLError, e:
+        raise Exception('could not download patch: %s (%s)' % (url,e))
+    except urllib2.HTTPError, e:
+        raise Exception('could not download patch: %s (%s)' % (url,e))
+    return localfile
+
Index: jhbuild/frontends/autobuild.py
===================================================================
--- jhbuild/frontends/autobuild.py	(revision 1719)
+++ jhbuild/frontends/autobuild.py	(working copy)
@@ -98,7 +98,7 @@
                 os.environ[k] = 'C'
 
         if self.verbose:
-            self.trayicon = trayicon.TrayIcon()
+            self.trayicon = trayicon.TrayIcon(config)
 
     def message(self, msg, module_num=-1, skipfp = False):
         '''Display a message to the user'''
Index: jhbuild/frontends/terminal.py
===================================================================
--- jhbuild/frontends/terminal.py	(revision 1719)
+++ jhbuild/frontends/terminal.py	(working copy)
@@ -64,12 +64,11 @@
 class TerminalBuildScript(buildscript.BuildScript):
     def __init__(self, config, module_list):
         buildscript.BuildScript.__init__(self, config, module_list)
-        self.trayicon = trayicon.TrayIcon()
+        self.trayicon = trayicon.TrayIcon(config)
         self.notify = notify.Notify(config)
 
     def message(self, msg, module_num=-1):
         '''Display a message to the user'''
-        
         if module_num == -1:
             module_num = self.module_num
         if module_num > 0:
Index: jhbuild/modtypes/tarball.py
===================================================================
--- jhbuild/modtypes/tarball.py	(revision 1719)
+++ jhbuild/modtypes/tarball.py	(working copy)
@@ -25,8 +25,8 @@
 
 from jhbuild.errors import FatalError, CommandError, BuildStateError
 from jhbuild.modtypes import Package, register_module_type, get_dependencies
-from jhbuild.utils import httpcache
 from jhbuild.utils.cmds import has_command
+from jhbuild.utils.download import download_file
 
 jhbuild_directory = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                                  '..', '..'))
@@ -143,14 +143,10 @@
             if self.check_localfile(buildscript) is not None:
                 # don't have a local copy
                 buildscript.set_action('Downloading', self, action_target=self.source_url)
-                if has_command('wget'):
-                    res = buildscript.execute(
-                            ['wget', self.source_url, '-O', localfile])
-                elif has_command('curl'):
-                    res = buildscript.execute(
-                            ['curl', '-L', self.source_url, '-o', localfile])
-                else:
-                    raise FatalError("unable to find wget or curl")
+                try:
+                    download_file(buildscript,self.source_url,localfile,nonetwork=False,cache=False)
+                except:
+                    raise FatalError("unable to download archive")
 
         status = self.check_localfile(buildscript)
         if status is not None:
@@ -185,17 +181,15 @@
             patchfile = ''
             if urlparse.urlparse(patch)[0]: # patch name has scheme
                 try:
-                    patchfile = httpcache.load(patch, nonetwork=buildscript.config.nonetwork)
-                except urllib2.URLError, e:
+                    patchfile = download_file(buildscript,patch,'',nonetwork=buildscript.config.nonetwork,cache=True)
+                except:
                     return (self.STATE_CONFIGURE, 'could not download patch', [])
-                except urllib2.HTTPError, e:
-                    return (self.STATE_CONFIGURE,
-                            'could not download patch (error: %s)' % e.code, [])
+
             elif self.uri:
                 for patch_prefix in ('.', 'patches'):
                     uri = urlparse.urljoin(self.uri, os.path.join(patch_prefix, patch))
                     try:
-                        patchfile = httpcache.load(uri, nonetwork=buildscript.config.nonetwork)
+                        patchfile = download_file(buildscript,uri,'',nonetwork=buildscript.config.nonetwork,cache=True)
                     except Exception, e:
                         continue
                     if not os.path.isfile(patchfile):
Index: jhbuild/versioncontrol/tarball.py
===================================================================
--- jhbuild/versioncontrol/tarball.py	(revision 1719)
+++ jhbuild/versioncontrol/tarball.py	(working copy)
@@ -27,6 +27,7 @@
 from jhbuild.versioncontrol import Repository, Branch, register_repo_type
 from jhbuild.utils.cmds import has_command
 from jhbuild.modtypes import get_branch
+from jhbuild.utils.download import download_file
 
 jhbuild_directory = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                                  '..', '..'))
@@ -160,15 +161,10 @@
             self._check_tarball()
         except BuildStateError:
             # don't have the tarball, try downloading it and check again
-            if has_command('wget'):
-                res = buildscript.execute(
-                        ['wget', self.module, '-O', localfile])
-            elif has_command('curl'):
-                res = buildscript.execute(
-                        ['curl', '-L', self.module, '-o', localfile])
-            else:
-                raise FatalError("unable to find wget or curl")
-
+            try:
+                download_file(buildscript,self.module,localfile)
+            except:
+                raise FatalError("unable to find download archive")
             self._check_tarball()
 
         # now to unpack it
Index: jhbuild/moduleset.py
===================================================================
--- jhbuild/moduleset.py	(revision 1719)
+++ jhbuild/moduleset.py	(working copy)
@@ -32,7 +32,7 @@
 
 from jhbuild import modtypes
 from jhbuild.versioncontrol import get_repo_type
-from jhbuild.utils import httpcache
+from jhbuild.utils.download import download_file
 
 __all__ = ['load', 'load_tests']
 
@@ -202,12 +202,13 @@
             yield node
 
 def _parse_module_set(config, uri):
+    if uri.startswith('http'):
+        try:
+            filename = download_file(None,uri,'',nonetwork=config.nonetwork,cache=True)
+        except Exception, e:
+            raise FatalError('could not download %s: %s' % (uri, str(e)))
+    filename = os.path.normpath(uri)
     try:
-        filename = httpcache.load(uri, nonetwork=config.nonetwork)
-    except Exception, e:
-        raise FatalError('could not download %s: %s' % (uri, str(e)))
-    filename = os.path.normpath(filename)
-    try:
         document = xml.dom.minidom.parse(filename)
     except xml.parsers.expat.ExpatError, e:
         raise FatalError('failed to parse %s: %s' % (filename, str(e)))
Index: jhbuild/config.py
===================================================================
--- jhbuild/config.py	(revision 1719)
+++ jhbuild/config.py	(working copy)
@@ -36,7 +36,7 @@
                 'alwaysautogen', 'nobuild', 'makeclean', 'makecheck',
                 'use_lib64', 'tinderbox_outputdir', 'sticky_date',
                 'tarballdir', 'pretty_print', 'svn_program', 'makedist',
-                'makedistcheck', 'nonotify', 'cvs_program',
+                'makedistcheck', 'nonotify', 'cvs_program', 'notrayicon',
                 'checkout_mode', 'copy_dir', 'module_checkout_mode']
 
 env_prepends = {}
Index: jhbuild/defaults.jhbuildrc
===================================================================
--- jhbuild/defaults.jhbuildrc	(revision 1719)
+++ jhbuild/defaults.jhbuildrc	(working copy)
@@ -60,11 +60,15 @@
 # whether to install to lib64 directories?  Currently this will default to
 # True on Linux AMD64, PPC64 or S390x systems, and False everywhere else.
 # Patches accepted to fix the default for other architectures.
-uname = os.uname()
-use_lib64 = (uname[0], uname[4]) in [ ('Linux', 'x86_64'),
+try:
+    uname = os.uname()
+    use_lib64 = (uname[0], uname[4]) in [ ('Linux', 'x86_64'),
                                       ('Linux', 'ppc64'),
                                       ('Linux', 's390x') ]
-del uname
+    del uname
+except AttributeError:
+    #windows
+    use_lib64 = False
 
 # default buildscript.  You should probably leave this as the default.
 # In particular, don't set it to 'gtk'.
@@ -88,6 +92,9 @@
 # whether not to emit notifications through the notification daemon
 nonotify = False
 
+# Show a tray icon using zenity
+notrayicon = False
+
 # whether to run tests in real X and not in Xvfb
 noxvfb = False
 
