1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 17:19:20 +00:00

ui/crumbs/tasklistmodel: optimise find_path_for_item()

Rather than calling get_path() for each iterated value use the get_value()
method to lookup the COL_NAME value and only call get_path() for a match.

This should save some time by potentially removing N-1 calls to get_path()
from the loop.

(Bitbake rev: d2450536269996147a22d6eafbdf72aa62afa4f6)

Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Lock
2011-08-30 09:15:35 -07:00
committed by Richard Purdie
parent 9a047762cf
commit bfdc8a295b
+2 -4
View File
@@ -481,11 +481,9 @@ class TaskListModel(gtk.ListStore):
return None
it = self.get_iter_first()
path = None
while it:
path = self.get_path(it)
if (self[path][self.COL_NAME] == item_name):
return path
if (self.get_value(it, self.COL_NAME) == item_name):
return self.get_path(it)
else:
it = self.iter_next(it)
return None