select correct row when deleting last row in the summary view
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Tue, 9 Oct 2001 19:16:20 +0000 (19:16 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Tue, 9 Oct 2001 19:16:20 +0000 (19:16 +0000)
ChangeLog.claws
configure.in
src/summaryview.c

index 6912e5ed0cdcd51e6a531613228ef2ef63a96c43..05a2884e1b72c4f0408323bd4db3d92ca7baf5ae 100644 (file)
@@ -1,3 +1,9 @@
+2001-10-09 [alfons]    0.6.3.claws4
+
+       * src/summaryview.c
+               select correct row when deleting last row in the summary view (and
+               close bug "[ #469104 ] select second last in list when deleting")
+
 2001-10-09 [paul]      0.6.3claws3
 
        * sync with sylpheed 0.6.3cvs1
index 97ec465f28093183c165bfe4b933c8eb95a5cebf..f17686cf22f25366c639be99f545bb0403aeb9c6 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws3
+EXTRA_VERSION=claws4
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 826757145c7a587db1b34ecb6bce51a87e665c9b..d5da80deb485d98ee33e707469b6d51539cf3965 100644 (file)
@@ -2330,6 +2330,11 @@ void summary_step(SummaryView *summaryview, GtkScrollType type)
 
        gtk_signal_emit_by_name(GTK_OBJECT(ctree), "scroll_vertical",
                                type, 0.0);
+       gtk_clist_select_row(GTK_CLIST(ctree), 
+                            gtkut_ctree_get_nth_from_node(
+                                       GTK_CTREE(ctree),
+                                       summaryview->selected),
+                            5);
 
        if (summaryview->msg_is_toggled_on)
                summary_display_msg(summaryview, summaryview->selected, FALSE);
@@ -2698,6 +2703,7 @@ void summary_delete(SummaryView *summaryview)
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        FolderItem *item = summaryview->folder_item;
        GList *cur;
+       GtkCTreeNode *dsp_last, *sel_last;
 
        if (!item || item->folder->type == F_NEWS) return;
 
@@ -2713,11 +2719,21 @@ void summary_delete(SummaryView *summaryview)
                if (aval != G_ALERTDEFAULT) return;
        }
 
+       /* next code sets current row focus right. if the last selection
+        * is also the last displayed row, we need to scroll backwards. 
+        * exception: if the last displayed row is an uncollapsed node,
+        * we don't scroll back. */
+       dsp_last = gtk_ctree_node_nth(ctree, GTK_CLIST(ctree)->rows - 1);
+       sel_last = NULL;
        for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next) {
-               summary_delete_row(summaryview, GTK_CTREE_NODE(cur->data));
+               sel_last = GTK_CTREE_NODE(cur->data);
+               summary_delete_row(summaryview, GTK_CTREE_NODE(sel_last));
        }
 
-       summary_step(summaryview, GTK_SCROLL_STEP_FORWARD);
+       if (dsp_last == sel_last && GTK_CTREE_ROW(sel_last)->expanded) 
+               summary_step(summaryview, GTK_SCROLL_STEP_BACKWARD);
+       else    
+               summary_step(summaryview, GTK_SCROLL_STEP_FORWARD);
 
        if (prefs_common.immediate_exec || item->stype == F_TRASH)
                summary_execute(summaryview);