From f6225f5cb75b24ba3a99e933b9444b05f6ef5fa7 Mon Sep 17 00:00:00 2001
From: mfranz <mfranz>
Date: Thu, 15 Dec 2005 20:07:14 +0000
Subject: [PATCH]          remove a few unused vars menubar: cosmetics of the
 day

---
 src/GUI/dialog.cxx  | 17 ++++++++++-------
 src/GUI/menubar.cxx |  9 +++++----
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/GUI/dialog.cxx b/src/GUI/dialog.cxx
index 1b9b0e95f..062acbe1b 100644
--- a/src/GUI/dialog.cxx
+++ b/src/GUI/dialog.cxx
@@ -525,7 +525,12 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
         return obj;
 
     } else if (type == "list") {
-        puList * obj = new puList(x, y, x + width, y + height);
+        vector<SGPropertyNode_ptr> value_nodes = props->getChildren("value");
+        char ** entries = make_char_array(value_nodes.size());
+        for (unsigned int i = 0; i < value_nodes.size(); i++)
+            entries[i] = strdup((char *)value_nodes[i]->getStringValue());
+
+        puList * obj = new puList(x, y, x + width, y + height, entries);
         setupObject(obj, props);
         setColor(obj, props);
         return obj;
@@ -590,10 +595,9 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
     } else if (type == "combo") {
         vector<SGPropertyNode_ptr> value_nodes = props->getChildren("value");
         char ** entries = make_char_array(value_nodes.size());
-        for (unsigned int i = 0, j = value_nodes.size() - 1;
-             i < value_nodes.size();
-             i++, j--)
+        for (unsigned int i = 0; i < value_nodes.size(); i++)
             entries[i] = strdup((char *)value_nodes[i]->getStringValue());
+
         puComboBox * obj = new puComboBox(x, y, x + width, y + height, entries,
                            props->getBoolValue("editable", false));
         setupObject(obj, props);
@@ -650,10 +654,9 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
             value_nodes.push_back(selection_node->getChild(q));
 
         char ** entries = make_char_array(value_nodes.size());
-        for (unsigned int i = 0, j = value_nodes.size() - 1;
-             i < value_nodes.size();
-             i++, j--)
+        for (unsigned int i = 0; i < value_nodes.size(); i++)
             entries[i] = strdup((char *)value_nodes[i]->getName());
+
         puSelectBox * obj =
             new puSelectBox(x, y, x + width, y + height, entries);
         setupObject(obj, props);
diff --git a/src/GUI/menubar.cxx b/src/GUI/menubar.cxx
index db26c919d..e37bb4caf 100644
--- a/src/GUI/menubar.cxx
+++ b/src/GUI/menubar.cxx
@@ -423,12 +423,13 @@ FGMenuBar::add_enabled_listener(SGPropertyNode * node)
 bool
 FGMenuBar::enable_item(const SGPropertyNode * node, bool state)
 {
-    if (!node || _objects.find(node->getPath()) == _objects.end()) {
-        SG_LOG(SG_GENERAL, SG_WARN, "Trying to enable/disable "
-            "non-existent menu item");
+    const char *path = node->getPath();
+    if (_objects.find(path) == _objects.end()) {
+        SG_LOG(SG_GENERAL, SG_ALERT, "Trying to enable/disable "
+            "non-existent menu item for node `" << path << '\'');
         return false;
     }
-    puObject *object = _objects[node->getPath()];
+    puObject *object = _objects[path];
     if (state)
         object->activate();
     else