From be00bf6ac1a1397207ee17c559f637741fb0e640 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 19 Oct 2004 06:35:44 +0000 Subject: ** See bug #67014. 2004-10-11 Not Zed ** See bug #67014. * mail-errors.xml: added "checking-service" error. * em-account-editor.c (em_account_editor_construct): keep track of the dialogue (emae_editor_destroyed): , and clean up when destroyed. * em-account-editor.c (emae_check_authtype) (emae_check_authtype_response, emae_check_authtype_done): handle checking authtype gui here. * mail-config.c (check_service_describe, check_service_check) (check_response, mail_config_check_service): removed. * mail-ops.c (mail_check_service): moved here from mail-config, and modified to be a re-usable threaded function. svn path=/trunk/; revision=27615 --- mail/mail-config.c | 114 ----------------------------------------------------- 1 file changed, 114 deletions(-) (limited to 'mail/mail-config.c') diff --git a/mail/mail-config.c b/mail/mail-config.c index c16113d4ab..c1c8adf02d 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -878,120 +878,6 @@ mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix) return filename; } - -/* Async service-checking/authtype-lookup code. */ -struct _check_msg { - struct _mail_msg msg; - - const char *url; - CamelProviderType type; - GList **authtypes; - gboolean *success; -}; - -static char * -check_service_describe (struct _mail_msg *mm, int complete) -{ - return g_strdup (_("Checking Service")); -} - -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) { - camel_operation_unregister(mm->cancel); - return; - } - - if (m->authtypes) - *m->authtypes = camel_service_query_auth_types (service, &mm->ex); - else - camel_service_connect (service, &mm->ex); - - camel_object_unref (service); - *m->success = !camel_exception_is_set(&mm->ex); - - camel_operation_unregister(mm->cancel); -} - -static struct _mail_msg_op check_service_op = { - check_service_describe, - check_service_check, - NULL, - NULL -}; - -static void -check_response (GtkDialog *dialog, int button, gpointer data) -{ - int *msg_id = data; - - mail_msg_cancel (*msg_id); -} - -/** - * mail_config_check_service: - * @url: service url - * @type: provider type - * @authtypes: set to list of supported authtypes on return if non-%NULL. - * - * Checks the service for validity. If @authtypes is non-%NULL, it will - * be filled in with a list of supported authtypes. - * - * Return value: %TRUE on success or %FALSE on error. - **/ -gboolean -mail_config_check_service (const char *url, CamelProviderType type, GList **authtypes, GtkWindow *window) -{ - static GtkWidget *dialog = NULL; - gboolean ret = FALSE; - struct _check_msg *m; - GtkWidget *label; - int id; - - if (dialog) { - gdk_window_raise (dialog->window); - *authtypes = NULL; - return FALSE; - } - - m = mail_msg_new (&check_service_op, NULL, sizeof(*m)); - m->url = url; - m->type = type; - m->authtypes = authtypes; - m->success = &ret; - - id = m->msg.seq; - e_thread_put(mail_thread_new, (EMsg *)m); - - /* FIXME: make this use e-error. - * It has to be modal otherwise we can get nasty re-entrancy whilst waiting for the - * subthread to complete. - * FIXME: make this whole function async to deal with this issue */ - dialog = gtk_dialog_new_with_buttons(_("Connecting to server..."), window, - GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_MODAL, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - NULL); - label = gtk_label_new (_("Connecting to server...")); - gtk_box_pack_start (GTK_BOX(GTK_DIALOG (dialog)->vbox), - label, TRUE, TRUE, 10); - g_signal_connect(dialog, "response", G_CALLBACK (check_response), &id); - gtk_widget_show_all (dialog); - - mail_msg_wait(id); - - gtk_widget_destroy (dialog); - dialog = NULL; - - return ret; -} - ESignatureList * mail_config_get_signatures (void) { -- cgit v1.2.3