[latexila] Autotools: handle build tools
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Autotools: handle build tools
- Date: Tue, 4 Sep 2012 20:05:01 +0000 (UTC)
commit d8109cbd07c0b1a087bbd295b96b1d11dcf70e40
Author: SÃbastien Wilmet <swilmet gnome org>
Date: Tue Sep 4 00:33:34 2012 +0200
Autotools: handle build tools
Instead of generating all the *.xml files for each language, use gettext
directly in the code for the translatable contents.
configure.ac | 1 +
data/Makefile.am | 2 +-
data/build_tools/Makefile.am | 4 ++
data/build_tools/build_tools.pot | 28 ++++++------
data/build_tools/{C => }/build_tools.xml | 0
data/build_tools/update_build_tools_pot.sh | 2 +-
src/build_tools.vala | 64 +++++++++++----------------
7 files changed, 47 insertions(+), 54 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d448a1b..48b28b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -121,6 +121,7 @@ AC_DEFINE([DESKTOP_SCHEMAS],
# Generate files
AC_CONFIG_FILES([Makefile
data/Makefile
+ data/build_tools/Makefile
data/icons/Makefile
data/icons/16x16/Makefile
data/icons/22x22/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index 7c09642..a44272e 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = icons images
+SUBDIRS = build_tools icons images
dist_pkgdata_DATA = \
completion.xml \
diff --git a/data/build_tools/Makefile.am b/data/build_tools/Makefile.am
new file mode 100644
index 0000000..1f5da4e
--- /dev/null
+++ b/data/build_tools/Makefile.am
@@ -0,0 +1,4 @@
+EXTRA_DIST = build_tools.pot
+dist_pkgdata_DATA = build_tools.xml
+
+-include $(top_srcdir)/git.mk
diff --git a/data/build_tools/build_tools.pot b/data/build_tools/build_tools.pot
index 40298b5..0d728a8 100644
--- a/data/build_tools/build_tools.pot
+++ b/data/build_tools/build_tools.pot
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2011-08-04 00:52+0200\n"
+"POT-Creation-Date: 2012-09-04 00:42+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL ADDRESS>\n"
"Language-Team: LANGUAGE <LL li org>\n"
@@ -9,55 +9,55 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: C/build_tools.xml:37(tool/label)
+#: build_tools.xml:45(tool/label)
msgid "View PDF"
msgstr ""
-#: C/build_tools.xml:38(tool/description)
+#: build_tools.xml:46(tool/description)
msgid "View the PDF file"
msgstr ""
-#: C/build_tools.xml:43(tool/label)
+#: build_tools.xml:51(tool/label)
msgid "View DVI"
msgstr ""
-#: C/build_tools.xml:44(tool/description)
+#: build_tools.xml:52(tool/description)
msgid "View the DVI file"
msgstr ""
-#: C/build_tools.xml:49(tool/label)
+#: build_tools.xml:57(tool/label)
msgid "View PS"
msgstr ""
-#: C/build_tools.xml:50(tool/description)
+#: build_tools.xml:58(tool/description)
msgid "View the PostScript file"
msgstr ""
-#: C/build_tools.xml:84(tool/description)
+#: build_tools.xml:92(tool/description)
msgid "Create a PDF file from LaTeX sources with the \"pdflatex\" command"
msgstr ""
-#: C/build_tools.xml:90(tool/description)
+#: build_tools.xml:98(tool/description)
msgid "Create a DVI file from LaTeX sources with the \"latex\" command"
msgstr ""
-#: C/build_tools.xml:98(tool/description)
+#: build_tools.xml:106(tool/description)
msgid "Run BibTeX (bibliography)"
msgstr ""
-#: C/build_tools.xml:104(tool/description)
+#: build_tools.xml:112(tool/description)
msgid "Run MakeIndex"
msgstr ""
-#: C/build_tools.xml:112(tool/description)
+#: build_tools.xml:120(tool/description)
msgid "Convert the DVI document to the PDF format"
msgstr ""
-#: C/build_tools.xml:118(tool/description)
+#: build_tools.xml:126(tool/description)
msgid "Convert the DVI document to the PostScript format"
msgstr ""
-#: C/build_tools.xml:124(tool/description)
+#: build_tools.xml:132(tool/description)
msgid "Convert the PostScript document to the PDF format"
msgstr ""
diff --git a/data/build_tools/C/build_tools.xml b/data/build_tools/build_tools.xml
similarity index 100%
rename from data/build_tools/C/build_tools.xml
rename to data/build_tools/build_tools.xml
diff --git a/data/build_tools/update_build_tools_pot.sh b/data/build_tools/update_build_tools_pot.sh
index da73718..58851e8 100755
--- a/data/build_tools/update_build_tools_pot.sh
+++ b/data/build_tools/update_build_tools_pot.sh
@@ -1,3 +1,3 @@
#!/bin/sh
-itstool -o build_tools.pot -i build_tools.its C/build_tools.xml
+itstool -o build_tools.pot -i build_tools.its build_tools.xml
diff --git a/src/build_tools.vala b/src/build_tools.vala
index 6c00cde..26c1eba 100644
--- a/src/build_tools.vala
+++ b/src/build_tools.vala
@@ -93,10 +93,7 @@ public abstract class BuildTools : GLib.Object
};
protected Gee.LinkedList<BuildTool?> _build_tools;
-
- // Possible locations for the XML file, containaing the build tools.
- // The order is important: the first file is tried, then the second, and so on.
- protected Gee.List<File> _xml_files = new Gee.LinkedList<File> ();
+ protected File _xml_file = null;
// Used during the XML file parsing to load the build tools.
private BuildTool _cur_tool;
@@ -162,29 +159,26 @@ public abstract class BuildTools : GLib.Object
{
_build_tools = new Gee.LinkedList<BuildTool?> ();
- // Try to load the XML file from the most desirable to least desirable location.
- foreach (File file in _xml_files)
- {
- if (! file.query_exists ())
- continue;
+ return_if_fail (_xml_file != null);
- string? contents = Utils.load_file (file);
- if (contents == null)
- continue;
+ if (! _xml_file.query_exists ())
+ return;
- try
- {
- MarkupParser parser =
- { parser_start, parser_end, parser_text, null, null };
- MarkupParseContext context =
- new MarkupParseContext (parser, 0, this, null);
- context.parse (contents, -1);
- break;
- }
- catch (GLib.Error e)
- {
- warning ("Impossible to load build tools: %s", e.message);
- }
+ string? contents = Utils.load_file (_xml_file);
+ if (contents == null)
+ return;
+
+ try
+ {
+ MarkupParser parser =
+ { parser_start, parser_end, parser_text, null, null };
+ MarkupParseContext context =
+ new MarkupParseContext (parser, 0, this, null);
+ context.parse (contents, -1);
+ }
+ catch (GLib.Error e)
+ {
+ warning ("Impossible to load build tools: %s", e.message);
}
}
@@ -242,7 +236,7 @@ public abstract class BuildTools : GLib.Object
attr_values[i]);
break;
- // for compatibility
+ // for compatibility (no longer used)
case "mustSucceed":
break;
@@ -293,11 +287,11 @@ public abstract class BuildTools : GLib.Object
break;
case "label":
- _cur_tool.label = text.strip ();
+ _cur_tool.label = _(text.strip ());
break;
case "description":
- _cur_tool.set_description (text.strip ());
+ _cur_tool.set_description (_(text.strip ()));
break;
case "open":
@@ -313,14 +307,8 @@ public class DefaultBuildTools : BuildTools
private DefaultBuildTools ()
{
- unowned string[] language_names = Intl.get_language_names ();
- foreach (string language_name in language_names)
- {
- string path = Path.build_filename (Config.DATA_DIR, "build_tools",
- language_name, "build_tools.xml");
-
- _xml_files.add (File.new_for_path (path));
- }
+ string path = Path.build_filename (Config.DATA_DIR, "build_tools.xml");
+ _xml_file = File.new_for_path (path);
load ();
load_enable_setting ();
@@ -424,7 +412,7 @@ public class PersonalBuildTools : BuildTools
private PersonalBuildTools ()
{
- _xml_files.add (get_user_config_file ());
+ _xml_file = get_user_config_file ();
load ();
modified.connect (() => _modified = true);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]