sync with sylpheed 0.6.3cvs3
authorPaul Mangan <paul@claws-mail.org>
Thu, 11 Oct 2001 08:29:11 +0000 (08:29 +0000)
committerPaul Mangan <paul@claws-mail.org>
Thu, 11 Oct 2001 08:29:11 +0000 (08:29 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/prefs_filter.c
src/summaryview.c
src/utils.c

index e1e24ac..89c1d73 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
 
        * src/utils.c: to_human_readable(): made a bit of optimization.
        * src/summaryview.c: summary_delete(): fixed a focus problem.
+         summary_find_{prev,next}_msg(): new. They find previous/next
+         message that is not deleted.
+       * src/prefs_filter.c: scroll CList automatically if moved row
+         becomes not fully visible.
 
 2001-10-09
 
index fd01735..49ab493 100644 (file)
@@ -1,3 +1,8 @@
+2001-10-11 [paul]      0.6.3claws8
+
+       * sync with sylpheed 0.6.3cvs3
+               see ChangeLog entry 2001-10-10
+
 2001-10-10 [christoph] 0.6.3claws7
 
        * .cvsignore
index 83113c1..cad277e 100644 (file)
@@ -2,6 +2,10 @@
 
        * src/utils.c: to_human_readable(): ¾¯¤·ºÇŬ²½¡£
        * src/summaryview.c: summary_delete(): ¥Õ¥©¡¼¥«¥¹¤ÎÌäÂê¤ò½¤Àµ¡£
+         summary_find_{prev,next}_msg(): ¿·µ¬¡£Á°/¼¡¤Îºï½ü¤µ¤ì¤Æ¤¤¤Ê¤¤
+         ¥á¥Ã¥»¡¼¥¸¤ò¸¡º÷¤¹¤ë¡£
+       * src/prefs_filter.c: °ÜÆ°¤·¤¿¹Ô¤¬´°Á´¤Ëɽ¼¨¤µ¤ì¤Ê¤¯¤Ê¤Ã¤¿¾ì¹ç¤Ï
+         ¼«Æ°Åª¤Ë CList ¤ò¥¹¥¯¥í¡¼¥ë¤µ¤»¤ë¤è¤¦¤Ë¤·¤¿¡£
 
 2001-10-09
 
index 39759c5..eaeb874 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws7
+EXTRA_VERSION=claws8
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 3c54b41..5719037 100644 (file)
@@ -99,6 +99,9 @@ static void prefs_filter_select               (GtkCList       *clist,
                                         gint            row,
                                         gint            column,
                                         GdkEvent       *event);
+static void prefs_filter_row_move      (GtkCList       *clist,
+                                        gint            source_row,
+                                        gint            dest_row);
 
 static void prefs_filter_dest_radio_button_toggled     (void);
 static void prefs_filter_notrecv_radio_button_toggled  (void);
@@ -434,6 +437,8 @@ static void prefs_filter_create(void)
                                GTK_CAN_FOCUS);
        gtk_signal_connect (GTK_OBJECT (cond_clist), "select_row",
                            GTK_SIGNAL_FUNC (prefs_filter_select), NULL);
+       gtk_signal_connect (GTK_OBJECT (cond_clist), "row_move",
+                           GTK_SIGNAL_FUNC (prefs_filter_row_move), NULL);
 
        btn_vbox = gtk_vbox_new (FALSE, 8);
        gtk_widget_show (btn_vbox);
@@ -745,13 +750,8 @@ static void prefs_filter_up(void)
        if (!clist->selection) return;
 
        row = GPOINTER_TO_INT(clist->selection->data);
-       if (row > 1) {
+       if (row > 1)
                gtk_clist_row_move(clist, row, row - 1);
-               if(gtk_clist_row_is_visible(clist, row - 1) != GTK_VISIBILITY_FULL) {
-                       gtk_clist_moveto(clist, row - 1, 0, 0, 0);
-               } 
-               prefs_filter_set_list();
-       }
 }
 
 static void prefs_filter_down(void)
@@ -762,13 +762,8 @@ static void prefs_filter_down(void)
        if (!clist->selection) return;
 
        row = GPOINTER_TO_INT(clist->selection->data);
-       if (row > 0 && row < clist->rows - 1) {
+       if (row > 0 && row < clist->rows - 1)
                gtk_clist_row_move(clist, row, row + 1);
-               if(gtk_clist_row_is_visible(clist, row + 1) != GTK_VISIBILITY_FULL) {
-                       gtk_clist_moveto(clist, row + 1, 0, 1, 0);
-               } 
-               prefs_filter_set_list();
-       }
 }
 
 #define ENTRY_SET_TEXT(entry, str) \
@@ -810,6 +805,16 @@ static void prefs_filter_select(GtkCList *clist, gint row, gint column,
                        (GTK_TOGGLE_BUTTON(filter.dest_radiobtn), TRUE);
 }
 
