Index: trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h	(revision 1380)
+++ trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h	(revision 1381)
@@ -338,4 +338,6 @@
     bool startMachine (const QUuid &id);
 
+    void addMediaToList (const CUnknown&, VBoxDefs::DiskType);
+
     void startEnumeratingMedia();
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp	(revision 1380)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp	(revision 1381)
@@ -1147,4 +1147,25 @@
 
 /**
+ *  Appends media_list with passed disk & it's children
+ */
+void VBoxGlobal::addMediaToList (const CUnknown &aDisk,
+                                 VBoxDefs::DiskType aType)
+{
+    VBoxMedia media (aDisk, aType, VBoxMedia::Unknown);
+    media_list += media;
+    /* appending all vdi children */
+    if (aType == VBoxDefs::HD)
+    {
+        CHardDisk hd = aDisk;
+        CHardDiskEnumerator enumerator = hd.GetChildren().Enumerate();
+        while (enumerator.HasMore())
+        {
+            CHardDisk subHd = enumerator.GetNext();
+            addMediaToList (CUnknown (subHd), VBoxDefs::HD);
+        }
+    }
+}
+
+/**
  *  Starts a thread that asynchronously enumerates all currently registered
  *  media, checks for its accessibility and posts VBoxEnumerateMediaEvent
@@ -1168,25 +1189,18 @@
         return;
 
-    /* composes a list of all currently known media */
+    /* composes a list of all currently known media & their children */
     media_list.clear();
     {
         CHardDiskEnumerator enHD = vbox.GetHardDisks().Enumerate();
         while (enHD.HasMore())
-        {
-            CHardDisk hd = enHD.GetNext();
-            media_list += VBoxMedia (CUnknown (hd), VBoxDefs::HD, VBoxMedia::Unknown);
-        }
+            addMediaToList (CUnknown (enHD.GetNext()), VBoxDefs::HD);
+
         CDVDImageEnumerator enCD = vbox.GetDVDImages().Enumerate();
         while (enCD.HasMore())
-        {
-            CDVDImage cd = enCD.GetNext();
-            media_list += VBoxMedia (CUnknown (cd), VBoxDefs::CD, VBoxMedia::Unknown);
-        }
+            addMediaToList (CUnknown (enCD.GetNext()), VBoxDefs::CD);
+
         CFloppyImageEnumerator enFD = vbox.GetFloppyImages().Enumerate();
         while (enFD.HasMore())
-        {
-            CFloppyImage fd = enFD.GetNext();
-            media_list += VBoxMedia (CUnknown (fd), VBoxDefs::FD, VBoxMedia::Unknown);
-        }
+            addMediaToList (CUnknown (enFD.GetNext()), VBoxDefs::FD);
     }
 
@@ -1220,5 +1234,5 @@
                         CHardDisk hd = media.disk;
                         media.status =
-                            hd.GetAllAccessible() == TRUE ? VBoxMedia::Ok :
+                            hd.GetAccessible() == TRUE ? VBoxMedia::Ok :
                             hd.isOk() ? VBoxMedia::Inaccessible :
                             VBoxMedia::Error;
