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/mail-threads.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'mail/mail-threads.c') 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); } /** -- cgit v1.2.3