From 2c4cdb5dcf3ffed1a932b93a177a55bf5a6581bf Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Wed, 21 Sep 2016 14:05:05 +0300 Subject: [PATCH] Closes #124: Add example template to the empty list automatically. --- src/MainWindow.vala | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 74e228d..f8f55b0 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -46,6 +46,16 @@ namespace LAview.Desktop { void fill_liststore_templates () { var templates = AppCore.core.get_templates_readable_names (); + + // #124 if core doesn't contain any templates then try adding an example template + var ex_templ_path = Path.build_path (Path.DIR_SEPARATOR_S, AppDirs.common_dir.get_path(), + "share/laview-core-0/templates/example.lyx"); + if (0 == templates.length && File.new_for_path(ex_templ_path).query_exists()) { + AppCore.core.add_template (ex_templ_path); + templates = AppCore.core.get_templates_readable_names (); + } + + liststore_templates.clear(); Gtk.TreeIter iter = Gtk.TreeIter(); foreach (var t in templates) {