Commit Graph

20 Commits

Author SHA1 Message Date
Bryan Schumaker
5199a26006 libsaria: Remove old preferences code
I don't need it anymore with the new code.
2011-05-01 12:46:16 -04:00
Bryan Schumaker
47f33a3f8f libsaria: Don't save on preference initialization
When a preference is initially created, it should be set to a default
value.  If it is set to a default value, then we don't need to save it
immediately.  Let's wait until it changes before actually doing a
save...
2011-05-01 11:05:55 -04:00
Bryan Schumaker
802513c726 libsaria: Don't immediately enable preference saving
We shouldn't need to save preferences during startup because at this
point only the initial values have been set.  If nothing is changed,
then nothing needs to be saved and we can save some time.  This should
also prevent any problems caused by crashing during a save.
2011-05-01 11:05:55 -04:00
Bryan Schumaker
aa685005c9 init_pref returns value
When I initialize a preference, the actual value of the preference
should be returned to the caller.
2010-12-03 08:31:03 -05:00
Bryan Schumaker
487e8c39be Move generic saving / loading functions
These belong under path/
2010-12-03 08:31:03 -05:00
Bryan Schumaker
80d91c3b60 Load preference trees
Preference trees should be able to load from disk if associated with a
file.
2010-12-03 08:30:12 -05:00
Bryan Schumaker
0716c7a79c Preference trees
Preference trees are used to store various preferences.  Each component
can have its own set of preferences that use overlapping names.
2010-12-03 08:30:12 -05:00
Bryan Schumaker
f8dd01a54c Tree lookup
Lookup will follow a path and return whatever node it is pointing to.
2010-12-03 08:29:16 -05:00
Bryan Schumaker
2949535aba Val trees walk values
Val trees can walk through their values in addition to their paths.  A
doubly-linked val tree can also walk values backwards.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
fe449ffea4 Value Trees
Value trees store a value in addition to the path.  They come in normal
and doubly-linked flavors.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
5dbbeb7dcb DLFSTrees
Doubly linked filesystem trees are both a doubly linked tree and a
filesystem tree.  They can walk paths backwards.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
ffd38ec9fa Find child id once
Rather than computing the child id for every iteration of walking
backwards, we do it once.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
825a8b8346 Add DLTree()
This patch adds a double-linked tree class for use in storing the
library.  This class can walk backwards from a leaf node when
walk_backwards is called.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
4a33a2f0fd Remove value from tree displaying
Displaying a tree should not use the old tree.value variable.  This
variable doesn't exist anymore.
2010-12-03 08:29:15 -05:00
Bryan Schumaker
5e6cd3c26a FSTree() correct insert
Correctly insert a split path into a FSTree()
2010-12-03 08:29:15 -05:00
Bryan Schumaker
c87a696e21 Tree() length
I made Tree().__len__() to use for finding the number of leafs that
exist on a tree.
2010-12-03 08:29:14 -05:00
Bryan Schumaker
1f1cbe1b34 FSTrees shouldn't have a value
If a Tree() doesn't have a value, then the FSTree() shouldn't either...
2010-12-03 08:29:14 -05:00
Bryan Schumaker
3598de0b72 Trees don't have values
Trees don't actually need a value.  I can make a subclass later if I
find it's important.
2010-12-03 08:29:14 -05:00
Bryan Schumaker
d5231e9db1 FSTree()
FSTree() is a tree representing paths in a filesystem.  It has functions
for inserting paths and returning the paths it is storing.  A path is a
UNIX path: "/home/bjschuma" is the path to my home directory.
2010-12-03 08:29:14 -05:00
Bryan Schumaker
8ca67cd4c7 Libsaria trees
libsaria.path.make_tree(path) will return a tree rooted at path
2010-12-03 08:29:13 -05:00