]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
make frontend::Application a bit slimmer
[lyx.git] / src / LyXFunc.cpp
index 6b65f012419535c689b970dd2b939854f9164d88..0ec1e9c4e97e0b231b546e809066984d9f59fde2 100644 (file)
@@ -79,7 +79,6 @@
 #include "frontends/Dialogs.h"
 #include "frontends/FileDialog.h"
 #include "frontends/FontLoader.h"
-#include "frontends/Gui.h"
 #include "frontends/KeySymbol.h"
 #include "frontends/LyXView.h"
 #include "frontends/Selection.h"
@@ -137,6 +136,7 @@ using support::prefixIs;
 namespace Alert = frontend::Alert;
 
 extern bool quitting;
+extern bool use_gui;
 
 namespace {
 
@@ -701,7 +701,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
        }
        case LFUN_WINDOW_CLOSE: {
-               enable = (theApp()->gui().viewIds().size() > 1);
+               enable = (theApp()->viewIds().size() > 1);
                break;
        }
 
@@ -1244,7 +1244,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        // (leaving the event loop).
                        lyx_view_->message(from_utf8(N_("Exiting.")));
                        if (theBufferList().quitWriteAll())
-                               theApp()->gui().closeAllViews();
+                               theApp()->closeAllViews();
                        break;
 
                case LFUN_BUFFER_AUTO_SAVE:
@@ -1560,9 +1560,12 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        break;
                }
 
-               case LFUN_DIALOG_HIDE:
-                       LyX::cref().hideDialogs(argument, 0);
+               case LFUN_DIALOG_HIDE: {
+                       if (quitting || !use_gui)
+                               break;
+                       theApp()->hideDialogs(argument, 0);
                        break;
+               }
 
                case LFUN_DIALOG_TOGGLE: {
                        BOOST_ASSERT(lyx_view_);