[Slim-Checkins] r11755 - in /trunk/server/Slim/Utils/Prefs: Base.pm Namespace.pm
adrian at svn.slimdevices.com
adrian at svn.slimdevices.com
Thu Apr 12 14:17:01 PDT 2007
Author: adrian
Date: Thu Apr 12 14:17:01 2007
New Revision: 11755
URL: http://svn.slimdevices.com?rev=11755&view=rev
Log:
Bug: N/A
Description: only execute on change function on a probable change, add
predefined prefs validator for files and directories
Modified:
trunk/server/Slim/Utils/Prefs/Base.pm
trunk/server/Slim/Utils/Prefs/Namespace.pm
Modified: trunk/server/Slim/Utils/Prefs/Base.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Prefs/Base.pm?rev=11755&r1=11754&r2=11755&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Prefs/Base.pm (original)
+++ trunk/server/Slim/Utils/Prefs/Base.pm Thu Apr 12 14:17:01 2007
@@ -86,7 +86,10 @@
$root->save;
- if ($change) {
+ if ($change && (!defined $old || !defined $new || $old ne $new || ref $new)) {
+
+ $log->debug("excuting on change function");
+
$change->($pref, $new, $class->_obj);
}
Modified: trunk/server/Slim/Utils/Prefs/Namespace.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Prefs/Namespace.pm?rev=11755&r1=11754&r2=11755&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Prefs/Namespace.pm (original)
+++ trunk/server/Slim/Utils/Prefs/Namespace.pm Thu Apr 12 14:17:01 2007
@@ -42,6 +42,8 @@
'hash' => sub { ref $_[1] eq 'HASH' },
'defined' => sub { defined $_[1] },
'false' => sub { 0 },
+ 'file' => sub { -e $_[1] },
+ 'dir' => sub { -d $_[1] },
};
sub new {
@@ -83,7 +85,7 @@
Associates a validator function with the preferences listed by list.
-$args may either be one of the following: 'int', 'num', 'array', 'hash', 'defined', 'false'
+$args may either be one of the following: 'int', 'num', 'array', 'hash', 'defined', 'false', 'file', 'dir'
or a hash containing the key 'validator' which specifies either 'intlimit' or 'numlimit' of a callback function.
More information about the checkins
mailing list