Commit 8f269dcc authored by Sébastien Wilmet's avatar Sébastien Wilmet

DeleteTemplateDialog: delete the good templates

This is an important bug fix. Wrong templates could have been deleted!
This bug is present in latexila since many versions, and hasn't been
reported. I guess the dialog window is usually used to delete only one
template at a time (in that case the bug doesn't occur). Many users are
hopefully not aware that it is possible to select several templates and
delete them in one go.
parent bd3b40ce
......@@ -274,12 +274,18 @@ public class DeleteTemplateDialog : Dialog
while (run () == ResponseType.ACCEPT)
{
TreeSelection select = templates_list.get_selection ();
List<TreePath> selected_items = select.get_selected_rows (null);
uint nb_selected_items = selected_items.length ();
unowned TreeModel model;
List<TreePath> selected_rows = select.get_selected_rows (out model);
List<TreeRowReference> row_refs = null;
foreach (TreePath path in selected_rows)
{
row_refs.prepend (new TreeRowReference (model, path));
}
for (int item_num = 0 ; item_num < nb_selected_items ; item_num++)
foreach (TreeRowReference row_ref in row_refs)
{
TreePath path = selected_items.nth_data (item_num);
TreePath path = row_ref.get_path ();
templates.delete_personal_template (path);
template_deleted = true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment