From d7f89b244f8df95dc3f5ca6fbfc39f99db9a2659 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 20 Mar 2003 17:55:12 +0000 Subject: Make the 5th argument to gtk_message_dialog_new() "%s" and move the 2003-03-20 Jeffrey Stedfast * mail-session.c (do_user_message): Make the 5th argument to gtk_message_dialog_new() "%s" and move the m->prompt to arg 6 so that we are safe if the prompt string contains any %'s. Also connect to the response signal for the user_msg dialog and set the callback to gtk_widget_destroy so that the user can actually close the dialog. We also need to g_object_weak_ref() the dialog so that we can set the global message_dialog pointer back to NULL when it gets destroyed. Fixes bug #40043. svn path=/trunk/; revision=20435 --- mail/mail-session.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'mail/mail-session.c') diff --git a/mail/mail-session.c b/mail/mail-session.c index 615c15707e..a78f9e064f 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -433,6 +433,12 @@ user_message_response (GtkDialog *dialog, int button, struct _user_message_msg * do_user_message((struct _mail_msg *)m); } +static void +user_message_destroy_notify (struct _user_message_msg *m, GObject *deadbeef) +{ + message_dialog = NULL; +} + static void do_user_message (struct _mail_msg *mm) { @@ -461,7 +467,7 @@ do_user_message (struct _mail_msg *mm) message_dialog = (GtkDialog *) gtk_message_dialog_new ( NULL, 0, msg_type, m->allow_cancel ? GTK_BUTTONS_OK_CANCEL : GTK_BUTTONS_OK, - m->prompt); + "%s", m->prompt); gtk_dialog_set_default_response (message_dialog, m->allow_cancel ? GTK_RESPONSE_CANCEL : GTK_RESPONSE_OK); g_object_set ((GObject *) message_dialog, "allow_shrink", TRUE, "allow_grow", TRUE, NULL); @@ -474,6 +480,8 @@ do_user_message (struct _mail_msg *mm) gtk_widget_show ((GtkWidget *) message_dialog); } } else { + g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_widget_destroy), message_dialog); + g_object_weak_ref ((GObject *) message_dialog, (GWeakNotify) user_message_destroy_notify, m); gtk_widget_show ((GtkWidget *) message_dialog); m->result = TRUE; e_msgport_reply ((EMsg *)m); -- cgit v1.2.3