Index: trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.cpp	(revision 44012)
+++ trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.cpp	(revision 44013)
@@ -37,27 +37,20 @@
     , m_iLastStep(-1)
 {
-    /* Setup size-policy: */
-    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-
-    /* Add item to the parent: */
+    /* Add set to the parent group: */
     parentItem()->addItem(this);
 
+    /* Prepare set: */
+    prepareSet();
+
     /* Prepare connections: */
-    connect(this, SIGNAL(sigStartFirstStep(QString)), this, SLOT(sltFirstStep(QString)), Qt::QueuedConnection);
-    connect(this, SIGNAL(sigSetPrepared()), this, SLOT(sltSetPrepared()), Qt::QueuedConnection);
-    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltMachineStateChange(QString)));
-    connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), this, SLOT(sltMachineAttributesChange(QString)));
-    connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(sltMachineAttributesChange(QString)));
-    connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
-    connect(&vboxGlobal(), SIGNAL(mediumEnumStarted()), this, SLOT(sltUpdateAppearance()));
-    connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), this, SLOT(sltUpdateAppearance()));
+    prepareConnections();
 }
 
 UIGDetailsSet::~UIGDetailsSet()
 {
-    /* Delete all the items: */
+    /* Cleanup items: */
     clearItems();
 
-    /* Remove item from the parent: */
+    /* Remove set from the parent group: */
     parentItem()->removeItem(this);
 }
@@ -66,6 +59,6 @@
 {
     /* Assign settings: */
+    m_machine = pItem->machine();
     m_fFullSet = fFullSet;
-    m_machine = pItem->machine();
     m_settings = settings;
 
@@ -74,16 +67,11 @@
 }
 
-const CMachine& UIGDetailsSet::machine() const
-{
-    return m_machine;
-}
-
 void UIGDetailsSet::sltFirstStep(QString strSetId)
 {
-    /* Clear step: */
+    /* Cleanup step: */
     delete m_pStep;
     m_pStep = 0;
 
-    /* Was that a requested set? */
+    /* Is step id valid? */
     if (strSetId != m_strSetId)
         return;
@@ -120,5 +108,5 @@
 {
     /* Is this our VM changed? */
-    if (machine().GetId() != strId)
+    if (m_machine.GetId() != strId)
         return;
 
@@ -134,5 +122,5 @@
 {
     /* Is this our VM changed? */
-    if (machine().GetId() != strId)
+    if (m_machine.GetId() != strId)
         return;
 
@@ -205,6 +193,6 @@
     switch (type)
     {
+        case UIGDetailsItemType_Element: return m_elements.values();
         case UIGDetailsItemType_Any: return items(UIGDetailsItemType_Element);
-        case UIGDetailsItemType_Element: return m_elements.values();
         default: AssertMsgFailed(("Invalid item type!")); break;
     }
@@ -216,6 +204,6 @@
     switch (type)
     {
+        case UIGDetailsItemType_Element: return !m_elements.isEmpty();
         case UIGDetailsItemType_Any: return hasItems(UIGDetailsItemType_Element);
-        case UIGDetailsItemType_Element: return !m_elements.isEmpty();
         default: AssertMsgFailed(("Invalid item type!")); break;
     }
@@ -227,9 +215,4 @@
     switch (type)
     {
-        case UIGDetailsItemType_Any:
-        {
-            clearItems(UIGDetailsItemType_Element);
-            break;
-        }
         case UIGDetailsItemType_Element:
         {
@@ -237,4 +220,9 @@
                 delete m_elements[iKey];
             AssertMsg(m_elements.isEmpty(), ("Set items cleanup failed!"));
+            break;
+        }
+        case UIGDetailsItemType_Any:
+        {
+            clearItems(UIGDetailsItemType_Element);
             break;
         }
@@ -253,4 +241,27 @@
         return pItem->toElement();
     return 0;
+}
+
+void UIGDetailsSet::prepareSet()
+{
+    /* Setup size-policy: */
+    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+}
+
+void UIGDetailsSet::prepareConnections()
+{
+    /* Build connections: */
+    connect(this, SIGNAL(sigStartFirstStep(QString)), this, SLOT(sltFirstStep(QString)), Qt::QueuedConnection);
+    connect(this, SIGNAL(sigSetPrepared()), this, SLOT(sltSetPrepared()), Qt::QueuedConnection);
+
+    /* Global-events connections: */
+    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltMachineStateChange(QString)));
+    connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), this, SLOT(sltMachineAttributesChange(QString)));
+    connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(sltMachineAttributesChange(QString)));
+    connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
+
+    /* Meidum-enumeration connections: */
+    connect(&vboxGlobal(), SIGNAL(mediumEnumStarted()), this, SLOT(sltUpdateAppearance()));
+    connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), this, SLOT(sltUpdateAppearance()));
 }
 
@@ -380,10 +391,10 @@
     foreach (UIGDetailsItem *pItem, items())
     {
-        /* Get particular element: */
+        /* Skip hidden: */
+        if (!pItem->isVisible())
+            continue;
+
+        /* For each particular element: */
         UIGDetailsElement *pElement = pItem->toElement();
-        if (!pElement->isVisible())
-            continue;
-
-        /* For each particular element: */
         switch (pElement->elementType())
         {
@@ -467,10 +478,12 @@
     }
 
-    /* Clear step: */
+    /* Cleanup step: */
     delete m_pStep;
     m_pStep = 0;
 
-    /* Prepare first element: */
+    /* Generate new set-id: */
     m_strSetId = QUuid::createUuid().toString();
+
+    /* Request to prepare first step: */
     emit sigStartFirstStep(m_strSetId);
 }
Index: trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.h	(revision 44012)
+++ trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.h	(revision 44013)
@@ -58,5 +58,5 @@
 
     /* API: Machine stuff: */
-    const CMachine& machine() const;
+    const CMachine& machine() const { return m_machine; }
 
 private slots:
@@ -87,5 +87,5 @@
     QVariant data(int iKey) const;
 
-    /* Children stuff: */
+    /* Hidden API: Children stuff: */
     void addItem(UIGDetailsItem *pItem);
     void removeItem(UIGDetailsItem *pItem);
@@ -94,4 +94,8 @@
     void clearItems(UIGDetailsItemType type = UIGDetailsItemType_Element);
     UIGDetailsElement* element(DetailsElementType elementType) const;
+
+    /* Helpers: Prepare stuff: */
+    void prepareSet();
+    void prepareConnections();
 
     /* Helpers: Layout stuff: */
