revert between 56095 -> 55830 in arch
[AROS.git] / workbench / system / Wanderer / Tools / DiskInfo / diskinfo.c
blob001dc4d5de2045dbe0b537541892bec3cc585aac
1 /*
2 Copyright © 2005-2013, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define MUIMASTER_YES_INLINE_STDARG
8 #define DEBUG 0
9 #include <aros/debug.h>
11 #include <exec/types.h>
12 #include <utility/tagitem.h>
13 #include <libraries/mui.h>
14 #include <libraries/asl.h>
15 #include <dos/filehandler.h>
17 #include <proto/alib.h>
18 #include <proto/exec.h>
19 #include <proto/dos.h>
20 #include <proto/intuition.h>
21 #include <proto/utility.h>
22 #include <proto/icon.h>
23 #include <proto/muimaster.h>
24 #include <proto/workbench.h>
26 #include <stdio.h>
28 #include <zune/iconimage.h>
29 #include "diskinfo.h"
30 #include "locale.h"
31 #include "support.h"
33 #ifndef ID_FAT12_DISK
34 #define ID_FAT12_DISK (0x46415400L)
35 #define ID_FAT16_DISK (0x46415401L)
36 #define ID_FAT32_DISK (0x46415402L)
37 #endif
38 #ifndef ID_CDFS_DISK
39 #define ID_CDFS_DISK (0x43444653L)
40 #endif
41 #ifndef ID_NTFS_DISK
42 #define ID_NTFS_DISK (0x4E544653L)
43 #endif
45 static LONG dt[]={ID_NO_DISK_PRESENT, ID_UNREADABLE_DISK,
46 ID_DOS_DISK, ID_FFS_DISK, ID_INTER_DOS_DISK, ID_INTER_FFS_DISK,
47 ID_FASTDIR_DOS_DISK, ID_FASTDIR_FFS_DISK, ID_NOT_REALLY_DOS,
48 ID_KICKSTART_DISK, ID_MSDOS_DISK, ID_SFS_BE_DISK, ID_SFS_LE_DISK,
49 ID_FAT12_DISK, ID_FAT16_DISK, ID_FAT32_DISK, ID_CDFS_DISK, ID_NTFS_DISK };
51 /*** Instance data **********************************************************/
52 struct DiskInfo_DATA
54 Object *dki_Window;
55 Object *dki_VolumeIcon;
56 Object *dki_VolumeName;
57 Object *dki_VolumeUseGauge;
58 Object *dki_VolumeUsed;
59 Object *dki_VolumeFree;
60 STRPTR dki_DOSDev;
61 STRPTR dki_DOSDevInfo;
62 STRPTR dki_FileSys;
63 struct MsgPort *dki_NotifyPort;
64 LONG dki_DiskType;
65 LONG dki_Aspect;
66 struct MUI_InputHandlerNode dki_NotifyIHN;
67 struct NotifyRequest dki_FSNotifyRequest;
70 /*** Methods ****************************************************************/
71 Object *DiskInfo__OM_NEW
73 Class *CLASS, Object *self, struct opSet *message
76 struct DosList *dl;
77 struct DiskInfo_DATA *data = NULL;
78 struct TagItem *tstate = message->ops_AttrList;
79 struct TagItem *tag = NULL;
80 BPTR initial = BNULL;
81 Object *window,
82 *volnameobj, *voliconobj, *volusegaugeobj,
83 *volusedobj, *volfreeobj,
84 *grp, *grpformat;
85 ULONG percent = 0;
86 LONG disktype = ID_NO_DISK_PRESENT;
87 LONG aspect = 0;
88 TEXT volname[108];
89 TEXT size[64];
90 TEXT used[64];
91 TEXT free[64];
92 TEXT blocksize[16];
93 STRPTR status = NULL;
94 STRPTR dosdevname = NULL;
95 STRPTR deviceinfo = NULL;
97 STRPTR filesystem = NULL;
98 STRPTR volicon = NULL;
99 STRPTR handlertype = "";
101 static struct InfoData id;
103 static STRPTR disktypelist[] =
105 "No Disk",
106 "Unreadable",
107 "OFS",
108 "FFS",
109 "OFS-Intl",
110 "FFS-Intl",
111 "OFS-DC",
112 "FFS-DC",
113 "Not DOS",
114 "KickStart",
115 "MSDOS",
116 "SFS0 BE",
117 "SFS0 LE",
118 "FAT12",
119 "FAT16",
120 "FAT32",
121 "CD-ROM",
122 "NTFS"
125 /* Parse initial taglist -----------------------------------------------*/
126 D(bug("[DiskInfo] %s()\n", __PRETTY_FUNCTION__));
128 while ((tag = NextTagItem(&tstate)) != NULL)
130 switch (tag->ti_Tag)
132 case MUIA_DiskInfo_Initial:
133 initial = (BPTR) tag->ti_Data;
134 D(bug("[DiskInfo] %s: initial lock @ 0x%p\n", __PRETTY_FUNCTION__, initial));
135 break;
136 /* TODO: Remove MUIA_DiskInfo_Aspect */
137 case MUIA_DiskInfo_Aspect:
138 aspect = tag->ti_Data;
139 D(bug("[DiskInfo] %s: aspect: %d\n", __PRETTY_FUNCTION__, aspect));
140 break;
144 /* Initial lock is required */
145 if (initial == BNULL)
147 return NULL;
150 /* obtain volume's name from the lock */
151 if (!NameFromLock(initial, volname, sizeof(volname))) {
152 SetIoErr(ERROR_DEVICE_NOT_MOUNTED);
153 return NULL;
155 int volname_len = strlen(volname);
156 if ((volicon = AllocVec(volname_len + 5, MEMF_CLEAR)) == NULL)
158 SetIoErr(ERROR_DEVICE_NOT_MOUNTED);
159 return NULL;
161 strcpy(volicon, volname);
162 strcat(volicon, "disk");
163 volname[strlen(volname)-1] = '\0';
164 D(bug("[DiskInfo] %s: Volume '%s'\n", __PRETTY_FUNCTION__, volname));
166 /* find the volumes doslist information .. */
167 filesystem = _(MSG_UNKNOWN);
169 volname[strlen(volname)] = ':';
171 /* Extract volume info from InfoData */
172 if (Info(initial, &id) == DOSTRUE)
174 LONG i;
175 disktype = id.id_DiskType;
177 for (i = 0; i < sizeof(dt) / sizeof(LONG); ++i)
179 if (disktype == dt[i])
181 filesystem = AllocVec(strlen(disktypelist[i]) + 1, MEMF_ANY|MEMF_CLEAR);
182 CopyMem(disktypelist[i], filesystem, strlen(disktypelist[i]));
183 break;
186 if (!filesystem)
188 filesystem = AllocVec(strlen(_(MSG_UNKNOWN)) + 1, MEMF_ANY|MEMF_CLEAR);
189 CopyMem(_(MSG_UNKNOWN), filesystem, strlen(_(MSG_UNKNOWN)));
192 FormatSize(size, id.id_NumBlocks, id.id_NumBlocks, id.id_BytesPerBlock, FALSE);
193 percent = FormatSize(used, id.id_NumBlocksUsed, id.id_NumBlocks, id.id_BytesPerBlock, TRUE);
194 FormatSize(free, id.id_NumBlocks - id.id_NumBlocksUsed, id.id_NumBlocks, id.id_BytesPerBlock, TRUE);
195 sprintf(blocksize, "%d %s", (int)id.id_BytesPerBlock, _(MSG_BYTES));
197 switch (id.id_DiskState)
199 case (ID_WRITE_PROTECTED):
200 status = _(MSG_READABLE);
201 break;
202 case (ID_VALIDATING):
203 status = _(MSG_VALIDATING);
204 break;
205 case (ID_VALIDATED):
206 status = _(MSG_READABLE_WRITABLE);
207 break;
208 default:
209 status = _(MSG_UNKNOWN);
212 dl = LockDosList(LDF_VOLUMES | LDF_READ);
213 dl = FindDosEntry(dl, volname, LDF_VOLUMES | LDF_READ);
214 UnLockDosList(LDF_VOLUMES | LDF_READ);
216 if (dl != NULL)
218 APTR voltask = dl->dol_Task;
219 dl = LockDosList(LDF_DEVICES|LDF_READ);
220 if (dl) {
221 while((dl = NextDosEntry(dl, LDF_DEVICES)))
223 if (dl->dol_Task == voltask)
225 struct FileSysStartupMsg *fsstartup = (struct FileSysStartupMsg *)BADDR(dl->dol_misc.dol_handler.dol_Startup);
226 dosdevname = (UBYTE*)AROS_BSTR_ADDR(dl->dol_Name);
227 if (dl->dol_misc.dol_handler.dol_Handler)
229 char *fscur = filesystem;
230 filesystem = AllocVec(strlen(fscur) + AROS_BSTR_strlen(dl->dol_misc.dol_handler.dol_Handler) + 4, MEMF_ANY);
231 sprintf(filesystem,"%s (%s)", fscur, AROS_BSTR_ADDR(dl->dol_misc.dol_handler.dol_Handler));
233 if (fsstartup != NULL)
235 deviceinfo = AllocVec(strlen((UBYTE*)AROS_BSTR_ADDR(fsstartup->fssm_Device)) + (fsstartup->fssm_Unit/10 + 1) + 7, MEMF_CLEAR);
236 sprintf(deviceinfo,"%s %s %d", (UBYTE*)AROS_BSTR_ADDR(fsstartup->fssm_Device), _(MSG_UNIT), (int)fsstartup->fssm_Unit);
238 break;
241 UnLockDosList(LDF_VOLUMES|LDF_READ);
245 else
247 filesystem = AllocVec(strlen(_(MSG_UNKNOWN)) + 1, MEMF_ANY);
248 CopyMem(_(MSG_UNKNOWN), filesystem, strlen(_(MSG_UNKNOWN)));
251 /* Create application and window objects -------------------------------*/
252 self = (Object *) DoSuperNewTags
254 CLASS, self, NULL,
256 MUIA_Application_Title, __(MSG_TITLE),
257 MUIA_Application_Version, (IPTR) "$VER: DiskInfo 0.5 ("ADATE") ©2006-2009 AROS Dev Team",
258 MUIA_Application_Copyright, __(MSG_COPYRIGHT),
259 MUIA_Application_Author, __(MSG_AUTHOR),
260 MUIA_Application_Description, __(MSG_DESCRIPTION),
261 MUIA_Application_Base, (IPTR) "DISKINFO",
262 SubWindow, (IPTR) (window = (Object *)WindowObject,
263 MUIA_Window_Title, (IPTR) volname,
264 MUIA_Window_Activate, TRUE,
265 MUIA_Window_NoMenus, TRUE,
266 MUIA_Window_CloseGadget, TRUE,
268 WindowContents, (IPTR) VGroup,
269 Child, (IPTR) HGroup,
270 Child, (IPTR) VGroup,
271 Child, (IPTR) HVSpace,
272 Child, (IPTR) HGroup,
273 Child, (IPTR) HVSpace,
274 Child, (IPTR)(voliconobj = (Object *)IconImageObject,
275 MUIA_InputMode, MUIV_InputMode_Toggle,
276 MUIA_IconImage_File, (IPTR) volicon,
277 End),
278 Child, (IPTR) HVSpace,
279 End,
280 Child, (IPTR) HVSpace,
281 End,
282 Child, (IPTR) (grp = (Object *)VGroup,
283 Child, (IPTR) HVSpace,
284 Child, (IPTR) ColGroup(2),
285 /* TODO: Build this list only when data is realy available, and localise */
286 (dosdevname) ? Child : TAG_IGNORE, (IPTR) TextObject,
287 MUIA_Text_PreParse, (IPTR) "\33r",
288 MUIA_Text_Contents, (IPTR) __(MSG_DOSDEVICE),
289 End,
290 (dosdevname) ? Child : TAG_IGNORE, (IPTR) TextObject,
291 MUIA_Text_PreParse, (IPTR) "\33l",
292 MUIA_Text_Contents, (IPTR) dosdevname,
293 End,
294 (deviceinfo) ? Child : TAG_IGNORE, (IPTR) TextObject,
295 MUIA_Text_PreParse, (IPTR) "\33r",
296 MUIA_Text_Contents, (IPTR) __(MSG_DEVICEINFO),
297 End,
298 (deviceinfo) ? Child : TAG_IGNORE, (IPTR) TextObject,
299 MUIA_Text_PreParse, (IPTR) "\33l",
300 MUIA_Text_Contents, (IPTR) deviceinfo,
301 End,
302 Child, (IPTR) TextObject,
303 MUIA_Text_PreParse, (IPTR) "\33r",
304 MUIA_Text_Contents, (IPTR) __(MSG_FILESYSTEM),
305 End,
306 Child, (IPTR) TextObject,
307 MUIA_Text_PreParse, (IPTR) "\33I[6:24] \33l",
308 MUIA_Text_Contents, (IPTR) filesystem,
309 End,
310 Child, (IPTR) HVSpace,
311 Child, (IPTR) TextObject,
312 MUIA_Text_PreParse, (IPTR) "\33l",
313 MUIA_Text_Contents, (IPTR) handlertype,
314 End,
315 End,
316 Child, (IPTR) HVSpace,
317 End),
318 Child, (IPTR) HVSpace,
319 End,
320 Child, (IPTR) VGroup,
321 Child, (IPTR) HGroup,
322 MUIA_Weight, 100,
323 GroupFrame,
324 Child, (IPTR) HVSpace,
325 Child, (IPTR) ColGroup(2),
326 Child, (IPTR) TextObject,
327 MUIA_Text_PreParse, (IPTR) "\33r",
328 MUIA_Text_Contents, __(MSG_NAME),
329 End,
330 Child, (IPTR)(volnameobj = (Object *)TextObject,
331 TextFrame,
332 MUIA_Background, MUII_TextBack,
333 MUIA_Text_PreParse, (IPTR) "\33b\33l",
334 MUIA_Text_Contents, (IPTR) volname,
335 End),
336 Child, (IPTR) VGroup,
337 Child, (IPTR) TextObject,
338 TextFrame,
339 MUIA_FramePhantomHoriz, (IPTR)TRUE,
340 MUIA_Text_PreParse, (IPTR) "\33r",
341 MUIA_Text_Contents, __(MSG_SIZE),
342 End,
343 Child, (IPTR) TextObject,
344 TextFrame,
345 MUIA_FramePhantomHoriz, (IPTR)TRUE,
346 MUIA_Text_PreParse, (IPTR) "\33r",
347 MUIA_Text_Contents, __(MSG_USED),
348 End,
349 Child, (IPTR) TextObject,
350 TextFrame,
351 MUIA_FramePhantomHoriz, (IPTR)TRUE,
352 MUIA_Text_PreParse, (IPTR) "\33r",
353 MUIA_Text_Contents, __(MSG_FREE),
354 End,
355 End,
356 Child, (IPTR) HGroup,
357 Child, (IPTR) VGroup,
358 Child, (IPTR) TextObject,
359 TextFrame,
360 MUIA_Background, MUII_TextBack,
361 MUIA_Text_PreParse, (IPTR) "\33l",
362 MUIA_Text_Contents, (IPTR) size,
363 End,
364 Child, (IPTR)(volusedobj = (Object *)TextObject,
365 TextFrame,
366 MUIA_Background, MUII_TextBack,
367 MUIA_Text_PreParse, (IPTR) "\33l",
368 MUIA_Text_Contents, (IPTR) used,
369 End),
370 Child, (IPTR)(volfreeobj = (Object *)TextObject,
371 TextFrame,
372 MUIA_Background, MUII_TextBack,
373 MUIA_Text_PreParse, (IPTR) "\33l",
374 MUIA_Text_Contents, (IPTR) free,
375 End),
376 End,
377 Child, (IPTR)(volusegaugeobj = (Object *)GaugeObject,
378 GaugeFrame,
379 MUIA_Gauge_InfoText, (IPTR) "",
380 MUIA_Gauge_Horiz, FALSE,
381 MUIA_Gauge_Current, percent,
382 End),
383 End,
384 Child, (IPTR) TextObject,
385 MUIA_Text_PreParse, (IPTR) "\33r",
386 MUIA_Text_Contents, __(MSG_BLOCK_SIZE),
387 End,
388 Child, (IPTR) TextObject,
389 TextFrame,
390 MUIA_Background, MUII_TextBack,
391 MUIA_Text_PreParse, (IPTR) "\33l",
392 MUIA_Text_Contents, (IPTR) blocksize,
393 End,
394 Child, (IPTR) TextObject,
395 MUIA_Text_PreParse, (IPTR) "\33r",
396 MUIA_Text_Contents, __(MSG_STATUS),
397 End,
398 Child, (IPTR) TextObject,
399 TextFrame,
400 MUIA_Background, MUII_TextBack,
401 MUIA_Text_PreParse, (IPTR) "\33l",
402 MUIA_Text_Contents, (IPTR) status,
403 End,
404 Child, (IPTR) HVSpace,
405 Child, (IPTR) HVSpace,
406 End,
407 Child, (IPTR) HVSpace,
408 End,
409 Child, (IPTR) (grpformat = (Object *)HGroup,
410 // grpformat object userlevel sensitive
411 Child, (IPTR) HVSpace,
412 End),
413 Child, (IPTR) HVSpace,
414 End,
415 End,
416 End),
417 TAG_DONE);
419 /* Check if object creation succeeded */
420 if (self == NULL)
421 return NULL;
423 /* Store instance data -------------------------------------------------*/
424 data = INST_DATA(CLASS, self);
426 data->dki_NotifyPort = CreateMsgPort();
428 data->dki_Window = window;
430 data->dki_VolumeName = volnameobj;
431 data->dki_VolumeIcon = voliconobj;
432 data->dki_VolumeUseGauge = volusegaugeobj;
433 data->dki_VolumeUsed = volusedobj;
434 data->dki_VolumeFree = volfreeobj;
436 data->dki_DOSDev = AllocVec(strlen(dosdevname) +2, MEMF_CLEAR);
437 sprintf(data->dki_DOSDev, "%s:", dosdevname);
439 data->dki_DOSDevInfo = deviceinfo;
440 data->dki_FileSys = filesystem;
441 data->dki_Aspect = aspect;
443 /* Setup notifications -------------------------------------------------*/
444 DoMethod( window, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
445 (IPTR) self, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
447 if (data->dki_NotifyPort)
449 /* Setup filesystem notification handler ---------------------------*/
450 data->dki_NotifyIHN.ihn_Signals = 1UL << data->dki_NotifyPort->mp_SigBit;
451 data->dki_NotifyIHN.ihn_Object = self;
452 data->dki_NotifyIHN.ihn_Method = MUIM_DiskInfo_HandleNotify;
454 DoMethod(self, MUIM_Application_AddInputHandler, (IPTR)&data->dki_NotifyIHN);
456 data->dki_FSNotifyRequest.nr_Name = volname;
457 data->dki_FSNotifyRequest.nr_Flags = NRF_SEND_MESSAGE;
458 data->dki_FSNotifyRequest.nr_stuff.nr_Msg.nr_Port = data->dki_NotifyPort;
459 if (StartNotify(&data->dki_FSNotifyRequest))
461 D(bug("[DiskInfo] %s: FileSystem-Notification setup for '%s'\n", __PRETTY_FUNCTION__, data->dki_FSNotifyRequest.nr_Name));
463 else
465 D(bug("[DiskInfo] %s: FAILED to setup FileSystem-Notification for '%s'\n", __PRETTY_FUNCTION__, data->dki_FSNotifyRequest.nr_Name));
466 DoMethod(self, MUIM_Application_RemInputHandler, (IPTR)&data->dki_NotifyIHN);
467 DeleteMsgPort(data->dki_NotifyPort);
468 data->dki_NotifyPort = NULL;
471 return self;
474 IPTR DiskInfo__OM_DISPOSE(Class *CLASS, Object *self, Msg message)
476 struct DiskInfo_DATA *data = INST_DATA(CLASS, self);
478 D(bug("[DiskInfo] %s()\n", __PRETTY_FUNCTION__));
480 if (data->dki_NotifyPort)
482 DoMethod(self, MUIM_Application_RemInputHandler, (IPTR) &data->dki_NotifyIHN);
484 EndNotify(&data->dki_FSNotifyRequest);
486 DeleteMsgPort(data->dki_NotifyPort);
489 FreeVec(data->dki_DOSDev);
490 FreeVec(data->dki_DOSDevInfo);
491 FreeVec(data->dki_FileSys);
493 return DoSuperMethodA(CLASS, self, message);
496 IPTR DiskInfo__MUIM_Application_Execute(Class *CLASS, Object *self, Msg message)
498 struct DiskInfo_DATA *data = INST_DATA(CLASS, self);
500 D(bug("[DiskInfo] %s()\n", __PRETTY_FUNCTION__));
502 SET(data->dki_Window, MUIA_Window_Open, TRUE);
504 DoSuperMethodA(CLASS, self, message);
506 SET(data->dki_Window, MUIA_Window_Open, FALSE);
508 return (IPTR) NULL;
511 IPTR DiskInfo__MUIM_DiskInfo_HandleNotify
513 Class *CLASS, Object *self, Msg message
516 struct DiskInfo_DATA *data = INST_DATA(CLASS, self);
517 struct NotifyMessage *npMessage = NULL;
518 static struct InfoData id;
519 BPTR fsdevlock = BNULL;
520 BOOL di_Quit = FALSE;
522 D(bug("[DiskInfo] %s()\n", __PRETTY_FUNCTION__));
524 if (data->dki_NotifyPort)
526 while ((npMessage = (struct NotifyMessage *)GetMsg(data->dki_NotifyPort)) != NULL)
528 D(bug("[DiskInfo] %s: FS notification received\n", __PRETTY_FUNCTION__));
530 if ((fsdevlock = Lock((STRPTR)XGET(data->dki_VolumeName, MUIA_Text_Contents), SHARED_LOCK)) != BNULL)
532 /* Extract volume info from InfoData */
533 if (Info(fsdevlock, &id) == DOSTRUE)
535 if (id.id_DiskType != ID_NO_DISK_PRESENT)
537 ULONG percent;
538 TEXT used[64];
539 TEXT free[64];
541 D(bug("[DiskInfo] %s: Updating Window from DOS Device '%s'\n", __PRETTY_FUNCTION__, (STRPTR)XGET(data->dki_VolumeName, MUIA_Text_Contents)));
543 //FormatSize(size, id.id_NumBlocks, id.id_NumBlocks, id.id_BytesPerBlock, FALSE);
544 percent = FormatSize(used, id.id_NumBlocksUsed, id.id_NumBlocks, id.id_BytesPerBlock, TRUE);
545 FormatSize(free, id.id_NumBlocks - id.id_NumBlocksUsed, id.id_NumBlocks, id.id_BytesPerBlock, TRUE);
546 //sprintf(blocksize, "%d %s", id.id_BytesPerBlock, _(MSG_BYTES));
548 //data->dki_VolumeName = volnameobj;
549 SET(data->dki_VolumeUsed, MUIA_Text_Contents, used);
550 SET(data->dki_VolumeFree, MUIA_Text_Contents, free);
551 SET(data->dki_VolumeUseGauge, MUIA_Gauge_Current, percent);
553 else
555 D(bug("[DiskInfo] %s: Volume no longer available on DOS Device '%s'\n", __PRETTY_FUNCTION__, data->dki_DOSDev));
556 di_Quit = TRUE;
559 else
561 D(bug("[DiskInfo] %s: Failed to obtain Info for DOS Device '%s'\n", __PRETTY_FUNCTION__, data->dki_DOSDev));
562 di_Quit = TRUE;
565 UnLock(fsdevlock);
567 else
569 D(bug("[DiskInfo] %s: Failed to lock DOS Device '%s'\n", __PRETTY_FUNCTION__, data->dki_DOSDev));
570 di_Quit = TRUE;
572 ReplyMsg((struct Message *)npMessage);
575 if (di_Quit)
577 /* TODO: set MUIV_Application_ReturnID_Quit */
579 return (IPTR)NULL;
582 IPTR DiskInfo__OM_GET(Class *CLASS, Object *self, struct opGet *msg)
584 struct DiskInfo_DATA *data = INST_DATA(CLASS, self);
585 IPTR retval = TRUE;
587 D(bug("[DiskInfo] %s()\n", __PRETTY_FUNCTION__));
589 switch(msg->opg_AttrID)
591 case MUIA_DiskInfo_Volname:
592 retval = (IPTR)XGET(data->dki_VolumeName, MUIA_Text_Contents);
593 break;
594 case MUIA_DiskInfo_Percent:
595 retval = (ULONG)XGET(data->dki_VolumeUseGauge, MUIA_Gauge_Current);
596 break;
597 case MUIA_DiskInfo_Aspect:
598 retval = (ULONG) data->dki_Aspect;
599 break;
600 default:
601 retval = DoSuperMethodA(CLASS, self, (Msg)msg);
602 break;
604 return retval;
607 IPTR DiskInfo__OM_SET(Class *CLASS, Object *self, struct opSet *msg)
609 struct DiskInfo_DATA *data = INST_DATA(CLASS, self);
610 struct TagItem *tags = msg->ops_AttrList;
611 struct TagItem *tag;
613 D(bug("[DiskInfo] %s()\n", __PRETTY_FUNCTION__));
615 while ((tag = NextTagItem(&tags)) != NULL)
617 switch (tag->ti_Tag)
619 case MUIA_DiskInfo_Aspect:
620 data->dki_Aspect = tag->ti_Data;
621 break;
624 return DoSuperMethodA(CLASS, self, (Msg)msg);
627 /*** Dispatcher *************************************************************/
628 BOOPSI_DISPATCHER(IPTR, DiskInfo_Dispatcher, CLASS, self, message)
630 switch (message->MethodID)
632 case OM_NEW: return (IPTR) DiskInfo__OM_NEW(CLASS, self, (struct opSet *) message);
633 case OM_DISPOSE: return DiskInfo__OM_DISPOSE(CLASS, self, message);
634 case OM_GET: return (IPTR) DiskInfo__OM_GET(CLASS, self, (struct opGet *)message);
635 case OM_SET: return (IPTR) DiskInfo__OM_SET(CLASS, self, (struct opSet *)message);
636 case MUIM_DiskInfo_HandleNotify: return DiskInfo__MUIM_DiskInfo_HandleNotify(CLASS, self, message);
637 case MUIM_Application_Execute: return DiskInfo__MUIM_Application_Execute(CLASS, self, message);
638 default: return DoSuperMethodA(CLASS, self, message);
640 return 0;
642 BOOPSI_DISPATCHER_END
644 /*** Setup ******************************************************************/
645 struct MUI_CustomClass *DiskInfo_CLASS;
647 BOOL DiskInfo_Initialize()
649 D(bug("[DiskInfo] %s()\n", __PRETTY_FUNCTION__));
651 DiskInfo_CLASS = MUI_CreateCustomClass(
652 NULL, MUIC_Application, NULL,
653 sizeof(struct DiskInfo_DATA), DiskInfo_Dispatcher);
655 return DiskInfo_CLASS ? TRUE : FALSE;
658 VOID DiskInfo_Deinitialize()
660 D(bug("[DiskInfo] %s()\n", __PRETTY_FUNCTION__));
662 if (DiskInfo_CLASS != NULL)
664 MUI_DeleteCustomClass(DiskInfo_CLASS);