changeset 20132:d7bea5b11fc3

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
author Torsten <ttl@justmail.de>
date Sat, 25 Apr 2015 19:43:27 +0200
parents 0d56160e346d
children bef9086a6725
files libgui/src/main-window.cc libgui/src/octave-qt-link.cc libgui/src/octave-qt-link.h
diffstat 3 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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;
--- 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);