[squeak-dev] Re: The Trunk: System-mha.167.mcz

Andreas Raab andreas.raab at gmx.de
Wed Nov 18 04:25:13 UTC 2009


Michael Haupt wrote:
> On the other hand, there is now a preference to toggle displaying a
> menu item for updating from the server at the top level of the World
> menu, just above all the Save and Quit items.

Two comments on that: First, preferences are a bane. The update menu 
should be either in one place or another, but not depending on 
preference, day of the week, or phase of the moon ;-) (personally I 
think we should redo the entire desktop menu but that's just me)

Secondly, instead of continuing to create new dependencies to 
Preferences which are hard to initialize, maintain and remove, you might 
want to use a pragma instead. To do this, add a class var (say 
IncludeUpdateInHelpMenu) and then these two methods:

TheWorldMenuClass>>includeUpdateInHelpMenu
     <preference: 'Update menu in Help'
       category: 'morphic'
       description: 'Governs whether the update button is shown in the 
help menu'
       type: #Boolean>
     ^IncludeUpdateInHelpMenu ifNil:[false] "or true"

TheWorldMenuClass>>includeUpdateInHelpMenu: aBoolean
    "Preference setter"
     IncludeUpdateInHelpMenu := aBoolean

Voila, the pain of creating, initializing removing preferences is gone. 
You can find other examples by browsing the senders of 
preference:category:description:type:

Cheers,
   - Andreas



More information about the Squeak-dev mailing list