[postr] Fix removal of photos from the photo list (#601129)
- From: Germán Poó Caamaño <gpoo src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [postr] Fix removal of photos from the photo list (#601129)
- Date: Sun, 8 Nov 2009 06:27:49 +0000 (UTC)
commit febe5c80876f38c9c2958a962b4c873504d6b438
Author: Francisco Rojas <frojas alumnos utalca cl>
Date: Sun Nov 8 03:24:31 2009 -0300
Fix removal of photos from the photo list (#601129)
When remove the last photos from the list, it actually
remove them through Make a list that stores all the iterators
of the selected rows and then actual removal of rows.
Signed-off-by: Germán Póo-Caamaño <gpoo gnome org>
src/postr.py | 26 +++++++++++---------------
1 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/src/postr.py b/src/postr.py
index a3b3993..fa3c2a9 100644
--- a/src/postr.py
+++ b/src/postr.py
@@ -438,24 +438,20 @@ class Postr(UniqueApp):
def on_remove_activate(self, widget):
"""Callback from File->Remove or Remove button."""
- selection = self.thumbview.get_selection()
- (model, items) = selection.get_selected_rows()
- # Remove the items
- for path in items:
- self.model.remove(self.model.get_iter(path))
+ def get_selected_iter(model, path, iter, selectList):
+ selectIter = model.get_iter(path)
+ selectList.append(selectIter)
- # Select a new row
- try:
- self.thumbview.set_cursor(self.model[items[0]].path)
- except IndexError:
- # TODO: It appears that the ability to simply do
- # gtk_tree_path_previous() is missing in PyGTK.
- path = list(items[-1])
- if path[0]:
- path[0] -= 1
- self.thumbview.set_cursor(self.model[tuple(path)].path)
+ selectList = []
+ selection = self.thumbview.get_selection()
+ selection.selected_foreach(get_selected_iter, selectList)
+ model = self.thumbview.get_model()
+ # actual removal of rows
+ for iter in selectList:
+ model.remove(iter)
+
self.update_statusbar()
def on_select_all_activate(self, menuitem):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]