0.8.6claws96
authorChristoph Hohmann <reboot@gmx.ch>
Tue, 10 Dec 2002 23:03:59 +0000 (23:03 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Tue, 10 Dec 2002 23:03:59 +0000 (23:03 +0000)
* src/compose.c
* src/folder.c
* src/imap.c
* src/inc.c
* src/main.c
* src/mainwindow.c
* src/news.c
* src/send.c
* src/statusbar.[ch]
* src/common/hooks.c
* src/common/log.[ch]
        o handle verbose logging in statusbar directly in statusbar code
          and common code does not need any knowledge about a statusbar
        o remove direct calls to statusbar_(puts|pop)_all functions

15 files changed:
ChangeLog.claws
configure.in
src/common/hooks.c
src/common/log.c
src/common/log.h
src/compose.c
src/folder.c
src/imap.c
src/inc.c
src/main.c
src/mainwindow.c
src/news.c
src/send.c
src/statusbar.c
src/statusbar.h

index cfce9c7..43bc76e 100644 (file)
@@ -1,3 +1,20 @@
+2002-12-10 [christoph] 0.8.6claws96
+
+       * src/compose.c
+       * src/folder.c
+       * src/imap.c
+       * src/inc.c
+       * src/main.c
+       * src/mainwindow.c
+       * src/news.c
+       * src/send.c
+       * src/statusbar.[ch]
+       * src/common/hooks.c
+       * src/common/log.[ch]
+               o handle verbose logging in statusbar directly in statusbar code
+                 and common code does not need any knowledge about a statusbar
+               o remove direct calls to statusbar_(puts|pop)_all functions
+
 2002-12-10 [jens]      0.8.6claws95
 
        * src/*.c
index 910fc45..16d11a9 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws95
+EXTRA_VERSION=claws96
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 634f705..95dc0a2 100644 (file)
@@ -72,6 +72,18 @@ gint hooks_register_hook(gchar *hooklist_name,
 void hooks_unregister_hook(gchar *hooklist_name,
                           guint hook_id)
 {
+       GHookList *hooklist;
+       GHook *hook;
+
+       g_return_if_fail(hooklist_name != NULL);
+
+       hooklist = hooks_get_hooklist(hooklist_name);
+       g_return_if_fail(hooklist != NULL);
+
+       hook = g_hook_get(hooklist, hook_id);
+       g_return_if_fail(hook != NULL);
+
+       g_hook_destroy_link(hooklist, hook);
 }
 
 struct MarshalData
index d5a1848..241130e 100644 (file)
@@ -59,30 +59,18 @@ void close_log_file(void)
        }
 }
 
-static guint log_verbosity_count = 0;
-
-void log_verbosity_set(gboolean verbose)
-{
-       if (verbose)
-               log_verbosity_count++;
-       else if (log_verbosity_count > 0)
-               log_verbosity_count--;
-}
-
-#define TIME_LEN       11
-
 void log_print(const gchar *format, ...)
 {
        va_list args;
-       gchar buf[BUFFSIZE + TIME_LEN];
+       gchar buf[BUFFSIZE + LOG_TIME_LEN];
        time_t t;
        LogText logtext;
 
        time(&t);
-       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
+       strftime(buf, LOG_TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
 
        va_start(args, format);
-       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
+       g_vsnprintf(buf + LOG_TIME_LEN, BUFFSIZE, format, args);
        va_end(args);
 
        if (debug_get_mode()) fputs(buf, stdout);
@@ -93,63 +81,56 @@ void log_print(const gchar *format, ...)
                fputs(buf, log_fp);
                fflush(log_fp);
        }
-
-       logtext.text = buf + TIME_LEN;
-       if (log_verbosity_count)
-               hooks_invoke(STATUSBAR_PUTS_ALL_HOOKLIST, &logtext);
 }
 
 void log_message(const gchar *format, ...)
 {
        va_list args;
-       gchar buf[BUFFSIZE + TIME_LEN];
+       gchar buf[BUFFSIZE + LOG_TIME_LEN];
        time_t t;
        LogText logtext;
 
        time(&t);
-       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
+       strftime(buf, LOG_TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
 
        va_start(args, format);
-       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
+       g_vsnprintf(buf + LOG_TIME_LEN, BUFFSIZE, format, args);
        va_end(args);
 
-       if (debug_get_mode()) g_message("%s", buf + TIME_LEN);
-       logtext.text = buf + TIME_LEN;
+       if (debug_get_mode()) g_message("%s", buf + LOG_TIME_LEN);
+       logtext.text = buf + LOG_TIME_LEN;
        logtext.type = LOG_MSG;
        hooks_invoke(LOG_APPEND_TEXT_HOOKLIST, &logtext);
        if (log_fp) {
-               fwrite(buf, TIME_LEN, 1, log_fp);
+               fwrite(buf, LOG_TIME_LEN, 1, log_fp);
                fputs("* message: ", log_fp);
-               fputs(buf + TIME_LEN, log_fp);
+               fputs(buf + LOG_TIME_LEN, log_fp);
                fflush(log_fp);
        }
-
-       logtext.text = buf + TIME_LEN;
-       hooks_invoke(STATUSBAR_PUTS_ALL_HOOKLIST, &logtext);
 }
 
 void log_warning(const gchar *format, ...)
 {
        va_list args;
-       gchar buf[BUFFSIZE + TIME_LEN];
+       gchar buf[BUFFSIZE + LOG_TIME_LEN];
        time_t t;
        LogText logtext;
 
        time(&t);
-       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
+       strftime(buf, LOG_TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
 
        va_start(args, format);
-       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
+       g_vsnprintf(buf + LOG_TIME_LEN, BUFFSIZE, format, args);
        va_end(args);
 
        g_warning("%s", buf);
-       logtext.text = buf + TIME_LEN;
+       logtext.text = buf + LOG_TIME_LEN;
        logtext.type = LOG_WARN;
        hooks_invoke(LOG_APPEND_TEXT_HOOKLIST, &logtext);
        if (log_fp) {
-               fwrite(buf, TIME_LEN, 1, log_fp);
+               fwrite(buf, LOG_TIME_LEN, 1, log_fp);
                fputs("** warning: ", log_fp);
-               fputs(buf + TIME_LEN, log_fp);
+               fputs(buf + LOG_TIME_LEN, log_fp);
                fflush(log_fp);
        }
 }
@@ -157,25 +138,25 @@ void log_warning(const gchar *format, ...)
 void log_error(const gchar *format, ...)
 {
        va_list args;
-       gchar buf[BUFFSIZE + TIME_LEN];
+       gchar buf[BUFFSIZE + LOG_TIME_LEN];
        time_t t;
        LogText logtext;
 
        time(&t);
-       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
+       strftime(buf, LOG_TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
 
        va_start(args, format);
-       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
+       g_vsnprintf(buf + LOG_TIME_LEN, BUFFSIZE, format, args);
        va_end(args);
 
        g_warning("%s", buf);
-       logtext.text = buf + TIME_LEN;
+       logtext.text = buf + LOG_TIME_LEN;
        logtext.type = LOG_ERROR;
        hooks_invoke(LOG_APPEND_TEXT_HOOKLIST, &logtext);
        if (log_fp) {
-               fwrite(buf, TIME_LEN, 1, log_fp);
+               fwrite(buf, LOG_TIME_LEN, 1, log_fp);
                fputs("*** error: ", log_fp);
-               fputs(buf + TIME_LEN, log_fp);
+               fputs(buf + LOG_TIME_LEN, log_fp);
                fflush(log_fp);
        }
 }
index e9d6b6d..b5b2783 100644 (file)
@@ -27,7 +27,7 @@
 #include <glib.h>
 
 #define LOG_APPEND_TEXT_HOOKLIST "log_append_text"
-#define STATUSBAR_PUTS_ALL_HOOKLIST "statusbar_puts_all"
+#define LOG_TIME_LEN 11
 
 typedef enum
 {
index 8fca36d..9a51d6c 100644 (file)
@@ -2901,7 +2901,6 @@ gint compose_send(Compose *compose)
                ac = compose->account;
 
                ok = send_message(tmp, ac, compose->to_list);
-               statusbar_pop_all();
        }
 
        if (ok == 0 && compose->newsgroup_list) {
index b10668e..c45394b 100644 (file)
@@ -1544,8 +1544,6 @@ FolderItem *folder_item_move_recursive (FolderItem *src, FolderItem *dest)
                                        100*cnt/g_slist_length(mlist));
                msginfo = (MsgInfo *) cur->data;
                folder_item_move_msg(new_item, msginfo);
-               if (cnt%500)
-                       statusbar_pop_all();
 
                procmsg_msginfo_free(msginfo);
        }
index 6d7359a..c4f60b4 100644 (file)
@@ -43,7 +43,6 @@
 #include "procmsg.h"
 #include "procheader.h"
 #include "folder.h"
-#include "statusbar.h"
 #include "prefs_account.h"
 #include "codeconv.h"
 #include "utils.h"
@@ -427,7 +426,6 @@ static IMAPSession *imap_session_get(Folder *folder)
                                rfolder->session = NULL;
                        }
                }
-               statusbar_pop_all();
                return IMAP_SESSION(rfolder->session);
        }
 
@@ -441,7 +439,6 @@ static IMAPSession *imap_session_get(Folder *folder)
         * successfully sent. -- mbp */
        if (time(NULL) - rfolder->session->last_access_time < SESSION_TIMEOUT) {
                rfolder->session->last_access_time = time(NULL);
-               statusbar_pop_all();
                return IMAP_SESSION(rfolder->session);
        }
 
@@ -469,7 +466,6 @@ static IMAPSession *imap_session_get(Folder *folder)
 
        if (rfolder->session)
                rfolder->session->last_access_time = time(NULL);
-       statusbar_pop_all();
        return IMAP_SESSION(rfolder->session);
 }
 
