Index: trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp	(revision 45196)
+++ trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp	(revision 45198)
@@ -292,10 +292,10 @@
 void UISettingsDialog::setDialogType(SettingsDialogType settingsDialogType)
 {
+    /* Remember new dialog-type: */
     m_dialogType = settingsDialogType;
-    for (int iWidgetNumber = 0; iWidgetNumber < m_pStack->count(); ++iWidgetNumber)
-    {
-        UISettingsPage *pPage = static_cast<UISettingsPage*>(m_pStack->widget(iWidgetNumber));
+
+    /* Propagate it to settings-page(s): */
+    foreach (UISettingsPage *pPage, m_pSelector->settingPages())
         pPage->setDialogType(dialogType());
-    }
 }
 
@@ -350,26 +350,16 @@
                                int iParentId /* = -1 */)
 {
-    QWidget *pPage = m_pSelector->addItem(strBigIcon, strBigIconDisabled,
-                                          strSmallIcon, strSmallIconDisabled,
-                                          cId, strLink, pSettingsPage, iParentId);
-    if (pPage)
-    {
-#ifdef Q_WS_MAC
-        /* On OSX we add a stretch to the vertical end to make sure the page is
-         * always top aligned. */
-        QWidget *pW = new QWidget();
-        pW->setContentsMargins(0, 0, 0, 0);
-        QVBoxLayout *pBox = new QVBoxLayout(pW);
-        VBoxGlobal::setLayoutMargin(pBox, 0);
-        pBox->addWidget(pPage);
-        pBox->addStretch(0);
-        m_pages[cId] = m_pStack->addWidget(pW);
-#else /* Q_WS_MAC */
+    /* Add new selector item: */
+    if (QWidget *pPage = m_pSelector->addItem(strBigIcon, strBigIconDisabled,
+                                              strSmallIcon, strSmallIconDisabled,
+                                              cId, strLink, pSettingsPage, iParentId))
+    {
+        /* Add stack-widget page if created: */
         m_pages[cId] = m_pStack->addWidget(pPage);
-#endif /* !Q_WS_MAC */
-        /* Update process bar: */
+        /* Update process-bar: */
         m_pProcessBar->setMinimum(0);
         m_pProcessBar->setMaximum(m_pStack->count());
     }
+    /* Assign validator if necessary: */
     if (pSettingsPage)
         assignValidator(pSettingsPage);
Index: trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp	(revision 45196)
+++ trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp	(revision 45198)
@@ -575,6 +575,8 @@
     m_machine = vboxGlobal().virtualBox().FindMachine(m_strMachineId);
     AssertMsg(!m_machine.isNull(), ("Can't find corresponding machine!\n"));
-    /* Assign current dialog type: */
-    setDialogType(determineSettingsDialogType(m_machine.GetSessionState(), m_machine.GetState()));
+    m_sessionState = m_machine.GetSessionState();
+    m_machineState = m_machine.GetState();
+    /* Recalculate current dialog-type: */
+    updateDialogType();
 
     /* Creating settings pages: */
@@ -991,4 +993,6 @@
 
     /* Make sure settings dialog will be updated on machine state/data changes: */
+    connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)),
+            this, SLOT(sltSessionStateChanged(QString, KSessionState)));
     connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)),
             this, SLOT(sltMachineStateChanged(QString, KMachineState)));
@@ -1012,5 +1016,5 @@
 }
 
-void UISettingsDialogMachine::sltMachineStateChanged(QString strMachineId, KMachineState machineState)
+void UISettingsDialogMachine::sltSessionStateChanged(QString strMachineId, KSessionState sessionState)
 {
     /* Ignore if thats NOT our VM: */
@@ -1019,4 +1023,21 @@
 
     /* Ignore if state was NOT actually changed: */
+    if (m_sessionState == sessionState)
+        return;
+
+    /* Update current session state: */
+    m_sessionState = sessionState;
+
+    /* Update dialog-type if necessary: */
+    updateDialogType();
+}
+
+void UISettingsDialogMachine::sltMachineStateChanged(QString strMachineId, KMachineState machineState)
+{
+    /* Ignore if thats NOT our VM: */
+    if (strMachineId != m_strMachineId)
+        return;
+
+    /* Ignore if state was NOT actually changed: */
     if (m_machineState == machineState)
         return;
@@ -1025,20 +1046,6 @@
     m_machineState = machineState;
 
-    /* Get new dialog type: */
-    SettingsDialogType newDialogType = determineSettingsDialogType(m_machine.GetSessionState(), m_machineState);
-
-    /* Ignore if dialog type was NOT actually changed: */
-    if (dialogType() == newDialogType)
-        return;
-
-    /* Should we show a warning about leaving 'offline' state? */
-    bool fShouldWe = dialogType() == SettingsDialogType_Offline;
-
-    /* Update current dialog type: */
-    setDialogType(newDialogType);
-
-    /* Show a warning about leaving 'offline' state if we should: */
-    if (isSettingsChanged() && fShouldWe)
-        msgCenter().warnAboutStateChange(this);
+    /* Update dialog-type if necessary: */
+    updateDialogType();
 }
 
@@ -1130,9 +1137,8 @@
 {
     bool fIsSettingsChanged = false;
-    for (int iWidgetNumber = 0; iWidgetNumber < m_pStack->count() && !fIsSettingsChanged; ++iWidgetNumber)
-    {
-        UISettingsPage *pPage = static_cast<UISettingsPage*>(m_pStack->widget(iWidgetNumber));
+    foreach (UISettingsPage *pPage, m_pSelector->settingPages())
+    {
         pPage->putToCache();
-        if (pPage->changed())
+        if (!fIsSettingsChanged && pPage->changed())
             fIsSettingsChanged = true;
     }
@@ -1140,4 +1146,24 @@
 }
 
+void UISettingsDialogMachine::updateDialogType()
+{
+    /* Get new dialog type: */
+    SettingsDialogType newDialogType = determineSettingsDialogType(m_sessionState, m_machineState);
+
+    /* Ignore if dialog type was NOT actually changed: */
+    if (dialogType() == newDialogType)
+        return;
+
+    /* Should we show a warning about leaving 'offline' state? */
+    bool fShouldWe = dialogType() == SettingsDialogType_Offline;
+
+    /* Update current dialog type: */
+    setDialogType(newDialogType);
+
+    /* Show a warning about leaving 'offline' state if we should: */
+    if (isSettingsChanged() && fShouldWe)
+        msgCenter().warnAboutStateChange(this);
+}
+
 # include "UISettingsDialogSpecific.moc"
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h	(revision 45196)
+++ trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h	(revision 45198)
@@ -109,4 +109,5 @@
     void sltMarkLoaded();
     void sltMarkSaved();
+    void sltSessionStateChanged(QString strMachineId, KSessionState sessionState);
     void sltMachineStateChanged(QString strMachineId, KMachineState machineState);
     void sltMachineDataChanged(QString strMachineId);
@@ -120,6 +121,8 @@
     bool isPageAvailable(int iPageId);
     bool isSettingsChanged();
+    void updateDialogType();
 
     QString m_strMachineId;
+    KSessionState m_sessionState;
     KMachineState m_machineState;
 
