A thousand cuts..
[jamaendo] / jamaui / settings.py
index 5820310..f141c69 100644 (file)
@@ -1,6 +1,31 @@
+#!/usr/bin/env python
+#
+# This file is part of Jamaendo.
+# Copyright (c) 2010 Kristoffer Gronlund
+#
+# Jamaendo is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Jamaendo is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Jamaendo.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Player code heavily based on http://thpinfo.com/2008/panucci/:
+#  A resuming media player for Podcasts and Audiobooks
+#  Copyright (c) 2008-05-26 Thomas Perl <thpinfo.com>
+#  (based on http://pygstdocs.berlios.de/pygst-tutorial/seeking.html)
+#
 import cPickle, os
 import logging
 
+from postoffice import postoffice
+
 VERSION = 1
 log = logging.getLogger(__name__)
 
@@ -12,10 +37,15 @@ class Settings(object):
         }
 
     def __init__(self):
-        self.__savename = "/tmp/jaemendo_uisettings"
+        self.__savename = "/tmp/jamaendo_uisettings"
         for k,v in self.defaults.iteritems():
             setattr(self, k, v)
 
+    def __setattr__(self, key, value):
+        object.__setattr__(self, key, value)
+        if key in self.defaults.keys():
+            postoffice.notify('settings-changed', key, value)
+
     def set_filename(self, savename):
         self.__savename = savename