[latexila] Build Tools: better way to know if a build tool is a compilation
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Build Tools: better way to know if a build tool is a compilation
- Date: Mon, 9 Jul 2012 01:10:24 +0000 (UTC)
commit b47675b0eb84d5fea63ef289e468bc17fd27e6ae
Author: SÃbastien Wilmet <swilmet src gnome org>
Date: Mon Jul 9 03:09:52 2012 +0200
Build Tools: better way to know if a build tool is a compilation
src/build_tools.vala | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/src/build_tools.vala b/src/build_tools.vala
index 8d12acd..92ba47f 100644
--- a/src/build_tools.vala
+++ b/src/build_tools.vala
@@ -142,7 +142,7 @@ public class BuildTools : GLib.Object
{
return_if_fail (0 <= pos && pos <= _build_tools.size);
- tool.compilation = is_compilation (tool.icon);
+ tool.compilation = is_compilation (tool);
_build_tools.insert (pos, tool);
modified ();
}
@@ -155,7 +155,7 @@ public class BuildTools : GLib.Object
if (! is_equal (current_tool, tool))
{
- tool.compilation = is_compilation (tool.icon);
+ tool.compilation = is_compilation (tool);
_build_tools.remove_at (num);
_build_tools.insert (num, tool);
modified ();
@@ -199,16 +199,19 @@ public class BuildTools : GLib.Object
return true;
}
- // TODO rewrite this, based on the job's commands.
- // Or simply assume that all the _build_ tools are compilation, since gtk_show_uri()
- // will be used for the other tools, anyway.
- private bool is_compilation (string icon)
+ // 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)
{
- // If it's a compilation, the files are first saved before running the
- // build tool, and the file browser is refreshed after the execution.
- return icon.contains ("compile")
- || icon == Gtk.Stock.EXECUTE
- || icon == Gtk.Stock.CONVERT;
+ foreach (BuildJob job in build_tool.jobs)
+ {
+ // If the command is not for viewing a file, we assume that it's
+ // a compilation.
+ if (! job.command.contains ("$view"))
+ return true;
+ }
+
+ return false;
}
private void load ()
@@ -285,7 +288,6 @@ public class BuildTools : GLib.Object
case "icon":
_cur_tool.icon = attr_values[i];
- _cur_tool.compilation = is_compilation (attr_values[i]);
break;
default:
@@ -337,6 +339,8 @@ public class BuildTools : GLib.Object
if (_cur_tool.description == null)
_cur_tool.description = _cur_tool.label;
+ _cur_tool.compilation = is_compilation (_cur_tool);
+
_build_tools.add (_cur_tool);
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]