From 2960cad1a7015eb13de39503081249b63f165962 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 30 Mar 2001 22:56:33 +0000 Subject: Register for cancellation. (mail_config_check_service): Pop up a modal * mail-config.c (check_service_check): Register for cancellation. (mail_config_check_service): Pop up a modal dialog with a message and a "Cancel" button for the duration of the check. svn path=/trunk/; revision=9058 --- mail/ChangeLog | 6 ++++++ mail/mail-config.c | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 14a68fc46d..2b7e546853 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2001-03-30 Dan Winship + + * mail-config.c (check_service_check): Register for cancellation. + (mail_config_check_service): Pop up a modal dialog with a message + and a "Cancel" button for the duration of the check. + 2001-03-30 Iain Holmes * importers/evolution-mbox-importer.c (load_file_fn): Check if diff --git a/mail/mail-config.c b/mail/mail-config.c index a58ecaaf02..a5ce5329f1 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include @@ -949,9 +951,13 @@ static void check_service_check(struct _mail_msg *mm) struct _check_msg *m = (struct _check_msg *)mm; CamelService *service = NULL; + camel_operation_register(mm->cancel); + service = camel_session_get_service (session, m->url, m->type, &mm->ex); - if (!service) + if (!service) { + camel_operation_unregister(mm->cancel); return; + } if (m->authtypes) *m->authtypes = camel_service_query_auth_types (service, &mm->ex); @@ -960,6 +966,8 @@ static void check_service_check(struct _mail_msg *mm) camel_object_unref (CAMEL_OBJECT (service)); *m->success = !camel_exception_is_set(&mm->ex); + + camel_operation_unregister(mm->cancel); } static struct _mail_msg_op check_service_op = { @@ -969,6 +977,14 @@ static struct _mail_msg_op check_service_op = { NULL }; +static void +check_cancelled (GnomeDialog *dialog, int button, gpointer data) +{ + int *msg_id = data; + + mail_msg_cancel (*msg_id); +} + /** * mail_config_check_service: * @url: service url @@ -980,13 +996,13 @@ static struct _mail_msg_op check_service_op = { * * Return value: %TRUE on success or %FALSE on error. **/ - gboolean mail_config_check_service (const char *url, CamelProviderType type, GList **authtypes) { gboolean ret = FALSE; struct _check_msg *m; int id; + GtkWidget *dialog, *label; m = mail_msg_new(&check_service_op, NULL, sizeof(*m)); m->url = url; @@ -996,7 +1012,21 @@ mail_config_check_service (const char *url, CamelProviderType type, GList **auth id = m->msg.seq; e_thread_put(mail_thread_queued, (EMsg *)m); + + dialog = gnome_dialog_new (_("Connecting to server..."), + GNOME_STOCK_BUTTON_CANCEL, + NULL); + label = gtk_label_new (_("Connecting to server...")); + gtk_box_pack_start (GNOME_DIALOG (dialog)->vbox, label, TRUE, TRUE, 10); + gnome_dialog_set_close (GNOME_DIALOG (dialog), FALSE); + gtk_signal_connect (GTK_OBJECT (dialog), "clicked", + GTK_SIGNAL_FUNC (check_cancelled), &id); + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + gtk_widget_show_all (dialog); + mail_msg_wait(id); - + + gtk_widget_destroy (dialog); + return ret; } -- cgit