[latexila] Add the 'files_to_open' field to the BuildTool struct



commit 52e357c9bea5a26bbb661e5a7ab48b4ac61e452f
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Fri Jul 13 03:06:52 2012 +0200

    Add the 'files_to_open' field to the BuildTool struct
    
    And adapt the code to take it into account.

 src/build_tool_dialog.vala |    3 ++-
 src/build_tools.vala       |   22 +++++++++++++---------
 2 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/src/build_tool_dialog.vala b/src/build_tool_dialog.vala
index cddf972..303ee9f 100644
--- a/src/build_tool_dialog.vala
+++ b/src/build_tool_dialog.vala
@@ -436,7 +436,7 @@ private class BuildToolDialog : Dialog
         _entry_label.text = build_tool.label;
         _entry_desc.text = build_tool.description;
         _entry_extensions.text = build_tool.extensions;
-        _entry_files_to_open.text = "";
+        _entry_files_to_open.text = build_tool.files_to_open;
 
         /* Icon */
 
@@ -486,6 +486,7 @@ private class BuildToolDialog : Dialog
             tool.description = desc;
 
         tool.extensions = _entry_extensions.text.strip ();
+        tool.files_to_open = _entry_files_to_open.text.strip ();
 
         /* Icon */
 
diff --git a/src/build_tools.vala b/src/build_tools.vala
index 92ba47f..bf7d379 100644
--- a/src/build_tools.vala
+++ b/src/build_tools.vala
@@ -41,6 +41,7 @@ public struct BuildTool
     string extensions;
     string label;
     string icon;
+    string files_to_open;
     bool enabled;
     bool compilation;
     Gee.ArrayList<BuildJob?> jobs;
@@ -179,6 +180,7 @@ public class BuildTools : GLib.Object
             || tool1.description != tool2.description
             || tool1.extensions != tool2.extensions
             || tool1.icon != tool2.icon
+            || tool1.files_to_open != tool2.files_to_open
             || tool1.jobs.size != tool2.jobs.size)
         {
             return false;
@@ -203,15 +205,7 @@ public class BuildTools : GLib.Object
     // build tool, and the file browser is refreshed after the execution.
     private bool is_compilation (BuildTool build_tool)
     {
-        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;
+        return build_tool.jobs.size > 0;
     }
 
     private void load ()
@@ -265,6 +259,7 @@ public class BuildTools : GLib.Object
             case "tools":
             case "label":
             case "description":
+            case "open":
                 return;
 
             case "tool":
@@ -332,6 +327,7 @@ public class BuildTools : GLib.Object
             case "tools":
             case "label":
             case "description":
+            case "open":
                 return;
 
             case "tool":
@@ -370,6 +366,10 @@ public class BuildTools : GLib.Object
             case "description":
                 _cur_tool.description = text.strip ();
                 break;
+
+            case "open":
+                _cur_tool.files_to_open = text.strip ();
+                break;
         }
     }
 
@@ -397,6 +397,10 @@ public class BuildTools : GLib.Object
 
                 content += Markup.printf_escaped ("%s</job>\n", job.command);
             }
+
+            content += Markup.printf_escaped ("    <open>%s</open>\n",
+                tool.files_to_open);
+
             content += "  </tool>\n";
         }
 



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