Blob Blame History Raw
Use gconf optionally
From http://bazaar.launchpad.net/~ballogy/gdesklets/optional-use-gconf-appindicator/revision/188
=== modified file 'shell/plugins/PackageInstaller/Downloader.py'
--- shell/plugins/PackageInstaller/Downloader.py	2007-06-23 18:13:19 +0000
+++ shell/plugins/PackageInstaller/Downloader.py	2012-03-04 21:49:39 +0000
@@ -61,16 +61,22 @@
 
         dest_fd = open(dest, "w")
 
-        import gconf
-        client = gconf.client_get_default()
-        use_proxy = client.get_bool('/system/http_proxy/use_http_proxy')
-        if (use_proxy != 0):
-           host = client.get_string('/system/http_proxy/host')
-           port = client.get_int('/system/http_proxy/port')
-           if (host != ""):
-               http_proxy = "http://" + host + ':' + str(port)
-           else:
-               http_proxy = None
+        try:
+            import gconf
+        except ImportError:
+            gconf = None
+        if gconf:
+            client = gconf.client_get_default()
+            use_proxy = client.get_bool('/system/http_proxy/use_http_proxy')
+            if (use_proxy != 0):
+               host = client.get_string('/system/http_proxy/host')
+               port = client.get_int('/system/http_proxy/port')
+               if (host != ""):
+                   http_proxy = "http://" + host + ':' + str(port)
+               else:
+                   http_proxy = None
+            else:
+                http_proxy = None
         else:
             http_proxy = None