diff --git a/libsaria/sources/__init__.py b/libsaria/sources/__init__.py index f1f621d7..9f6b89d2 100644 --- a/libsaria/sources/__init__.py +++ b/libsaria/sources/__init__.py @@ -8,6 +8,7 @@ call = libsaria.event.call exists = libsaria.path.exists expand = libsaria.path.expand FileRef = tagpy.FileRef +prefs = None import library import playlist @@ -20,11 +21,13 @@ inc_score = library.inc_score inc_count = library.inc_count def init(): - libsaria.init_pref("random", False) + global prefs + prefs = libsaria.prefs2 + prefs.init_pref("libsaria.random", False) libsaria.event.invite("POSTINIT", init) def toggle_rand(): - libsaria.prefs["random"] = not libsaria.prefs["random"] + prefs.set_pref("libsaria.random", not prefs.get_pref("libsaria.random")) cur_lib_id = -1 diff --git a/libsaria/sources/playlist.py b/libsaria/sources/playlist.py index 865b4cda..10ddb3e4 100644 --- a/libsaria/sources/playlist.py +++ b/libsaria/sources/playlist.py @@ -111,7 +111,7 @@ def rand_next(): return id def next(): - if libsaria.prefs["random"] == True: + if libsaria.prefs2.get_pref("libsaria.random") == True: id = rand_next() else: id = seq_next() diff --git a/ocarina/button.py b/ocarina/button.py index 7b8ae44e..db47eb35 100644 --- a/ocarina/button.py +++ b/ocarina/button.py @@ -5,6 +5,7 @@ import image LS = ocarina.libsaria gtk = ocarina.gtk prefs = LS.prefs +prefs2 = LS.prefs2 class Button(gtk.Button): @@ -115,7 +116,7 @@ class RandomButton(gtk.ToggleButton): img = gtk.image_new_from_file("images/random.png") img.show() self.add(img) - self.set_active(prefs["random"]) + self.set_active(prefs2.get_pref("libsaria.random")) self.set_relief(gtk.RELIEF_NONE) self.connect("toggled", self.toggle) self.show()