7619 : Notes used in the "To Do" gramplet are found by the Remove Unused Objects tool
This commit is contained in:
parent
21869e4939
commit
a99b56e123
@ -61,6 +61,7 @@ from gramps.gen.display.place import displayer as _pd
|
||||
from gramps.gen.updatecallback import UpdateCallback
|
||||
from gramps.gui.plug import tool
|
||||
from gramps.gui.glade import Glade
|
||||
from gramps.gen.filters import GenericFilterFactory, rules
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -266,6 +267,15 @@ class RemoveUnused(tool.Tool, ManagedWindow, UpdateCallback):
|
||||
('notes', db.get_note_cursor, db.get_number_of_notes),
|
||||
)
|
||||
|
||||
# bug 7619 : don't select notes from to do list.
|
||||
# notes associated to the todo list doesn't have references.
|
||||
# get the todo list (from get_note_list method of the todo gramplet )
|
||||
all_notes = self.dbstate.db.get_note_handles()
|
||||
FilterClass = GenericFilterFactory('Note')
|
||||
filter = FilterClass()
|
||||
filter.add_rule(rules.note.HasType(["To Do"]))
|
||||
todo_list = filter.apply(self.dbstate.db, all_notes)
|
||||
|
||||
for (the_type, cursor_func, total_func) in tables:
|
||||
if not self.options.handler.options_dict[the_type]:
|
||||
# This table was not requested. Skip it.
|
||||
@ -276,8 +286,9 @@ class RemoveUnused(tool.Tool, ManagedWindow, UpdateCallback):
|
||||
fbh = db.find_backlink_handles
|
||||
for handle, data in cursor:
|
||||
if not any(h for h in fbh(handle)):
|
||||
self.add_results((the_type, handle.decode('utf-8'),
|
||||
data))
|
||||
if handle not in todo_list:
|
||||
self.add_results((the_type, handle.decode('utf-8'),
|
||||
data))
|
||||
self.update()
|
||||
self.reset()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user