+static void prefs_filter_row_move(GtkCList *clist, gint source_row,
+                                 gint dest_row)
+{
+       prefs_filter_set_list();
+       if (gtk_clist_row_is_visible(clist, dest_row) != GTK_VISIBILITY_FULL) {
+               gtk_clist_moveto(clist, dest_row, -1,
+                                source_row < dest_row ? 1.0 : 0.0, 0.0);
+       }
+}
+
 static void prefs_filter_dest_radio_button_toggled(void)
 {
        gtk_widget_set_sensitive(filter.dest_entry, TRUE);
index 55f9bcc..c585318 100644 (file)
@@ -153,6 +153,12 @@ static void summary_set_menu_sensitive     (SummaryView            *summaryview);
 static guint summary_get_msgnum                (SummaryView            *summaryview,
                                         GtkCTreeNode           *node);
 
+static GtkCTreeNode *summary_find_prev_msg
+                                       (SummaryView            *summaryview,
+                                        GtkCTreeNode           *current_node);
+static GtkCTreeNode *summary_find_next_msg
+                                       (SummaryView            *summaryview,
+                                        GtkCTreeNode           *current_node);
 static GtkCTreeNode *summary_find_prev_unread_msg
                                        (SummaryView            *summaryview,
                                         GtkCTreeNode           *current_node);
@@ -1370,6 +1376,46 @@ static guint summary_get_msgnum(SummaryView *summaryview, GtkCTreeNode *node)
        return msginfo->msgnum;
 }
 
+static GtkCTreeNode *summary_find_prev_msg(SummaryView *summaryview,
+                                          GtkCTreeNode *current_node)
+{
+       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCTreeNode *node;
+       MsgInfo *msginfo;
+
+       if (current_node)
+               node = current_node;
+       else
+               node = gtk_ctree_node_nth(ctree, GTK_CLIST(ctree)->rows - 1);
+
+       for (; node != NULL; node = GTK_CTREE_NODE_PREV(node)) {
+               msginfo = gtk_ctree_node_get_row_data(ctree, node);
+               if (!MSG_IS_DELETED(msginfo->flags)) break;
+       }
+
+       return node;
+}
+
+static GtkCTreeNode *summary_find_next_msg(SummaryView *summaryview,
+                                          GtkCTreeNode *current_node)
+{
+       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+       GtkCTreeNode *node;
+       MsgInfo *msginfo;
+
+       if (current_node)
+               node = current_node;
+       else
+               node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
+
+       for (; node != NULL; node = gtkut_ctree_node_next(ctree, node)) {
+               msginfo = gtk_ctree_node_get_row_data(ctree, node);
+               if (!MSG_IS_DELETED(msginfo->flags)) break;
+       }
+
+       return node;
+}
+
 static GtkCTreeNode *summary_find_prev_unread_msg(SummaryView *summaryview,
                                                  GtkCTreeNode *current_node)
 {
@@ -2698,7 +2744,8 @@ void summary_delete(SummaryView *summaryview)
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        FolderItem *item = summaryview->folder_item;
        GList *cur;
-       GtkCTreeNode *dsp_last, *sel_last = NULL;
+       GtkCTreeNode *sel_last = NULL;
+       GtkCTreeNode *node;
 
        if (!item || item->folder->type == F_NEWS) return;
 
@@ -2714,20 +2761,24 @@ 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 has children,
-        * we don't scroll back. */
-       dsp_last = gtk_ctree_node_nth(ctree, GTK_CLIST(ctree)->rows - 1);
+       /* next code sets current row focus right. We need to find a row
+        * that is not deleted. */
        for (cur = GTK_CLIST(ctree)->selection; cur != NULL; cur = cur->next) {
                sel_last = GTK_CTREE_NODE(cur->data);
                summary_delete_row(summaryview, sel_last);
        }
 
-       if (dsp_last == sel_last && !GTK_CTREE_ROW(sel_last)->children)
-               summary_step(summaryview, GTK_SCROLL_STEP_BACKWARD);
-       else    
+       node = summary_find_next_msg(summaryview, sel_last);
+       if (!node)
+               node = summary_find_prev_msg(summaryview, sel_last);
+       if (node == gtkut_ctree_node_next(ctree, sel_last))
                summary_step(summaryview, GTK_SCROLL_STEP_FORWARD);
+       else if (node == GTK_CTREE_NODE_PREV(sel_last))
+               summary_step(summaryview, GTK_SCROLL_STEP_BACKWARD);
+       else
+               summary_select_node
+                       (summaryview, node,
+                        summaryview->msg_is_toggled_on);
 
        if (prefs_common.immediate_exec || item->stype == F_TRASH)
                summary_execute(summaryview);
index 45dad27..66eeddc 100644 (file)
@@ -136,23 +136,15 @@ gchar *itos(gint n)
 gchar *to_human_readable(off_t size)
 {
        static gchar str[10];
-       gint shift;
 
-       for (shift = 0; shift < 30; shift += 10) {
-               if (size >> shift < 1024)
-                       break;
-       }
-
-       switch (shift) {
-       case 0 : g_snprintf(str, sizeof(str), "%dB",    (gint)size);   break;
-       case 10: g_snprintf(str, sizeof(str), "%.1fKB", (gfloat)size / (1 << 10));
-               break;
-       case 20: g_snprintf(str, sizeof(str), "%.2fMB", (gfloat)size / (1 << 20));
-               break;
-       default:
+       if (size < 1024)
+               g_snprintf(str, sizeof(str), "%dB", (gint)size);
+       else if (size >> 10 < 1024)
+               g_snprintf(str, sizeof(str), "%.1fKB", (gfloat)size / (1 << 10));
+       else if (size >> 20 < 1024)
+               g_snprintf(str, sizeof(str), "%.2fMB", (gfloat)size / (1 << 20));
+       else
                g_snprintf(str, sizeof(str), "%.2fGB", (gfloat)size / (1 << 30));
-               break;
-       }
 
        return str;
 }