From 2063939db42ac2baaa90113d4ebbb4bff1c9c91b Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Fri, 1 Dec 2000 08:19:16 +0000 Subject: use mail_op_set_message_plain 2000-12-01 Radek Doulik * mail-ops.c (mail_op_report_status): use mail_op_set_message_plain * mail-threads.c (mail_op_set_message_plain): plain version of mail_op_set_message, doesn't use printf, passes message untouched, use set_message (mail_op_set_message): set_message (set_message): helper function svn path=/trunk/; revision=6753 --- mail/ChangeLog | 10 ++++++++++ mail/mail-ops.c | 2 +- mail/mail-threads.c | 33 +++++++++++++++++++++++++++++---- mail/mail-threads.h | 1 + 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index bd6c125047..c6fba1cfff 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2000-12-01 Radek Doulik + + * mail-ops.c (mail_op_report_status): use mail_op_set_message_plain + + * mail-threads.c (mail_op_set_message_plain): plain version of + mail_op_set_message, doesn't use printf, passes message untouched, + use set_message + (mail_op_set_message): set_message + (set_message): helper function + 2000-11-30 Jeffrey Stedfast * mail-ops.c (cleanup_fetch_mail): Don't display a dialog, instead diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 9052eaed3b..77d3aa564e 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -117,7 +117,7 @@ mail_op_report_status (FilterDriver *driver, enum filter_status_t status, const /* FIXME: make it work */ switch (status) { case FILTER_STATUS_START: - mail_op_set_message (desc); + mail_op_set_message_plain (desc); break; case FILTER_STATUS_END: break; diff --git a/mail/mail-threads.c b/mail/mail-threads.c index 8e9365eac7..6491a936c5 100644 --- a/mail/mail-threads.c +++ b/mail/mail-threads.c @@ -385,6 +385,32 @@ mail_op_show_progressbar (void) #endif +/** + * mail_op_set_message: + * @str: message + * + * Set the message displayed above the progress bar for the currently + * executing operation. + * Threadsafe for, nay, intended to be called by, the dispatching thread. + **/ + +static void +set_message (gchar *str) +{ + com_msg_t msg; + + msg.type = MESSAGE; + msg.message = str; + + pipe_write (MAIN_WRITER, &msg, sizeof (msg)); +} + +void +mail_op_set_message_plain (const gchar *str) +{ + set_message (g_strdup (str)); +} + /** * mail_op_set_message: * @fmt: printf-style format string for the message @@ -398,15 +424,14 @@ mail_op_show_progressbar (void) void mail_op_set_message (const gchar *fmt, ...) { - com_msg_t msg; + gchar *str; va_list val; va_start (val, fmt); - msg.type = MESSAGE; - msg.message = g_strdup_vprintf (fmt, val); + str = g_strdup_vprintf (fmt, val); va_end (val); - pipe_write (MAIN_WRITER, &msg, sizeof (msg)); + set_message (str); } /** diff --git a/mail/mail-threads.h b/mail/mail-threads.h index d3872276f3..83a78e782a 100644 --- a/mail/mail-threads.h +++ b/mail/mail-threads.h @@ -58,6 +58,7 @@ void mail_op_hide_progressbar (void); void mail_op_show_progressbar (void); #endif +void mail_op_set_message_plain (const gchar *str); void mail_op_set_message (const gchar *fmt, ...) G_GNUC_PRINTF (1, 2); void mail_op_error (gchar * fmt, ...) G_GNUC_PRINTF (1, 2); gboolean mail_op_get_password (gchar * prompt, gboolean secret, -- cgit v1.2.3