[Phonehome-commits] r63 - trunk/frontend/src

pamadio at garage.maemo.org pamadio at garage.maemo.org
Sat Oct 18 22:45:44 EEST 2008


Author: pamadio
Date: 2008-10-18 22:45:43 +0300 (Sat, 18 Oct 2008)
New Revision: 63

Modified:
   trunk/frontend/src/phonehome-gui
Log:
starting to play with proxies

Modified: trunk/frontend/src/phonehome-gui
===================================================================
--- trunk/frontend/src/phonehome-gui	2008-10-18 19:09:43 UTC (rev 62)
+++ trunk/frontend/src/phonehome-gui	2008-10-18 19:45:43 UTC (rev 63)
@@ -25,8 +25,12 @@
 import hildon
 import osso
 import xmlrpclib
+import conic
+import dbus
 _ = gettext.gettext
 
+
+
 class phonehome_frontend(hildon.Program):
     def __init__(self):
         self.program=hildon.Program()
@@ -34,6 +38,13 @@
         self.hildon_window = hildon.Window()
         self.osso_context = osso.Context("org.maemo.phonehomegui", "0.0.1", False)
         self.osso_rpc=osso.Rpc(self.osso_context)
+        self.bus = dbus.SystemBus(private=True)
+        self.connection = conic.Connection()
+        self.connection.connect("connection-event", self.connection_cb)
+        self.connection.set_property("automatic-connection-events", True)
+        self.http_proxy=None
+        self.https_proxy=None
+        
         self.gconf_default=gconf.client_get_default()
         self.gconf_root="/apps/osso/phonehome"
 
@@ -97,6 +108,8 @@
         self.end_application()
 
     def test_button_clicked(self,widget):
+        self.connection.request_connection(conic.CONNECT_FLAG_NONE)
+        
         id=self.tid_entry.get_text()
         passw=self.password_entry.get_text()
         server_url=self.server_entry.get_text()
@@ -111,6 +124,16 @@
         except:
             msg=_("Connection failed")
         sysnote.system_note_infoprint(msg)
+
+    def connection_cb(self,connection, event):
+        status = event.get_status()
+
+        if status == conic.STATUS_CONNECTED:
+            print "on est connecte"
+            self.http_proxy=self.connection.get_proxy_host(conic.PROXY_PROTOCOL_HTTP)
+            self.https_proxy=self.connection.get_proxy_host(conic.PROXY_PROTOCOL_HTTPS)
+            print "proxy=",self.http_proxy
+
 """
 locale.setlocale(locale.LC_ALL, "fr_FR")
 os.environ["LANGUAGE"]="fr_FR"



More information about the Phonehome-commits mailing list