Index: /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp	(revision 78396)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp	(revision 78397)
@@ -93,4 +93,5 @@
 
     /* Prepare Main event handlers: */
+#ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineDataChange,
             this, &UIMediumEnumerator::sltHandleMachineUpdate);
@@ -105,4 +106,16 @@
     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineRegistered,
             this, &UIMediumEnumerator::sltHandleMachineRegistration);
+#else /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
+    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigStorageControllerChange,
+            this, &UIMediumEnumerator::sltHandleStorageControllerChange);
+    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigStorageDeviceChange,
+            this, &UIMediumEnumerator::sltHandleStorageDeviceChange);
+    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMediumChange,
+            this, &UIMediumEnumerator::sltHandleMediumChange);
+    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMediumConfigChange,
+            this, &UIMediumEnumerator::sltHandleMediumConfigChange);
+    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMediumRegistered,
+            this, &UIMediumEnumerator::sltHandleMediumRegistered);
+#endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
 
     /* Prepare global thread-pool listener: */
@@ -234,4 +247,6 @@
 }
 
+#ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
+
 void UIMediumEnumerator::sltHandleMachineUpdate(const QUuid &uMachineID)
 {
@@ -333,4 +348,52 @@
 }
 
+#else /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
+
+void UIMediumEnumerator::sltHandleStorageControllerChange(const QUuid &uMachineId, const QString &strControllerName)
+{
+    //printf("OnStorageControllerChanged: machine-id=%s, controller-name=%s\n",
+    //       uMachineId.toString().toUtf8().constData(), strControllerName.toUtf8().constData());
+    LogRel2(("GUI: UIMediumEnumerator: OnStorageControllerChanged event received, Medium ID = {%s}, Controller Name = {%s}\n",
+             uMachineId.toString().toUtf8().constData(), strControllerName.toUtf8().constData()));
+}
+
+void UIMediumEnumerator::sltHandleStorageDeviceChange(CMediumAttachment comAttachment, bool fRemoved, bool fSilent)
+{
+    //printf("OnStorageDeviceChanged: removed=%d, silent=%d\n",
+    //       fRemoved, fSilent);
+    LogRel2(("GUI: UIMediumEnumerator: OnStorageDeviceChanged event received, Removed = {%d}, Silent = {%d}\n",
+             fRemoved, fSilent));
+
+    Q_UNUSED(comAttachment);
+}
+
+void UIMediumEnumerator::sltHandleMediumChange(CMediumAttachment comAttachment)
+{
+    //printf("OnMediumChanged\n");
+    LogRel2(("GUI: UIMediumEnumerator: OnMediumChanged event received\n"));
+
+    Q_UNUSED(comAttachment);
+}
+
+void UIMediumEnumerator::sltHandleMediumConfigChange(CMedium comMedium)
+{
+    //printf("OnMediumConfigChanged\n");
+    LogRel2(("GUI: UIMediumEnumerator: OnMediumConfigChanged event received\n"));
+
+    Q_UNUSED(comMedium);
+}
+
+void UIMediumEnumerator::sltHandleMediumRegistered(const QUuid &uMediumId, KDeviceType enmMediumType, bool fRegistered)
+{
+    //printf("OnMediumRegistered: medium-id=%s, medium-type=%d, registered=%d\n",
+    //       uMediumId.toString().toUtf8().constData(), enmMediumType, fRegistered);
+    //printf(" Medium to recache: %s\n",
+    //       uMediumId.toString().toUtf8().constData());
+    LogRel2(("GUI: UIMediumEnumerator: OnMediumRegistered event received, Medium ID = {%s}, Medium type = {%d}, Registered = {%d}\n",
+             uMediumId.toString().toUtf8().constData(), enmMediumType, fRegistered));
+}
+
+#endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
+
 void UIMediumEnumerator::sltHandleMediumEnumerationTaskComplete(UITask *pTask)
 {
@@ -449,4 +512,6 @@
     }
 }
+
+#ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
 
 void UIMediumEnumerator::calculateCachedUsage(const QUuid &uMachineID,
@@ -596,4 +661,6 @@
 }
 
+#endif /* !VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
+
 
 #include "UIMediumEnumerator.moc"
Index: /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h	(revision 78396)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h	(revision 78397)
@@ -22,4 +22,6 @@
 #endif
 
+//#define VBOX_GUI_WITH_NEW_MEDIA_EVENTS
+
 /* Qt includes: */
 #include <QObject>
@@ -30,4 +32,10 @@
 #include "UILibraryDefs.h"
 #include "UIMedium.h"
+
+/* COM includes: */
+#ifdef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
+# include "CMedium.h"
+# include "CMediumAttachment.h"
+#endif
 
 /* Forward declarations: */
@@ -92,4 +100,5 @@
 private slots:
 
+#ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
     /** Handles machine-data-change and snapshot-change events for a machine with specified @a uMachineID. */
     void sltHandleMachineUpdate(const QUuid &uMachineID);
@@ -99,4 +108,24 @@
     /** Handles snapshot-deleted events for a machine with specified @a uMachineID and a snapshot with specified @a uSnapshotID. */
     void sltHandleSnapshotDeleted(const QUuid &uMachineID, const QUuid &uSnapshotID);
+#else /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
+    /** Handles signal about storage controller change.
+      * @param  uMachineId         Brings the ID of machine corresponding controller belongs to.
+      * @param  strControllerName  Brings the name of controller this event is related to. */
+    void sltHandleStorageControllerChange(const QUuid &uMachineId, const QString &strControllerName);
+    /** Handles signal about storage device change.
+      * @param  comAttachment  Brings corresponding attachment.
+      * @param  fRemoved       Brings whether medium is removed or added.
+      * @param  fSilent        Brings whether this change has gone silent for guest. */
+    void sltHandleStorageDeviceChange(CMediumAttachment comAttachment, bool fRemoved, bool fSilent);
+    /** Handles signal about storage medium @a comAttachment state change. */
+    void sltHandleMediumChange(CMediumAttachment comAttachment);
+    /** Handles signal about storage @a comMedium config change. */
+    void sltHandleMediumConfigChange(CMedium comMedium);
+    /** Handles signal about storage medium is (un)registered.
+      * @param  uMediumId      Brings corresponding medium ID.
+      * @param  enmMediumType  Brings corresponding medium type.
+      * @param  fRegistered    Brings whether medium is registered or unregistered. */
+    void sltHandleMediumRegistered(const QUuid &uMediumId, KDeviceType enmMediumType, bool fRegistered);
+#endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
 
     /** Handles medium-enumeration @a pTask complete signal. */
@@ -112,4 +141,5 @@
     void addMediaToMap(const CMediumVector &inputMedia, UIMediumMap &outputMedia);
 
+#ifndef VBOX_GUI_WITH_NEW_MEDIA_EVENTS
     /** Updates usage for machine with specified @a uMachineID on the basis of cached data.
       * @param  previousUIMediumIDs               Brings UIMedium IDs used in cached data.
@@ -147,4 +177,5 @@
     void recacheFromActualUsage(const CMediumMap &currentCMediums,
                                 const QList<QUuid> &currentCMediumIDs);
+#endif /* !VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
 
     /** Holds whether consolidated medium-enumeration process is in progress. */
