# HG changeset patch # User Torsten # Date 1429983807 -7200 # Node ID d7bea5b11fc354604b84a08ce6f907267d649636 # Parent 0d56160e346d5d1fe7cac15ce6feed19655a3106 only update file browser and dir selection box when on top-level (bug #44622) * main-window.cc (change_directory_callback): call function for updating gui * octave-qt-link.cc (octave_qt_link): init new variables _current_directory and _new_dir; (do_change_directory): only store current dir and new state, no gui update; (update_directory): new function updating gui and clearing new dir state; (do_set_workspace): when on top level and new dir state, update gui * octave-qt-link.h: new update function, new variables for dir and state diff -r 0d56160e346d -r d7bea5b11fc3 libgui/src/main-window.cc --- a/libgui/src/main-window.cc Sat Apr 25 13:18:02 2015 -0400 +++ b/libgui/src/main-window.cc Sat Apr 25 19:43:27 2015 +0200 @@ -2141,6 +2141,7 @@ main_window::change_directory_callback (const std::string& directory) { Fcd (ovl (directory)); + _octave_qt_link->update_directory (); } // The next callbacks are invoked by GUI buttons. Those buttons diff -r 0d56160e346d -r d7bea5b11fc3 libgui/src/octave-qt-link.cc --- a/libgui/src/octave-qt-link.cc Sat Apr 25 13:18:02 2015 -0400 +++ b/libgui/src/octave-qt-link.cc Sat Apr 25 19:43:27 2015 +0200 @@ -47,6 +47,9 @@ : octave_link (), main_thread (new QThread ()), command_interpreter (new octave_interpreter ()) { + _current_directory = ""; + _new_dir = true; + connect (this, SIGNAL (execute_interpreter_signal (void)), command_interpreter, SLOT (execute (void))); @@ -431,7 +434,15 @@ void octave_qt_link::do_change_directory (const std::string& dir) { - emit change_directory_signal (QString::fromStdString (dir)); + _current_directory = QString::fromStdString (dir); + _new_dir = true; +} + +void +octave_qt_link::update_directory () +{ + emit change_directory_signal (_current_directory); + _new_dir = false; } void @@ -447,6 +458,9 @@ if (! top_level && ! debug) return; + if (_new_dir) + update_directory (); + QString scopes; QStringList symbols; QStringList class_names; diff -r 0d56160e346d -r d7bea5b11fc3 libgui/src/octave-qt-link.h --- a/libgui/src/octave-qt-link.h Sat Apr 25 13:18:02 2015 -0400 +++ b/libgui/src/octave-qt-link.h Sat Apr 25 19:43:27 2015 +0200 @@ -139,6 +139,8 @@ QWaitCondition waitcondition; void shutdown_confirmation (bool sd) {_shutdown_confirm_result = sd;} + void update_directory (void); + private: bool _shutdown_confirm_result; @@ -155,6 +157,9 @@ octave_interpreter *command_interpreter; + QString _current_directory; + bool _new_dir; + signals: void execute_interpreter_signal (void);