diff options
Diffstat (limited to 'mail/mail-config.c')
-rw-r--r-- | mail/mail-config.c | 114 |
1 files changed, 0 insertions, 114 deletions
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) { |