[postr] Select a row after remove an image (#625059)



commit 7e8214028a804b6286dc398a08211e61518ce0de
Author: Francisco Rojas <frojas alumnos utalca cl>
Date:   Thu Jul 22 20:27:40 2010 +0200

    Select a row after remove an image (#625059)
    
    After remove a group of selected rows, select the next image of
    the last image of the removed group
    
    Signed-off-by: Karl Mikaelsson <derfian lysator liu se>

 src/postr.py |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/postr.py b/src/postr.py
index 0e5142a..754c11d 100644
--- a/src/postr.py
+++ b/src/postr.py
@@ -531,17 +531,26 @@ class Postr(UniqueApp):
             selectIter = model.get_iter(path)
             selectList.append(selectIter)
 
-        selectList = []
-        
+        select_list = []
+
         selection = self.thumbview.get_selection()
-        selection.selected_foreach(get_selected_iter, selectList)
+        selection.selected_foreach(get_selected_iter, select_list)
         model = self.thumbview.get_model()
+
+        next_select_iter = model.iter_next(select_list[-1])
+
         # actual removal of rows
-        for iter in selectList:
+        for iter in select_list:
             model.remove(iter)
 
         self.update_statusbar()
-        
+
+        if next_select_iter:
+            self.thumbview.set_cursor(model.get_path(next_select_iter))
+        elif len(model) > 0:
+            self.thumbview.set_cursor(model[-1].path)
+
+
     def on_select_all_activate(self, menuitem):
         """Callback from Edit->Select All."""
         selection = self.thumbview.get_selection()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]