Added proxy support
[feedingit] / src / config.py
index 805a66f..cb7aaa0 100644 (file)
@@ -27,6 +27,8 @@ import gtk
 import hildon
 import ConfigParser
 import gobject
+import gconf
+import urllib2
 
 section = "FeedingIt"
 ranges = { "updateInterval":[0.5, 1, 2, 4, 12, 24], "expiry":[24, 48, 72], "fontSize":range(12,24), "orientation":["Automatic", "Landscape", "Portrait"], "artFontSize":[10, 12, 14, 16, 18, 20]}
@@ -62,20 +64,20 @@ class Config():
             picker.set_name('HildonButton-finger')
             picker.set_alignment(0,0,1,1)
             self.buttons[setting] = picker
-            vbox.pack_start(picker)
+            vbox.pack_start(picker, expand=False)
         
         button = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
         button.set_label("Auto-update Enabled")
         button.set_active(self.config["autoupdate"])
         button.connect("toggled", self.button_toggled, "autoupdate")
-        vbox.pack_start(button)
+        vbox.pack_start(button, expand=False)
 
         if self.has_webkit:
             button = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
             button.set_label("Webkit Articles Enabled")
             button.set_active(self.config["webkit"])
             button.connect("toggled", self.button_toggled, "webkit")
-            vbox.pack_start(button)
+            vbox.pack_start(button, expand=False)
         
         panArea.add_with_viewport(vbox)
         
@@ -179,4 +181,11 @@ class Config():
         if self.has_webkit:
             return self.config["webkit"]
         else:
-            return False
\ No newline at end of file
+            return False
+    def getProxy(self):
+        if gconf.client_get_default().get_bool('/system/http_proxy/use_http_proxy'):
+            port = gconf.client_get_default().get_int('/system/http_proxy/port')
+            http = gconf.client_get_default().get_string('/system/http_proxy/host')
+            proxy = proxy = urllib2.ProxyHandler( {"http":"http://%s:%s/"% (http,port)} )
+            return (True, proxy)
+        return (False, None)
\ No newline at end of file