[balsa] Look for next part above current part



commit 2d47fbcf015fbc8058ef25da9d9bd87cf7fb50a4
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Fri Nov 12 21:30:05 2010 -0500

    Look for next part above current part
    
    	* src/balsa-message.c (bm_next_part_info): look for next part
    	above current part, if necessary; fixes
            http://mail.gnome.org/archives/balsa-list/2010-November/msg00003.html

 ChangeLog           |    5 +++++
 src/balsa-message.c |   24 ++++++++++++++++--------
 2 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2d8cab1..a4a15c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-12  Peter Bloomfield
+
+	* src/balsa-message.c (bm_next_part_info): look for next part
+	above current part, if necessary.
+
 2010-11-07  Peter Bloomfield
 
 	Implement LibBalsaCompletion as a copy of (deprecated)
diff --git a/src/balsa-message.c b/src/balsa-message.c
index 6ec59db..d4ce194 100644
--- a/src/balsa-message.c
+++ b/src/balsa-message.c
@@ -1880,16 +1880,24 @@ bm_next_part_info(BalsaMessage * bmessage)
         if (!gtk_tree_model_get_iter_first(model, &sel.sel_iter))
             return NULL;
     } else {
-        GtkTreeIter child;
+        GtkTreeIter iter;
 
-        /* If the first selected iter has a child, select it, otherwise take
-           next on the same level. If there is no next, return NULL */
-        if (gtk_tree_model_iter_children (model, &child, &sel.sel_iter))
-	    sel.sel_iter = child;
-        else if (!gtk_tree_model_iter_next (model, &sel.sel_iter))
-            return NULL;
+        /* If the first selected iter has a child, select it, otherwise
+         * take next on the same or higher level.  If there is no next,
+         * return NULL */
+        if (!gtk_tree_model_iter_children (model, &iter, &sel.sel_iter)) {
+            GtkTreeIter tmp_iter;
+
+            tmp_iter = iter = sel.sel_iter;
+            while (!gtk_tree_model_iter_next (model, &iter)) {
+                if (!gtk_tree_model_iter_parent(model, &iter, &tmp_iter))
+                    return NULL;
+	        tmp_iter = iter;
+            }
+        }
+        sel.sel_iter = iter;
     }
-    
+
     return tree_next_valid_part_info(model, &sel.sel_iter);
 }
 



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