From c90908327cb1ec573b668f2762f85496444bf454 Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Sat, 2 Jul 2022 20:59:33 +0200 Subject: [PATCH] updated PathWidget to skip reloading if path has not changed --- src/gui/NavigationWidget.cxx | 5 +++++ src/gui/NavigationWidget.hxx | 9 +-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/gui/NavigationWidget.cxx b/src/gui/NavigationWidget.cxx index 7a56d649e..cccdda33f 100644 --- a/src/gui/NavigationWidget.cxx +++ b/src/gui/NavigationWidget.cxx @@ -154,6 +154,11 @@ NavigationWidget::PathWidget::PathWidget(GuiObject* boss, CommandReceiver* targe // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void NavigationWidget::PathWidget::setPath(const string& path) { + if(path == myLastPath) + return; + + myLastPath = path; + const int fontWidth = _font.getMaxCharWidth(); int x = _x + fontWidth, w = _w; FSNode node(path); diff --git a/src/gui/NavigationWidget.hxx b/src/gui/NavigationWidget.hxx index 1235083bb..072562a1b 100644 --- a/src/gui/NavigationWidget.hxx +++ b/src/gui/NavigationWidget.hxx @@ -71,14 +71,7 @@ class NavigationWidget : public Widget const string& getPath(int idx) const; private: - struct PathType - { - string path; - StaticTextWidget* widget{nullptr}; - - explicit PathType(const string& _path, StaticTextWidget* _widget) - : path{_path}, widget{_widget} {} - }; + string myLastPath; std::vector myFolderList; CommandReceiver* myTarget{nullptr};