a1200   NEWS   APPS   DOCS   ABOUT
a1200
----
a1200
----
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

NAME

	UpdateWorkbench - Tell Workbench of a new or deleted icon.       (V37)

SYNOPSIS

	UpdateWorkbench(name, parentlock, action)
A0 A1 D0
VOID UpdateWorkbench(char *, BPTR, LONG);

FUNCTION

	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.

INPUTS

	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

RESULT

	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.

EXAMPLE

	/* 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);

NOTES

	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.

SEE ALSO

icon.library/PutDiskObject(), icon.library/DeleteDiskObject()

Comments

Name:
E-mail: Use this if you want a message if you get a response, will not be shown.
Comment:
Select correct short for:

Andromeda

RBS
AOA
ANA
FC

Comments:

$VER: d0.se 1.14 Copyright © 2011-2024 Tobias Geijersson support at d0 dot se