sync with 0.9.2cvs12
authorPaul Mangan <paul@claws-mail.org>
Thu, 3 Jul 2003 06:57:01 +0000 (06:57 +0000)
committerPaul Mangan <paul@claws-mail.org>
Thu, 3 Jul 2003 06:57:01 +0000 (06:57 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.ac
src/common/session.c
src/inc.c
src/inc.h

index 224d8b7..2a4b660 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-07-03
+
+       * src/inc.[ch]: update received message number on CList while
+         retrieving.
+       * src/session.c: session_read_data_cb(): optimized by removing
+         g_malloc() and memcpy().
+
 2003-07-02
 
        * src/socket.[ch]: sock_add_watch(): new. It monitors SSL by original
index 64de6f1..85901fb 100644 (file)
@@ -1,3 +1,8 @@
+2003-07-03 [paul]      0.9.0claws75
+
+       * sync with 0.9.2cvs12
+               see ChangeLog 2003-07-03
+
 2003-07-02 [paul]      0.9.0claws74
 
        * src/messageview.c
index 2bfaaea..b9d3e53 100644 (file)
@@ -1,3 +1,9 @@
+2003-07-03
+
+       * src/inc.[ch]: ¼õ¿®Ãæ¤Ë CList ¤Î¼õ¿®ºÑ¥á¥Ã¥»¡¼¥¸¿ô¤ò¹¹¿·¡£
+       * src/session.c: session_read_data_cb(): g_malloc() ¤È memcpy() ¤ò
+         ¼è¤ê½ü¤¤¤ÆºÇŬ²½¡£
+
 2003-07-02
 
        * src/socket.[ch]: sock_add_watch(): ¿·µ¬¡£ SSL ¤ò¥ª¥ê¥¸¥Ê¥ë¤Î watch
index 81df286..28f373a 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws74
+EXTRA_VERSION=claws75
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 1c2f92c..8e66924 100644 (file)
@@ -452,9 +452,8 @@ static gboolean session_read_data_cb(SockInfo *source, GIOCondition condition,
        gint read_len;
        gint terminator_len;
        gboolean complete = FALSE;
+       guint data_len;
        gint ret;
-       gchar *ret_data;
-       gint data_len;
 
        g_return_val_if_fail(condition == G_IO_IN, FALSE);
 
@@ -512,18 +511,17 @@ static gboolean session_read_data_cb(SockInfo *source, GIOCondition condition,
                session->io_tag = 0;
        }
 
-       /* callback */
-       ret_data = g_malloc(data_buf->len);
-       memcpy(ret_data, data_buf->data, data_buf->len);
        data_len = data_buf->len - terminator_len;
+
+       /* callback */
+       ret = session->recv_data_finished(session, (gchar *)data_buf->data,
+                                         data_len);
+
        g_byte_array_set_size(data_buf, 0);
 
-       ret = session->recv_data_finished(session, ret_data, data_len);
        session->recv_data_notify(session, data_len,
                                  session->recv_data_notify_data);
 
-       g_free(ret_data);
-
        if (ret < 0)
                session->state = SESSION_ERROR;
 
index cee3734..704a4fe 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -378,6 +378,7 @@ static IncProgressDialog *inc_progress_dialog_create(void)
 
        dialog->dialog = progress;
        dialog->queue_list = NULL;
+       dialog->cur_row = 0;
 
        inc_dialog_list = g_list_append(inc_dialog_list, dialog);
 
@@ -462,7 +463,6 @@ static gint inc_start(IncProgressDialog *inc_dialog)
        GList *qlist;
        Pop3Session *pop3_session;
        IncState inc_state;
-       gint num = 0;
        gint error_num = 0;
        gint new_msgs = 0;
        gchar *msg;
@@ -511,13 +511,18 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                qlist = next;
        }
 
-       for (; inc_dialog->queue_list != NULL; num++) {
+#define SET_PIXMAP_AND_TEXT(xpm, xpmmask, str)                            \
+{                                                                         \
+       gtk_clist_set_pixmap(clist, inc_dialog->cur_row, 0, xpm, xpmmask); \
+       gtk_clist_set_text(clist, inc_dialog->cur_row, 2, str);            \
+}
+
+       for (; inc_dialog->queue_list != NULL; inc_dialog->cur_row++) {
                session = inc_dialog->queue_list->data;
                pop3_session = POP3_SESSION(session->session);
 
                if (pop3_session->pass == NULL) {
-                       gtk_clist_set_pixmap(clist, num, 0, okxpm, okxpmmask);
-                       gtk_clist_set_text(clist, num, 2, _("Cancelled"));
+                       SET_PIXMAP_AND_TEXT(okxpm, okxpmmask, _("Cancelled"));
                        inc_session_destroy(session);
                        inc_dialog->queue_list =
                                g_list_remove(inc_dialog->queue_list, session);
@@ -525,10 +530,10 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                }
 
                inc_progress_dialog_clear(inc_dialog);
-               gtk_clist_moveto(clist, num, -1, 1.0, 0.0);
+               gtk_clist_moveto(clist, inc_dialog->cur_row, -1, 1.0, 0.0);
 
-               gtk_clist_set_pixmap(clist, num, 0, currentxpm, currentxpmmask);
-               gtk_clist_set_text(clist, num, 2, _("Retrieving"));
+               SET_PIXMAP_AND_TEXT(currentxpm, currentxpmmask,
+                                   _("Retrieving"));
 
                session_set_recv_message_notify(session->session,
                                                inc_recv_message, session);
@@ -549,32 +554,29 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                                         to_human_readable(pop3_session->cur_total_recv_bytes));
                        else
                                msg = g_strdup_printf(_("Done (no new messages)"));
-                       gtk_clist_set_pixmap(clist, num, 0, okxpm, okxpmmask);
-                       gtk_clist_set_text(clist, num, 2, msg);
+                       SET_PIXMAP_AND_TEXT(okxpm, okxpmmask, msg);
                        g_free(msg);
                        break;
                case INC_CONNECT_ERROR:
-                       gtk_clist_set_pixmap(clist, num, 0, errorxpm, errorxpmmask);
-                       gtk_clist_set_text(clist, num, 2, _("Connection failed"));
+                       SET_PIXMAP_AND_TEXT(errorxpm, errorxpmmask,
+                                           _("Connection failed"));
                        break;
                case INC_AUTH_FAILED:
-                       gtk_clist_set_pixmap(clist, num, 0, errorxpm, errorxpmmask);
-                       gtk_clist_set_text(clist, num, 2, _("Auth failed"));
+                       SET_PIXMAP_AND_TEXT(errorxpm, errorxpmmask,
+                                           _("Auth failed"));
                        break;
                case INC_LOCKED:
-                       gtk_clist_set_pixmap(clist, num, 0, errorxpm, errorxpmmask);
-                       gtk_clist_set_text(clist, num, 2, _("Locked"));
+                       SET_PIXMAP_AND_TEXT(errorxpm, errorxpmmask,
+                                           _("Locked"));
                        break;
                case INC_ERROR:
                case INC_NO_SPACE:
                case INC_IO_ERROR:
                case INC_SOCKET_ERROR:
-                       gtk_clist_set_pixmap(clist, num, 0, errorxpm, errorxpmmask);
-                       gtk_clist_set_text(clist, num, 2, _("Error"));
+                       SET_PIXMAP_AND_TEXT(errorxpm, errorxpmmask, _("Error"));
                        break;
                case INC_CANCEL:
-                       gtk_clist_set_pixmap(clist, num, 0, okxpm, okxpmmask);
-                       gtk_clist_set_text(clist, num, 2, _("Cancelled"));
+                       SET_PIXMAP_AND_TEXT(okxpm, okxpmmask, _("Cancelled"));
                        break;
                default:
                        break;
@@ -654,6 +656,8 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                        g_list_remove(inc_dialog->queue_list, session);
        }
 
+#undef SET_PIXMAP_AND_TEXT
+
        if (new_msgs > 0)
                fin_msg = g_strdup_printf(_("Finished (%d new message(s))"),
                                          new_msgs);
@@ -901,7 +905,9 @@ static gint inc_recv_data_progressive(Session *session, guint cur_len,
 static gint inc_recv_data_finished(Session *session, guint len, gpointer data)
 {
        IncSession *inc_session = (IncSession *)data;
+       Pop3Session *pop3_session = POP3_SESSION(session);
        IncProgressDialog *inc_dialog;
+       gchar *msg;
 
        g_return_val_if_fail(inc_session != NULL, -1);
 
@@ -909,6 +915,15 @@ static gint inc_recv_data_finished(Session *session, guint len, gpointer data)
        inc_recv_data_progressive(session, 0, len, inc_session);
        inc_progress_dialog_set_label(inc_dialog, inc_session);
 
+       if (pop3_session->cur_total_num == 0) return 0;
+
+       msg = g_strdup_printf(_("Retrieving (%d message(s) (%s) received)"),
+                             pop3_session->cur_total_num,
+                             to_human_readable
+                               (pop3_session->cur_total_recv_bytes));
+       gtk_clist_set_text(GTK_CLIST(inc_dialog->dialog->clist),
+                          inc_dialog->cur_row, 2, msg);
+
        return 0;
 }
 
index 8cf1cf8..a4477c7 100644 (file)
--- a/src/inc.h
+++ b/src/inc.h
@@ -35,6 +35,7 @@
 
 typedef struct _IncProgressDialog      IncProgressDialog;
 typedef struct _IncSession             IncSession;
+
 typedef enum
 {
        INC_SUCCESS,
@@ -57,6 +58,7 @@ struct _IncProgressDialog
        gboolean show_dialog;
 
        GList *queue_list;      /* list of IncSession */
+       gint cur_row;
 };
 
 struct _IncSession