[comp.sys.mac.programmer] Saving user preferences

gil@ginger.sri.com (Gil Porat) (11/10/89)

What is a clean and user-transparent scheme for storing an
application's user settable preferences (e.g. English vs Metric)?

The one that readily comes to mind is a file that the
application reads in when launched, and writes out when
modified.

This scheme doesn't seem that user-transparent because
the preferences file usually manifests itself as an icon.
The user might accidentally delete it, rename it, etc...

Gil Porat
gil@rml.sri.com

oster@dewey.soe.berkeley.edu (David Phillip Oster) (11/12/89)

In the first place, the application shouldn't need to ask the user to
choose between English & Metric units, the applicatiuon should pick it up
from the system, and the system should already be localized to the right
units.

In the second place, so what if the user deletes the preferences file?
That just means he gets the default preferences.

Apple recommends you use "Stationery" files. The are like ordinary
documents, but when you double click on one, you get an "untitled" file
that prompts you to Save As the first time you go to save. The user puts
their favorite stationery out on the desk top, and never double clicks on
the application itself.  There is a tech note on all this.

ken@jose.uucp (Ken MacLeod) (11/17/89)

In article <5542@unix.SRI.COM>, gil@ginger.sri.com (Gil Porat) writes:
>What is a clean and user-transparent scheme for storing an
>application's user settable preferences (e.g. English vs Metric)?

  One is a "Notepad" which is a pseudo-document (and the icon is marked by
the lower-left corner folded up, instead of the upper-right folded down).
The only difference between a notepad and a document, to the user, is that
the document opens up "Unnamed" and must be "Save as..."'d.  This allows
for templates, "type of document" preferences, etc., and keeps the
preferences in each document.

  I believe I heard mumblings somewhere that multifinder, a newer finder,
or a "pseudo-application" (to go with the pseudo-docs :-) was created
to handle notepads entirely outside of applications.  A real document
can be taken and marked as a "notepad created by NotePad-App", NotePad-App
is launched when the icon is double-clicked, it asks for a new name, copies
the notepad to the new name, marks the new file back to the original doc
type, and launchs the real app with the new file.  Consistent to the user
and transparent _to_you_! :-)

>This scheme doesn't seem that user-transparent because
>the preferences file usually manifests itself as an icon.
>The user might accidentally delete it, rename it, etc...

  Then again, they might do it purposely, "That's a feature."  It enables
one to have different sets of preferences for different purposes (I'll use
metric when doing things for A, but English for B) by merely changing file
names and to purposely delete them in a manner _consistent_ with the rest
of the Mac.  You could put an explicit rename-, pick- and clear-
preferences menu items, but why clutter up your application menus with
something the finder already handles well?

  I highly recommend notepads, store the preferences in each document.
If the "preferences" are somewhat large, like macros, functions (as in
callable macros, not necessarily compiled C, of course :-), style/template
definitions, etc., then the document can contain the name of the notepad
(or path if we've "Save as..."'d in into another folder).  If you can't
find the notepad immediately upon opening, throw up an "Open..." dialog:
"I can't find notepad XXX, please locate it", like HyperCard does when it
can't find a stack.