diff options
| -rw-r--r-- | UpdateManager/fakegconf.py | 61 | ||||
| -rw-r--r-- | debian/changelog | 7 | ||||
| -rw-r--r-- | debian/control | 3 |
3 files changed, 60 insertions, 11 deletions
diff --git a/UpdateManager/fakegconf.py b/UpdateManager/fakegconf.py index fd465fa3..7e387b56 100644 --- a/UpdateManager/fakegconf.py +++ b/UpdateManager/fakegconf.py @@ -1,24 +1,69 @@ -# This is a class which contains stubs for the gconf methods -# used in Update Manager. When gconf is unavailable it will -# still work but not retain the user settings. +# Copyright (c) 2006 Jani Monoses <jani@ubuntu.com> + +# This is a class which handles settings when the gconf library +# is unavailable such as in a non-Gnome environment +# The configuration is stored in python hash format which is sourced +# at program start and dumped at exit + +import string +import atexit + +CONFIG_FILE="/root/.update-manager-conf" class FakeGconf: + + def __init__(self): + self.config = {} + try: + #execute python file which contains the dictionary called config + exec open (CONFIG_FILE) + self.config = config + except: + pass + #only get the 'basename' from the gconf key + def keyname(self, key): + return string.rsplit(key, '/', 1)[-1] + def get_bool(self, key): - return False + key = self.keyname(key) + return self.config.setdefault(self.keyname(key), True) def set_bool(self, key,value): - pass + key = self.keyname(key) + self.config[key] = value + # FIXME assume type is int for now def get_pair(self, key, ta = None, tb = None): - return [300,300] + key = self.keyname(key) + return self.config.setdefault(self.keyname(key), [400, 500]) + # FIXME assume type is int for now def set_pair(self, key, ta, tb, a, b): - pass + key = self.keyname(key) + self.config[key] = [a, b] + + #Save current dictionary to config file + def save(self): + file = open(CONFIG_FILE, "w") + data = "config = {" + for i in self.config: + data += "'"+i+"'" + ":" + str(self.config[i])+",\n" + data += "}" + file.write(data) + file.close() + VALUE_INT = "" +fakegconf = FakeGconf() + def client_get_default(): - return FakeGconf() + return fakegconf + +def fakegconf_atexit(): + fakegconf.save() + +atexit.register(fakegconf_atexit) diff --git a/debian/changelog b/debian/changelog index f9b39c53..236841b7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,11 @@ update-manager (0.42.2ubuntu11) dapper; urgency=low - * debian/control: depend on unattended-upgrades + * debian/control: + - depend on unattended-upgrades + - move python-gnome2 to recommends (we only use gconf from it) + * UpdateManager/fakegconf.py: update for xubuntu (thanks to Jani Monoses) - -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 4 Apr 2006 21:47:05 +0200 + -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 5 Apr 2006 14:46:10 +0200 update-manager (0.42.2ubuntu10) dapper; urgency=low diff --git a/debian/control b/debian/control index 97f0d3dc..691eba0c 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,8 @@ Standards-Version: 3.6.1.1 Package: update-manager Architecture: all -Depends: ${python:Depends}, ${misc:Depends}, python, python-gnome2, python-glade2, python-apt (>= 0.6.15), synaptic (>= 0.57.8), lsb-release, python-gnupginterface, unattended-upgrades +Depends: ${python:Depends}, ${misc:Depends}, python, python-glade2, python-apt (>= 0.6.15), synaptic (>= 0.57.8), lsb-release, python-gnupginterface, unattended-upgrades +Recommends: python-gnome2 Description: GNOME application that manages apt updates This is the GNOME apt update manager. It checks for updates and lets the user choose which to install. |
