Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / system / Wanderer / iconwindow_volumelist.c
blobda14ed21630c823293d8f0ca7c1c95818e188649
1 /*
2 Copyright 2004-2009, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define ZCC_QUIET
8 #include "portable_macros.h"
10 #ifdef __AROS__
11 #define MUIMASTER_YES_INLINE_STDARG
12 #endif
14 //#define DEBUG_NETWORKBROWSER
15 //#define DEBUG_SHOWUSERFILES
16 #define TXTBUFF_LEN 1024
18 #ifdef __AROS__
19 #define DEBUG 0
20 #include <aros/debug.h>
21 #endif
23 #include <exec/types.h>
24 #include <libraries/mui.h>
26 #ifdef __AROS__
27 #include <zune/customclasses.h>
28 #else
29 #include <zune_AROS/customclasses.h>
30 #endif
33 #include <proto/utility.h>
35 #include <proto/graphics.h>
36 #include <proto/exec.h>
37 #include <proto/datatypes.h>
38 #include <proto/icon.h>
40 #include <dos/dos.h>
41 #include <proto/dos.h>
43 #include <stdio.h>
44 #include <string.h>
46 #include <intuition/screens.h>
47 #include <datatypes/pictureclass.h>
48 #include <clib/macros.h>
50 #if defined(__AMIGA__) && !defined(__PPC__)
51 #define NO_INLINE_STDARG
52 #endif
53 #ifndef _PROTO_INTUITION_H
54 #include <proto/intuition.h>
55 #endif
56 #include <proto/muimaster.h>
58 #include "Classes/iconlist.h"
59 #include "Classes/iconlist_attributes.h"
60 #include "Classes/icon_attributes.h"
62 #include "wanderer.h"
63 #include "wandererprefs.h"
64 #include "iconwindow.h"
65 #include "iconwindow_iconlist.h"
68 #ifndef __AROS__
69 #define DEBUG 1
71 #ifdef DEBUG
72 #define D(x) if (DEBUG) x
73 #ifdef __amigaos4__
74 #define bug DebugPrintF
75 #else
76 #define bug kprintf
77 #endif
78 #else
79 #define D(...)
80 #endif
81 #endif
83 extern struct IconWindow_BackFill_Descriptor *iconwindow_BackFill_Active;
85 #define WIWVLVERS 1
86 #define WIWVLREV 0
88 #define BG_DRAWFLAG 0xf00dd00f
90 /*** Instance Data **********************************************************/
92 struct IconWindowVolumeList_DATA
94 Object *iwcd_IconWindow;
95 struct RastPort *iwcd_RastPort;
96 struct MUI_EventHandlerNode iwcd_EventHandlerNode;
97 #ifdef __AROS__
98 struct Hook iwcd_ProcessIconListPrefs_hook;
99 #else
100 struct Hook *iwcd_ProcessIconListPrefs_hook;
101 #endif
103 IPTR iwcd_ViewPrefs_ID;
104 Object *iwcd_ViewPrefs_NotificationObject;
105 #ifdef __AROS__
106 struct Hook iwvcd_UpdateNetworkPrefs_hook;
107 #else
108 struct Hook *iwvcd_UpdateNetworkPrefs_hook;
109 #endif
111 IPTR iwvcd_ShowNetworkBrowser;
112 IPTR iwvcd_ShowUserFolder;
113 char *iwvcd_UserFolderPath;
116 static char __icwc_intern_TxtBuff[TXTBUFF_LEN];
118 /*** Macros *****************************************************************/
119 #define SETUP_INST_DATA struct IconWindowVolumeList_DATA *data = INST_DATA(CLASS, self)
121 /*** Hook functions *********************************************************/
122 ///IconWindowVolumeList__HookFunc_ProcessIconListPrefsFunc()
123 #ifdef __AROS__
124 AROS_UFH3(
125 void, IconWindowVolumeList__HookFunc_ProcessIconListPrefsFunc,
126 AROS_UFHA(struct Hook *, hook, A0),
127 AROS_UFHA(APTR *, obj, A2),
128 AROS_UFHA(IPTR *, param, A1)
131 #else
132 HOOKPROTO(IconWindowVolumeList__HookFunc_ProcessIconListPrefsFunc, void, APTR *obj, IPTR *param)
134 #endif
135 AROS_USERFUNC_INIT
137 /* Get our private data */
138 Object *self = ( Object *)obj;
139 IPTR CHANGED_ATTRIB = *param;
140 Class *CLASS = OCLASS(self);
142 SETUP_INST_DATA;
144 Object *prefs = NULL;
146 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__));
148 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
150 if (prefs)
152 IPTR attrib_Current, attrib_Prefs, prefs_Processing = 0;
153 BOOL options_changed = FALSE;
155 D(bug("[Wanderer:VolumeList] %s: Setting IconList options ..\n", __PRETTY_FUNCTION__));
157 GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
159 switch (CHANGED_ATTRIB)
161 case MUIA_IconList_IconListMode:
162 GET(self, MUIA_IconList_IconListMode, &attrib_Current);
164 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_IconListMode)) != -1) &&
165 (attrib_Current != attrib_Prefs))
167 D(bug("[Wanderer:VolumeList] %s: IconList ListMode changed - updating ..\n", __PRETTY_FUNCTION__));
168 options_changed = TRUE;
169 if (prefs_Processing)
171 NNSET(self, MUIA_IconList_IconListMode, attrib_Prefs);
173 else
175 SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
178 break;
180 case MUIA_IconList_LabelText_Mode:
181 GET(self, MUIA_IconList_LabelText_Mode, &attrib_Current);
183 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_Mode)) != -1) &&
184 (attrib_Current != attrib_Prefs))
186 D(bug("[Wanderer:VolumeList] %s: IconList TextRenderMode changed - updating ..\n", __PRETTY_FUNCTION__));
187 options_changed = TRUE;
188 if (prefs_Processing)
190 NNSET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
192 else
194 SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
197 break;
199 case MUIA_IconList_LabelText_MaxLineLen:
200 GET(self, MUIA_IconList_LabelText_MaxLineLen, &attrib_Current);
202 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen)) != -1) &&
203 (attrib_Current != attrib_Prefs))
205 D(bug("[Wanderer:VolumeList] %s: IconList Max Text Length changed - updating ..\n", __PRETTY_FUNCTION__));
206 options_changed = TRUE;
207 if (prefs_Processing)
209 NNSET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
211 else
213 SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
216 break;
218 case MUIA_IconList_LabelText_MultiLine:
219 GET(self, MUIA_IconList_LabelText_MultiLine, &attrib_Current);
221 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine)) != -1) &&
222 (attrib_Current != attrib_Prefs))
224 D(bug("[Wanderer:VolumeList] %s: IconList Multi-Line changed - updating ..\n", __PRETTY_FUNCTION__));
225 options_changed = TRUE;
226 if (prefs_Processing)
228 NNSET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
230 else
232 SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
235 break;
237 case MUIA_IconList_LabelText_MultiLineOnFocus:
238 GET(self, MUIA_IconList_LabelText_MultiLineOnFocus, &attrib_Current);
240 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus)) != -1) &&
241 (attrib_Current != attrib_Prefs))
243 D(bug("[Wanderer:VolumeList] %s: Multi-Line on Focus changed - updating ..\n", __PRETTY_FUNCTION__));
244 options_changed = TRUE;
245 if (prefs_Processing)
247 NNSET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
249 else
251 SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
254 break;
256 case MUIA_IconList_Icon_HorizontalSpacing:
257 GET(self, MUIA_IconList_Icon_HorizontalSpacing, &attrib_Current);
259 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing)) != -1) &&
260 (attrib_Current != attrib_Prefs))
262 D(bug("[Wanderer:VolumeList] %s: Icon Horizontal Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
263 options_changed = TRUE;
264 if (prefs_Processing)
266 NNSET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
268 else
270 SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
273 break;
275 case MUIA_IconList_Icon_VerticalSpacing:
276 GET(self, MUIA_IconList_Icon_VerticalSpacing, &attrib_Current);
278 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing)) != -1) &&
279 (attrib_Current != attrib_Prefs))
281 D(bug("[Wanderer:VolumeList] %s: Icon Vertical Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
282 options_changed = TRUE;
283 if (prefs_Processing)
285 NNSET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
287 else
289 SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
292 break;
294 case MUIA_IconList_Icon_ImageSpacing:
295 GET(self, MUIA_IconList_Icon_ImageSpacing, &attrib_Current);
297 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing)) != -1) &&
298 (attrib_Current != attrib_Prefs))
300 D(bug("[Wanderer:VolumeList] %s: Icon Label Image Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
301 options_changed = TRUE;
302 if (prefs_Processing)
304 NNSET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
306 else
308 SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
311 break;
313 case MUIA_IconList_LabelText_HorizontalPadding:
314 GET(self, MUIA_IconList_LabelText_HorizontalPadding, &attrib_Current);
316 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding)) != -1) &&
317 (attrib_Current != attrib_Prefs))
319 D(bug("[Wanderer:VolumeList] %s: Icon Label Horizontal Padding changed - updating ..\n", __PRETTY_FUNCTION__));
320 options_changed = TRUE;
321 if (prefs_Processing)
323 NNSET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
325 else
327 SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
330 break;
332 case MUIA_IconList_LabelText_VerticalPadding:
333 GET(self, MUIA_IconList_LabelText_VerticalPadding, &attrib_Current);
335 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding)) != -1) &&
336 (attrib_Current != attrib_Prefs))
338 D(bug("[Wanderer:VolumeList] %s: Icon Label Vertical Padding changed - updating ..\n", __PRETTY_FUNCTION__));
339 options_changed = TRUE;
340 if (prefs_Processing)
342 NNSET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
344 else
346 SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
349 break;
351 case MUIA_IconList_LabelText_BorderWidth:
352 GET(self, MUIA_IconList_LabelText_BorderWidth, &attrib_Current);
354 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth)) != -1) &&
355 (attrib_Current != attrib_Prefs))
357 D(bug("[Wanderer:VolumeList] %s: Icon Label Border Width changed - updating ..\n", __PRETTY_FUNCTION__));
358 options_changed = TRUE;
359 if (prefs_Processing)
361 NNSET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
363 else
365 SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
368 break;
370 case MUIA_IconList_LabelText_BorderHeight:
371 GET(self, MUIA_IconList_LabelText_BorderHeight, &attrib_Current);
373 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight)) != -1) &&
374 (attrib_Current != attrib_Prefs))
376 D(bug("[Wanderer:VolumeList] %s: Icon Label Border Height changed - updating ..\n", __PRETTY_FUNCTION__));
377 options_changed = TRUE;
378 if (prefs_Processing)
380 NNSET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
382 else
384 SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
387 break;
389 default:
390 D(bug("[Wanderer:VolumeList] %s: Unhandled change\n", __PRETTY_FUNCTION__));
391 break;
394 if (options_changed)
396 if (!(prefs_Processing))
398 D(bug("[Wanderer:VolumeList] %s: IconList Options have changed, causing an update ..\n", __PRETTY_FUNCTION__));
399 DoMethod(self, MUIM_IconList_Update);
401 else if (data->iwcd_IconWindow)
403 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
407 AROS_USERFUNC_EXIT
409 #ifndef __AROS__
410 MakeStaticHook(Hook_ProcessIconListPrefsFunc,IconWindowVolumeList__HookFunc_ProcessIconListPrefsFunc);
411 #endif
414 ///IconWindowVolumeList__HookFunc_UpdateNetworkPrefsFunc()
415 #ifdef __AROS__
416 AROS_UFH3(
417 void, IconWindowVolumeList__HookFunc_UpdateNetworkPrefsFunc,
418 AROS_UFHA(struct Hook *, hook, A0),
419 AROS_UFHA(APTR *, obj, A2),
420 AROS_UFHA(APTR, param, A1)
423 #else
424 HOOKPROTO(IconWindowVolumeList__HookFunc_UpdateNetworkPrefsFunc, void, APTR *obj, APTR param)
426 #endif
427 AROS_USERFUNC_INIT
429 /* Get our private data */
430 Object *self = ( Object *)obj;
431 Object *prefs = NULL;
432 Class *CLASS = *( Class **)param;
434 SETUP_INST_DATA;
436 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__));
438 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
440 if (prefs)
442 BOOL options_changed = FALSE;
443 IPTR prefs_Processing = 0;
445 GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
447 IPTR current_ShowNetwork = 0;
448 IPTR prefs_ShowNetwork = 0;
450 D(bug("[Wanderer:VolumeList] %s: Setting ROOT view Network options ..\n", __PRETTY_FUNCTION__));
452 GET(self, MUIA_IconWindowExt_NetworkBrowser_Show, &current_ShowNetwork);
454 D(bug("[Wanderer:VolumeList] %s: Current = %d\n", __PRETTY_FUNCTION__, current_ShowNetwork));
456 GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &prefs_ShowNetwork);
458 D(bug("[Wanderer:VolumeList] %s: Prefs = %d\n", __PRETTY_FUNCTION__, prefs_ShowNetwork));
460 if ((BOOL)current_ShowNetwork != (BOOL)prefs_ShowNetwork)
462 D(bug("[Wanderer:VolumeList] %s: ROOT view Network prefs changed - updating ..\n", __PRETTY_FUNCTION__));
463 options_changed = TRUE;
464 ((struct IconWindowVolumeList_DATA *)data)->iwvcd_ShowNetworkBrowser = prefs_ShowNetwork;
466 if ((options_changed) && !(prefs_Processing))
468 D(bug("[Wanderer:VolumeList] %s: Network prefs changed, causing an update ..\n", __PRETTY_FUNCTION__));
469 DoMethod(self, MUIM_IconList_Update);
471 else if (data->iwcd_IconWindow)
473 SET(data->iwcd_IconWindow, MUIA_IconWindow_Changed, TRUE);
476 AROS_USERFUNC_EXIT
478 #ifndef __AROS__
479 MakeStaticHook(Hook_UpdateNetworkPrefsFunc,IconWindowVolumeList__HookFunc_UpdateNetworkPrefsFunc);
480 #endif
482 #define BDRPLINELEN_MAX 1024
483 BOOL IconWindowVolumeList__Func_ParseBackdrop(Class *CLASS, Object *self, char *bdrp_dir)
485 BPTR bdrp_lock = (BPTR)NULL;
486 char *bdrp_file = NULL, *linebuf = NULL, *bdrp_fullfile = NULL, *bdrp_namepart = NULL;
487 struct DiskObject *bdrp_currfile_dob = NULL;
488 BOOL retVal = FALSE;
490 if ((bdrp_dir == NULL) || (bdrp_dir[strlen(bdrp_dir) - 1] != ':'))
491 return retVal;
493 D(bug("[Wanderer:VolumeList] %s: Checking '%s' for .backdrop file .. \n", __PRETTY_FUNCTION__, bdrp_dir));
495 if ((bdrp_file = AllocVec(strlen(bdrp_dir) + 9 + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
497 sprintf(bdrp_file, "%s.backdrop", bdrp_dir);
498 if ((bdrp_lock = Open(bdrp_file, MODE_OLDFILE)))
500 D(bug("[Wanderer:VolumeList] %s: Loading backdrop file: '%s'\n", __PRETTY_FUNCTION__, bdrp_file));
502 if ((linebuf = AllocMem(BDRPLINELEN_MAX, MEMF_PUBLIC)) != NULL)
504 while (FGets(bdrp_lock, linebuf, BDRPLINELEN_MAX))
506 int linelen = 0;
507 if (*linebuf != ':')
508 continue;
510 linelen = strlen(linebuf) - 1; /* drop the newline char */
511 linebuf[linelen] = '\0';
513 if ((bdrp_fullfile = AllocVec(linelen + strlen(bdrp_dir), MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
515 sprintf(bdrp_fullfile, "%s%s", bdrp_dir, &linebuf[1]);
516 bdrp_namepart = FilePart(bdrp_fullfile);
517 bdrp_currfile_dob = GetIconTags
519 bdrp_fullfile,
520 ICONGETA_FailIfUnavailable, FALSE,
521 ICONGETA_Label, bdrp_namepart,
522 TAG_DONE
525 D(bug("[Wanderer:VolumeList] %s: LEAVEOUT Icon '%s' ('%s') DOB @ 0x%p\n", __PRETTY_FUNCTION__, bdrp_fullfile, bdrp_namepart, bdrp_currfile_dob));
527 if (bdrp_currfile_dob)
529 struct IconEntry *this_entry = NULL;
530 if ((this_entry = (struct IconEntry *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)bdrp_fullfile, (IPTR)bdrp_namepart, (IPTR)NULL, (IPTR)bdrp_currfile_dob, 0)))
532 struct FileInfoBlock *fib = AllocDosObject(DOS_FIB, NULL);
533 if (fib)
535 BPTR fib_lock = (BPTR)NULL;
536 if ((fib_lock = Lock(bdrp_fullfile, SHARED_LOCK)) != NULL)
538 if (Examine(fib_lock, fib))
540 if (fib->fib_DirEntryType == ST_FILE)
542 this_entry->ie_IconListEntry.type = ST_LINKFILE;
543 D(bug("[Wanderer:VolumeList] %s: LEAVEOUT ST_LINKFILE Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
545 else if (fib->fib_DirEntryType == ST_USERDIR)
547 this_entry->ie_IconListEntry.type = ST_LINKDIR;
548 D(bug("[Wanderer:VolumeList] %s: LEAVEOUT ST_LINKDIR Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
550 else
552 D(bug("[Wanderer:VolumeList] %s: LEAVEOUT Unknown Entry Type @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
555 UnLock(fib_lock);
557 FreeDosObject(DOS_FIB, fib);
559 retVal = TRUE;
564 FreeMem(linebuf, BDRPLINELEN_MAX);
566 Close(bdrp_lock);
568 FreeVec(bdrp_file);
570 return retVal;
574 /*** Methods ****************************************************************/
575 ///OM_NEW()
576 Object *IconWindowVolumeList__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
578 IPTR _newIconList__FSNotifyPort = 0;
580 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__));
582 _newIconList__FSNotifyPort = GetTagData(MUIA_Wanderer_FileSysNotifyPort, (IPTR) NULL, message->ops_AttrList);
584 self = (Object *) DoSuperNewTags
586 CLASS, self, NULL,
587 MUIA_CycleChain, 1,
588 TAG_MORE, (IPTR) message->ops_AttrList
591 if (self != NULL)
593 SETUP_INST_DATA;
594 D(bug("[Wanderer:VolumeList] %s: SELF = 0x%p\n", __PRETTY_FUNCTION__, self));
596 #ifdef __AROS__
597 data->iwcd_ProcessIconListPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowVolumeList__HookFunc_ProcessIconListPrefsFunc;
598 #else
599 data->iwcd_ProcessIconListPrefs_hook = &Hook_ProcessIconListPrefsFunc;
600 #endif
603 return self;
607 ///OM_SET()
608 IPTR IconWindowVolumeList__OM_SET(Class *CLASS, Object *self, struct opSet *message)
610 SETUP_INST_DATA;
612 struct TagItem *tstate = message->ops_AttrList, *tag;
614 while ((tag = NextTagItem((const struct TagItem**)&tstate)) != NULL)
616 switch (tag->ti_Tag)
618 case MUIA_Background:
620 D(bug("[Wanderer:VolumeList] %s: MUIA_Background\n", __PRETTY_FUNCTION__));
621 break;
623 case MUIA_IconWindow_Window:
625 D(bug("[Wanderer:VolumeList] %s: MUIA_IconWindow_Window @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
626 data->iwcd_IconWindow = (Object *)tag->ti_Data;
627 break;
629 case MUIA_IconList_BufferRastport:
631 D(bug("[Wanderer:VolumeList] %s: MUIA_IconList_BufferRastport @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
632 data->iwcd_RastPort = (struct RastPort *)tag->ti_Data;
633 break;
637 return DoSuperMethodA(CLASS, self, (Msg) message);
641 ///OM_GET()
642 IPTR IconWindowVolumeList__OM_GET(Class *CLASS, Object *self, struct opGet *message)
644 //SETUP_INST_DATA;
645 IPTR *store = message->opg_Storage;
646 IPTR rv = TRUE;
648 switch (message->opg_AttrID)
650 case MUIA_Version:
651 *store = (IPTR)WIWVLVERS;
652 break;
654 case MUIA_Revision:
655 *store = (IPTR)WIWVLREV;
656 break;
658 default:
659 rv = DoSuperMethodA(CLASS, self, (Msg) message);
662 return rv;
666 ///IconWindowVolumeList__MUIM_Setup()
667 IPTR IconWindowVolumeList__MUIM_Setup
669 Class *CLASS, Object *self, Msg message
672 SETUP_INST_DATA;
674 Object *prefs = NULL;
676 if (!DoSuperMethodA(CLASS, self, message)) return FALSE;
678 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
680 if (prefs)
682 /* Set our initial options */
683 IPTR attrib_Prefs;
685 GET(_win(self), MUIA_IconWindow_BackgroundAttrib, &data->iwcd_ViewPrefs_ID);
686 D(bug("[Wanderer:VolumeList] %s: Window Background = '%s'\n", __PRETTY_FUNCTION__, data->iwcd_ViewPrefs_ID));
687 data->iwcd_ViewPrefs_NotificationObject = (Object *)DoMethod(prefs,
688 MUIM_WandererPrefs_ViewSettings_GetNotifyObject,
689 data->iwcd_ViewPrefs_ID);
691 D(bug("[Wanderer:VolumeList] %s: Background Notification Obj @ 0x%p\n", __PRETTY_FUNCTION__, data->iwcd_ViewPrefs_NotificationObject));
693 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_IconListMode);
694 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_IconListMode))) SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
696 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_Mode);
697 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_Mode))) SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
699 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen);
700 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MaxLineLen))) SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
702 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine);
703 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLine))) SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
705 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus);
706 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLineOnFocus))) SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
708 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing);
709 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_HorizontalSpacing))) SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
711 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing);
712 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_VerticalSpacing))) SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
714 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing);
715 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_ImageSpacing))) SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
717 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding);
718 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_HorizontalPadding))) SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
720 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding);
721 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_VerticalPadding))) SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
723 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth);
724 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderWidth))) SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
726 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwcd_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight);
727 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderHeight))) SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
729 /* Configure notifications incase they get updated =) */
730 DoMethod
732 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_IconListMode, MUIV_EveryTime,
733 (IPTR) self, 3,
734 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_IconListMode
737 DoMethod
739 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_Mode, MUIV_EveryTime,
740 (IPTR) self, 3,
741 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_Mode
744 DoMethod
746 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MaxLineLen, MUIV_EveryTime,
747 (IPTR) self, 3,
748 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MaxLineLen
751 DoMethod
753 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLine, MUIV_EveryTime,
754 (IPTR) self, 3,
755 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLine
758 DoMethod
760 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLineOnFocus, MUIV_EveryTime,
761 (IPTR) self, 3,
762 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLineOnFocus
765 DoMethod
767 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_HorizontalSpacing, MUIV_EveryTime,
768 (IPTR) self, 3,
769 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_HorizontalSpacing
772 DoMethod
774 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_VerticalSpacing, MUIV_EveryTime,
775 (IPTR) self, 3,
776 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_VerticalSpacing
779 DoMethod
781 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_ImageSpacing, MUIV_EveryTime,
782 (IPTR) self, 3,
783 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_ImageSpacing
786 DoMethod
788 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_HorizontalPadding, MUIV_EveryTime,
789 (IPTR) self, 3,
790 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_HorizontalPadding
793 DoMethod
795 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_VerticalPadding, MUIV_EveryTime,
796 (IPTR) self, 3,
797 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_VerticalPadding
800 DoMethod
802 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderWidth, MUIV_EveryTime,
803 (IPTR) self, 3,
804 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderWidth
807 DoMethod
809 data->iwcd_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderHeight, MUIV_EveryTime,
810 (IPTR) self, 3,
811 MUIM_CallHook, &data->iwcd_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderHeight
815 if (prefs)
817 #ifdef __AROS__
818 ((struct IconWindowVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowVolumeList__HookFunc_UpdateNetworkPrefsFunc;
819 #else
820 ((struct IconWindowVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook = &Hook_UpdateNetworkPrefsFunc;
821 #endif
823 DoMethod
825 prefs, MUIM_Notify, MUIA_IconWindowExt_NetworkBrowser_Show, MUIV_EveryTime,
826 (IPTR) self, 3,
827 MUIM_CallHook, &((struct IconWindowVolumeList_DATA *)data)->iwvcd_UpdateNetworkPrefs_hook, (IPTR)CLASS
831 if (muiRenderInfo(self))
833 D(bug("[Wanderer:VolumeList] %s: Setting up EventHandler for (IDCMP_DISKINSERTED | IDCMP_DISKREMOVED)\n", __PRETTY_FUNCTION__));
835 data->iwcd_EventHandlerNode.ehn_Priority = 1;
836 data->iwcd_EventHandlerNode.ehn_Flags = MUI_EHF_GUIMODE;
837 data->iwcd_EventHandlerNode.ehn_Object = self;
838 data->iwcd_EventHandlerNode.ehn_Class = CLASS;
839 data->iwcd_EventHandlerNode.ehn_Events = IDCMP_DISKINSERTED | IDCMP_DISKREMOVED;
841 DoMethod(_win(self), MUIM_Window_AddEventHandler, &data->iwcd_EventHandlerNode);
843 else
845 D(bug("[Wanderer:VolumeList] %s: Couldnt add IDCMP EventHandler!\n", __PRETTY_FUNCTION__));
848 D(bug("[Wanderer:VolumeList] %s: Setup complete!\n", __PRETTY_FUNCTION__));
850 return TRUE;
854 ///IconWindowVolumeList__MUIM_Cleanup()
855 IPTR IconWindowVolumeList__MUIM_Cleanup
857 Class *CLASS, Object *self, Msg message
860 SETUP_INST_DATA;
862 Object *prefs = NULL;
864 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__));
865 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
867 if (prefs)
869 DoMethod
871 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_IconListMode, (IPTR)self
874 DoMethod
876 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_Mode, (IPTR)self
879 DoMethod
881 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MaxLineLen, (IPTR)self
884 DoMethod
886 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLine, (IPTR)self
889 DoMethod
891 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLineOnFocus, (IPTR)self
894 DoMethod
896 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_HorizontalSpacing, (IPTR)self
899 DoMethod
901 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_VerticalSpacing, (IPTR)self
904 DoMethod
906 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_ImageSpacing, (IPTR)self
909 DoMethod
911 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_HorizontalPadding, (IPTR)self
914 DoMethod
916 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_VerticalPadding, (IPTR)self
919 DoMethod
921 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderWidth, (IPTR)self
924 DoMethod
926 data->iwcd_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderHeight, (IPTR)self
930 if (prefs)
932 DoMethod
934 prefs,
935 MUIM_KillNotifyObj, MUIA_IconWindowExt_NetworkBrowser_Show, (IPTR) self
938 D(bug("[Wanderer:VolumeList] %s: Removing Disk Event Handler\n", __PRETTY_FUNCTION__));
939 DoMethod(_win(self), MUIM_Window_RemEventHandler, &data->iwcd_EventHandlerNode);
941 return DoSuperMethodA(CLASS, self, message);
945 ///IconWindowVolumeList__MUIM_HandleEvent()
946 IPTR IconWindowVolumeList__MUIM_HandleEvent
948 Class *CLASS, Object *self, struct MUIP_HandleEvent *message
951 //SETUP_INST_DATA;
953 struct IntuiMessage *imsg = message->imsg;
955 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__));
957 if(imsg->Class == IDCMP_DISKINSERTED)
959 D(bug("[Wanderer:VolumeList] %s: IDCMP_DISKINSERTED\n", __PRETTY_FUNCTION__));
960 DoMethod(self, MUIM_IconList_Update);
961 return(MUI_EventHandlerRC_Eat);
963 else if (imsg->Class == IDCMP_DISKREMOVED)
965 D(bug("[Wanderer:VolumeList] %s: IDCMP_DISKREMOVED\n", __PRETTY_FUNCTION__));
966 DoMethod(self, MUIM_IconList_Update);
967 return(MUI_EventHandlerRC_Eat);
969 return 0;
973 ///IconWindowVolumeList__MUIM_DrawBackground()
974 IPTR IconWindowVolumeList__MUIM_DrawBackground
976 Class *CLASS, Object *self, struct MUIP_DrawBackground *message
979 SETUP_INST_DATA;
981 IPTR retVal = (IPTR)TRUE;
982 IPTR clip = 0;
983 struct RastPort *DrawBackGround_RastPort;
984 struct IconWindowBackFillMsg DrawBackGround_BackFillMsg;
986 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__));
988 if ((iconwindow_BackFill_Active == NULL) ||
989 (data->iwcd_IconWindow == NULL))
991 D(bug("[Wanderer:VolumeList] %s: No Backfill support/Window not set .. causing parent class to render\n", __PRETTY_FUNCTION__));
992 goto iwc_ParentBackground;
995 DrawBackGround_RastPort = _rp(self);
997 if ((data->iwcd_RastPort != NULL) && (DrawBackGround_RastPort != data->iwcd_RastPort))
999 DrawBackGround_RastPort = data->iwcd_RastPort;
1001 DrawBackGround_BackFillMsg.AreaBounds.MinX = 0;
1002 DrawBackGround_BackFillMsg.AreaBounds.MinY = 0;
1003 DrawBackGround_BackFillMsg.AreaBounds.MaxX = _mwidth(self);
1004 DrawBackGround_BackFillMsg.AreaBounds.MaxY = _mheight(self);
1006 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left - _mleft(self);
1007 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top - _mtop(self);
1008 DrawBackGround_BackFillMsg.DrawBounds.MaxX = message->width;
1009 DrawBackGround_BackFillMsg.DrawBounds.MaxY = message->height;
1011 else
1013 DrawBackGround_BackFillMsg.AreaBounds.MinX = _mleft(self);
1014 DrawBackGround_BackFillMsg.AreaBounds.MinY = _mtop(self);
1015 DrawBackGround_BackFillMsg.AreaBounds.MaxX = (_mleft(self) + _mwidth(self));
1016 DrawBackGround_BackFillMsg.AreaBounds.MaxY = (_mtop(self) + _mheight(self));
1018 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left;
1019 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top;
1020 DrawBackGround_BackFillMsg.DrawBounds.MaxX = (message->left + message->width);
1021 DrawBackGround_BackFillMsg.DrawBounds.MaxY = (message->top + message->height);
1024 DrawBackGround_BackFillMsg.Layer = DrawBackGround_RastPort->Layer;
1026 /* Offset into source image (ala scroll bar position) */
1027 DrawBackGround_BackFillMsg.OffsetX = message->xoffset;
1028 DrawBackGround_BackFillMsg.OffsetY = message->yoffset;
1030 D(bug("[Wanderer:VolumeList] %s: RastPort @ 0x%p\n", __PRETTY_FUNCTION__, DrawBackGround_RastPort));
1032 if ((retVal = DoMethod(data->iwcd_IconWindow, MUIM_IconWindow_BackFill_DrawBackground, XGET(data->iwcd_IconWindow, MUIA_IconWindow_BackFillData), &DrawBackGround_BackFillMsg, DrawBackGround_RastPort)) == (IPTR)TRUE)
1034 D(bug("[Wanderer:VolumeList] %s: Backfill module rendered background ..\n", __PRETTY_FUNCTION__));
1035 return retVal;
1037 D(bug("[Wanderer:VolumeList] %s: Backfill module failed to render background ..\n", __PRETTY_FUNCTION__));
1039 iwc_ParentBackground:
1041 clip = (IPTR)MUI_AddClipping(muiRenderInfo(self), message->left, message->top, message->width, message->height);
1043 message->width = _mwidth(self);
1044 message->height = _mheight(self);
1045 message->left = _mleft(self);
1046 message->top = _mtop(self);
1048 retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1050 MUI_RemoveClipping(muiRenderInfo(self), (APTR)clip);
1052 return retVal;
1056 ///IconWindowVolumeList__MUIM_IconList_Update()
1057 IPTR IconWindowVolumeList__MUIM_IconList_Update
1059 Class *CLASS, Object *self, struct MUIP_IconList_Update *message
1062 SETUP_INST_DATA;
1064 IPTR retVal = (IPTR)TRUE;
1066 if ((BOOL)XGET(_win(self), MUIA_IconWindow_IsRoot))
1068 struct IconList_Entry *icon_entry = (IPTR)MUIV_IconList_NextIcon_Start;
1069 Object *prefs = NULL;
1070 BOOL sort_list = FALSE;
1072 D(bug("[Wanderer:VolumeList] %s: Causing parent to update\n", __PRETTY_FUNCTION__));
1073 retVal = DoSuperMethodA(CLASS, self, (Msg) message);
1075 D(bug("[Wanderer:VolumeList] %s: Check if we should show NetworkBrowser Icon ..\n", __PRETTY_FUNCTION__));
1077 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
1079 if (prefs)
1081 struct IconWindowVolumeList_DATA *volumel_data = (struct IconWindowVolumeList_DATA *)data;
1083 GET(prefs, MUIA_IconWindowExt_NetworkBrowser_Show, &volumel_data->iwvcd_ShowNetworkBrowser);
1085 #if defined(DEBUG_NETWORKBROWSER)
1086 volumel_data->iwvcd_ShowNetworkBrowser = TRUE;
1087 #endif
1089 if (volumel_data->iwvcd_ShowNetworkBrowser)
1091 struct DiskObject *_nb_dob = NULL;
1092 _nb_dob = GetIconTags
1094 "ENV:SYS/def_NetworkHost",
1095 ICONGETA_FailIfUnavailable, FALSE,
1096 ICONGETA_Label, (IPTR)"Network Access..",
1097 TAG_DONE
1100 D(bug("[Wanderer:VolumeList] %s: NetworkBrowser Icon DOB @ 0x%p\n", __PRETTY_FUNCTION__, _nb_dob));
1102 if (_nb_dob)
1104 struct Node *this_entry = NULL;
1105 if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, (IPTR)"?wanderer.networkbrowse?", (IPTR)"Network Access..", (IPTR)NULL, (IPTR)_nb_dob, 0)))
1107 this_entry->ln_Pri = 3; /// Network Access gets Priority 3 so its displayed after special dirs
1108 sort_list = TRUE;
1109 D(bug("[Wanderer:VolumeList] %s: NetworkBrowser Icon Entry @ 0x%p\n", __PRETTY_FUNCTION__, this_entry));
1114 GET(prefs, MUIA_IconWindowExt_UserFiles_ShowFilesFolder, &volumel_data->iwvcd_ShowUserFolder);
1116 #if defined(DEBUG_SHOWUSERFILES)
1117 volumel_data->iwvcd_ShowUserFolder = TRUE;
1118 #endif
1119 if (volumel_data->iwvcd_ShowUserFolder)
1121 if (GetVar("SYS/Wanderer/userfiles.prefs", __icwc_intern_TxtBuff, TXTBUFF_LEN, GVF_GLOBAL_ONLY) != -1)
1123 char * userfiles_path = NULL;
1125 D(bug("[Wanderer:VolumeList] %s: SYS/UserFilesLocation = '%s'\n", __PRETTY_FUNCTION__, __icwc_intern_TxtBuff));
1127 if ((userfiles_path = AllocVec(strlen(__icwc_intern_TxtBuff) + 1, MEMF_CLEAR|MEMF_PUBLIC)) != NULL)
1129 struct DiskObject *_nb_dob = NULL;
1131 volumel_data->iwvcd_UserFolderPath = userfiles_path;
1133 D(bug("[Wanderer:VolumeList] %s: UserFilesLocation Path storage @ 0x%p\n", __PRETTY_FUNCTION__, userfiles_path));
1135 strcpy(userfiles_path, __icwc_intern_TxtBuff);
1137 D(bug("[Wanderer:VolumeList] %s: UserFilesLocation Path storage contains '%s'\n", __PRETTY_FUNCTION__, userfiles_path));
1139 _nb_dob = GetIconTags
1141 "ENV:SYS/def_UserHome",
1142 ICONGETA_FailIfUnavailable, FALSE,
1143 ICONGETA_Label, (IPTR)"User Files..",
1144 TAG_DONE
1147 D(bug("[Wanderer:VolumeList] %s: UserFiles Icon DOB @ 0x%p\n", __PRETTY_FUNCTION__, _nb_dob));
1149 if (_nb_dob)
1151 struct Node *this_entry = NULL;
1152 if ((this_entry = (struct Node *)DoMethod(self, MUIM_IconList_CreateEntry, userfiles_path, (IPTR)"User Files..", (IPTR)NULL, (IPTR)_nb_dob, 0)))
1154 this_entry->ln_Pri = 5; /// Special dirs get Priority 5
1155 sort_list = TRUE;
1161 if (sort_list) DoMethod(self, MUIM_IconList_Sort);
1164 else
1166 retVal = TRUE;
1167 DoMethod(self, MUIM_IconList_Clear);
1170 return retVal;
1174 IPTR IconWindowVolumeList__MUIM_IconList_CreateEntry(struct IClass *CLASS, Object *obj, struct MUIP_IconList_CreateEntry *message)
1176 struct IconEntry *this_Icon = NULL;
1177 struct VolumeIcon_Private *volPrivate = NULL;
1179 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__));
1181 this_Icon = DoSuperMethodA(CLASS, obj, (Msg) message);
1183 if (this_Icon)
1185 D(bug("[Wanderer:VolumeList] %s: IconEntry Allocated @ %p\n", __PRETTY_FUNCTION__, this_Icon));
1187 volPrivate = this_Icon->ie_IconListEntry.udata;
1189 if ((this_Icon->ie_IconListEntry.type == ST_ROOT) && (volPrivate && ((volPrivate->vip_FLags & (ICONENTRY_VOL_OFFLINE|ICONENTRY_VOL_DISABLED)) == 0)))
1191 IconWindowVolumeList__Func_ParseBackdrop(CLASS, obj, this_Icon->ie_IconListEntry.label);
1194 return this_Icon;
1197 IPTR IconWindowVolumeList__MUIM_IconList_UpdateEntry(struct IClass *CLASS, Object *obj, struct MUIP_IconList_UpdateEntry *message)
1199 struct IconEntry *this_Icon = NULL;
1200 struct VolumeIcon_Private *volPrivate = NULL;
1202 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__));
1204 volPrivate = message->icon->ie_IconListEntry.udata;
1206 this_Icon = DoSuperMethodA(CLASS, obj, (Msg) message);
1208 return this_Icon;
1211 IPTR IconWindowVolumeList__MUIM_IconList_DestroyEntry(struct IClass *CLASS, Object *obj, struct MUIP_IconList_DestroyEntry *message)
1213 struct VolumeIcon_Private *volPrivate = NULL;
1214 IPTR rv = NULL;
1216 D(bug("[Wanderer:VolumeList]: %s()\n", __PRETTY_FUNCTION__));
1218 volPrivate = message->icon->ie_IconListEntry.udata;
1220 rv = DoSuperMethodA(CLASS, obj, (Msg) message);
1222 return rv;
1226 /*** Setup ******************************************************************/
1227 #ifdef __AROS__
1228 ICONWINDOWICONVOLUMELIST_CUSTOMCLASS
1230 IconWindowVolumeList, NULL, MUIC_IconVolumeList, NULL,
1231 OM_NEW, struct opSet *,
1232 OM_SET, struct opSet *,
1233 OM_GET, struct opGet *,
1234 MUIM_Setup, Msg,
1235 MUIM_Cleanup, Msg,
1236 MUIM_DrawBackground, Msg,
1237 MUIM_HandleEvent, Msg,
1238 MUIM_IconList_Update, struct MUIP_IconList_Update *,
1239 MUIM_IconList_CreateEntry, struct MUIP_IconList_CreateEntry *,
1240 MUIM_IconList_UpdateEntry, struct MUIP_IconList_UpdateEntry *,
1241 MUIM_IconList_DestroyEntry, struct MUIP_IconList_DestroyEntry *
1243 #else
1244 ICONWINDOWICONVOLUMELIST_CUSTOMCLASS
1246 IconWindowVolumeList, NULL, NULL, IconVolumeList_Class,
1247 OM_NEW, struct opSet *,
1248 OM_SET, struct opSet *,
1249 OM_GET, struct opGet *,
1250 MUIM_Setup, Msg,
1251 MUIM_Cleanup, Msg,
1252 MUIM_DrawBackground, Msg,
1253 MUIM_HandleEvent, Msg,
1254 MUIM_IconList_Update, struct MUIP_IconList_Update *,
1255 MUIM_IconList_CreateEntry, struct MUIP_IconList_CreateEntry *,
1256 MUIM_IconList_UpdateEntry, struct MUIP_IconList_UpdateEntry *,
1257 MUIM_IconList_DestroyEntry, struct MUIP_IconList_DestroyEntry *
1259 #endif