@@ -608,7 +604,6 @@ GSList *imap_get_msg_list(Folder *folder, FolderItem *item, gboolean use_cache)
                mlist = procmsg_read_cache(item, FALSE);
                item->last_num = procmsg_get_last_num_in_msg_list(mlist);
                procmsg_set_flags(mlist, item);
-               statusbar_pop_all();
                return mlist;
        }
 
@@ -625,7 +620,6 @@ GSList *imap_get_msg_list(Folder *folder, FolderItem *item, gboolean use_cache)
                        last_uid = first_uid;
        } else {
                imap_delete_all_cached_messages(item);
-               statusbar_pop_all();
                return NULL;
        }
 
@@ -677,7 +671,6 @@ GSList *imap_get_msg_list(Folder *folder, FolderItem *item, gboolean use_cache)
        item->last_num = last_uid;
 
 catch:
-       statusbar_pop_all();
        return mlist;
 }
 
@@ -711,7 +704,6 @@ gchar *imap_fetch_msg(Folder *folder, FolderItem *item, gint uid)
 
        ok = imap_select(session, IMAP_FOLDER(folder), item->path,
                         NULL, NULL, NULL, NULL);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS) {
                g_warning("can't select mailbox %s\n", item->path);
                g_free(filename);
@@ -721,8 +713,6 @@ gchar *imap_fetch_msg(Folder *folder, FolderItem *item, gint uid)
        debug_print("getting message %d...\n", uid);
        ok = imap_cmd_fetch(SESSION(session)->sock, (guint32)uid, filename);
 
-       statusbar_pop_all();
-
        if (ok != IMAP_SUCCESS) {
                g_warning("can't fetch message %d\n", uid);
                g_free(filename);
@@ -750,7 +740,6 @@ gint imap_add_msg(Folder *folder, FolderItem *dest, const gchar *file,
 
        ok = imap_status(session, IMAP_FOLDER(folder), dest->path,
                         &messages, &recent, &uid_next, &uid_validity, &unseen);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS) {
                g_warning("can't append message %s\n", file);
                return -1;
@@ -797,7 +786,6 @@ static gint imap_do_copy(Folder *folder, FolderItem *dest, MsgInfo *msginfo,
 
        ok = imap_status(session, IMAP_FOLDER(folder), dest->path,
                         &messages, &recent, &uid_next, &uid_validity, &unseen);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS) {
                g_warning("can't copy message\n");
                return -1;
@@ -808,7 +796,6 @@ static gint imap_do_copy(Folder *folder, FolderItem *dest, MsgInfo *msginfo,
        /* ensure source folder selected */
        ok = imap_select(session, IMAP_FOLDER(folder), msginfo->folder->path,
                         NULL, NULL, NULL, NULL);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS)
                return -1;
         
@@ -830,7 +817,6 @@ static gint imap_do_copy(Folder *folder, FolderItem *dest, MsgInfo *msginfo,
        }
 
        g_free(destdir);
-       statusbar_pop_all();
 
        if (ok == IMAP_SUCCESS)
                return uid_next;
@@ -868,7 +854,6 @@ static gint imap_do_copy_msgs_with_dest(Folder *folder, FolderItem *dest,
                /* ensure source folder selected */
                ok = imap_select(session, IMAP_FOLDER(folder), 
                                 msginfo->folder->path, NULL, NULL, NULL, NULL);
-               statusbar_pop_all();
         
                if (remove_source)
                        debug_print("Moving message %s%c%d to %s ...\n",
@@ -893,7 +878,6 @@ static gint imap_do_copy_msgs_with_dest(Folder *folder, FolderItem *dest,
                ok = imap_cmd_expunge(SESSION(session)->sock);
 
        g_free(destdir);
-       statusbar_pop_all();
 
        if (ok == IMAP_SUCCESS)
                return 0;
@@ -1016,21 +1000,18 @@ gint imap_remove_msg(Folder *folder, FolderItem *item, gint uid)
 
        ok = imap_select(session, IMAP_FOLDER(folder), item->path,
                         NULL, NULL, NULL, NULL);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS)
                return ok;
 
        ok = imap_set_message_flags
                (IMAP_SESSION(REMOTE_FOLDER(folder)->session),
                 (guint32)uid, (guint32)uid, IMAP_FLAG_DELETED, TRUE);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS) {
                log_warning(_("can't set deleted flags: %d\n"), uid);
                return ok;
        }
 
        ok = imap_cmd_expunge(SESSION(session)->sock);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS) {
                log_warning(_("can't expunge\n"));
                return ok;
@@ -1063,7 +1044,6 @@ gint imap_remove_msgs(Folder *folder, FolderItem *item, GSList *msglist)
 
        ok = imap_select(session, IMAP_FOLDER(folder), item->path,
                         NULL, NULL, NULL, NULL);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS)
                return ok;
 
@@ -1073,7 +1053,6 @@ gint imap_remove_msgs(Folder *folder, FolderItem *item, GSList *msglist)
                ok = imap_set_message_flags
                        (IMAP_SESSION(REMOTE_FOLDER(folder)->session),
                         uid, uid, IMAP_FLAG_DELETED, TRUE);
-               statusbar_pop_all();
                if (ok != IMAP_SUCCESS) {
                        log_warning(_("can't set deleted flags: %d\n"), uid);
                        return ok;
@@ -1081,7 +1060,6 @@ gint imap_remove_msgs(Folder *folder, FolderItem *item, GSList *msglist)
        }
 
        ok = imap_cmd_expunge(SESSION(session)->sock);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS) {
                log_warning(_("can't expunge\n"));
                return ok;
@@ -1116,7 +1094,6 @@ gint imap_remove_all_msg(Folder *folder, FolderItem *item)
 
        ok = imap_select(session, IMAP_FOLDER(folder), item->path,
                         &exists, &recent, &unseen, &uid_validity);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS)
                return ok;
        if (exists == 0)
@@ -1125,14 +1102,12 @@ gint imap_remove_all_msg(Folder *folder, FolderItem *item)
        imap_cmd_gen_send(SESSION(session)->sock,
                          "STORE 1:%d +FLAGS (\\Deleted)", exists);
        ok = imap_cmd_ok(SESSION(session)->sock, NULL);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS) {
                log_warning(_("can't set deleted flags: 1:%d\n"), exists);
                return ok;
        }
 
        ok = imap_cmd_expunge(SESSION(session)->sock);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS) {
                log_warning(_("can't expunge\n"));
                return ok;
@@ -1167,7 +1142,6 @@ gint imap_scan_folder(Folder *folder, FolderItem *item)
 
        ok = imap_status(session, IMAP_FOLDER(folder), item->path,
                         &messages, &recent, &uid_next, &uid_validity, &unseen);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS) return -1;
 
        item->new = unseen > 0 ? recent : 0;
@@ -1378,7 +1352,6 @@ static GSList *imap_parse_list(Folder *folder, IMAPSession *session, const gchar
        }
 
        g_string_free(str, TRUE);
-       statusbar_pop_all();
 
        return item_list;
 }
