summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Heinlein <sebastian.heinlein@web.de>2006-02-07 14:07:57 +0100
committerSebastian Heinlein <sebastian.heinlein@web.de>2006-02-07 14:07:57 +0100
commit5073b91679242238428c1c6b5c967ae67ff4643b (patch)
tree5333882470bdcbd88424cfcae7a7fcb764736bc0
parentf5f4fc0812ec40a3701ff17692c4bd295d53daaa (diff)
downloadpython-apt-5073b91679242238428c1c6b5c967ae67ff4643b.tar.gz
* Do not always set max_age to 1 if the check box is toggled
* Sanity check for the max_age combo box
-rw-r--r--SoftwareProperties/SoftwareProperties.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py
index 16adae43..b1d557d4 100644
--- a/SoftwareProperties/SoftwareProperties.py
+++ b/SoftwareProperties/SoftwareProperties.py
@@ -240,23 +240,24 @@ class SoftwareProperties(SimpleGladeApp):
def on_combobox_delete_interval_changed(self, widget):
i = self.combobox_delete_interval.get_active()
- value = self.combobox_delete_interval_mapping[i]
- # Only write the key if it has changed
- if not value == apt_pkg.Config.FindI(CONF_MAP["max_age"]):
- apt_pkg.Config.Set(CONF_MAP["max_age"], str(value))
- self.write_config()
+ if i != -1:
+ value = self.combobox_delete_interval_mapping[i]
+ # Only write the key if it has changed
+ if not value == apt_pkg.Config.FindI(CONF_MAP["max_age"]):
+ apt_pkg.Config.Set(CONF_MAP["max_age"], str(value))
+ self.write_config()
def on_opt_autodelete_toggled(self, widget):
if self.checkbutton_auto_delete.get_active():
self.combobox_delete_interval.set_sensitive(True)
- # if no frequency was specified use daily
+ # if no frequency was specified use the first default value
i = self.combobox_delete_interval.get_active()
if i == -1:
i = 0
self.combobox_delete_interval.set_active(i)
value_maxage = self.combobox_delete_interval_mapping[i]
value_clean = 1
- apt_pkg.Config.Set(CONF_MAP["max_age"], str(value_clean))
+ apt_pkg.Config.Set(CONF_MAP["max_age"], str(value_maxage))
else:
self.combobox_delete_interval.set_sensitive(False)
value_clean = 0