Index: src/plugin/src/xplra/Globals.cc
===================================================================
--- src/plugin/src/xplra/Globals.cc	(revision 44)
+++ src/plugin/src/xplra/Globals.cc	(revision 44)
@@ -0,0 +1,54 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "Globals.h"
+
+#include <XPLMUtilities.h>
+
+//------------------------------------------------------------------------------
+
+using xplra::Globals;
+
+//------------------------------------------------------------------------------
+
+Globals::Globals() :
+    menu(messageWindow)
+{
+    XPLMHostApplicationID hostID = 0;
+    XPLMGetVersions(&xplaneVersion, &xplmVersion, &hostID);
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/Globals.h
===================================================================
--- src/plugin/src/xplra/Globals.h	(revision 44)
+++ src/plugin/src/xplra/Globals.h	(revision 44)
@@ -0,0 +1,114 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_GLOBALS_H
+#define XPLRA_GLOBALS_H
+//------------------------------------------------------------------------------
+
+#include "MessageWindow.h"
+#include "Menu.h"
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Class containing the globals for the enabled instance of the
+ * plugin.
+ */
+class Globals
+{
+private:
+    /**
+     * The version of X-Plane.
+     */
+    int xplaneVersion;
+
+    /**
+     * The version of the XPLM library.
+     */
+    int xplmVersion;
+
+    /**
+     * The message window.
+     */
+    MessageWindow messageWindow;
+
+    /**
+     * The menu.
+     */
+    Menu menu;
+
+public:
+    /**
+     * Construct the globals.
+     */
+    Globals();
+
+    /**
+     * Get the versions.
+     */
+    void getVersions(int& xplaneV, int& xplmV) const;
+
+    /**
+     * Get the message window.
+     */
+    MessageWindow& getMessageWindow();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline MessageWindow& Globals::getMessageWindow()
+{
+    return messageWindow;
+}
+
+//------------------------------------------------------------------------------
+
+inline void Globals::getVersions(int& xplaneV, int& xplmV) const
+{
+    xplaneV = xplaneVersion;
+    xplmV = xplmVersion;
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_GLOBALS_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/plugin/src/xplra/ListenThread.h
===================================================================
--- src/plugin/src/xplra/ListenThread.h	(revision 38)
+++ src/plugin/src/xplra/ListenThread.h	(revision 44)
@@ -44,5 +44,5 @@
 //------------------------------------------------------------------------------
 
-class MessageWindow;
+class Globals;
 
 //------------------------------------------------------------------------------
@@ -58,17 +58,7 @@
 private:
     /**
-     * The version of X-Plane.
+     * The global objects.
      */
-    int xplaneVersion;
-
-    /**
-     * The version of the XPLM library.
-     */
-    int xplmVersion;
-
-    /**
-     * The message window for showing messages.
-     */
-    MessageWindow& messageWindow;
+    Globals& globals;
 
     /**
@@ -92,16 +82,10 @@
      * Construct the thread.
      */
-    ListenThread(int xplaneVersion, int xplmVersion,
-                 MessageWindow& messageWindow);
+    ListenThread(Globals& globals);
 
     /**
-     * Get the versions
+     * Get the globals
      */
-    void getVersions(int& xplane, int& xplm) const;
-
-    /**
-     * Get the message window.
-     */
-    MessageWindow& getMessageWindow();
+    Globals& getGlobals();
 
     /**
@@ -120,10 +104,7 @@
 //------------------------------------------------------------------------------
 
-inline ListenThread::ListenThread(int xplaneVersion, int xplmVersion,
-                                  MessageWindow& messageWindow) :
+inline ListenThread::ListenThread(Globals& globals) :
     Thread(true),
-    xplaneVersion(xplaneVersion),
-    xplmVersion(xplmVersion),
-    messageWindow(messageWindow),
+    globals(globals),
     quitEvent(&waiter)
 {
@@ -132,15 +113,7 @@
 //------------------------------------------------------------------------------
 
-inline void ListenThread::getVersions(int& xplane, int& xplm) const
+inline Globals& ListenThread::getGlobals()
 {
-    xplane = xplaneVersion;
-    xplm = xplmVersion;
-}
-
-//------------------------------------------------------------------------------
-
-inline MessageWindow& ListenThread::getMessageWindow()
-{
-    return messageWindow;
+    return globals;
 }
 
Index: src/plugin/src/xplra/Makefile.am
===================================================================
--- src/plugin/src/xplra/Makefile.am	(revision 43)
+++ src/plugin/src/xplra/Makefile.am	(revision 44)
@@ -18,4 +18,5 @@
 	SetMultiDataRefRequest.cc	\
 	ReloadPluginsRequest.cc		\
+	Globals.cc			\
 	MessageWindow.cc		\
 	MessageRequest.cc		\
@@ -37,4 +38,5 @@
 	SetMultiDataRefRequest.h	\
 	ReloadPluginsRequest.h		\
+	Globals.h			\
 	MessageWindow.h			\
 	MessageRequest.h		\
Index: src/plugin/src/xplra/ServerThread.cc
===================================================================
--- src/plugin/src/xplra/ServerThread.cc	(revision 39)
+++ src/plugin/src/xplra/ServerThread.cc	(revision 44)
@@ -41,4 +41,5 @@
 #include "ReloadPluginsRequest.h"
 #include "MessageRequest.h"
+#include "Globals.h"
 
 #include <hu/varadiistvan/xplcommon/Util.h>
@@ -400,5 +401,5 @@
     int xplmVersion = 0;
 
-    listenThread.getVersions(xplaneVersion, xplmVersion);
+    listenThread.getGlobals().getVersions(xplaneVersion, xplmVersion);
 
     stream.writeU8(Protocol::RESULT_OK);
@@ -433,5 +434,6 @@
         stream.writeU8(Protocol::RESULT_INVALID_DURATION);
     } else {
-        MessageRequest request(listenThread.getMessageWindow(), message, duration);
+        MessageRequest request(listenThread.getGlobals().getMessageWindow(),
+                               message, duration);
         if (!requestQueue.execute(&request)) return false;
 
Index: src/plugin/src/xplra/plugin.cc
===================================================================
--- src/plugin/src/xplra/plugin.cc	(revision 43)
+++ src/plugin/src/xplra/plugin.cc	(revision 44)
@@ -31,6 +31,5 @@
 #include "ListenThread.h"
 
-#include "MessageWindow.h"
-#include "Menu.h"
+#include "Globals.h"
 
 #include <hu/varadiistvan/xplcommon/Util.h>
@@ -38,5 +37,4 @@
 
 #include <XPLMDefs.h>
-#include <XPLMUtilities.h>
 #include <XPLMProcessing.h>
 #include <XPLMMenus.h>
@@ -53,6 +51,5 @@
 
 using xplra::ListenThread;
-using xplra::MessageWindow;
-using xplra::Menu;
+using xplra::Globals;
 
 using hu::varadiistvan::xplcommon::Util;
@@ -61,12 +58,7 @@
 
 /**
- * The window to display messages from the clients.
+ * The global objects.
  */
-static MessageWindow* messageWindow = 0;
-
-/**
- * The menu.
- */
-static Menu* menu = 0;
+static Globals* globals = 0;
 
 /**
@@ -100,14 +92,7 @@
     // XPLMRegisterFlightLoopCallback(&callback, 5.0, 0);
 
-    int xplaneVersion = 0;
-    int xplmVersion = 0;
-    XPLMHostApplicationID hostID = 0;
-    XPLMGetVersions(&xplaneVersion, &xplmVersion, &hostID);
+    globals = new Globals();
 
-    messageWindow = new MessageWindow();
-    menu = new Menu(*messageWindow);
-
-    listenThread = new ListenThread(xplaneVersion, xplmVersion,
-                                    *messageWindow);
+    listenThread = new ListenThread(*globals);
     listenThread->start();
 }
@@ -134,6 +119,5 @@
     }
 
-    delete menu; menu = 0;
-    delete messageWindow; messageWindow = 0;
+    delete globals; globals = 0;
 }
 
