diff options
author | Not Zed <NotZed@Ximian.com> | 2004-10-19 14:35:44 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-10-19 14:35:44 +0800 |
commit | be00bf6ac1a1397207ee17c559f637741fb0e640 (patch) | |
tree | 20c4547441219cf8b01f4bf74e9bb105ccd50b44 /mail/em-account-editor.c | |
parent | 0caac5ff878a9cb7dc5d53906c7d57ef6483b5f7 (diff) | |
download | gsoc2013-evolution-be00bf6ac1a1397207ee17c559f637741fb0e640.tar.gz gsoc2013-evolution-be00bf6ac1a1397207ee17c559f637741fb0e640.tar.zst gsoc2013-evolution-be00bf6ac1a1397207ee17c559f637741fb0e640.zip |
** See bug #67014.
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.
svn path=/trunk/; revision=27615
Diffstat (limited to 'mail/em-account-editor.c')
-rw-r--r-- | mail/em-account-editor.c | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index d80bc9edbd..5cfde83efb 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -123,6 +123,9 @@ typedef struct _EMAccountEditorService { 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 @@ emae_setup_authtype(EMAccountEditor *emae, EMAccountEditorService *service) 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 @@ emae_commit(EConfig *ec, GSList *items, void *data) 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 @@ em_account_editor_construct(EMAccountEditor *emae, EAccount *account, em_account 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); } |