aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-03-21 01:55:12 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-03-21 01:55:12 +0800
commitd7f89b244f8df95dc3f5ca6fbfc39f99db9a2659 (patch)
tree6a6429b14aea341ed7e9d9032076a27505468fae
parentaa30af489775562d385eab6200961b8b5d653c87 (diff)
downloadgsoc2013-evolution-d7f89b244f8df95dc3f5ca6fbfc39f99db9a2659.tar
gsoc2013-evolution-d7f89b244f8df95dc3f5ca6fbfc39f99db9a2659.tar.gz
gsoc2013-evolution-d7f89b244f8df95dc3f5ca6fbfc39f99db9a2659.tar.bz2
gsoc2013-evolution-d7f89b244f8df95dc3f5ca6fbfc39f99db9a2659.tar.lz
gsoc2013-evolution-d7f89b244f8df95dc3f5ca6fbfc39f99db9a2659.tar.xz
gsoc2013-evolution-d7f89b244f8df95dc3f5ca6fbfc39f99db9a2659.tar.zst
gsoc2013-evolution-d7f89b244f8df95dc3f5ca6fbfc39f99db9a2659.zip
Make the 5th argument to gtk_message_dialog_new() "%s" and move the
2003-03-20 Jeffrey Stedfast <fejj@ximian.com> * 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
-rw-r--r--mail/ChangeLog11
-rw-r--r--mail/mail-session.c10
2 files changed, 20 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 068f157c94..d4bb8a9198 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,14 @@
+2003-03-20 Jeffrey Stedfast <fejj@ximian.com>
+
+ * 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.
+
2003-03-20 Dan Winship <danw@ximian.com>
* mail-ops.c (build_from): Remove this since there's a function in
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
@@ -434,6 +434,12 @@ user_message_response (GtkDialog *dialog, int button, struct _user_message_msg *
}
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)
{
struct _user_message_msg *m = (struct _user_message_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);