Connect the save method to the settings dialog closing
authorjaviplx <javiplx@gmail.com>
Thu, 12 May 2011 20:52:55 +0000 (20:52 +0000)
committerjaviplx <javiplx@gmail.com>
Thu, 12 May 2011 20:52:55 +0000 (20:52 +0000)
git-svn-id: file:///svnroot/wifihood/trunk@153 c51dfc6a-5949-4919-9c8e-f207a149c383

wifiscanner/wifimap/config.py

index 45afae4..0ab9d1c 100644 (file)
@@ -11,6 +11,9 @@ class Configuration :
 
     def __init__ ( self , type ) :
         self._type = type
+        self.read()
+
+    def read ( self ) :
         self._client = gconf.client_get_default()
 
         self.homedir = self._client.get_string( "/apps/wifihood/basedir" ) or "/home/user/MyDocs"
@@ -52,12 +55,20 @@ class Configuration :
         self._client.set_int( "/apps/wifihood/%s-zoom" % self._type , zoom )
         self.zoom = zoom
 
-    def save ( self ) :
+    def save ( self , widget , event ) :
+        print "Calling save() on",self, widget , event 
         self._client.set_string( "/apps/wifihood/basedir" , self.homedir )
         self._client.set_string( "/apps/wifihood/dbname" , self.dbname )
         self._client.set_string( "/apps/wifihood/maps" , self.mapsdir )
         self._client.set_string( "/apps/wifihood/maptype" , self.mapclass )
 
+        self._client.set_int( "/apps/wifihood/scan-period" , self.scan_period )
+        self._client.set_bool( "/apps/wifihood/store-logfile" , self.store_log )
+        self._client.set_bool( "/apps/wifihood/use-mapper" , self.use_mapper )
+        self._client.set_bool( "/apps/wifihood/store-gps" , self.store_gps )
+
+        self.set_latlon( self.lat , self.lon )
+        self.set_zoom( self.zoom )
 
 class AbstractSettingsWindow :
 
@@ -283,6 +294,7 @@ else :
     def __init__ ( self , config , handler=None ) :
         gtk.Window.__init__( self )
         AbstractSettingsWindow.__init__( self , config , handler )
+        self.connect_object("delete_event", config.save , self )
 
     def MainArea ( self ) :
         scrollwin = gtk.ScrolledWindow()