From 974e152f9bbc98a81c6f12ecd2fac08023d35302 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 8 Feb 2008 14:43:44 +0000 Subject: ** Fixes part of bug #509741 2008-02-08 Matthew Barnes ** Fixes part of bug #509741 * mail/mail-session.c (user_message_exec): Use the number of dialog buttons as a heuristic for whether to display a message in the status bar or immediately present the dialog to the user. * e-util/e-error.c (e_error_newv): If the error dialog has no primary text, fallback to the window title for the "primary" data key. This is what gets displayed in the status bar. * e-util/e-error.c (e_error_count_buttons): New function counts buttons in a dialog's action area. svn path=/trunk/; revision=34977 --- mail/ChangeLog | 9 +++++++++ mail/mail-session.c | 34 +++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 13 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 37f91f43c4..aadafa8a63 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,12 @@ +2008-02-08 Matthew Barnes + + ** Fixes part of bug #509741 + + * mail-session.c (user_message_exec): + Use the number of dialog buttons as a heuristic for whether to + display a message in the status bar or immediately present the + dialog to the user. + 2008-01-29 Matthew Barnes * mail-send-recv.c: diff --git a/mail/mail-session.c b/mail/mail-session.c index 793796f330..9f9a2712b7 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -342,23 +342,31 @@ user_message_exec (struct _user_message_msg *m) user_message_dialog, "allow_shrink", TRUE, "allow_grow", TRUE, NULL); - /* We only need to wait for the result if we allow cancel - * otherwise show but send result back instantly */ - if (m->allow_cancel && m->ismain) { - gint response = gtk_dialog_run (user_message_dialog); - user_message_response (user_message_dialog, response, m); + /* Use the number of dialog buttons as a heuristic for whether to + * emit a status bar message or present the dialog immediately, the + * thought being if there's more than one button then something is + * probably blocked until the user responds. */ + if (e_error_count_buttons (user_message_dialog) > 1) { + if (m->ismain) { + gint response; + + response = gtk_dialog_run (user_message_dialog); + user_message_response ( + user_message_dialog, response, m); + } else { + g_signal_connect ( + user_message_dialog, "response", + G_CALLBACK (user_message_response), m); + gtk_widget_show (user_message_dialog); + } } else { - g_object_set_data ((GObject *) user_message_dialog, "response-handled", GINT_TO_POINTER(TRUE)); g_signal_connect ( user_message_dialog, "response", G_CALLBACK (user_message_response), m); - - /* If the dialog has no "primary" text, there's nothing to - * display in the status bar. So just show the dialog. */ - if (g_object_get_data (user_message_dialog, "primary")) - em_utils_show_error_silent (user_message_dialog); - else - gtk_widget_show (user_message_dialog); + g_object_set_data ( + user_message_dialog, "response-handled", + GINT_TO_POINTER (TRUE)); + em_utils_show_error_silent (user_message_dialog); } } -- cgit v1.2.3