aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-session.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-02-08 22:43:44 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-02-08 22:43:44 +0800
commit974e152f9bbc98a81c6f12ecd2fac08023d35302 (patch)
tree9d8c3f17b2201ebce7ca9c5601aba6ca18c6a08a /mail/mail-session.c
parent05438a2dad5111faa4e3e6551f4cc8d9be56b092 (diff)
downloadgsoc2013-evolution-974e152f9bbc98a81c6f12ecd2fac08023d35302.tar
gsoc2013-evolution-974e152f9bbc98a81c6f12ecd2fac08023d35302.tar.gz
gsoc2013-evolution-974e152f9bbc98a81c6f12ecd2fac08023d35302.tar.bz2
gsoc2013-evolution-974e152f9bbc98a81c6f12ecd2fac08023d35302.tar.lz
gsoc2013-evolution-974e152f9bbc98a81c6f12ecd2fac08023d35302.tar.xz
gsoc2013-evolution-974e152f9bbc98a81c6f12ecd2fac08023d35302.tar.zst
gsoc2013-evolution-974e152f9bbc98a81c6f12ecd2fac08023d35302.zip
** Fixes part of bug #509741
2008-02-08 Matthew Barnes <mbarnes@redhat.com> ** 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
Diffstat (limited to 'mail/mail-session.c')
-rw-r--r--mail/mail-session.c34
1 files changed, 21 insertions, 13 deletions
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);
}
}