@@ -1502,7 +1475,6 @@ FolderItem *imap_create_folder(Folder *folder, FolderItem *parent,
                argbuf = g_ptr_array_new();
                ok = imap_cmd_list(SESSION(session)->sock, NULL, imap_path,
                                   argbuf);
-               statusbar_pop_all();
                if (ok != IMAP_SUCCESS) {
                        log_warning(_("can't create mailbox: LIST failed\n"));
                        g_free(imap_path);
@@ -1523,7 +1495,6 @@ FolderItem *imap_create_folder(Folder *folder, FolderItem *parent,
 
                if (!exist) {
                        ok = imap_cmd_create(SESSION(session)->sock, imap_path);
-                       statusbar_pop_all();
                        if (ok != IMAP_SUCCESS) {
                                log_warning(_("can't create mailbox\n"));
                                g_free(imap_path);
@@ -1576,7 +1547,6 @@ gint imap_rename_folder(Folder *folder, FolderItem *item, const gchar *name)
        session->mbox = NULL;
        ok = imap_cmd_examine(SESSION(session)->sock, "INBOX",
                              &exists, &recent, &unseen, &uid_validity);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS) {
                g_free(real_oldpath);
                return -1;
@@ -1594,7 +1564,6 @@ gint imap_rename_folder(Folder *folder, FolderItem *item, const gchar *name)
        imap_path_separator_subst(real_newpath, separator);
 
        ok = imap_cmd_rename(SESSION(session)->sock, real_oldpath, real_newpath);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS) {
                log_warning(_("can't rename mailbox: %s to %s\n"),
                            real_oldpath, real_newpath);
@@ -1653,14 +1622,12 @@ gint imap_remove_folder(Folder *folder, FolderItem *item)
 
        ok = imap_cmd_examine(SESSION(session)->sock, "INBOX",
                              &exists, &recent, &unseen, &uid_validity);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS) {
                g_free(path);
                return -1;
        }
 
        ok = imap_cmd_delete(SESSION(session)->sock, path);
-       statusbar_pop_all();
        if (ok != IMAP_SUCCESS) {
                log_warning(_("can't delete mailbox\n"));
                g_free(path);
index de99261..181d234 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -580,8 +580,6 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                        }
                }
 
-               statusbar_pop_all();
-
                /* CLAWS: perform filtering actions on dropped message */
                /* CLAWS: get default inbox (perhaps per account) */
                if (pop3_state->ac_prefs->inbox) {
@@ -754,7 +752,6 @@ static IncState inc_pop3_session_do(IncSession *session)
        progress_dialog_set_label(inc_dialog->dialog, buf);
        g_free(buf);
        GTK_EVENTS_FLUSH();
-       statusbar_pop_all();
 
        if ((sockinfo = sock_connect(server, port)) == NULL) {
                log_warning(_("Can't connect to POP3 server: %s:%d\n"),
@@ -789,7 +786,7 @@ static IncState inc_pop3_session_do(IncSession *session)
        pop3_state->sockinfo = sockinfo;
        atm->help_sock = sockinfo;
 
-       log_verbosity_set(TRUE);
+       statusbar_verbosity_set(TRUE);
        /* oha: this messes up inc_progress update:
           disabling this would avoid the label "Retrieve Header"
           being overwritten by "Retrieve Message"
@@ -809,7 +806,7 @@ static IncState inc_pop3_session_do(IncSession *session)
        if (!atm->terminated)
                pop3_automaton_terminate(sockinfo, atm);
 
-       log_verbosity_set(FALSE);
+       statusbar_verbosity_set(FALSE);
        /* oha: see above */
        recv_set_ui_func(NULL, NULL);
 
index c8bc488..4c463cd 100644 (file)
@@ -787,7 +787,6 @@ static void send_queue(void)
                        if (procmsg_send_queue
                                (folder->queue, prefs_common.savemsg) < 0)
                                alertpanel_error(_("Some errors occurred while sending queued messages."));
-                       statusbar_pop_all();
                        folder_item_scan(folder->queue);
                        if (prefs_common.savemsg && folder->outbox) {
                                folder_update_item(folder->outbox, TRUE);
index 7b7782c..53fd490 100644 (file)
@@ -3047,7 +3047,6 @@ void send_queue_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
                        if (procmsg_send_queue
                                (folder->queue, prefs_common.savemsg) < 0)
                                alertpanel_error(_("Some errors occurred while sending queued messages."));
-                       statusbar_pop_all();
                        folder_item_scan(folder->queue);
                        folder_update_item(folder->queue, TRUE);
                }
index 3d6300e..1f8745f 100644 (file)
@@ -266,13 +266,11 @@ NNTPSession *news_session_get(Folder *folder)
 
        if (!rfolder->session) {
                rfolder->session = news_session_new_for_folder(folder);
-               statusbar_pop_all();
                return NNTP_SESSION(rfolder->session);
        }
 
        if (time(NULL) - rfolder->session->last_access_time < SESSION_TIMEOUT) {
                rfolder->session->last_access_time = time(NULL);
-               statusbar_pop_all();
                return NNTP_SESSION(rfolder->session);
        }
 
@@ -289,7 +287,6 @@ NNTPSession *news_session_get(Folder *folder)
 
        if (rfolder->session)
                rfolder->session->last_access_time = time(NULL);
-       statusbar_pop_all();
        return NNTP_SESSION(rfolder->session);
 }
 
@@ -341,8 +338,6 @@ GSList *news_get_article_list(Folder *folder, FolderItem *item,
 
        procmsg_set_flags(alist, item);
 
-       statusbar_pop_all();
-
        return alist;
 }
 
@@ -373,7 +368,6 @@ gchar *news_fetch_msg(Folder *folder, FolderItem *item, gint num)
        }
 
        ok = news_select_group(session, item->path, NULL, NULL, NULL);
-       statusbar_pop_all();
        if (ok != NN_SUCCESS) {
                g_warning("can't select group %s\n", item->path);
                g_free(filename);
@@ -383,7 +377,6 @@ gchar *news_fetch_msg(Folder *folder, FolderItem *item, gint num)
        debug_print("getting article %d...\n", num);
        ok = news_get_article(NNTP_SESSION(REMOTE_FOLDER(folder)->session),
                              num, filename);
-       statusbar_pop_all();
        if (ok < 0) {
                g_warning("can't read article %d\n", num);
                g_free(filename);
@@ -503,10 +496,8 @@ GSList *news_get_group_list(Folder *folder)
 
                if (nntp_list(session->nntp_sock) != NN_SUCCESS) {
                        g_free(filename);
-                       statusbar_pop_all();
                        return NULL;
                }
-               statusbar_pop_all();
                if (recv_write_to_file(SESSION(session)->sock, filename) < 0) {
                        log_warning("can't retrieve newsgroup list\n");
                        session_destroy(SESSION(session));
@@ -554,8 +545,6 @@ GSList *news_get_group_list(Folder *folder)
 
        list = g_slist_sort(list, (GCompareFunc)news_group_info_compare);
 
-       statusbar_pop_all();
-
        return list;
 }
 
@@ -606,8 +595,6 @@ gint news_post(Folder *folder, const gchar *file)
 
        fclose(fp);
 
-       statusbar_pop_all();
-
        return ok;
 }
 
index d879f47..b00cbb1 100644 (file)
@@ -401,7 +401,7 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list,
            && (ac_prefs->protocol == A_APOP || ac_prefs->protocol == A_POP3)
            && (time(NULL) - ac_prefs->last_pop_login_time) > (60 * ac_prefs->pop_before_smtp_timeout)) {
                g_snprintf(buf, sizeof(buf), _("Doing POP before SMTP..."));
-               statusbar_puts_all(buf);
+               log_message(buf);
                progress_dialog_set_label(dialog->dialog, buf);
                gtk_clist_set_text(clist, 0, 2, _("POP before SMTP"));
                GTK_EVENTS_FLUSH();
@@ -447,14 +447,12 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list,
                 "sending data");
 
        progress_dialog_set_label(dialog->dialog, _("Quitting..."));
-       statusbar_puts_all(_("Quitting..."));
+       log_message(_("Quitting..."));
        GTK_EVENTS_FLUSH();
 
        SEND_EXIT_IF_NOTOK(smtp_eom(SMTP_SESSION(session)), "terminating data");
        SEND_EXIT_IF_NOTOK(smtp_quit(SMTP_SESSION(session)), "sending QUIT");
 
-       statusbar_pop_all();
-
        session_destroy(session);
        send_progress_dialog_destroy(dialog);
 
@@ -485,7 +483,6 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list,
                           _("Sending message (%d / %d bytes)"), \
                           bytes, size); \
                progress_dialog_set_label(dialog->dialog, str); \
-               statusbar_puts_all(str); \
                progress_dialog_set_percentage \
                        (dialog->dialog, (gfloat)bytes / (gfloat)size); \
                GTK_EVENTS_FLUSH(); \
index f91868e..54fdc12 100644 (file)
 #define BUFFSIZE 1024
 
 static GList *statusbar_list = NULL;
-gboolean statusbar_puts_all_hook (gpointer source, gpointer data);
+gint statusbar_puts_all_hook_id = -1;
 
 GtkWidget *statusbar_create(void)
 {
        GtkWidget *statusbar;
 
        statusbar = gtk_statusbar_new();
-       
-       if(statusbar_list == NULL)
-               hooks_register_hook(STATUSBAR_PUTS_ALL_HOOKLIST, statusbar_puts_all_hook, NULL);
 
        statusbar_list = g_list_append(statusbar_list, statusbar);
 
        return statusbar;
 }
 
-gboolean statusbar_puts_all_hook (gpointer source, gpointer data)
-{
-       LogText *logtext = (LogText *) source;
-
-       g_return_val_if_fail(logtext != NULL, TRUE);
-       g_return_val_if_fail(logtext->text != NULL, TRUE);
-
-       statusbar_puts_all(logtext->text);
-
-       return FALSE;
-}
-
 void statusbar_puts(GtkStatusbar *statusbar, const gchar *str)
 {
        gint cid;
@@ -141,3 +126,32 @@ void statusbar_pop_all(void)
                gtk_statusbar_pop(GTK_STATUSBAR(cur->data), cid);
        }
 }
+
+gboolean statusbar_puts_all_hook (gpointer source, gpointer data)
+{
+       LogText *logtext = (LogText *) source;
+
+       g_return_val_if_fail(logtext != NULL, TRUE);
+       g_return_val_if_fail(logtext->text != NULL, TRUE);
+
+       statusbar_pop_all();
+       if (logtext->type == LOG_NORMAL) {
+               statusbar_puts_all(logtext->text + LOG_TIME_LEN);
+       } else if (logtext->type == LOG_MSG) {
+               statusbar_puts_all(logtext->text);
+       }
+
+       return FALSE;
+}
+
+void statusbar_verbosity_set(gboolean verbose)
+{
+       if (verbose && (statusbar_puts_all_hook_id == -1)) {
+               statusbar_puts_all_hook_id =
+                       hooks_register_hook(LOG_APPEND_TEXT_HOOKLIST, statusbar_puts_all_hook, NULL);
+       } else if (!verbose && (statusbar_puts_all_hook_id != -1)) {
+               hooks_unregister_hook(LOG_APPEND_TEXT_HOOKLIST, statusbar_puts_all_hook_id);
+               statusbar_puts_all_hook_id = -1;
+               statusbar_pop_all();
+       }
+}
index f8d25b1..c3e09e0 100644 (file)
@@ -34,6 +34,7 @@ void statusbar_print          (GtkStatusbar   *statusbar,
 void statusbar_print_all       (const gchar    *format, ...)
                                 G_GNUC_PRINTF(1, 2);
 void statusbar_pop_all         (void);
+void statusbar_verbosity_set   (gboolean        verbose);
 
 #define STATUSBAR_PUSH(mainwin, str) \
 { \