]> git.mxchange.org Git - flightgear.git/commitdiff
Reset: GUI can be shutdown.
authorJames Turner <zakalawe@mac.com>
Sun, 6 Oct 2013 16:34:53 +0000 (17:34 +0100)
committerJames Turner <zakalawe@mac.com>
Tue, 29 Oct 2013 23:02:46 +0000 (23:02 +0000)
src/GUI/new_gui.cxx
src/GUI/new_gui.hxx

index 8ca5c12c5b9c03845f50713325e9aba92e1d4448..ca1c2f50d593a3d3bd00b40355765d046dc9475c 100644 (file)
@@ -52,18 +52,10 @@ using std::string;
 NewGUI::NewGUI () :
   _active_dialog(0)
 {
-#if defined(SG_MAC)
-    if (fgGetBool("/sim/menubar/native", true)) {
-        _menubar.reset(new FGCocoaMenuBar);
-        return;
-    }
-#endif
-  _menubar.reset(new FGPUIMenuBar);
 }
 
 NewGUI::~NewGUI ()
 {
-    _dialog_props.clear();
     for (_itt_t it = _colors.begin(); it != _colors.end(); ++it)
         delete it->second;
 }
@@ -71,6 +63,18 @@ NewGUI::~NewGUI ()
 void
 NewGUI::init ()
 {
+#if defined(SG_MAC)
+    if (fgGetBool("/sim/menubar/native", true)) {
+        _menubar.reset(new FGCocoaMenuBar);
+    }
+#endif
+    if (!_menubar.get()) {
+        _menubar.reset(new FGPUIMenuBar);
+    }
+    
+    fgTie("/sim/menubar/visibility", this,
+          &NewGUI::getMenuBarVisible, &NewGUI::setMenuBarVisible);
+    
     setStyle();
     SGPath p(globals->get_fg_root(), "gui/dialogs");
     readDir(p);
@@ -82,6 +86,14 @@ NewGUI::init ()
     _menubar->init();
 }
 
+void
+NewGUI::shutdown()
+{
+    fgUntie("/sim/menubar/visibility");
+    _menubar.reset();
+    _dialog_props.clear();
+}
+
 void
 NewGUI::reinit ()
 {
@@ -132,14 +144,11 @@ NewGUI::reset (bool reload)
 void
 NewGUI::bind ()
 {
-    fgTie("/sim/menubar/visibility", this,
-          &NewGUI::getMenuBarVisible, &NewGUI::setMenuBarVisible);
 }
 
 void
 NewGUI::unbind ()
 {
-    fgUntie("/sim/menubar/visibility");
 }
 
 void
index d0e09571304eb8b85692087fb59027fb380e89b1..d3ee2979e8cacdf6795517c8d1171e47f6fcd0a5 100644 (file)
@@ -46,6 +46,8 @@ public:
      */
     virtual void init ();
 
+    virtual void shutdown ();
+    
     /**
      * Reinitialize the GUI subsystem. Reloads all XML dialogs.
      */