From 50d1d0486b9b6ffda01537cd1f8e1472387d9df0 Mon Sep 17 00:00:00 2001 From: javiplx Date: Thu, 12 May 2011 20:52:55 +0000 Subject: [PATCH] Connect the save method to the settings dialog closing git-svn-id: file:///svnroot/wifihood/trunk@153 c51dfc6a-5949-4919-9c8e-f207a149c383 --- wifiscanner/wifimap/config.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/wifiscanner/wifimap/config.py b/wifiscanner/wifimap/config.py index 45afae4..0ab9d1c 100644 --- a/wifiscanner/wifimap/config.py +++ b/wifiscanner/wifimap/config.py @@ -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() -- 1.7.9.5