diff options
Diffstat (limited to 'SoftwareProperties/SoftwareProperties.py')
| -rw-r--r-- | SoftwareProperties/SoftwareProperties.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index b1d557d4..4254a3ee 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -48,6 +48,7 @@ CONF_MAP = { "autoupdate" : "APT::Periodic::Update-Package-Lists", "autodownload" : "APT::Periodic::Download-Upgradeable-Packages", "autoclean" : "APT::Periodic::AutocleanInterval", + "unattended" : "APT::Periodic::Unattended-Upgrade", "max_size" : "APT::Archives::MaxSize", "max_age" : "APT::Archives::MaxAge" } @@ -151,6 +152,21 @@ class SoftwareProperties(SimpleGladeApp): else: self.checkbutton_auto_download.set_active(False) + # Unattended updates + if os.path.exists("/usr/bin/unattended-upgrade"): + # FIXME: we should always show the option. if unattended-upgrades is + # not installed a dialog should popup and allow the user to install + # unattended-upgrade + #self.checkbutton_unattended.set_sensitive(True) + self.checkbutton_unattended.show() + else: + #self.checkbutton_unattended.set_sensitive(False) + self.checkbutton_unattended.hide() + if apt_pkg.Config.FindI(CONF_MAP["unattended"]) == 1: + self.checkbutton_unattended.set_active(True) + else: + self.checkbutton_unattended.set_active(False) + # apt-key stuff self.apt_key = apt_key() self.init_keyslist() @@ -228,6 +244,16 @@ class SoftwareProperties(SimpleGladeApp): # FIXME: Write config options, apt_pkg should be able to do this. self.write_config() + def on_opt_unattended_toggled(self, widget): + if self.checkbutton_unattended.get_active(): + self.checkbutton_unattended.set_active(True) + apt_pkg.Config.Set(CONF_MAP["unattended"], str(1)) + else: + self.checkbutton_unattended.set_active(False) + apt_pkg.Config.Set(CONF_MAP["unattended"], str(0)) + # FIXME: Write config options, apt_pkg should be able to do this. + self.write_config() + def on_opt_autodownload_toggled(self, widget): if self.checkbutton_auto_download.get_active(): self.checkbutton_auto_download.set_active(True) |
