[latexila] Replace the 'compilation' field of BuildTool by has_jobs()
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Replace the 'compilation' field of BuildTool by has_jobs()
- Date: Fri, 13 Jul 2012 03:41:22 +0000 (UTC)
commit aa1d10feb111ed0ce24f8c495dac418363384b03
Author: SÃbastien Wilmet <swilmet src gnome org>
Date: Fri Jul 13 03:49:36 2012 +0200
Replace the 'compilation' field of BuildTool by has_jobs()
Structures in Vala can have functions, yeah! It's like a small class.
src/build_tools.vala | 18 +++++-------------
src/main_window.vala | 14 +++++++-------
2 files changed, 12 insertions(+), 20 deletions(-)
---
diff --git a/src/build_tools.vala b/src/build_tools.vala
index 1784c0a..533f139 100644
--- a/src/build_tools.vala
+++ b/src/build_tools.vala
@@ -43,7 +43,6 @@ public struct BuildTool
string icon;
string files_to_open;
bool enabled;
- bool compilation;
Gee.ArrayList<BuildJob?> jobs;
public BuildTool ()
@@ -54,9 +53,13 @@ public struct BuildTool
icon = "";
files_to_open = "";
enabled = false;
- compilation = false;
jobs = new Gee.ArrayList<BuildJob?> ();
}
+
+ public bool has_jobs ()
+ {
+ return jobs.size > 0;
+ }
}
public class BuildTools : GLib.Object
@@ -155,7 +158,6 @@ public class BuildTools : GLib.Object
{
return_if_fail (0 <= pos && pos <= _build_tools.size);
- tool.compilation = is_compilation (tool);
_build_tools.insert (pos, tool);
modified ();
}
@@ -168,7 +170,6 @@ public class BuildTools : GLib.Object
if (! is_equal (current_tool, tool))
{
- tool.compilation = is_compilation (tool);
_build_tools.remove_at (num);
_build_tools.insert (num, tool);
modified ();
@@ -213,13 +214,6 @@ public class BuildTools : GLib.Object
return true;
}
- // If it's a compilation, the files are first saved before running the
- // build tool, and the file browser is refreshed after the execution.
- private bool is_compilation (BuildTool build_tool)
- {
- return build_tool.jobs.size > 0;
- }
-
private void load ()
{
_build_tools = new Gee.LinkedList<BuildTool?> ();
@@ -345,8 +339,6 @@ public class BuildTools : GLib.Object
if (_cur_tool.description == "")
_cur_tool.description = _cur_tool.label;
- _cur_tool.compilation = is_compilation (_cur_tool);
-
_build_tools.add (_cur_tool);
break;
diff --git a/src/main_window.vala b/src/main_window.vala
index df1cde4..dde4735 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -1213,13 +1213,13 @@ public class MainWindow : Window
BuildTool? tool = BuildTools.get_default ().get_by_id (tool_index);
return_if_fail (tool != null);
- if (! tool.compilation)
+ if (! tool.has_jobs ())
return_if_fail (active_document.location != null);
_build_view.show ();
- // save the document if it's a compilation
- if (tool.compilation)
+ // save the document if commands are executed
+ if (tool.has_jobs ())
{
if (active_document.location == null)
{
@@ -1243,7 +1243,7 @@ public class MainWindow : Window
}
}
- // Ensure that the files are correctly saved before the compilation.
+ // Ensure that the files are correctly saved before the execution.
Utils.flush_queue ();
}
@@ -1257,9 +1257,9 @@ public class MainWindow : Window
{
action_stop_exec.sensitive = false;
- // Refresh the file browser when the compilation is finished.
+ // Refresh the file browser when the execution is finished.
// TODO It would be better if the file browser could detect file updates.
- if (tool.compilation)
+ if (tool.has_jobs ())
file_browser.refresh_for_document (active_document);
});
}
@@ -1429,7 +1429,7 @@ public class MainWindow : Window
build_tools_action_group.get_action (@"BuildTool_$tool_num");
if (unsaved_doc)
- action.set_sensitive (tool.compilation);
+ action.set_sensitive (tool.has_jobs ());
else
{
string[] extensions = tool.extensions.split (" ");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]