From a9084ac5618756fe728ee176100048e6f5b5f64b Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Tue, 27 Feb 2018 11:10:12 +0100 Subject: [PATCH] Add-ons: make NewGUI read dialogs from $addon_dir/gui/dialogs As for aircraft, an add-on can now add its custom dialogs in $addon_dir/gui/dialogs. This commit makes NewGUI consider this directory as a dialog-providing one for each registered add-on. --- src/GUI/new_gui.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/GUI/new_gui.cxx b/src/GUI/new_gui.cxx index a2d6b3979..58cd8dfa2 100644 --- a/src/GUI/new_gui.cxx +++ b/src/GUI/new_gui.cxx @@ -21,6 +21,7 @@ #include #include +#include #include
#if defined(SG_UNIX) && !defined(SG_MAC) @@ -82,7 +83,17 @@ NewGUI::init () if (aircraftDialogDir.exists()) { readDir(aircraftDialogDir); } - + + // Read XML dialogs made available by registered add-ons + const auto& addonManager = flightgear::addons::AddonManager::instance(); + for (const auto& addon: addonManager->registeredAddons()) { + SGPath addonDialogDir = addon->getBasePath() / "gui/dialogs"; + + if (addonDialogDir.exists()) { + readDir(addonDialogDir); + } + } + // Fix for http://code.google.com/p/flightgear-bugs/issues/detail?id=947 fgGetNode("sim/menubar")->setAttribute(SGPropertyNode::PRESERVE, true); _menubar->init();