Am I missing anything, or can most of this be driven into #startUp methods?:
SmalltalkImage >> setPlatformPreferences "Set some platform specific preferences on system startup" | platform specs | Preferences automaticPlatformSettings ifFalse:[^self]. SoundPlayer soundQuickStart: SoundPlayer defaultQuickStartForPlatform. SoundPlayer stopSoundWhenDone: SoundPlayer defaultStopSoundForPlatform. platform := self platformName. specs := #(). platform = 'Win32' ifTrue:[ specs := #()]. platform = 'Mac OS' ifTrue:[ specs := #()]. specs do:[:tuple| Preferences setPreference: tuple first toValue: (tuple last == true). ]. In particular, it looks like SoundPlayer >> #startUp would be a good place to put Preferences automaticPlatformSettings ifTrue: [ SoundPlayer soundQuickStart: SoundPlayer defaultQuickStartForPlatform. SoundPlayer stopSoundWhenDone: SoundPlayer defaultStopSoundForPlatform]. The rest of #setPlatformPreferences is a giant no-op, but it's a giant no-op that shows the structure one would need to follow if we needed per-platform specs, at least. (Although my strong preference would still be to drive this kind've stuff into packages' #startUp methods.) frank |
FWIW, here's what it used to do
setPlatformPreferences "Set some platform specific preferences on system startup" | platform specs | Preferences automaticPlatformSettings ifFalse:[^self]. platform _ self platformName. specs _ #( (soundStopWhenDone false) (soundQuickStart false) ). platform = 'Win32' ifTrue:[ specs _ #( (soundStopWhenDone true) (soundQuickStart false) )]. platform = 'Mac OS' ifTrue:[ specs _ #( (soundStopWhenDone false) (soundQuickStart true) )]. specs do:[:tuple| Preferences setPreference: tuple first toValue: (tuple last == #true). ]. Cheers, Bob On 9/29/13 7:15 AM, Frank Shearar
wrote:
Am I missing anything, or can most of this be driven into #startUp methods?: SmalltalkImage >> setPlatformPreferences "Set some platform specific preferences on system startup" | platform specs | Preferences automaticPlatformSettings ifFalse:[^self]. SoundPlayer soundQuickStart: SoundPlayer defaultQuickStartForPlatform. SoundPlayer stopSoundWhenDone: SoundPlayer defaultStopSoundForPlatform. platform := self platformName. specs := #(). platform = 'Win32' ifTrue:[ specs := #()]. platform = 'Mac OS' ifTrue:[ specs := #()]. specs do:[:tuple| Preferences setPreference: tuple first toValue: (tuple last == true). ]. In particular, it looks like SoundPlayer >> #startUp would be a good place to put Preferences automaticPlatformSettings ifTrue: [ SoundPlayer soundQuickStart: SoundPlayer defaultQuickStartForPlatform. SoundPlayer stopSoundWhenDone: SoundPlayer defaultStopSoundForPlatform]. The rest of #setPlatformPreferences is a giant no-op, but it's a giant no-op that shows the structure one would need to follow if we needed per-platform specs, at least. (Although my strong preference would still be to drive this kind've stuff into packages' #startUp methods.) frank |
Thanks. That certainly explains why the current version has a giant no-op.
I like that SoundPlayer's responsible for sound-related platform differences. I just don't think that SmalltalkImage is the right place for setting the preferences. SoundPlayer is. Both because, well, they're sound preferences, but also because SmalltalkImage is a much lower level thing than SoundPlayer. If it knows anything about higher level things, it should know them only as some abstract thing that needs starting. And we have that, if I understand correctly, in the set of #startUp implementations. Unless I've missed something, which is entirely possible. frank On 29 September 2013 12:31, Bob Arning <[hidden email]> wrote: > FWIW, here's what it used to do > > > setPlatformPreferences > "Set some platform specific preferences on system startup" > | platform specs | > Preferences automaticPlatformSettings ifFalse:[^self]. > platform _ self platformName. > specs _ #( > (soundStopWhenDone false) > (soundQuickStart false) > > ). > platform = 'Win32' ifTrue:[ > specs _ #( > (soundStopWhenDone true) > (soundQuickStart false) > > )]. > platform = 'Mac OS' ifTrue:[ > specs _ #( > (soundStopWhenDone false) > (soundQuickStart true) > > )]. > specs do:[:tuple| > Preferences setPreference: tuple first toValue: (tuple last == > #true). > ]. > > > Cheers, > Bob > > On 9/29/13 7:15 AM, Frank Shearar wrote: > > Am I missing anything, or can most of this be driven into #startUp methods?: > > SmalltalkImage >> setPlatformPreferences > "Set some platform specific preferences on system startup" > | platform specs | > Preferences automaticPlatformSettings ifFalse:[^self]. > SoundPlayer soundQuickStart: SoundPlayer defaultQuickStartForPlatform. > SoundPlayer stopSoundWhenDone: SoundPlayer defaultStopSoundForPlatform. > platform := self platformName. > specs := #(). > platform = 'Win32' ifTrue:[ > specs := #()]. > platform = 'Mac OS' ifTrue:[ > specs := #()]. > specs do:[:tuple| > Preferences setPreference: tuple first toValue: (tuple last == > true). > ]. > > In particular, it looks like SoundPlayer >> #startUp would be a good > place to put > > Preferences automaticPlatformSettings ifTrue: [ > SoundPlayer soundQuickStart: SoundPlayer defaultQuickStartForPlatform. > SoundPlayer stopSoundWhenDone: SoundPlayer defaultStopSoundForPlatform]. > > The rest of #setPlatformPreferences is a giant no-op, but it's a giant > no-op that shows the structure one would need to follow if we needed > per-platform specs, at least. (Although my strong preference would > still be to drive this kind've stuff into packages' #startUp methods.) > > frank > > > > > > |
Free forum by Nabble | Edit this page |