Re: [evolution-patches] 67014, modality issue checking supported auth types
- From: Not Zed <notzed ximian com>
- To: asdf <evolution-patches lists ximian com>
- Subject: Re: [evolution-patches] 67014, modality issue checking supported auth types
- Date: Mon, 11 Oct 2004 13:43:35 +0800
that patch had some cruft left in it, here's a better one, and a patch against head too.
On Mon, 2004-10-11 at 11:17 +0800, Not Zed wrote:
This should fix it, makes the auth check non-modal but async.
Requires a different patch for head though.
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3444.2.20
diff -u -3 -r1.3444.2.20 ChangeLog
--- mail/ChangeLog 7 Oct 2004 01:09:09 -0000 1.3444.2.20
+++ mail/ChangeLog 11 Oct 2004 05:46:40 -0000
@@ -1,3 +1,17 @@
+2004-10-11 Not Zed <NotZed Ximian com>
+
+ ** See bug #67014.
+
+ * mail-config.c (check_service_describe, check_service_check)
+ (check_response, mail_config_check_service): removed.
+
+ * mail-account-gui.c (service_check_supported): call
+ mail_check_service to do the checking async. Make the popopup
+ window non-modal, but de-sensitize the dialog instead.
+
+ * mail-ops.c (mail_check_service): moved here from mail-config,
+ and modified to be a re-usable threaded function.
+
2004-09-28 Not Zed <NotZed Ximian com>
* em-composer-utils.c (forward_non_attached): put back in the
Index: mail/mail-account-gui.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-account-gui.c,v
retrieving revision 1.171.14.5
diff -u -3 -r1.171.14.5 mail-account-gui.c
--- mail/mail-account-gui.c 27 Sep 2004 18:58:44 -0000 1.171.14.5
+++ mail/mail-account-gui.c 11 Oct 2004 05:46:41 -0000
@@ -45,6 +45,7 @@
#include <gtk/gtknotebook.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkdialog.h>
+#include <gtk/gtkstock.h>
#ifdef USE_GTKFILECHOOSER
#include <gtk/gtkfilechooser.h>
#include <gtk/gtkradiobutton.h>
@@ -880,38 +881,95 @@
service_complete (service, NULL, NULL));
}
+/* the fun of async ... */
+struct _service_check_data {
+ MailAccountGuiService *gsvc;
+ GtkWidget *dialog;
+ GtkWidget *window;
+
+ int id;
+ gulong destroy_id;
+ int destroyed:1;
+};
+
+static void
+service_check_done(const char *url, CamelProviderType type, GList *types, void *data)
+{
+ struct _service_check_data *sd = data;
+
+ if (!sd->destroyed) {
+ gtk_widget_set_sensitive(sd->window, TRUE);
+ build_auth_menu(sd->gsvc, sd->gsvc->provider->authtypes, types, TRUE);
+ }
+
+ if (sd->dialog) {
+ gtk_widget_destroy(sd->dialog);
+ sd->dialog = NULL;
+ }
+
+ if (sd->destroy_id)
+ g_signal_handler_disconnect(sd->window, sd->destroy_id);
+
+ g_free(sd);
+}
+
+static void
+service_check_response(GtkDialog *d, int button, struct _service_check_data *sd)
+{
+ mail_msg_cancel(sd->id);
+
+ gtk_widget_destroy(sd->dialog);
+ sd->dialog = NULL;
+}
+
+static void
+service_check_destroy(GtkWindow *w, struct _service_check_data *sd)
+{
+ sd->destroy_id = 0;
+ sd->destroyed = TRUE;
+ mail_msg_cancel(sd->id);
+}
+
static void
service_check_supported (GtkButton *button, gpointer user_data)
{
MailAccountGuiService *gsvc = user_data;
EAccountService *service;
- GList *authtypes = NULL;
+ GtkWidget *dialog;
GtkWidget *authitem;
- GtkWidget *window;
-
- service = g_new0 (EAccountService, 1);
-
+ struct _service_check_data *sd;
+
+ sd = g_malloc0(sizeof(*sd));
+ sd->id = -1;
+ sd->gsvc = gsvc;
+
/* This is sort of a hack, when checking for supported AUTH
types we don't want to use whatever authtype is selected
because it may not be available. */
+ service = g_malloc0(sizeof(*service));
authitem = gsvc->authitem;
gsvc->authitem = NULL;
-
save_service (gsvc, NULL, service);
-
gsvc->authitem = authitem;
-
- window = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_WINDOW);
-
- if (mail_config_check_service (service->url, gsvc->provider_type, &authtypes, GTK_WINDOW (window))) {
- build_auth_menu (gsvc, gsvc->provider->authtypes, authtypes, TRUE);
- if (!authtypes) {
- /* provider doesn't support any authtypes */
- gtk_widget_set_sensitive (GTK_WIDGET (gsvc->check_supported), FALSE);
- }
- g_list_free (authtypes);
- }
-
+
+ sd->window = gtk_widget_get_toplevel((GtkWidget *)button);
+ sd->destroy_id = g_signal_connect(sd->window, "destroy", G_CALLBACK(service_check_destroy), sd);
+
+ gtk_widget_set_sensitive(sd->window, FALSE);
+ dialog = gtk_dialog_new_with_buttons(_("Connecting to server..."),
+ (GtkWindow *)sd->window,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ NULL);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
+ gtk_label_new(_("Connecting to server...")),
+ TRUE, TRUE, 10);
+ g_signal_connect(dialog, "response", G_CALLBACK(service_check_response), sd);
+ gtk_widget_show_all(dialog);
+
+ sd->dialog = dialog;
+ sd->id = mail_check_service(service->url, gsvc->provider_type, service_check_done, sd);
+
g_free (service->url);
g_free (service);
}
Index: mail/mail-config.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.c,v
retrieving revision 1.310.4.1
diff -u -3 -r1.310.4.1 mail-config.c
--- mail/mail-config.c 16 Sep 2004 14:45:56 -0000 1.310.4.1
+++ mail/mail-config.c 11 Oct 2004 05:46:41 -0000
@@ -878,120 +878,6 @@
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)
{
Index: mail/mail-config.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.h,v
retrieving revision 1.118
diff -u -3 -r1.118 mail-config.h
--- mail/mail-config.h 1 Apr 2004 19:47:06 -0000 1.118
+++ mail/mail-config.h 11 Oct 2004 05:46:41 -0000
@@ -161,9 +161,6 @@
char *mail_config_folder_to_cachename (struct _CamelFolder *folder, const char *prefix);
char *mail_config_folder_to_safe_url (struct _CamelFolder *folder);
-/* Ugh, this totally does not belong in this module */
-gboolean mail_config_check_service (const char *url, CamelProviderType type, GList **authtypes, struct _GtkWindow *window);
-
GType evolution_mail_config_get_type (void);
gboolean evolution_mail_config_factory_init (void);
Index: mail/mail-ops.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-ops.c,v
retrieving revision 1.438.14.1
diff -u -3 -r1.438.14.1 mail-ops.c
--- mail/mail-ops.c 27 Sep 2004 05:21:46 -0000 1.438.14.1
+++ mail/mail-ops.c 11 Oct 2004 05:46:41 -0000
@@ -2264,3 +2264,80 @@
gnome_execute_async_fds (NULL, argc, argv, TRUE);
}
+
+/* Async service-checking/authtype-lookup code. */
+struct _check_msg {
+ struct _mail_msg msg;
+
+ char *url;
+ CamelProviderType type;
+ GList *authtypes;
+
+ void (*done)(const char *url, CamelProviderType type, GList *types, void *data);
+ void *data;
+};
+
+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;
+
+ service = camel_session_get_service(session, m->url, m->type, &mm->ex);
+ if (!service) {
+ camel_operation_unregister(mm->cancel);
+ return;
+ }
+
+ m->authtypes = camel_service_query_auth_types(service, &mm->ex);
+ camel_object_unref(service);
+}
+
+static void
+check_service_done(struct _mail_msg *mm)
+{
+ struct _check_msg *m = (struct _check_msg *)mm;
+
+ if (m->done)
+ m->done(m->url, m->type, m->authtypes, m->data);
+}
+
+static void
+check_service_free(struct _mail_msg *mm)
+{
+ struct _check_msg *m = (struct _check_msg *)mm;
+
+ g_free(m->url);
+ g_list_free(m->authtypes);
+}
+
+static struct _mail_msg_op check_service_op = {
+ check_service_describe,
+ check_service_check,
+ check_service_done,
+ check_service_free,
+};
+
+int
+mail_check_service(const char *url, CamelProviderType type, void (*done)(const char *url, CamelProviderType type, GList *authtypes, void *data), void *data)
+{
+ struct _check_msg *m;
+ int id;
+
+ m = mail_msg_new (&check_service_op, NULL, sizeof(*m));
+ m->url = g_strdup(url);
+ m->type = type;
+ m->done = done;
+ m->data = data;
+
+ id = m->msg.seq;
+ e_thread_put(mail_thread_new, (EMsg *)m);
+
+ return id;
+}
Index: mail/mail-ops.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-ops.h,v
retrieving revision 1.69
diff -u -3 -r1.69 mail-ops.h
--- mail/mail-ops.h 12 Mar 2004 18:27:45 -0000 1.69
+++ mail/mail-ops.h 11 Oct 2004 05:46:41 -0000
@@ -154,6 +154,9 @@
/* filter driver execute shell command async callback */
void mail_execute_shell_command (CamelFilterDriver *driver, int argc, char **argv, void *data);
+int mail_check_service(const char *url, CamelProviderType type,
+ void (*done)(const char *url, CamelProviderType type, GList *authtypes, void *data), void *data);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3469
diff -u -3 -r1.3469 ChangeLog
--- mail/ChangeLog 7 Oct 2004 08:20:49 -0000 1.3469
+++ mail/ChangeLog 11 Oct 2004 05:43:45 -0000
@@ -1,3 +1,23 @@
+2004-10-11 Not Zed <NotZed Ximian com>
+
+ ** 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.
+
2004-10-07 Not Zed <NotZed Ximian com>
* mail-component.c (mc_startup): dont init the base plugin system
Index: mail/em-account-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-account-editor.c,v
retrieving revision 1.4
diff -u -3 -r1.4 em-account-editor.c
--- mail/em-account-editor.c 27 Sep 2004 18:45:15 -0000 1.4
+++ mail/em-account-editor.c 11 Oct 2004 05:43:46 -0000
@@ -123,6 +123,9 @@
struct _GtkButton *check_supported;
struct _GtkToggleButton *needs_auth;
+ struct _GtkWidget *check_dialog;
+ int check_id;
+
GList *authtypes; /* if "Check supported" */
CamelProvider *provider;
CamelProviderType type;
@@ -1407,19 +1410,51 @@
return (GtkWidget *)dropdown;
}
+static void emae_check_authtype_done(const char *uri, CamelProviderType type, GList *types, void *data)
+{
+ EMAccountEditorService *service = data;
+
+ if (service->check_dialog) {
+ if (service->authtypes)
+ g_list_free(service->authtypes);
+
+ service->authtypes = g_list_copy(types);
+ emae_setup_authtype(service->emae, service);
+ gtk_widget_destroy(service->check_dialog);
+ }
+
+ if (service->emae->editor)
+ gtk_widget_set_sensitive(service->emae->editor, TRUE);
+
+ service->check_id = -1;
+ g_object_unref(service->emae);
+}
+
+static void emae_check_authtype_response(GtkWidget *d, int button, EMAccountEditorService *service)
+{
+ mail_msg_cancel(service->check_id);
+ gtk_widget_destroy(service->check_dialog);
+ service->check_dialog = NULL;
+
+ if (service->emae->editor)
+ gtk_widget_set_sensitive(service->emae->editor, TRUE);
+}
+
static void emae_check_authtype(GtkWidget *w, EMAccountEditorService *service)
{
EMAccountEditor *emae = service->emae;
const char *uri;
- if (service->authtypes) {
- g_list_free(service->authtypes);
- service->authtypes = NULL;
- }
-
+ /* TODO: do we need to remove the auth mechanism from the uri? */
uri = e_account_get_string(emae->account, emae_service_info[service->type].account_uri_key);
- if (mail_config_check_service(uri, service->type, &service->authtypes, (GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emae->editor)))
- emae_setup_authtype(emae, service);
+ g_object_ref(emae);
+
+ service->check_dialog = e_error_new((GtkWindow *)gtk_widget_get_toplevel(emae->editor),
+ "mail:checking-service", NULL);
+ g_signal_connect(service->check_dialog, "response", G_CALLBACK(emae_check_authtype_response), service);
+ gtk_widget_show(service->check_dialog);
+ gtk_widget_set_sensitive(emae->editor, FALSE);
+ service->check_id = mail_check_service(uri, service->type, emae_check_authtype_done, service);
}
static void
@@ -2331,6 +2366,13 @@
e_account_list_save(accounts);
}
+static void
+emae_editor_destroyed(GtkWidget *dialog, EMAccountEditor *emae)
+{
+ emae->editor = NULL;
+ g_object_unref(emae);
+}
+
void
em_account_editor_construct(EMAccountEditor *emae, EAccount *account, em_account_editor_t type)
{
@@ -2435,5 +2477,6 @@
e_config_set_target((EConfig *)ec, (EConfigTarget *)target);
emae->editor = e_config_create_window((EConfig *)ec, NULL, type==EMAE_NOTEBOOK?_("Account Editor"):_("Evolution Account Assistant"));
- /* FIXME: need to hook onto destroy as required */
+ g_object_ref(emae);
+ g_signal_connect(emae->editor, "destroy", G_CALLBACK(emae_editor_destroyed), emae);
}
Index: mail/mail-config.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.c,v
retrieving revision 1.311
diff -u -3 -r1.311 mail-config.c
--- mail/mail-config.c 8 Sep 2004 04:14:34 -0000 1.311
+++ mail/mail-config.c 11 Oct 2004 05:43:46 -0000
@@ -878,120 +878,6 @@
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)
{
Index: mail/mail-config.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.h,v
retrieving revision 1.118
diff -u -3 -r1.118 mail-config.h
--- mail/mail-config.h 1 Apr 2004 19:47:06 -0000 1.118
+++ mail/mail-config.h 11 Oct 2004 05:43:46 -0000
@@ -161,9 +161,6 @@
char *mail_config_folder_to_cachename (struct _CamelFolder *folder, const char *prefix);
char *mail_config_folder_to_safe_url (struct _CamelFolder *folder);
-/* Ugh, this totally does not belong in this module */
-gboolean mail_config_check_service (const char *url, CamelProviderType type, GList **authtypes, struct _GtkWindow *window);
-
GType evolution_mail_config_get_type (void);
gboolean evolution_mail_config_factory_init (void);
Index: mail/mail-errors.xml
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-errors.xml,v
retrieving revision 1.7
diff -u -3 -r1.7 mail-errors.xml
--- mail/mail-errors.xml 20 Sep 2004 05:59:55 -0000 1.7
+++ mail/mail-errors.xml 11 Oct 2004 05:43:46 -0000
@@ -318,6 +318,13 @@
you can accept its license.</secondary>
</error>
+ <error id="checking-service" type="info">
+ <title>Querying server</title>
+ <primary>Please wait.</primary>
+ <secondary>Querying server for a list of supported authentication mechanisms.</secondary>
+ <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
+ </error>
+
<error id="gw-accountsetup-error" type="error">
<primary><span weight="bold" size="larger">Unable to connect to the GroupWise
server.</span></primary>
Index: mail/mail-errors.xml.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-errors.xml.h,v
retrieving revision 1.7
diff -u -3 -r1.7 mail-errors.xml.h
--- mail/mail-errors.xml.h 21 Sep 2004 01:54:09 -0000 1.7
+++ mail/mail-errors.xml.h 11 Oct 2004 05:43:46 -0000
@@ -236,6 +236,10 @@
char *s = N_("Cannot read the license file \"{0}\", due to an\n"
" installation problem. You will not be able to use this provider until\n"
" you can accept its license.");
+/* mail:checking-service primary */
+char *s = N_("Please wait.");
+/* mail:checking-service secondary */
+char *s = N_("Querying server for a list of supported authentication mechanisms.");
/* mail:gw-accountsetup-error primary */
char *s = N_("Unable to connect to the GroupWise\n"
"server.");
Index: mail/mail-ops.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-ops.c,v
retrieving revision 1.440
diff -u -3 -r1.440 mail-ops.c
--- mail/mail-ops.c 27 Sep 2004 05:31:06 -0000 1.440
+++ mail/mail-ops.c 11 Oct 2004 05:43:47 -0000
@@ -2265,3 +2265,80 @@
gnome_execute_async_fds (NULL, argc, argv, TRUE);
}
+
+/* Async service-checking/authtype-lookup code. */
+struct _check_msg {
+ struct _mail_msg msg;
+
+ char *url;
+ CamelProviderType type;
+ GList *authtypes;
+
+ void (*done)(const char *url, CamelProviderType type, GList *types, void *data);
+ void *data;
+};
+
+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;
+
+ service = camel_session_get_service(session, m->url, m->type, &mm->ex);
+ if (!service) {
+ camel_operation_unregister(mm->cancel);
+ return;
+ }
+
+ m->authtypes = camel_service_query_auth_types(service, &mm->ex);
+ camel_object_unref(service);
+}
+
+static void
+check_service_done(struct _mail_msg *mm)
+{
+ struct _check_msg *m = (struct _check_msg *)mm;
+
+ if (m->done)
+ m->done(m->url, m->type, m->authtypes, m->data);
+}
+
+static void
+check_service_free(struct _mail_msg *mm)
+{
+ struct _check_msg *m = (struct _check_msg *)mm;
+
+ g_free(m->url);
+ g_list_free(m->authtypes);
+}
+
+static struct _mail_msg_op check_service_op = {
+ check_service_describe,
+ check_service_check,
+ check_service_done,
+ check_service_free,
+};
+
+int
+mail_check_service(const char *url, CamelProviderType type, void (*done)(const char *url, CamelProviderType type, GList *authtypes, void *data), void *data)
+{
+ struct _check_msg *m;
+ int id;
+
+ m = mail_msg_new (&check_service_op, NULL, sizeof(*m));
+ m->url = g_strdup(url);
+ m->type = type;
+ m->done = done;
+ m->data = data;
+
+ id = m->msg.seq;
+ e_thread_put(mail_thread_new, (EMsg *)m);
+
+ return id;
+}
Index: mail/mail-ops.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-ops.h,v
retrieving revision 1.69
diff -u -3 -r1.69 mail-ops.h
--- mail/mail-ops.h 12 Mar 2004 18:27:45 -0000 1.69
+++ mail/mail-ops.h 11 Oct 2004 05:43:47 -0000
@@ -154,6 +154,9 @@
/* filter driver execute shell command async callback */
void mail_execute_shell_command (CamelFilterDriver *driver, int argc, char **argv, void *data);
+int mail_check_service(const char *url, CamelProviderType type,
+ void (*done)(const char *url, CamelProviderType type, GList *authtypes, void *data), void *data);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]