Index: /trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp	(revision 51568)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp	(revision 51569)
@@ -826,4 +826,27 @@
 }
 
+int UIExtraDataManager::hostScreenForPassedGuestScreen(int iGuestScreenIndex, const QString &strID)
+{
+    /* Choose corresponding key: */
+    const QString strKey = extraDataKeyPerScreen(GUI_VirtualScreenToHostScreen, iGuestScreenIndex, true);
+
+    /* Load value and convert it to index: */
+    const QString strValue = extraDataString(strKey, strID);
+    bool fOk = false;
+    const int iHostScreenIndex = strValue.toULong(&fOk);
+
+    /* Return corresponding index: */
+    return fOk ? iHostScreenIndex : -1;
+}
+
+void UIExtraDataManager::setHostScreenForPassedGuestScreen(int iGuestScreenIndex, int iHostScreenIndex, const QString &strID)
+{
+    /* Choose corresponding key: */
+    const QString strKey = extraDataKeyPerScreen(GUI_VirtualScreenToHostScreen, iGuestScreenIndex, true);
+
+    /* Save passed index under corresponding value: */
+    setExtraDataString(strKey, iHostScreenIndex != -1 ? QString::number(iHostScreenIndex) : QString(), strID);
+}
+
 MachineCloseAction UIExtraDataManager::restrictedMachineCloseActions(const QString &strID) const
 {
@@ -1203,7 +1226,7 @@
 
 /* static */
-QString UIExtraDataManager::extraDataKeyPerScreen(const QString &strBase, ulong uScreenIndex)
-{
-    return uScreenIndex ? strBase + QString::number(uScreenIndex) : strBase;
+QString UIExtraDataManager::extraDataKeyPerScreen(const QString &strBase, ulong uScreenIndex, bool fSameRuleForPrimary /* = false */)
+{
+    return fSameRuleForPrimary || uScreenIndex ? strBase + QString::number(uScreenIndex) : strBase;
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h	(revision 51568)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h	(revision 51569)
@@ -235,4 +235,9 @@
     void setRequestedVisualState(UIVisualStateType visualState, const QString &strID);
 
+    /** Returns host-screen index corresponding to passed guest-screen @a iGuestScreenIndex. */
+    int hostScreenForPassedGuestScreen(int iGuestScreenIndex, const QString &strID);
+    /** Defines host-screen index corresponding to passed guest-screen @a iGuestScreenIndex as @a iHostScreenIndex. */
+    void setHostScreenForPassedGuestScreen(int iGuestScreenIndex, int iHostScreenIndex, const QString &strID);
+
     /** Returns default machine close action. */
     MachineCloseAction defaultMachineCloseAction(const QString &strID) const;
@@ -315,7 +320,7 @@
     void setExtraDataStringList(const QString &strKey, const QStringList &strValue, const QString &strID = m_sstrGlobalID);
 
-    /** Return a string consisting of @a strBase with a suffix for the passed screen.
-      * Used for storing per-screen extra-data. */
-    static QString extraDataKeyPerScreen(const QString &strBase, ulong uScreenIndex);
+    /** Returns string consisting of @a strBase appended with @a uScreenIndex for the *non-primary* screen-index.
+      * If @a fSameRuleForPrimary is 'true' same rule will be used for *primary* screen-index. Used for storing per-screen extra-data. */
+    static QString extraDataKeyPerScreen(const QString &strBase, ulong uScreenIndex, bool fSameRuleForPrimary = false);
 
     /** Singleton Extra-data Manager instance. */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp	(revision 51568)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp	(revision 51569)
@@ -93,11 +93,7 @@
         {
             /* If the user ever selected a combination in the view menu, we have the following entry: */
-            QString strTest = machine.GetExtraData(QString("%1%2").arg(GUI_VirtualScreenToHostScreen).arg(iGuestScreen));
-            bool fOk;
-            /* Check is this value can be converted: */
-            iHostScreen = strTest.toInt(&fOk);
+            iHostScreen = gEDataManager->hostScreenForPassedGuestScreen(iGuestScreen, vboxGlobal().managedVMUuid());
             /* Revalidate: */
-            fValid =    fOk /* Valid data */
-                     && iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */
+            fValid =    iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */
                      && m_screenMap.key(iHostScreen, -1) == -1; /* Not taken already? */
         }
@@ -379,8 +375,5 @@
         int iHostScreen = m_screenMap.value(iGuestScreen, -1);
         if (fWithSave)
-        {
-            QString strHostScreen(iHostScreen != -1 ? QString::number(iHostScreen) : QString());
-            machine.SetExtraData(QString("%1%2").arg(GUI_VirtualScreenToHostScreen).arg(iViewAction), strHostScreen);
-        }
+            gEDataManager->setHostScreenForPassedGuestScreen(iViewAction, iHostScreen, vboxGlobal().managedVMUuid());
         QList<QAction*> screenActions = viewActions.at(iViewAction)->menu()->actions();
         /* Update screen actions: */
