[kupfer: 46/51] favorites: Implement configuration storage protocol
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer: 46/51] favorites: Implement configuration storage protocol
- Date: Sun, 10 Jan 2010 12:00:42 +0000 (UTC)
commit c7b3955699fea03c766a8f79f20e52f04ff6adf7
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Sun Jan 10 03:07:36 2010 +0100
favorites: Implement configuration storage protocol
kupfer/plugin/favorites.py | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/kupfer/plugin/favorites.py b/kupfer/plugin/favorites.py
index 5ea9ef1..d49e312 100644
--- a/kupfer/plugin/favorites.py
+++ b/kupfer/plugin/favorites.py
@@ -2,7 +2,6 @@ import collections
import weakref
from kupfer.objects import Leaf, Source, Action
-from kupfer.obj.helplib import PicklingHelperMixin
from kupfer import utils, objects, pretty
from kupfer import puid
@@ -20,24 +19,22 @@ def _FavoritesLeafTypes():
"""reasonable pickleable types"""
yield Leaf
-class FavoritesSource (Source, PicklingHelperMixin):
+class FavoritesSource (Source):
"""Keep a list of Leaves that the User may add and remove from"""
instance = None
def __init__(self):
Source.__init__(self, _("Favorites"))
- self._version = 2
self.references = []
- self.unpickle_finish()
- def pickle_prepare(self):
- self.mark_for_update()
- self.references = [puid.get_unique_id(F) for F in self.favorites]
- self.favorites = []
- self.reference_table = None
- self.persist_table = None
+ def config_save(self):
+ references = [puid.get_unique_id(F) for F in self.favorites]
+ return {"favorites": references, "version": self.version}
+
+ def config_save_name(self):
+ return __name__
- def unpickle_finish(self):
- pass
+ def config_restore(self, state):
+ self.references = state["favorites"]
def _lookup_item(self, id_):
itm = puid.resolve_unique_id(id_, excluding=self)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]