[latexila] Add IDs for the default build tools



commit 7d473ceb7807b363107272cc6f8b6e12b3186648
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Wed Jul 18 00:11:02 2012 +0200

    Add IDs for the default build tools

 data/build_tools/C/build_tools.xml |   38 ++++++++++++++++++------------------
 src/build_tools.vala               |    9 ++++++++
 2 files changed, 28 insertions(+), 19 deletions(-)
---
diff --git a/data/build_tools/C/build_tools.xml b/data/build_tools/C/build_tools.xml
index ef09cba..21702df 100644
--- a/data/build_tools/C/build_tools.xml
+++ b/data/build_tools/C/build_tools.xml
@@ -1,37 +1,37 @@
 <tools xmlns:its="http://www.w3.org/2005/11/its";>
   <!-- Latexmk -->
 
-  <tool show="true" extensions=".tex" icon="compile_pdf">
+  <tool id="0" show="true" extensions=".tex" icon="compile_pdf">
     <label its:translate="no">LaTeX â PDF (Latexmk)</label>
     <job postProcessor="latexmk">latexmk -pdf $filename</job>
     <open>$shortname.pdf</open>
   </tool>
 
-  <tool show="true" extensions=".tex" icon="compile_dvi">
+  <tool id="1" show="true" extensions=".tex" icon="compile_dvi">
     <label its:translate="no">LaTeX â DVI â PDF (Latexmk)</label>
     <job postProcessor="latexmk">latexmk -pdfdvi $filename</job>
     <open>$shortname.pdf</open>
   </tool>
 
-  <tool show="true" extensions=".tex" icon="compile_ps">
+  <tool id="2" show="true" extensions=".tex" icon="compile_ps">
     <label its:translate="no">LaTeX â DVI â PS â PDF (Latexmk)</label>
     <job postProcessor="latexmk">latexmk -pdfps $filename</job>
     <open>$shortname.pdf</open>
   </tool>
 
-  <tool show="false" extensions=".tex" icon="compile_dvi">
+  <tool id="3" show="false" extensions=".tex" icon="compile_dvi">
     <label its:translate="no">LaTeX â DVI (Latexmk)</label>
     <job postProcessor="latexmk">latexmk $filename</job>
     <open>$shortname.dvi</open>
   </tool>
 
-  <tool show="false" extensions=".tex" icon="compile_ps">
+  <tool id="4" show="false" extensions=".tex" icon="compile_ps">
     <label its:translate="no">LaTeX â DVI â PS (Latexmk)</label>
     <job postProcessor="latexmk">latexmk -ps $filename</job>
     <open>$shortname.ps</open>
   </tool>
 
-  <tool show="false" extensions=".tex" icon="compile_pdf">
+  <tool id="5" show="false" extensions=".tex" icon="compile_pdf">
     <label its:translate="no">XeTeX â PDF (Latexmk)</label>
     <job postProcessor="latexmk">
       latexmk -pdf -e &apos;$pdflatex=q/xelatex %O %S/&apos; $filename
@@ -41,19 +41,19 @@
 
   <!-- View DVI/PDF/PS -->
 
-  <tool show="true" extensions=".tex .pdf" icon="view_pdf">
+  <tool id="6" show="true" extensions=".tex .pdf" icon="view_pdf">
     <label>View PDF</label>
     <description>View the PDF file</description>
     <open>$shortname.pdf</open>
   </tool>
 
-  <tool show="true" extensions=".tex .dvi" icon="view_dvi">
+  <tool id="7" show="true" extensions=".tex .dvi" icon="view_dvi">
     <label>View DVI</label>
     <description>View the DVI file</description>
     <open>$shortname.dvi</open>
   </tool>
 
-  <tool show="true" extensions=".tex .ps" icon="view_ps">
+  <tool id="8" show="true" extensions=".tex .ps" icon="view_ps">
     <label>View PS</label>
     <description>View the PostScript file</description>
     <open>$shortname.ps</open>
@@ -61,7 +61,7 @@
 
   <!-- Rubber -->
 
-  <tool show="false" extensions=".tex" icon="compile_pdf">
+  <tool id="9" show="false" extensions=".tex" icon="compile_pdf">
     <label its:translate="no">LaTeX â PDF (Rubber)</label>
     <job postProcessor="rubber">
       rubber --maxerr -1 --short --force --warn all --pdf $filename
@@ -69,7 +69,7 @@
     <open>$shortname.pdf</open>
   </tool>
 