Index: trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaComboBox.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaComboBox.cpp	(revision 1380)
+++ trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaComboBox.cpp	(revision 1381)
@@ -137,6 +137,11 @@
     {
         case VBoxDefs::HD:
-            processHdMedia (aMedia);
+        {
+            /* ignoring non-root disks */
+            CHardDisk hd = aMedia.disk;
+            if (hd.GetParent().isNull())
+                processHdMedia (aMedia);
             break;
+        }
         case VBoxDefs::CD:
             processCdMedia (aMedia);
Index: trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui	(revision 1380)
+++ trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui	(revision 1381)
@@ -617,8 +617,7 @@
     <function access="private">updateCdItem( DiskImageItem*, const VBoxMedia &amp; )</function>
     <function access="private">updateFdItem( DiskImageItem*, const VBoxMedia &amp; )</function>
-    <function access="private" returnType="DiskImageItem*">createHdItem( QListView*, DiskImageItem*, const VBoxMedia &amp; )</function>
-    <function access="private" returnType="DiskImageItem*">createCdItem( QListView*, DiskImageItem*, const VBoxMedia &amp; )</function>
-    <function access="private" returnType="DiskImageItem*">createFdItem( QListView*, DiskImageItem*, const VBoxMedia &amp; )</function>
-    <function access="private">createHdChildren( DiskImageItem*, const VBoxMedia &amp; )</function>
+    <function access="private" returnType="DiskImageItem*">createHdItem( QListView*, const VBoxMedia &amp; )</function>
+    <function access="private" returnType="DiskImageItem*">createCdItem( QListView*, const VBoxMedia &amp; )</function>
+    <function access="private" returnType="DiskImageItem*">createFdItem( QListView*, const VBoxMedia &amp; )</function>
     <function access="protected">showEvent( QShowEvent * )</function>
     <function access="protected">resizeEvent( QResizeEvent* )</function>
Index: trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui.h	(revision 1380)
+++ trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui.h	(revision 1381)
@@ -35,4 +35,6 @@
 public:
 
+    enum { TypeId = 1001 };
+
     DiskImageItem (DiskImageItem *parent) :
         QListViewItem (parent), mStatus (VBoxMedia::Unknown) {}
@@ -90,5 +92,5 @@
     }
 
-    int rtti() const { return 1001; }
+    int rtti() const { return TypeId; }
 
     int compare (QListViewItem *aItem, int aColumn, bool aAscending) const
@@ -110,5 +112,5 @@
     {
         return (QListViewItem::nextSibling() &&
-                QListViewItem::nextSibling()->rtti() == 1001) ?
+                QListViewItem::nextSibling()->rtti() == DiskImageItem::TypeId) ?
                 static_cast<DiskImageItem*> (QListViewItem::nextSibling()) : 0;
     }
@@ -140,4 +142,25 @@
 
     VBoxMedia::Status mStatus;
+};
+
+
+class DiskImageItemIterator : public QListViewItemIterator
+{
+public:
+
+    DiskImageItemIterator (QListView* aList)
+        : QListViewItemIterator (aList) {}
+
+    DiskImageItem* operator*()
+    {
+        QListViewItem *item = QListViewItemIterator::operator*();
+        return item && item->rtti() == DiskImageItem::TypeId ?
+            static_cast<DiskImageItem*> (item) : 0;
+    }
+
+    DiskImageItemIterator& operator++()
+    {
+        return (DiskImageItemIterator&) QListViewItemIterator::operator++();
+    }
 };
 
