[latexila] Build Tools: fix sensitivity issue of stop execution action



commit ef401f5879831096dc8cdfbb2641616f42c1c40e
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Fri Jul 13 05:37:56 2012 +0200

    Build Tools: fix sensitivity issue of stop execution action
    
    The finished signal is connected to set the stop execution action as
    insensitive. But the execute was already finished when the signal was
    connected. So now, we explicitly call run() on the BuildToolRunner, so
    we have the time to connect the signal before.

 src/build_tool_runner.vala |   15 +++++++--------
 src/main_window.vala       |    2 ++
 2 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/build_tool_runner.vala b/src/build_tool_runner.vala
index 298a2b6..8026e61 100644
--- a/src/build_tool_runner.vala
+++ b/src/build_tool_runner.vala
@@ -27,9 +27,9 @@ public class BuildToolRunner : GLib.Object
 
     private TreeIter _main_title;
 
-    private int _job_num;
+    private int _job_num = 0;
     private BuildJob _current_job;
-    private TreeIter _current_job_title;
+    private TreeIter? _current_job_title = null;
     private BuildJobRunner? _current_job_runner = null;
 
     private bool _aborted = false;
@@ -44,9 +44,6 @@ public class BuildToolRunner : GLib.Object
 
         _view.clear ();
         _main_title = _view.add_main_title (_tool.label, BuildState.RUNNING);
-
-        _job_num = 0;
-        proceed ();
     }
 
     public void abort ()
@@ -55,13 +52,15 @@ public class BuildToolRunner : GLib.Object
             _current_job_runner.abort ();
 
         _view.set_title_state (_main_title, BuildState.ABORTED);
-        _view.set_title_state (_current_job_title, BuildState.ABORTED);
+
+        if (_current_job_title != null)
+            _view.set_title_state (_current_job_title, BuildState.ABORTED);
 
         _aborted = true;
         finished ();
     }
 
-    private void proceed ()
+    public void run ()
     {
         _current_job_runner = null;
 
@@ -102,7 +101,7 @@ public class BuildToolRunner : GLib.Object
             _view.set_title_state (_current_job_title, state);
 
             _job_num++;
-            proceed ();
+            run ();
         });
 
         try
diff --git a/src/main_window.vala b/src/main_window.vala
index bfde072..bb972ad 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -1262,6 +1262,8 @@ public class MainWindow : Window
             if (tool.has_jobs ())
                 file_browser.refresh_for_document (active_document);
         });
+
+        build_tool_runner.run ();
     }
 
     private void update_documents_list_menu ()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]