Changeset 631


Ignore:
Timestamp:
Mar 7, 2004, 7:54:20 AM (16 years ago)
Author:
gb
Message:

Only synch if we added a new key.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/examples/cocoa-defaults.lisp

    r617 r631  
    7171   
    7272(defun update-cocoa-defaults ()
    73   (let* ((domain (send (@class "NSUserDefaults") 'standard-user-defaults)))
     73  (let* ((domain (send (@class "NSUserDefaults") 'standard-user-defaults))
     74         (need-synch nil))
    7475    (dolist (d (cocoa-defaults))
    7576      (let* ((name (cocoa-default-symbol d))
    7677             (key (objc-constant-string-nsstringptr (cocoa-default-string d))))
    7778        (if (%null-ptr-p (send domain :object-for-key key))
    78           (send domain
    79                 :set-object (%make-nsstring (format nil "~a" (cocoa-default-value d)))
    80                 :for-key key)
     79          (progn
     80            (send domain
     81                  :set-object (%make-nsstring (format nil "~a" (cocoa-default-value d)))
     82                  :for-key key)
     83            (setq need-synch t))
    8184          (case (cocoa-default-type d)
    8285            (:int
     
    8891               (unless (%null-ptr-p nsstring)
    8992                 (set name (lisp-string-from-nsstring nsstring)))))))))
    90     (send domain 'synchronize)
    91     (send domain 'dictionary-representation)))
     93    (when need-synch (send domain 'synchronize))))
    9294
    9395
Note: See TracChangeset for help on using the changeset viewer.