Index: trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp	(revision 92978)
+++ trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp	(revision 92979)
@@ -476,4 +476,14 @@
     Q_UNUSED(iIndex);
     setVerticalToolBarActionsEnabled();
+
+    /* Mark the current guest table: */
+    UIFileManagerGuestTable *pCurrentGuestTable = currentGuestTable();
+    for (int i = 0; i < m_pGuestTablesContainer->count(); ++i)
+    {
+        UIFileManagerGuestTable *pTable = qobject_cast<UIFileManagerGuestTable*>(m_pGuestTablesContainer->widget(i));
+        if (!pTable)
+            continue;
+        pTable->setIsCurrent(pTable == pCurrentGuestTable);
+    }
 }
 
@@ -700,4 +710,5 @@
         selectedMachines << item->id();
     }
+    QUuid lastSelection = selectedMachines.isEmpty() ? QUuid() : selectedMachines.last();
     /** Iterate through the current tabs and add any machine id for which we have a running guest session to the
       * list of machine ids we want to have a tab for: */
@@ -711,8 +722,8 @@
     }
 
-    setMachines(selectedMachines);
-}
-
-void UIFileManager::setMachines(const QVector<QUuid> &machineIds)
+    setMachines(selectedMachines, lastSelection);
+}
+
+void UIFileManager::setMachines(const QVector<QUuid> &machineIds, const QUuid &lastSelectedMachineId /* = QUuid() */)
 {
     AssertReturnVoid(m_pGuestTablesContainer);
@@ -732,5 +743,18 @@
     addTabs(newSelections);
     removeTabs(unselectedMachines);
-    m_pGuestTablesContainer->setCurrentIndex(m_pGuestTablesContainer->count()-1);
+    if (!lastSelectedMachineId.isNull())
+    {
+        int iIndexToSelect = -1;
+        for (int i = 0; i < m_pGuestTablesContainer->count() && iIndexToSelect == -1; ++i)
+        {
+            UIFileManagerGuestTable *pTable = qobject_cast<UIFileManagerGuestTable*>(m_pGuestTablesContainer->widget(i));
+            if (!pTable)
+                continue;
+            if (lastSelectedMachineId == pTable->machineId())
+                iIndexToSelect = i;
+        }
+        if (iIndexToSelect != -1)
+            m_pGuestTablesContainer->setCurrentIndex(iIndexToSelect);
+    }
 }
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.h	(revision 92978)
+++ trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.h	(revision 92979)
@@ -151,5 +151,5 @@
     void                      savePanelVisibility();
 
-    void setMachines(const QVector<QUuid> &machineIDs);
+    void setMachines(const QVector<QUuid> &machineIDs, const QUuid &lastSelectedMachineId = QUuid());
     void removeTabs(const QVector<QUuid> &machineIdsToRemove);
     void addTabs(const QVector<QUuid> &machineIdsToAdd);
Index: trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp	(revision 92978)
+++ trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp	(revision 92979)
@@ -378,4 +378,5 @@
     , m_comMachine(comMachine)
     , m_pGuestSessionPanel(0)
+    , m_fIsCurrent(false)
 {
     if (!m_comMachine.isNull())
@@ -653,4 +654,12 @@
 }
 
+void UIFileManagerGuestTable::setIsCurrent(bool fIsCurrent)
+{
+    if (m_fIsCurrent == fIsCurrent)
+        return;
+    m_fIsCurrent = fIsCurrent;
+    prepareActionConnections();
+}
+
 void UIFileManagerGuestTable::copyGuestToHost(const QString& hostDestinationPath)
 {
@@ -984,34 +993,37 @@
 }
 
