From 5a5eec6a63ca61ba652dfc4f096b5d29bd26c98e Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 13 Dec 2002 22:51:35 +0000 Subject: Make sure the folder-browser is not NULL or we'll crash. 2002-12-13 Jeffrey Stedfast * mail-callbacks.c (check_send_configuration): Make sure the folder-browser is not NULL or we'll crash. svn path=/trunk/; revision=19115 --- mail/ChangeLog | 3 +++ mail/mail-callbacks.c | 39 +++++++++++++++++++++++---------------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index da51461bd5..8b66aa6bad 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,8 @@ 2002-12-13 Jeffrey Stedfast + * mail-callbacks.c (check_send_configuration): Make sure the + folder-browser is not NULL or we'll crash. + * mail-preferences.c (mail_preferences_construct): Fix the colour code to get a guint32 rgb correctly (I think - can't test because the shell keeps crashing, yay). diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 02c54e5b06..2b550bcb0a 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -182,16 +182,16 @@ static gboolean configure_mail (FolderBrowser *fb) { MailConfigDruid *druid; - - if (e_question(FB_WINDOW(fb), GTK_RESPONSE_YES, NULL, - _("You have not configured the mail client.\n" - "You need to do this before you can send,\n" - "receive or compose mail.\n" - "Would you like to configure it now?"))) { + + if (e_question (FB_WINDOW (fb), GTK_RESPONSE_YES, NULL, + _("You have not configured the mail client.\n" + "You need to do this before you can send,\n" + "receive or compose mail.\n" + "Would you like to configure it now?"))) { druid = mail_config_druid_new (fb->shell); g_object_weak_ref ((GObject *) druid, (GWeakNotify) druid_destroy_cb, NULL); - gtk_widget_show ((GtkWidget *)druid); - gtk_grab_add ((GtkWidget *)druid); + gtk_widget_show ((GtkWidget *) druid); + gtk_grab_add ((GtkWidget *) druid); gtk_main (); } @@ -204,25 +204,32 @@ check_send_configuration (FolderBrowser *fb) const MailConfigAccount *account; GtkWidget *dialog; - /* Check general */ - if (!mail_config_is_configured () && !configure_mail (fb)) - return FALSE; + if (!mail_config_is_configured ()) { + if (fb == NULL) { + e_notice (NULL, GTK_MESSAGE_WARNING, + _("You need to configure an account\nbefore you can compose mail.")); + return FALSE; + } + + if (!configure_mail (fb)) + return FALSE; + } /* Get the default account */ account = mail_config_get_default_account (); /* Check for an identity */ if (!account) { - e_notice(FB_WINDOW(fb), GTK_MESSAGE_WARNING, - _("You need to configure an identity\nbefore you can compose mail.")); + e_notice (FB_WINDOW (fb), GTK_MESSAGE_WARNING, + _("You need to configure an identity\nbefore you can compose mail.")); return FALSE; } /* Check for a transport */ if (!account->transport || !account->transport->url) { - e_notice(FB_WINDOW(fb), GTK_MESSAGE_WARNING, - _("You need to configure a mail transport\n" - "before you can compose mail.")); + e_notice (FB_WINDOW (fb), GTK_MESSAGE_WARNING, + _("You need to configure a mail transport\n" + "before you can compose mail.")); return FALSE; } -- cgit