@@ -464,5 +487,5 @@
     switch (aItem->rtti())
     {
-        case 1001:
+        case DiskImageItem::TypeId:
             tip = static_cast<DiskImageItem*> (aItem)->getToolTip();
             break;
@@ -768,8 +791,8 @@
     DiskImageItem *item = 0;
 
-    if (aList)
+    if (aRoot)
+        item = new DiskImageItem (aRoot);
+    else if (aList)
         item = new DiskImageItem (aList);
-    else if (aRoot)
-        item = new DiskImageItem (aRoot);
     else
         Assert (0);
@@ -1058,4 +1081,5 @@
                                             const VBoxMedia &aMedia)
 {
+    if (!aItem) return;
     CHardDisk hd = aMedia.disk;
     VBoxMedia::Status status = aMedia.status;
@@ -1105,4 +1129,5 @@
                                             const VBoxMedia &aMedia)
 {
+    if (!aItem) return;
     CDVDImage cd = aMedia.disk;
     VBoxMedia::Status status = aMedia.status;
@@ -1130,4 +1155,5 @@
                                             const VBoxMedia &aMedia)
 {
+    if (!aItem) return;
     CFloppyImage fd = aMedia.disk;
     VBoxMedia::Status status = aMedia.status;
@@ -1153,46 +1179,29 @@
 
 
-DiskImageItem* VBoxDiskImageManagerDlg::createHdItem (QListView       *aList,
-                                                      DiskImageItem   *aRoot,
+DiskImageItem* VBoxDiskImageManagerDlg::createHdItem (QListView *aList,
                                                       const VBoxMedia &aMedia)
 {
-    DiskImageItem *item = createImageNode (aList, aRoot);
+    CHardDisk hd = aMedia.disk;
+    QUuid rootId = hd.GetParent().isNull() ? QUuid() : hd.GetParent().GetId();
+    DiskImageItem *root = searchItem (aList, rootId);
+    DiskImageItem *item = createImageNode (aList, root);
     updateHdItem (item, aMedia);
-    createHdChildren (item, aMedia);
     return item;
 }
 
-DiskImageItem* VBoxDiskImageManagerDlg::createCdItem (QListView       *aList,
-                                                      DiskImageItem   *aRoot,
+DiskImageItem* VBoxDiskImageManagerDlg::createCdItem (QListView *aList,
                                                       const VBoxMedia &aMedia)
 {
-    DiskImageItem *item = createImageNode (aList, aRoot);
+    DiskImageItem *item = createImageNode (aList, 0);
     updateCdItem (item, aMedia);
     return item;
 }
 
-DiskImageItem* VBoxDiskImageManagerDlg::createFdItem (QListView       *aList,
-                                                      DiskImageItem   *aRoot,
+DiskImageItem* VBoxDiskImageManagerDlg::createFdItem (QListView *aList,
                                                       const VBoxMedia &aMedia)
 {
-    DiskImageItem *item = createImageNode (aList, aRoot);
+    DiskImageItem *item = createImageNode (aList, 0);
     updateFdItem (item, aMedia);
     return item;
-}
-
-void VBoxDiskImageManagerDlg::createHdChildren (DiskImageItem   *aRoot,
-                                                const VBoxMedia &aMedia)
-{
-    CHardDisk hd = aMedia.disk;
-    CHardDiskEnumerator enumerator = hd.GetChildren().Enumerate();
-    while (enumerator.HasMore())
-    {
-        CHardDisk subHd = enumerator.GetNext();
-        VBoxMedia::Status status =
-            subHd.GetAccessible() == TRUE ? VBoxMedia::Ok :
-            subHd.isOk() ? VBoxMedia::Inaccessible :
-            VBoxMedia::Error;
-        createHdItem (0, aRoot, VBoxMedia (CUnknown (subHd), VBoxDefs::HD, status));
-    }
 }
 
@@ -1222,14 +1231,13 @@
                                                     const QUuid &aId)
 {
-    DiskImageItem *item = 0, *iterator = 0;
-    if (aList->firstChild() && aList->firstChild()->rtti() == 1001)
-        iterator = static_cast<DiskImageItem*>(aList->firstChild());
-    while (iterator)
-    {
-        if (iterator->getUuid() == aId)
-            item = iterator;
-        iterator = iterator->nextSibling();
-    }
-    return item;
+    if (aId.isNull()) return 0;
+    DiskImageItemIterator iterator (aList);
+    while (*iterator)
+    {
+        if ((*iterator)->getUuid() == aId)
+            return *iterator;
+        ++iterator;
+    }
+    return 0;
 }
 
@@ -1383,5 +1391,5 @@
     {
         case VBoxDefs::HD:
-            item = createHdItem (hdsView, 0, aMedia);
+            item = createHdItem (hdsView, aMedia);
             if (item->getUuid() == hdSelectedId)
             {
@@ -1391,5 +1399,5 @@
             break;
         case VBoxDefs::CD:
-            item = createCdItem (cdsView, 0, aMedia);
+            item = createCdItem (cdsView, aMedia);
             if (item->getUuid() == cdSelectedId)
             {
@@ -1399,5 +1407,5 @@
             break;
         case VBoxDefs::FD:
-            item = createFdItem (fdsView, 0, aMedia);
+            item = createFdItem (fdsView, aMedia);
             if (item->getUuid() == fdSelectedId)
             {
@@ -1432,6 +1440,5 @@
             CHardDisk hd = aMedia.disk;
             item = searchItem (hdsView, hd.GetId());
-            if (item)
-                updateHdItem (item, aMedia);
+            updateHdItem (item, aMedia);
             break;
         }
@@ -1440,6 +1447,5 @@
             CDVDImage cd = aMedia.disk;
             item = searchItem (cdsView, cd.GetId());
-            if (item)
-                updateCdItem (item, aMedia);
+            updateCdItem (item, aMedia);
             break;
         }
@@ -1448,6 +1454,5 @@
             CFloppyImage fd = aMedia.disk;
             item = searchItem (fdsView, fd.GetId());
-            if (item)
-                updateFdItem (item, aMedia);
+            updateFdItem (item, aMedia);
             break;
         }
@@ -1531,13 +1536,16 @@
 
     item = hdsView->currentItem();
-    di = (item && item->rtti() == 1001) ? static_cast <DiskImageItem *> (item) : 0;
+    di = (item && item->rtti() == DiskImageItem::TypeId) ?
+        static_cast <DiskImageItem *> (item) : 0;
     hdSelectedId = di ? di->getUuid() : QString::null;
 
     item = cdsView->currentItem();
-    di = (item && item->rtti() == 1001) ? static_cast <DiskImageItem *> (item) : 0;
+    di = (item && item->rtti() == DiskImageItem::TypeId) ?
+        static_cast <DiskImageItem *> (item) : 0;
     cdSelectedId = di ? di->getUuid() : QString::null;
 
     item = fdsView->currentItem();
-    di = (item && item->rtti() == 1001) ? static_cast <DiskImageItem *> (item) : 0;
+    di = (item && item->rtti() == DiskImageItem::TypeId) ?
+        static_cast <DiskImageItem *> (item) : 0;
     fdSelectedId = di ? di->getUuid() : QString::null;
 
@@ -1656,5 +1664,5 @@
 void VBoxDiskImageManagerDlg::processCurrentChanged (QListViewItem *aItem)
 {
-    DiskImageItem *item = aItem && aItem->rtti() == 1001 ?
+    DiskImageItem *item = aItem && aItem->rtti() == DiskImageItem::TypeId ?
         static_cast<DiskImageItem*> (aItem) : 0;
 
@@ -1749,5 +1757,6 @@
     QListView *currentList = getCurrentListView();
     DiskImageItem *item =
-        currentList->currentItem() && currentList->currentItem()->rtti() == 1001 ?
+        currentList->currentItem() &&
+        currentList->currentItem()->rtti() == DiskImageItem::TypeId ?
         static_cast <DiskImageItem*> (currentList->currentItem()) : 0;
 
@@ -1806,5 +1815,6 @@
     QListView *currentList = getCurrentListView();
     DiskImageItem *item =
-        currentList->currentItem() && currentList->currentItem()->rtti() == 1001 ?
+        currentList->currentItem() &&
+        currentList->currentItem()->rtti() == DiskImageItem::TypeId ?
         static_cast<DiskImageItem*> (currentList->currentItem()) : 0;
     AssertMsg (item, ("Current item must not be null"));
@@ -1863,5 +1873,6 @@
     QListView *currentList = getCurrentListView();
     DiskImageItem *item =
-        currentList->currentItem() && currentList->currentItem()->rtti() == 1001 ?
+        currentList->currentItem() &&
+        currentList->currentItem()->rtti() == DiskImageItem::TypeId ?
         static_cast<DiskImageItem*> (currentList->currentItem()) : 0;
     AssertMsg (item, ("Current item must not be null"));
@@ -1996,6 +2007,6 @@
     QUuid uuid;
 
-    if ( currentList->selectedItem() &&
-         currentList->selectedItem()->rtti() == 1001 )
+    if (currentList->selectedItem() &&
+        currentList->selectedItem()->rtti() == DiskImageItem::TypeId)
         uuid = QUuid (static_cast<DiskImageItem *>(currentList->selectedItem())
                       ->getUuid());
@@ -2010,5 +2021,6 @@
     QString path;
 
-    if ( currentList->selectedItem() && currentList->selectedItem()->rtti() == 1001 )
+    if (currentList->selectedItem() &&
+        currentList->selectedItem()->rtti() == DiskImageItem::TypeId )
         path = static_cast<DiskImageItem*> (currentList->selectedItem())
                ->getPath().stripWhiteSpace();
