* Update the next_row_reference if it was invalidated previously
authorSergio Villar Senin <svillar@igalia.com>
Mon, 23 Jul 2007 17:06:20 +0000 (17:06 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 23 Jul 2007 17:06:20 +0000 (17:06 +0000)
* Fixes NB#63349, the viewer moves to the next message even if the old following one was deleted

pmo-trunk-r2775

src/maemo/modest-msg-view-window.c

index a431f2a..9b9e3b9 100644 (file)
@@ -1160,8 +1160,21 @@ modest_msg_view_window_select_next_message (ModestMsgViewWindow *window)
        g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window), FALSE);
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
 
-       path = gtk_tree_row_reference_get_path (priv->next_row_reference);
-       if (path == NULL) 
+       /* Update the next row reference if it's not valid. This could
+          happen if for example the header which it was pointing to,
+          was deleted. The best place to do it is in the row-deleted
+          handler but the tinymail model do not work like the glib
+          tree models and reports the deletion when the row is still
+          there */
+       if (!gtk_tree_row_reference_valid (priv->next_row_reference)) {
+               if (gtk_tree_row_reference_valid (priv->row_reference)) {
+                       priv->next_row_reference = gtk_tree_row_reference_copy (priv->row_reference);
+                       select_next_valid_row (priv->header_model, &(priv->next_row_reference), FALSE);
+               }
+       }
+       if (priv->next_row_reference)
+               path = gtk_tree_row_reference_get_path (priv->next_row_reference);
+       if (path == NULL)
                return FALSE;
 
        gtk_tree_model_get_iter (priv->header_model,