diff libgui/src/main-window.cc @ 15987:47a4c92924a7

gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4) * main-window.h: declaration of new function connect_visibility_changed () * main-window.cc (connect_visibility_changed): new function for connecting the signales emitted when the visibility of a widget changes; this function must be called after the main window is shown * main-window.cc (construct): do not connect the signals here * octave-gui.cc (octave_start_gui): call connect_visibility_changed () just before calling application.exec ()
author Torsten <ttl@justmail.de>
date Tue, 29 Jan 2013 18:24:16 +0100
parents 200dab2eecd4
children afc4e08f2143
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Sun Jan 27 12:29:00 2013 +0100
+++ b/libgui/src/main-window.cc	Tue Jan 29 18:24:16 2013 +0100
@@ -616,6 +616,30 @@
   settings->sync ();
 }
 
+
+// Connecting the signals emitted when the visibility of a widget changes.
+// This has to be done after the window is shown (see octave-gui.cc)
+void
+main_window::connect_visibility_changed ()
+{
+  connect (_terminal_dock_widget, SIGNAL (visibilityChanged (bool)),
+           this,                  SLOT (handle_command_window_visible (bool)));
+  connect (_workspace_view,       SIGNAL (visibilityChanged (bool)),
+           this,                  SLOT (handle_workspace_visible (bool)));
+  connect (_history_dock_widget,  SIGNAL (visibilityChanged (bool)),
+           this,                  SLOT (handle_command_history_visible (bool)));
+  connect (_files_dock_widget,    SIGNAL (visibilityChanged (bool)),
+           this,                  SLOT (handle_current_directory_visible (bool)));
+#ifdef HAVE_QSCINTILLA
+  connect (_file_editor,          SIGNAL (visibilityChanged (bool)),
+           this,                  SLOT (handle_editor_visible (bool)));
+#endif
+  connect (_documentation_dock_widget,  SIGNAL (visibilityChanged (bool)),
+           this,                  SLOT (handle_documentation_visible (bool)));
+}
+
+
+// Main subroutine of the constructor
 void
 main_window::construct ()
 {
@@ -992,20 +1016,6 @@
            this,                        SLOT (focus_editor ()));
   connect (documentation_action,        SIGNAL (triggered ()),
            this,                        SLOT (focus_documentation ()));
-  connect (_terminal_dock_widget,       SIGNAL (visibilityChanged (bool)),
-           this,                        SLOT (handle_command_window_visible (bool)));
-  connect (_workspace_view,             SIGNAL (visibilityChanged (bool)),
-           this,                        SLOT (handle_workspace_visible (bool)));
-  connect (_history_dock_widget,        SIGNAL (visibilityChanged (bool)),
-           this,                        SLOT (handle_command_history_visible (bool)));
-  connect (_files_dock_widget,          SIGNAL (visibilityChanged (bool)),
-           this,                        SLOT (handle_current_directory_visible (bool)));
-#ifdef HAVE_QSCINTILLA
-  connect (_file_editor,                SIGNAL (visibilityChanged (bool)),
-           this,                        SLOT (handle_editor_visible (bool)));
-#endif
-  connect (_documentation_dock_widget,  SIGNAL (visibilityChanged (bool)),
-           this,                        SLOT (handle_documentation_visible (bool)));
 
   connect (reset_windows_action,        SIGNAL (triggered ()),
            this,                        SLOT   (reset_windows ()));