Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / system / Wanderer / Classes / iconvolumelist.c
blobe629ca6be6d15a28eabe1103fb9cc500aa79cf91
1 /*
2 Copyright 2002-2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #ifndef __AROS__
7 #include "../portable_macros.h"
8 #define WANDERER_BUILTIN_ICONVOLUMELIST 1
9 #else
10 #define DEBUG 0
11 #include <aros/debug.h>
12 #endif
14 #define DEBUG_ILC_EVENTS
15 #define DEBUG_ILC_KEYEVENTS
16 #define DEBUG_ILC_ICONRENDERING
17 #define DEBUG_ILC_ICONSORTING
18 #define DEBUG_ILC_ICONSORTING_DUMP
19 #define DEBUG_ILC_ICONPOSITIONING
20 #define DEBUG_ILC_LASSO
21 #define DEBUG_ILC_MEMALLOC
23 #include <string.h>
24 #include <stdlib.h>
25 #include <stdio.h>
26 #include <string.h>
27 #include <math.h>
29 #include <dos/dos.h>
30 #include <dos/datetime.h>
31 #include <dos/filehandler.h>
33 #include <exec/memory.h>
34 #include <graphics/gfx.h>
35 #include <graphics/view.h>
36 #include <graphics/rpattr.h>
37 #include <workbench/icon.h>
38 #include <workbench/workbench.h>
40 #ifdef __AROS__
41 #include <devices/rawkeycodes.h>
42 #include <clib/alib_protos.h>
43 #endif
45 #include <proto/exec.h>
46 #include <proto/graphics.h>
47 #include <proto/utility.h>
48 #include <proto/dos.h>
49 #include <proto/icon.h>
50 #include <proto/layers.h>
51 #include <proto/dos.h>
52 #include <proto/iffparse.h>
54 #ifdef __AROS__
55 #include <prefs/prefhdr.h>
56 #include <prefs/wanderer.h>
57 #else
58 #include <prefs_AROS/prefhdr.h>
59 #include <prefs_AROS/wanderer.h>
60 #endif
62 #include <proto/cybergraphics.h>
64 #ifdef __AROS__
65 #include <cybergraphx/cybergraphics.h>
66 #else
67 #include <cybergraphx_AROS/cybergraphics.h>
68 #endif
71 #if defined(__AMIGA__) && !defined(__PPC__)
72 #define NO_INLINE_STDARG
73 #endif
74 #include <proto/intuition.h>
75 #include <proto/muimaster.h>
76 #include <libraries/mui.h>
77 //#include "muimaster_intern.h"
78 //#include "support.h"
79 //#include "imspec.h"
80 #include "iconlist_attributes.h"
81 #include "icon_attributes.h"
82 #include "iconlist.h"
83 #include "iconvolumelist_private.h"
85 #ifndef __AROS__
86 #define DEBUG 1
88 #ifdef DEBUG
89 #define D(x) if (DEBUG) x
90 #ifdef __amigaos4__
91 #define bug DebugPrintF
92 #else
93 #define bug kprintf
94 #endif
95 #else
96 #define D(...)
97 #endif
98 #endif
100 extern struct Library *MUIMasterBase;
102 struct DOSVolumeList
104 struct List dvl_List;
105 APTR dvl_Pool;
108 struct DOSVolumeNode
110 struct Node dvn_Node;
111 STRPTR dvn_VolName;
112 STRPTR dvn_DevName;
113 ULONG dvn_Flags;
114 struct MsgPort *dvn_Port;
117 static BOOL VolumeIsOffline(struct DosList *dl)
119 return dl->dol_Task == NULL;
122 ///IconVolumeList__CreateDOSList()
123 static struct DOSVolumeList *IconVolumeList__CreateDOSList(void)
125 APTR pool = NULL;
126 struct DosList *dl = NULL;
127 struct DOSVolumeNode *newdvn = NULL;
128 struct DOSVolumeList *newdvl = NULL;
130 D(bug("[IconVolumeList]: %s()\n", __PRETTY_FUNCTION__));
132 if ((pool = CreatePool(MEMF_PUBLIC | MEMF_CLEAR, 4096, 4096)) != NULL)
134 if ((newdvl =
135 (struct DOSVolumeList *)AllocPooled(pool,
136 sizeof(struct DOSVolumeList))) != NULL)
138 NewList((struct List *)&newdvl->dvl_List);
139 newdvl->dvl_Pool = pool;
141 /* work around to only start scanning dos list after all */
142 /* shared locks are gone, eg. in rom/dos/getdeviceproc.c RunHandler */
143 dl = LockDosList(LDF_VOLUMES | LDF_WRITE);
144 while ((dl = NextDosEntry(dl, LDF_VOLUMES)))
146 STRPTR vn_VolName;
148 UBYTE *dosname = (UBYTE *) AROS_BSTR_ADDR(dl->dol_Name);
149 LONG len = AROS_BSTR_strlen(dl->dol_Name);
151 D(bug("[IconVolumeList] Found volume %b (length %u)\n",
152 dl->dol_Name, len));
154 if ((vn_VolName = AllocPooled(newdvl->dvl_Pool, len + 2)))
156 vn_VolName[len] = ':';
157 vn_VolName[len + 1] = 0;
158 strncpy(vn_VolName, dosname, len);
160 if ((newdvn =
161 AllocPooled(newdvl->dvl_Pool,
162 sizeof(struct DOSVolumeNode))))
164 newdvn->dvn_VolName = vn_VolName;
165 D(bug
166 ("[IconVolumeList] Registering Volume '%s' @ %p, Type %d, Port 0x%p\n",
167 newdvn->dvn_VolName, dl, dl->dol_Type,
168 dl->dol_Task));
170 newdvn->dvn_Port = dl->dol_Task;
172 if (VolumeIsOffline(dl))
174 D(bug
175 ("[IconVolumeList] %s: Volume '%s' is OFFLINE\n",
176 __PRETTY_FUNCTION__,
177 newdvn->dvn_VolName));
178 newdvn->dvn_Flags |=
179 (ICONENTRY_VOL_OFFLINE |
180 ICONENTRY_VOL_DISABLED);
182 #if DEBUG
183 if (dl->dol_misc.dol_handler.dol_Startup)
185 struct FileSysStartupMsg *thisfs_SM =
186 BADDR(dl->dol_misc.dol_handler.dol_Startup);
188 bug("[IconVolumeList] %s: Startup msg @ 0x%p\n",
189 __PRETTY_FUNCTION__, thisfs_SM);
190 bug("[IconVolumeList] %s: Startup Device @ %p, Unit %d\n", __PRETTY_FUNCTION__, thisfs_SM->fssm_Device, thisfs_SM->fssm_Unit);
193 if (dl->dol_Task != NULL)
194 bug("[IconVolumeList] %s: Packet Style device\n", __PRETTY_FUNCTION__);
195 else
196 bug("[IconVolumeList] %s: Unknown device type\n", __PRETTY_FUNCTION__);
197 #endif
198 AddTail((struct List *)&newdvl->dvl_List,
199 (struct Node *)&newdvn->dvn_Node);
203 D(bug("[IconVolumeList] Finished registering volumes\n"));
204 UnLockDosList(LDF_VOLUMES | LDF_WRITE);
206 dl = LockDosList(LDF_DEVICES | LDF_READ);
207 while ((dl = NextDosEntry(dl, LDF_DEVICES)))
209 struct DOSVolumeNode *dvn = NULL;
210 char *nd_nambuf = NULL;
211 struct InfoData *nd_paramblock = NULL;
213 UBYTE *dosname = (UBYTE *) AROS_BSTR_ADDR(dl->dol_Name);
214 LONG len = AROS_BSTR_strlen(dl->dol_Name);
216 D(bug
217 ("[IconVolumeList] %s: Checking Device '%s' @ %p (Device ",
218 __PRETTY_FUNCTION__, dosname, dl));
220 if (dl->dol_Task == NULL)
222 D(bug("[IconVolumeList] %s: '%s' : handler inactive!\n",
223 __PRETTY_FUNCTION__, dosname));
224 continue;
227 if ((nd_nambuf =
228 AllocPooled(newdvl->dvl_Pool, len + 2)) != NULL)
230 strncpy(nd_nambuf, dosname, len);
231 nd_nambuf[len] = ':';
232 nd_nambuf[len + 1] = 0;
234 if (!IsFileSystem(nd_nambuf))
236 FreePooled(newdvl->dvl_Pool, nd_nambuf, len + 2);
237 continue;
240 if ((nd_paramblock =
241 AllocMem(sizeof(struct InfoData),
242 MEMF_CLEAR | MEMF_PUBLIC)) != NULL)
245 if (!DoPkt(dl->dol_Task, ACTION_DISK_INFO,
246 (SIPTR) MKBADDR(nd_paramblock),
247 (SIPTR) BNULL, (SIPTR) BNULL,
248 (SIPTR) BNULL, (SIPTR) BNULL))
250 FreeMem(nd_paramblock,
251 sizeof(struct InfoData));
252 nd_paramblock = NULL;
256 else
258 D(bug
259 ("[IconVolumeList] %s: Failed to allocate InfoData storage\n",
260 __PRETTY_FUNCTION__, nd_nambuf));
263 D(bug
264 ("[IconVolumeList] %s: '%s' : Checking for Attached Volumes ... \n",
265 __PRETTY_FUNCTION__, dosname));
266 /* Find the Volume attached to this device */
267 BOOL found = FALSE;
268 dvn =
269 (struct DOSVolumeNode *)GetHead((struct List
270 *)&newdvl->dvl_List);
271 while ((dvn))
273 BOOL volfound;
275 /* For packet handlers it's enough to compare MsgPort */
276 volfound = dvn->dvn_Port == dl->dol_Task;
278 if (volfound)
280 if (!(dvn->dvn_Flags & ICONENTRY_VOL_OFFLINE))
282 if ((nd_paramblock)
283 && (nd_paramblock->id_DiskType !=
284 ID_NO_DISK_PRESENT))
286 STRPTR nd_namext;
287 int nd_namext_len = 0;
289 D(bug
290 ("[IconVolumeList] %s: '%s' : Device unit %d, state = %x, Vol node @ %p\n",
291 __PRETTY_FUNCTION__, nd_nambuf,
292 nd_paramblock->id_UnitNumber,
293 nd_paramblock->id_DiskState,
294 BADDR
295 (nd_paramblock->id_VolumeNode)));
297 found = TRUE;
298 dvn->dvn_Flags &=
299 ~(ICONENTRY_VOL_OFFLINE |
300 ICONENTRY_VOL_DISABLED);
302 switch (nd_paramblock->id_DiskState)
304 case ID_VALIDATING:
305 D(bug
306 ("[IconVolumeList] %s: '%s' : Validating\n",
307 __PRETTY_FUNCTION__,
308 nd_nambuf));
310 nd_namext = "BUSY";
311 nd_namext_len = 4;
312 break;
314 case ID_WRITE_PROTECTED:
315 D(bug
316 ("[IconVolumeList] %s: '%s' : Volume is WRITE-PROTECTED\n",
317 __PRETTY_FUNCTION__,
318 nd_nambuf));
320 dvn->dvn_Flags |=
321 ICONENTRY_VOL_READONLY;
322 break;
325 if (nd_namext_len > 0)
327 char *newVolName =
328 AllocPooled(newdvl->dvl_Pool,
329 strlen(dvn->dvn_VolName) +
330 nd_namext_len + 2);
332 if (newVolName)
334 sprintf(newVolName, "%s%s",
335 dvn->dvn_VolName,
336 nd_namext);
337 dvn->dvn_VolName = newVolName;
341 else
343 D(bug
344 ("[IconVolumeList] %s: '%s' : No Media Inserted (error state?)\n",
345 __PRETTY_FUNCTION__,
346 nd_nambuf));
349 dvn->dvn_DevName = nd_nambuf;
350 D(bug
351 ("[IconVolumeList] %s: DeviceName set to '%s' for '%s'\n",
352 __PRETTY_FUNCTION__,
353 dvn->dvn_DevName,
354 dvn->dvn_VolName));
356 else
358 D(bug
359 ("[IconVolumeList] '%s' : Volume is offline... skipping\n",
360 nd_nambuf));
363 dvn = (struct DOSVolumeNode *)GetSucc(dvn);
364 } /* dvn */
366 if (!(found))
368 D(bug
369 ("[IconVolumeList] %s: '%s' : Couldn't find an associated Volume\n",
370 __PRETTY_FUNCTION__, nd_nambuf));
371 if ((nd_paramblock)
372 && (nd_paramblock->id_DiskType !=
373 ID_NO_DISK_PRESENT))
375 if ((newdvn =
376 (struct DOSVolumeNode
377 *)AllocPooled(newdvl->dvl_Pool,
378 sizeof(struct DOSVolumeNode))))
380 STRPTR nd_namext;
381 int nd_namext_len = 0;
383 switch (nd_paramblock->id_DiskType)
385 /*case ID_BUSY_DISK:
386 nd_namext = "BUSY";
387 nd_namext_len = 4;
388 break; */
389 case ID_UNREADABLE_DISK:
390 nd_namext = "BAD";
391 nd_namext_len = 3;
392 break;
393 case ID_NOT_REALLY_DOS:
394 nd_namext = "NDOS";
395 nd_namext_len = 4;
396 break;
397 case ID_KICKSTART_DISK:
398 nd_namext = "KICK";
399 nd_namext_len = 4;
400 break;
401 default:
402 nd_namext = "BUSY";
403 nd_namext_len = 4;
404 D(bug
405 ("[IconVolumeList] %s: '%s' : disk type 0x%lx\n",
406 __PRETTY_FUNCTION__, nd_nambuf,
407 nd_paramblock->id_DiskType));
408 break;
410 if (nd_namext_len > 0)
412 if ((newdvn->dvn_VolName =
413 AllocPooled(newdvl->dvl_Pool,
414 strlen(nd_nambuf) +
415 nd_namext_len + 2)) != NULL)
417 sprintf(newdvn->dvn_VolName, "%s%s",
418 nd_nambuf, nd_namext);
419 newdvn->dvn_DevName = nd_nambuf;
420 newdvn->dvn_Flags |=
421 ICONENTRY_VOL_DISABLED;
422 AddTail((struct List *)
423 &newdvl->dvl_List,
424 (struct Node *)
425 &newdvn->dvn_Node);
428 #if 0
429 else
431 D(bug
432 ("[IconVolumeList] %s: '%s' : Unknown Condition?\n",
433 __PRETTY_FUNCTION__,
434 nd_nambuf));
436 #endif
441 if (nd_paramblock)
442 FreeMem(nd_paramblock, sizeof(struct InfoData));
445 UnLockDosList(LDF_DEVICES | LDF_READ);
447 return newdvl;
449 DeletePool(pool);
451 return NULL;
456 ///IconVolumeList__DestroyDOSList()
457 static void IconVolumeList__DestroyDOSList(struct DOSVolumeList *dvl)
459 D(bug("[IconVolumeList]: %s()\n", __PRETTY_FUNCTION__));
460 if (dvl && dvl->dvl_Pool)
461 DeletePool(dvl->dvl_Pool);
465 /* sba: End SimpleFind3 */
467 ///OM_NEW()
468 /**************************************************************************
469 OM_NEW
470 **************************************************************************/
471 IPTR IconVolumeList__OM_NEW(struct IClass *CLASS, Object * obj,
472 struct opSet *message)
474 #if 0 /* unused */
475 struct IconDrawerList_DATA *data = NULL;
476 #endif
477 // struct TagItem *tag = NULL,
478 // *tags = NULL;
480 D(bug("[IconVolumeList]: %s()\n", __PRETTY_FUNCTION__));
482 obj = (Object *) DoSuperNewTags(CLASS, obj, NULL,
483 TAG_MORE, (IPTR) message->ops_AttrList);
485 if (!obj)
486 return FALSE;
488 SET(obj, MUIA_IconList_DisplayFlags,
489 (ICONLIST_DISP_VERTICAL | ICONLIST_DISP_MODEDEFAULT));
490 SET(obj, MUIA_IconList_SortFlags, MUIV_IconList_Sort_ByName);
492 D(bug("[IconVolumeList] obj @ %p\n", obj));
493 return (IPTR) obj;
498 static struct IconEntry *FindIconlistVolumeIcon(struct List *iconlist,
499 char *icondevname, char *iconvolname)
501 struct IconEntry *foundEntry = NULL;
503 /* First look for icons representing offline volumes which match the volume name */
504 ForeachNode(iconlist, foundEntry)
506 if ((foundEntry->ie_IconListEntry.type == ST_ROOT)
507 && (_volpriv(foundEntry)->vip_FLags & ICONENTRY_VOL_OFFLINE)
508 && (strcasecmp(foundEntry->ie_IconListEntry.label, iconvolname) == 0))
509 return foundEntry;
512 /* Then, match on device name */
513 ForeachNode(iconlist, foundEntry)
515 if ((foundEntry->ie_IconListEntry.type == ST_ROOT)
516 && (((strcasecmp(foundEntry->ie_IconNode.ln_Name, icondevname)) == 0)
517 || ((strcasecmp(foundEntry->ie_IconListEntry.label, icondevname)) == 0)))
518 return foundEntry;
520 return NULL;
523 ///MUIM_IconList_Update()
524 /**************************************************************************
525 MUIM_IconList_Update
526 **************************************************************************/
527 IPTR IconVolumeList__MUIM_IconList_Update(struct IClass * CLASS,
528 Object * obj, struct MUIP_IconList_Update * message)
530 //struct IconVolumeList_DATA *data = INST_DATA(CLASS, obj);
531 struct IconEntry *this_Icon = NULL;
532 struct DOSVolumeList *dvl = NULL;
533 struct DOSVolumeNode *dvn = NULL;
534 char *devname = NULL;
535 struct List *iconlist = NULL;
536 struct List newiconlist;
537 struct Node *tmpNode = NULL;
539 D(bug("[IconVolumeList]: %s()\n", __PRETTY_FUNCTION__));
541 GET(obj, MUIA_Family_List, &iconlist);
543 if (iconlist != NULL)
545 NewList(&newiconlist);
547 if ((dvl = IconVolumeList__CreateDOSList()) != NULL)
549 D(bug("[IconVolumeList] %s: DOSVolumeList @ %p\n",
550 __PRETTY_FUNCTION__, dvl));
552 ForeachNode(dvl, dvn)
554 D(bug("[IconVolumeList] %s: DOSVolumeNode @ %p\n",
555 __PRETTY_FUNCTION__, dvn));
556 if (dvn->dvn_VolName)
558 struct DiskObject *volDOB = NULL;
560 D(bug("[IconVolumeList] %s: DOSList Entry '%s'\n",
561 __PRETTY_FUNCTION__, dvn->dvn_VolName));
563 if (dvn->dvn_Flags & ICONENTRY_VOL_OFFLINE)
564 devname = dvn->dvn_VolName;
565 else
566 devname = dvn->dvn_DevName;
568 D(bug("[IconVolumeList] %s: Processing '%s'\n",
569 __PRETTY_FUNCTION__, devname));
571 if ((this_Icon = FindIconlistVolumeIcon(iconlist, devname, dvn->dvn_VolName)) != NULL)
573 BOOL entrychanged = FALSE;
574 volDOB = this_Icon->ie_DiskObj;
576 Remove((struct Node *)&this_Icon->ie_IconNode);
578 D(bug
579 ("[IconVolumeList] %s: Found existing IconEntry for '%s' @ %p\n",
580 __PRETTY_FUNCTION__,
581 this_Icon->ie_IconListEntry.label,
582 this_Icon));
584 /* Compare the Entry and update as needed ... */
585 if (strcmp(this_Icon->ie_IconListEntry.label,
586 dvn->dvn_VolName) != 0)
587 entrychanged = TRUE;
589 if ((this_Icon->ie_IconListEntry.udata) &&
590 (dvn->dvn_Flags != _volpriv(this_Icon)->vip_FLags))
591 entrychanged = TRUE;
593 if ((dvn->dvn_Flags & ICONENTRY_VOL_DISABLED)
594 && !(volDOB))
596 volDOB = GetIconTags
597 (dvn->dvn_DevName,
598 ICONGETA_FailIfUnavailable, FALSE,
599 ICONGETA_GenerateImageMasks, TRUE,
600 TAG_DONE);
603 if (entrychanged)
605 D(bug("[IconVolumeList] %s: IconEntry changed - updating..\n", __PRETTY_FUNCTION__));
607 _volpriv(this_Icon)->vip_FLags = dvn->dvn_Flags;
609 this_Icon =
610 (struct IconEntry *)DoMethod(obj, MUIM_IconList_UpdateEntry, this_Icon,
611 (IPTR) devname, (IPTR) dvn->dvn_VolName, (IPTR) NULL, volDOB, ST_ROOT);
613 if (this_Icon)
614 AddTail(&newiconlist,
615 (struct Node *)&this_Icon->ie_IconNode);
617 else
619 struct VolumeIcon_Private * volPrivate = AllocMem(sizeof(struct VolumeIcon_Private), MEMF_CLEAR);
620 if (volPrivate) volPrivate->vip_FLags = dvn->dvn_Flags;
622 if (dvn->dvn_Flags & ICONENTRY_VOL_DISABLED)
624 volDOB = GetIconTags
625 (dvn->dvn_DevName,
626 ICONGETA_FailIfUnavailable, FALSE,
627 ICONGETA_GenerateImageMasks, TRUE,
628 TAG_DONE);
631 if ((volPrivate) && ((this_Icon = (struct IconEntry *)DoMethod(obj, MUIM_IconList_CreateEntry,
632 (IPTR) devname, (IPTR) dvn->dvn_VolName, (IPTR) NULL, volDOB,
633 ST_ROOT, volPrivate)) != NULL))
635 D(bug
636 ("[IconVolumeList] %s: Created IconEntry for '%s' @ %p\n",
637 __PRETTY_FUNCTION__,
638 this_Icon->ie_IconListEntry.label,
639 this_Icon));
641 if (!(this_Icon->ie_Flags &
642 ICONENTRY_FLAG_HASICON))
643 this_Icon->ie_Flags |=
644 ICONENTRY_FLAG_HASICON;
646 if ((strcasecmp(dvn->dvn_VolName,
647 "Ram Disk:")) == 0)
649 D(bug
650 ("[IconVolumeList] %s: Setting '%s' entry node priority to 5\n",
651 __PRETTY_FUNCTION__,
652 this_Icon->ie_IconListEntry.label));
653 this_Icon->ie_IconNode.ln_Pri = 5; // Special dirs get Priority 5
655 else
657 this_Icon->ie_IconNode.ln_Pri = 2; // Fixed Media get Priority 2
659 AddTail(&newiconlist,
660 (struct Node *)&this_Icon->ie_IconNode);
663 else
665 ("[IconVolumeList] %s: Failed to Add IconEntry for '%s'\n",
666 __PRETTY_FUNCTION__,
667 dvn->dvn_VolName);)}
668 } /* (dvn->dvn_VolName) */
670 IconVolumeList__DestroyDOSList(dvl);
671 ForeachNodeSafe(iconlist, this_Icon, tmpNode)
673 if (this_Icon->ie_IconListEntry.type == ST_ROOT)
675 D(bug
676 ("[IconVolumeList] %s: Destroying Removed IconEntry for '%s' @ %p\n",
677 __PRETTY_FUNCTION__,
678 this_Icon->ie_IconListEntry.label, this_Icon));
679 Remove((struct Node *)&this_Icon->ie_IconNode);
680 DoMethod(obj, MUIM_IconList_DestroyEntry, this_Icon);
684 D(bug("[IconVolumeList] %s: Updating IconList\n",
685 __PRETTY_FUNCTION__));
686 ForeachNodeSafe(&newiconlist, this_Icon, tmpNode)
688 Remove((struct Node *)&this_Icon->ie_IconNode);
689 DoMethod(obj, MUIM_Family_AddTail,
690 (struct Node *)&this_Icon->ie_IconNode);
694 /* default display/sorting flags */
696 DoSuperMethodA(CLASS, obj, (Msg) message);
698 return 1;
701 IPTR IconVolumeList__MUIM_IconList_UpdateEntry(struct IClass * CLASS,
702 Object * obj, struct MUIP_IconList_UpdateEntry * message)
704 IPTR this_Icon;
706 D(bug("[IconVolumeList]: %s()\n", __PRETTY_FUNCTION__));
708 this_Icon = DoSuperMethodA(CLASS, obj, (Msg) message);
710 return this_Icon;
713 IPTR IconVolumeList__MUIM_IconList_DestroyEntry(struct IClass * CLASS,
714 Object * obj, struct MUIP_IconList_DestroyEntry * message)
716 struct VolumeIcon_Private *volPrivate = NULL;
717 IPTR rv;
719 D(bug("[IconVolumeList]: %s()\n", __PRETTY_FUNCTION__));
721 volPrivate = message->entry->ie_IconListEntry.udata;
723 rv = DoSuperMethodA(CLASS, obj, (Msg) message);
725 if (volPrivate)
726 FreeMem(volPrivate, sizeof(struct VolumeIcon_Private));
728 return rv;
732 ///OM_GET()
733 /**************************************************************************
734 OM_GET
735 **************************************************************************/
736 IPTR IconVolumeList__OM_GET(struct IClass * CLASS, Object * obj,
737 struct opGet * message)
739 #define STORE *(message->opg_Storage)
741 D(bug("[IconVolumeList]: %s()\n", __PRETTY_FUNCTION__));
743 switch (message->opg_AttrID)
745 /* TODO: Get the version/revision from our config.. */
746 case MUIA_Version:
747 STORE = (IPTR) 1;
748 return 1;
749 case MUIA_Revision:
750 STORE = (IPTR) 3;
751 return 1;
754 return DoSuperMethodA(CLASS, obj, (Msg) message);
755 #undef STORE
760 #if WANDERER_BUILTIN_ICONVOLUMELIST
761 BOOPSI_DISPATCHER(IPTR, IconVolumeList_Dispatcher, CLASS, obj, message)
763 #if !defined(__AROS__)
764 struct IClass *CLASS = cl;
765 Msg message = msg;
766 #endif
767 switch (message->MethodID)
769 case OM_NEW:
770 return IconVolumeList__OM_NEW(CLASS, obj, (struct opSet *)message);
771 case OM_GET:
772 return IconVolumeList__OM_GET(CLASS, obj, (struct opGet *)message);
773 case MUIM_IconList_Update:
774 return IconVolumeList__MUIM_IconList_Update(CLASS, obj,
775 (struct MUIP_IconList_Update *)message);
776 case MUIM_IconList_CreateEntry:
777 return IconVolumeList__MUIM_IconList_CreateEntry(CLASS, obj,
778 (APTR) message);
779 case MUIM_IconList_UpdateEntry:
780 return IconVolumeList__MUIM_IconList_UpdateEntry(CLASS, obj,
781 (APTR) message);
782 case MUIM_IconList_DestroyEntry:
783 return IconVolumeList__MUIM_IconList_DestroyEntry(CLASS, obj,
784 (APTR) message);
787 return DoSuperMethodA(CLASS, obj, message);
790 BOOPSI_DISPATCHER_END
791 #if defined(__AROS__)
792 /* Class descriptor. */
793 const struct __MUIBuiltinClass _MUI_IconVolumeList_desc = {
794 MUIC_IconVolumeList,
795 MUIC_IconList,
796 sizeof(struct IconVolumeList_DATA),
797 (void *)IconVolumeList_Dispatcher
799 #endif
800 #else
801 #if !defined(__AROS__)
802 struct MUI_CustomClass *initIconVolumeListClass(void)
804 return (struct MUI_CustomClass *)MUI_CreateCustomClass(NULL, NULL,
805 IconList_Class, sizeof(struct IconVolumeList_DATA),
806 ENTRY(IconVolumeList_Dispatcher));
808 #endif
809 #endif /* WANDERER_BUILTIN_ICONVOLUMELIST */