+void UIFileManagerGuestTable::manageConnection(bool fConnect, QAction *pAction, void (UIFileManagerGuestTable::*fptr)(void))
+{
+    if (!pAction || !fptr)
+        return;
+    if (fConnect)
+        connect(pAction, &QAction::triggered, this, fptr);
+    else
+        disconnect(pAction, 0, this, 0);
+}
+
 void UIFileManagerGuestTable::prepareActionConnections()
 {
     if (m_pActionPool->action(UIActionIndex_M_FileManager_T_GuestSession))
-        connect(m_pActionPool->action(UIActionIndex_M_FileManager_T_GuestSession), &QAction::toggled,
-                this, &UIFileManagerGuestTable::sltGuestSessionPanelToggled);
-
-    connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoUp), &QAction::triggered,
-            this, &UIFileManagerTable::sltGoUp);
-    connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoHome), &QAction::triggered,
-            this, &UIFileManagerTable::sltGoHome);
-    connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Refresh), &QAction::triggered,
-            this, &UIFileManagerTable::sltRefresh);
-    connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Delete), &QAction::triggered,
-            this, &UIFileManagerTable::sltDelete);
-    connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Rename), &QAction::triggered,
-            this, &UIFileManagerTable::sltRename);
-    connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Copy), &QAction::triggered,
-            this, &UIFileManagerTable::sltCopy);
-    connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Cut), &QAction::triggered,
-            this, &UIFileManagerTable::sltCut);
-    connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Paste), &QAction::triggered,
-            this, &UIFileManagerTable::sltPaste);
-    connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_SelectAll), &QAction::triggered,
-            this, &UIFileManagerTable::sltSelectAll);
-    connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_InvertSelection), &QAction::triggered,
-            this, &UIFileManagerTable::sltInvertSelection);
-    connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_ShowProperties), &QAction::triggered,
-            this, &UIFileManagerTable::sltShowProperties);
-    connect(m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_CreateNewDirectory), &QAction::triggered,
-            this, &UIFileManagerTable::sltCreateNewDirectory);
+    {
+        if (m_fIsCurrent)
+            connect(m_pActionPool->action(UIActionIndex_M_FileManager_T_GuestSession), &QAction::toggled,
+                    this, &UIFileManagerGuestTable::sltGuestSessionPanelToggled);
+        else
+            disconnect(m_pActionPool->action(UIActionIndex_M_FileManager_T_GuestSession), 0, this, 0);
+    }
+
+    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoUp), &UIFileManagerTable::sltGoUp);
+    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_GoHome), &UIFileManagerTable::sltGoHome);
+    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Refresh), &UIFileManagerTable::sltRefresh);
+    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Delete), &UIFileManagerTable::sltDelete);
+    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Rename), &UIFileManagerTable::sltRename);
+    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Copy), &UIFileManagerTable::sltCopy);
+    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Cut), &UIFileManagerTable::sltCut);
+    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_Paste), &UIFileManagerTable::sltPaste);
+    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_SelectAll), &UIFileManagerTable::sltSelectAll);
+    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_InvertSelection), &UIFileManagerTable::sltInvertSelection);
+    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_ShowProperties), &UIFileManagerTable::sltShowProperties);
+    manageConnection(m_fIsCurrent, m_pActionPool->action(UIActionIndex_M_FileManager_S_Guest_CreateNewDirectory), &UIFileManagerTable::sltCreateNewDirectory);
 }
 
Index: trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.h	(revision 92978)
+++ trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.h	(revision 92979)
@@ -65,4 +65,5 @@
     QUuid machineId();
     bool isGuestSessionRunning() const;
+    void setIsCurrent(bool fIsCurrent);
 
 protected:
@@ -142,5 +143,5 @@
     void initFileTable();
     void cleanAll();
-
+    void manageConnection(bool fConnect, QAction *pAction, void (UIFileManagerGuestTable::*fptr)(void));
     CGuest          m_comGuest;
     CGuestSession   m_comGuestSession;
@@ -156,5 +157,6 @@
     CEventListener m_comConsoleListener;
     UIGuestSessionCreateWidget *m_pGuestSessionPanel;
-;
+    /** True if this table is the current table in parents tab widget. */
+    bool m_fIsCurrent;
     State m_enmState;
 };
