[latexila/gnome-3-16] DeleteTemplateDialog: delete the good templates
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila/gnome-3-16] DeleteTemplateDialog: delete the good templates
- Date: Sun, 19 Apr 2015 09:03:17 +0000 (UTC)
commit 8f269dcc517a0858905a0a3d87f5e71ab8310987
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Apr 19 10:50:12 2015 +0200
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.
src/templates_dialogs.vala | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/templates_dialogs.vala b/src/templates_dialogs.vala
index a5b57b0..63ac516 100644
--- a/src/templates_dialogs.vala
+++ b/src/templates_dialogs.vala
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]