Autodocs Libraries:
workbench.library AddAppIconA AddAppMenuItemA AddAppWindowA AddAppWindowDropZoneA ChangeWorkbenchSelectionA CloseWorkbenchObjectA MakeWorkbenchObjectVisibleA OpenWorkbenchObjectA RemoveAppIcon RemoveAppMenuItem RemoveAppWindow RemoveAppWindowDropZone UpdateWorkbench WBInfo WorkbenchControlA Include GuruMeditation
|
Docs » Autodocs » workbench.library » UpdateWorkbench
UpdateWorkbench - Tell Workbench of a new or deleted icon. (V37)
UpdateWorkbench(name, parentlock, action) A0 A1 D0 VOID UpdateWorkbench(char *, BPTR, LONG);
This function does the "magic" of letting Workbench know that an object has been added, changed, or removed. The name is the name of the object, the lock is a lock on the directory that contains the object. The action determines what has happened. If UPDATEWB_ObjectAdded, the object is either NEW or has CHANGED. If UPDATEWB_ObjectRemoved, the object has been deleted.
name - Name of the object (without the .info) parentlock - Lock on the object's parent directory. action - UPDATEWB_ObjectAdded for a new or changed object UPDATEWB_ObjectRemoved for a deleted object
Workbench will update its display, if needed. An object that has been deleted will be removed from the display. An object that is new will be added to the respective display if it is not already there; if it is already there, its appearance will be changed if necessary.
/* Remove the object named "Prefs" from the SYS: drawer display; * note that this will affect only the display, the drawer will * still remain on the file system, and telling Workbench to * rescan the drawer will reveal it again. */ BPTR lock,old_dir; lock = Lock("SYS:",SHARED_LOCK); UpdateWorkbench("Prefs",lock,UPDATEWB_ObjectRemoved); UnLock(lock); /* Change the name of the file "RAM:Thursday" * to "Friday"; this works by first removing the * object from the display, renaming the object * and then telling Workbench that the object has * changed. */ lock = Lock("RAM:",SHARED_LOCK); UpdateWorkbench("Thursday",lock,UPDATEWB_ObjectRemoved); old_dir = CurrentDir(lock); Rename("Thursday","Friday"); CurrentDir(old_dir); UpdateWorkbench("Friday",lock,UPDATEWB_ObjectAdded); UnLock(lock);
Note that saying that a DISK icon has been deleted will not do much as disk icons must continue to be visible. Thus, this is currently a NO-OP. At some future date (maybe) it will change the disk icon to the default.
icon.library/PutDiskObject(), icon.library/DeleteDiskObject()
|