Index: /trunk/src/VBox/Main/Global.cpp
===================================================================
--- /trunk/src/VBox/Main/Global.cpp	(revision 23647)
+++ /trunk/src/VBox/Main/Global.cpp	(revision 23648)
@@ -27,4 +27,5 @@
 
 #include <iprt/assert.h>
+#include <iprt/string.h>
 
 /* static */
@@ -168,14 +169,44 @@
  */
 /* static */
-const char *Global::OSTypeId (VBOXOSTYPE aOSType)
+const char *Global::OSTypeId(VBOXOSTYPE aOSType)
 {
-    for (size_t i = 0; i < RT_ELEMENTS (sOSTypes); ++ i)
+    for (size_t i = 0; i < RT_ELEMENTS(sOSTypes); ++i)
     {
-        if (sOSTypes [i].osType == aOSType)
-            return sOSTypes [i].id;
+        if (sOSTypes[i].osType == aOSType)
+            return sOSTypes[i].id;
     }
 
-    AssertMsgFailed (("No record for VBOXOSTYPE %d\n", aOSType));
-    return sOSTypes [0].id;
+    AssertMsgFailed(("No record for VBOXOSTYPE %d\n", aOSType));
+    return sOSTypes[0].id;
 }
+
+/*static*/ const char *
+Global::stringifyMachineState(MachineState_T aState)
+{
+    switch (aState)
+    {
+        case MachineState_Null:         return "Null";
+        case MachineState_PoweredOff:   return "PoweredOff";
+        case MachineState_Saved:        return "Saved";
+        case MachineState_Aborted:      return "Aborted";
+        case MachineState_Running:      return "Running";
+        case MachineState_Paused:       return "Paused";
+        case MachineState_Stuck:        return "GuruMeditation";
+        case MachineState_Starting:     return "Starting";
+        case MachineState_Stopping:     return "Stopping";
+        case MachineState_Saving:       return "Saving";
+        case MachineState_Restoring:    return "Restoring";
+        case MachineState_Discarding:   return "Discarding";
+        case MachineState_SettingUp:    return "SettingUp";
+        default:
+        {
+            AssertMsgFailed(("%d (%#x)\n", aState, aState));
+            static char s_szMsg[48];
+            RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidState-0x%08x\n", aState);
+            return s_szMsg;
+        }
+
+    }
+}
+
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
Index: /trunk/src/VBox/Main/include/Global.h
===================================================================
--- /trunk/src/VBox/Main/include/Global.h	(revision 23647)
+++ /trunk/src/VBox/Main/include/Global.h	(revision 23648)
@@ -64,7 +64,7 @@
     };
 
-    static const OSType sOSTypes [SchemaDefs::OSTypeId_COUNT];
+    static const OSType sOSTypes[SchemaDefs::OSTypeId_COUNT];
 
-    static const char *OSTypeId (VBOXOSTYPE aOSType);
+    static const char *OSTypeId(VBOXOSTYPE aOSType);
 
     /**
@@ -74,5 +74,5 @@
      * transitional states (see #IsTransitional()).
      */
-    static bool IsOnline (MachineState_T aState)
+    static bool IsOnline(MachineState_T aState)
     {
         return aState >= MachineState_FirstOnline &&
@@ -87,5 +87,5 @@
      * online states (see #IsOnline()).
      */
-    static bool IsTransient (MachineState_T aState)
+    static bool IsTransient(MachineState_T aState)
     {
         return aState >= MachineState_FirstTransient &&
@@ -98,7 +98,7 @@
      * another exclusive operation.
      */
-    static bool IsOnlineOrTransient (MachineState_T aState)
+    static bool IsOnlineOrTransient(MachineState_T aState)
     {
-        return IsOnline (aState) || IsTransient (aState);
+        return IsOnline(aState) || IsTransient(aState);
     }
 
@@ -110,10 +110,18 @@
      * or stopped, etc.
      */
-    static bool IsActive (MachineState_T aState)
+    static bool IsActive(MachineState_T aState)
     {
-        return IsOnline (aState) && !IsTransient (aState);
+        return IsOnline(aState) && !IsTransient(aState);
     }
+
+    /**
+     * Stringify a machine state.
+     *
+     * @returns Pointer to a read only string.
+     * @param   aState      Valid machine state.
+     */
+    static const char *stringifyMachineState(MachineState_T aState);
 };
 
-#endif /* ____H_GLOBAL */
+#endif /* !____H_GLOBAL */
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