-  <tool show="false" extensions=".tex" icon="compile_dvi">
+  <tool id="10" show="false" extensions=".tex" icon="compile_dvi">
     <label its:translate="no">LaTeX â DVI (Rubber)</label>
     <job postProcessor="rubber">
       rubber --maxerr -1 --short --force --warn all $filename
@@ -77,7 +77,7 @@
     <open>$shortname.dvi</open>
   </tool>
 
-  <tool show="false" extensions=".tex" icon="compile_ps">
+  <tool id="11" show="false" extensions=".tex" icon="compile_ps">
     <label its:translate="no">LaTeX â DVI â PS (Rubber)</label>
     <job postProcessor="rubber">
       rubber --maxerr -1 --short --force --warn all --ps $filename
@@ -87,13 +87,13 @@
 
   <!-- latex, pdflatex -->
 
-  <tool show="false" extensions=".tex" icon="compile_pdf">
+  <tool id="12" show="false" extensions=".tex" icon="compile_pdf">
     <label its:translate="no">LaTeX â PDF (pdflatex)</label>
     <description>Create a PDF file from LaTeX sources with the "pdflatex" command</description>
     <job postProcessor="latex">pdflatex -interaction=nonstopmode $filename</job>
   </tool>
 
-  <tool show="false" extensions=".tex" icon="compile_dvi">
+  <tool id="13" show="false" extensions=".tex" icon="compile_dvi">
     <label its:translate="no">LaTeX â DVI (latex)</label>
     <description>Create a DVI file from LaTeX sources with the "latex" command</description>
     <job postProcessor="latex">latex -interaction=nonstopmode $filename</job>
@@ -101,13 +101,13 @@
 
   <!-- BibTeX, MakeIndex -->
 
-  <tool show="false" extensions=".tex" icon="gtk-execute">
+  <tool id="14" show="false" extensions=".tex" icon="gtk-execute">
     <label its:translate="no">BibTeX</label>
     <description>Run BibTeX (bibliography)</description>
     <job postProcessor="all-output">bibtex $shortname.aux</job>
   </tool>
 
-  <tool show="false" extensions=".tex" icon="gtk-execute">
+  <tool id="15" show="false" extensions=".tex" icon="gtk-execute">
     <label its:translate="no">MakeIndex</label>
     <description>Run MakeIndex</description>
     <job postProcessor="all-output">makeindex $shortname.idx</job>
@@ -115,19 +115,19 @@
 
   <!-- Convert -->
 
-  <tool show="false" extensions=".tex" icon="gtk-convert">
+  <tool id="16" show="false" extensions=".tex" icon="gtk-convert">
     <label its:translate="no">DVI â PDF</label>
     <description>Convert the DVI document to the PDF format</description>
     <job postProcessor="all-output">dvipdf $shortname.dvi</job>
   </tool>
 
-  <tool show="false" extensions=".tex" icon="gtk-convert">
+  <tool id="17" show="false" extensions=".tex" icon="gtk-convert">
     <label its:translate="no">DVI â PS</label>
     <description>Convert the DVI document to the PostScript format</description>
     <job postProcessor="all-output">dvips $shortname.dvi</job>
   </tool>
 
-  <tool show="false" extensions=".tex" icon="gtk-convert">
+  <tool id="18" show="false" extensions=".tex" icon="gtk-convert">
     <label its:translate="no">PS â PDF</label>
     <description>Convert the PostScript document to the PDF format</description>
     <job postProcessor="all-output">ps2pdf $shortname.ps</job>
diff --git a/src/build_tools.vala b/src/build_tools.vala
index 1464ede..8aba455 100644
--- a/src/build_tools.vala
+++ b/src/build_tools.vala
@@ -45,6 +45,10 @@ public struct BuildTool
     bool enabled;
     Gee.ArrayList<BuildJob?> jobs;
 
+    // The ID is used only by the default build tools.
+    // It is used to save those that are enabled or disabled.
+    int id;
+
     public BuildTool ()
     {
         _description = "";
@@ -54,6 +58,7 @@ public struct BuildTool
         files_to_open = "";
         enabled = false;
         jobs = new Gee.ArrayList<BuildJob?> ();
+        id = 0;
     }
 
     public bool has_jobs ()
@@ -201,6 +206,10 @@ public abstract class BuildTools : GLib.Object
                 {
                     switch (attr_names[i])
                     {
+                        case "id":
+                            _cur_tool.id = int.parse (attr_values[i]);
+                            break;
+
                         // 'show' was the previous name of 'enabled'
                         case "show":
                         case "enabled":



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