From 6dd8aabeeee1945c4d96af5e045b75995db56517 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 27 Mar 2001 05:23:27 +0000 Subject: Probably the very last new config dialog ever. (Ha ha). From Anna, based * mail-config.glade: Probably the very last new config dialog ever. (Ha ha). From Anna, based on a story by me. * mail-account-gui.c: New code for the new mail-config.glade. This abstracts out all of the common code between the account editor and the druid. It also handles the spiffy new provider-specific config stuff. FIXME: The code to check if a service is ok or not is no longer there... waiting until the online/offline stuff from the shell appears. * mail-account-editor.c, mail-config-druid.c: These are much smaller now, since most of the interesting bits moved to mail-account-gui.c * mail-accounts.c: Add an enabled/disabled column/button to replace the checkbox that used to be in the editor, because it really makes more sense to have it out here. This looks ugly. Probably ought to ETable it... (load_accounts): Fill in the enabled column. (mail_select, mail_unselect): toggle the sensitivity and name of the Enable/Disable button appropriately (mail_able): Handle the enable/disable button. * mail-config.c: Remove reply-to from MailConfigIdentity since it didn't belong there (and wasn't being saved anyway). (mail_config_check_service): Simplify this a bit. This really needs to pop up a dialog with a "connecting..." message and a cancel button. svn path=/trunk/; revision=8971 --- mail/ChangeLog | 43 + mail/Makefile.am | 2 + mail/mail-account-editor.c | 827 +-------- mail/mail-account-editor.h | 51 +- mail/mail-account-gui.c | 1086 +++++++++++ mail/mail-account-gui.h | 99 + mail/mail-accounts.c | 49 +- mail/mail-accounts.h | 1 + mail/mail-config-druid.c | 1404 +++----------- mail/mail-config-druid.h | 75 +- mail/mail-config.c | 61 +- mail/mail-config.glade | 4409 ++++++++++++++++---------------------------- mail/mail-config.h | 6 +- 13 files changed, 3131 insertions(+), 4982 deletions(-) create mode 100644 mail/mail-account-gui.c create mode 100644 mail/mail-account-gui.h (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index cf7589c04f..41fca130d9 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,46 @@ +2001-03-27 Dan Winship + + * mail-config.glade: Probably the very last new config dialog + ever. (Ha ha). From Anna, based on a story by me. + + * mail-account-gui.c: New code for the new mail-config.glade. This + abstracts out all of the common code between the account editor + and the druid. It also handles the spiffy new provider-specific + config stuff. + + FIXME: The code to check if a service is ok or not is no longer + there... waiting until the online/offline stuff from the shell + appears. + + * mail-account-editor.c, mail-config-druid.c: These are much + smaller now, since most of the interesting bits moved to + mail-account-gui.c + + * mail-accounts.c: Add an enabled/disabled column/button to + replace the checkbox that used to be in the editor, because it + really makes more sense to have it out here. This looks ugly. + Probably ought to ETable it... + (load_accounts): Fill in the enabled column. + (mail_select, mail_unselect): toggle the sensitivity and name of + the Enable/Disable button appropriately + (mail_able): Handle the enable/disable button. + + * mail-config.c: Remove reply-to from MailConfigIdentity since it + didn't belong there (and wasn't being saved anyway). + (mail_config_check_service): Simplify this a bit. This really + needs to pop up a dialog with a "connecting..." message and a + cancel button. + + * mail-ops.c (uid_cachename_hack): Kludge, copied+modified from + mail_config_folder_to_cachename to deal with the different + behavior of the URL code now. Will go away when the keep-on-server + code moves. + (get_folderinfo_get): Only pass "subscribed_only" to + camel_store_get_folder_info if the store supports subscriptions... + + * mail-local.c (local_provider): Update this to reflect the + CamelProvider structure change + 2001-03-26 Jeffrey Stedfast * mail-callbacks.c (transfer_msg): Add "vtrash" as an allowed mail diff --git a/mail/Makefile.am b/mail/Makefile.am index 84591e5b88..4d967545e9 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -55,6 +55,8 @@ evolution_mail_SOURCES = \ mail-accounts.h \ mail-account-editor.c \ mail-account-editor.h \ + mail-account-gui.c \ + mail-account-gui.h \ mail-autofilter.c \ mail-autofilter.h \ mail-callbacks.c \ diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c index 751ae57646..5765e40cd3 100644 --- a/mail/mail-account-editor.c +++ b/mail/mail-account-editor.c @@ -1,8 +1,10 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Authors: Jeffrey Stedfast + * Authors: + * Jeffrey Stedfast + * Dan Winship * - * Copyright 2001 Helix Code, Inc. (www.helixcode.com) + * Copyright 2001 Ximian, Inc. (www.ximian.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,10 +29,10 @@ #include #include #include +#include static void mail_account_editor_class_init (MailAccountEditorClass *class); -static void mail_account_editor_init (MailAccountEditor *editor); -static void mail_account_editor_finalise (GtkObject *obj); +static void mail_account_editor_finalize (GtkObject *obj); static GnomeDialogClass *parent_class; @@ -39,21 +41,21 @@ GtkType mail_account_editor_get_type () { static GtkType type = 0; - + if (!type) { GtkTypeInfo type_info = { "MailAccountEditor", sizeof (MailAccountEditor), sizeof (MailAccountEditorClass), (GtkClassInitFunc) mail_account_editor_class_init, - (GtkObjectInitFunc) mail_account_editor_init, + (GtkObjectInitFunc) NULL, (GtkArgSetFunc) NULL, (GtkArgGetFunc) NULL }; - + type = gtk_type_unique (gnome_dialog_get_type (), &type_info); } - + return type; } @@ -61,230 +63,55 @@ static void mail_account_editor_class_init (MailAccountEditorClass *class) { GtkObjectClass *object_class; - + object_class = (GtkObjectClass *) class; parent_class = gtk_type_class (gnome_dialog_get_type ()); - - object_class->finalize = mail_account_editor_finalise; - /* override methods */ - -} -static void -mail_account_editor_init (MailAccountEditor *o) -{ - ; + object_class->finalize = mail_account_editor_finalize; } static void -mail_account_editor_finalise (GtkObject *obj) +mail_account_editor_finalize (GtkObject *obj) { MailAccountEditor *editor = (MailAccountEditor *) obj; - - gtk_object_unref (GTK_OBJECT (editor->gui)); - - ((GtkObjectClass *)(parent_class))->finalize (obj); -} -static gboolean -is_email (const char *address) -{ - const char *at, *hname; - - g_return_val_if_fail (address != NULL, FALSE); - - at = strchr (address, '@'); - /* make sure we have an '@' and that it's not the first or last char */ - if (!at || at == address || *(at + 1) == '\0') - return FALSE; - - hname = at + 1; - /* make sure the first and last chars aren't '.' */ - if (*hname == '.' || hname[strlen (hname) - 1] == '.') - return FALSE; - - return strchr (hname, '.') != NULL; -} - -/* callbacks */ -static void -entry_changed (GtkEntry *entry, gpointer data) -{ - MailAccountEditor *editor = data; - char *account_name, *name, *address; - gboolean sensitive; - - account_name = gtk_entry_get_text (editor->account_name); - name = gtk_entry_get_text (editor->name); - address = gtk_entry_get_text (editor->email); - - sensitive = account_name && *account_name && name && *name && is_email (address); - - gnome_dialog_set_sensitive (GNOME_DIALOG (editor), 0, sensitive); - gnome_dialog_set_sensitive (GNOME_DIALOG (editor), 1, sensitive); + mail_account_gui_destroy (editor->gui); + ((GtkObjectClass *)(parent_class))->finalize (obj); } static gboolean apply_changes (MailAccountEditor *editor) { MailConfigAccount *account; - char *host, *pport, *str; - CamelURL *source_url = NULL, *transport_url; - gboolean retval = TRUE; - int port; - - account = (MailConfigAccount *) editor->account; - - /* account name */ - if (editor->account_name) { - g_free (account->name); - account->name = e_utf8_gtk_entry_get_text (editor->account_name); - } - - /* identity info */ - g_free (account->id->name); - account->id->name = e_utf8_gtk_entry_get_text (editor->name); - - g_free (account->id->address); - account->id->address = e_utf8_gtk_entry_get_text (editor->email); - - if (editor->reply_to) { - g_free (account->id->reply_to); - account->id->reply_to = e_utf8_gtk_entry_get_text (editor->reply_to); - } - - if (editor->organization) { - g_free (account->id->organization); - account->id->organization = e_utf8_gtk_entry_get_text (editor->organization); - } - - if (editor->signature) { - g_free (account->id->signature); - account->id->signature = gnome_file_entry_get_full_path (editor->signature, TRUE); - } - - /* source */ - if (account->source->url) { - source_url = camel_url_new (account->source->url, NULL); - - g_free (source_url->user); - str = gtk_entry_get_text (editor->source_user); - source_url->user = str && *str ? g_strdup (str) : NULL; - - g_free (source_url->passwd); - str = gtk_entry_get_text (editor->source_passwd); - source_url->passwd = str && *str ? g_strdup (str) : NULL; - - g_free (source_url->authmech); - str = gtk_object_get_data (GTK_OBJECT (editor), "source_authmech"); - source_url->authmech = str && *str ? g_strdup (str) : NULL; - - g_free (source_url->host); - host = g_strdup (gtk_entry_get_text (editor->source_host)); - if (host && (pport = strchr (host, ':'))) { - *pport = '\0'; - port = atoi (pport + 1); - } else { - port = 0; - } - source_url->host = host; - source_url->port = port; - - g_free (source_url->path); - str = gtk_entry_get_text (editor->source_path); - source_url->path = str && *str ? g_strdup (str) : NULL; - - account->source->save_passwd = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->source_save_passwd)); - account->source->keep_on_server = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->keep_on_server)); - - account->source->enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->source_enabled)); - account->source->auto_check = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->source_auto_check)); - account->source->auto_check_time = gtk_spin_button_get_value_as_int (editor->source_auto_timeout); - - /* set the new source url */ - g_free (account->source->url); - account->source->url = camel_url_to_string (source_url, FALSE); - } - - /* transport */ - transport_url = g_new0 (CamelURL, 1); - - if (editor->transport) { - transport_url->protocol = g_strdup (editor->transport->protocol); - } else { - /* workaround for anna's dialog */ - CamelURL *url; - - url = camel_url_new (account->transport->url, NULL); - transport_url->protocol = g_strdup (url->protocol); - camel_url_free (url); - } - - str = gtk_object_get_data (GTK_OBJECT (editor), "transport_authmech"); - transport_url->authmech = str && *str ? g_strdup (str) : NULL; - - if (transport_url->authmech) { - str = gtk_entry_get_text (editor->transport_user); - transport_url->user = str && *str ? g_strdup (str) : NULL; - - str = gtk_entry_get_text (editor->transport_passwd); - transport_url->passwd = str && *str ? g_strdup (str) : NULL; - } - - host = g_strdup (gtk_entry_get_text (editor->transport_host)); - if (host && (pport = strchr (host, ':'))) { - *pport = '\0'; - port = atoi (pport + 1); - } else { - port = 0; - } - transport_url->host = host; - transport_url->port = port; - - /* set the new transport url */ - g_free (account->transport->url); - account->transport->url = camel_url_to_string (transport_url, FALSE); - - account->transport->save_passwd = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->transport_save_passwd)); - - /* check to make sure the source works */ - if (source_url) { - if (mail_config_check_service (source_url, CAMEL_PROVIDER_STORE, FALSE, NULL)) { - /* save the password if we were requested to do so */ - if (account->source->save_passwd && source_url->passwd) { - mail_session_set_password (account->source->url, source_url->passwd); - mail_session_remember_password (account->source->url); - } - } else { - retval = FALSE; - } - camel_url_free (source_url); - } - - /* check to make sure the transport works */ - if (mail_config_check_service (transport_url, CAMEL_PROVIDER_TRANSPORT, FALSE, NULL)) { - /* save the password if we were requested to do so */ - if (account->transport->save_passwd && transport_url->passwd) { - mail_session_set_password (account->transport->url, transport_url->passwd); - mail_session_remember_password (account->transport->url); - } - } else { - retval = FALSE; + int page = -1; + + if (!mail_account_gui_identity_complete (editor->gui) || + !mail_account_gui_management_complete (editor->gui)) + page = 0; + else if (!mail_account_gui_source_complete (editor->gui)) + page = 1; + else if (!mail_account_gui_transport_complete (editor->gui)) + page = 3; + + if (page != -1) { + gtk_notebook_set_page (editor->notebook, page); + e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("You have not filled in all of the required information.")); + return FALSE; } - - camel_url_free (transport_url); - + + mail_account_gui_save (editor->gui); + account = editor->gui->account; + /* save any changes we may have */ mail_config_write (); - - return retval; + return TRUE; } static void apply_clicked (GtkWidget *widget, gpointer data) { MailAccountEditor *editor = data; - + apply_changes (editor); } @@ -292,450 +119,51 @@ static void ok_clicked (GtkWidget *widget, gpointer data) { MailAccountEditor *editor = data; - - if (apply_changes (editor)) { + + if (apply_changes (editor)) gtk_widget_destroy (GTK_WIDGET (editor)); - } else { - GtkWidget *mbox; - - mbox = gnome_message_box_new (_("One or more of your servers are not configured correctly.\n" - "Do you wish to save anyway?"), - GNOME_MESSAGE_BOX_WARNING, - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, NULL); - - gnome_dialog_set_default (GNOME_DIALOG (mbox), 1); - gtk_widget_grab_focus (GTK_WIDGET (GNOME_DIALOG (mbox)->buttons->data)); - - gnome_dialog_set_parent (GNOME_DIALOG (mbox), GTK_WINDOW (editor)); - - if (gnome_dialog_run_and_close (GNOME_DIALOG (mbox)) == 0) - gtk_widget_destroy (GTK_WIDGET (editor)); - } } static void cancel_clicked (GtkWidget *widget, gpointer data) { MailAccountEditor *editor = data; - + gtk_widget_destroy (GTK_WIDGET (editor)); } static void -source_auth_type_changed (GtkWidget *widget, gpointer user_data) +switch_page (GtkNotebook *notebook, GtkNotebookPage *page, + int page_num, gpointer user_data) { MailAccountEditor *editor = user_data; - CamelServiceAuthType *authtype; - gboolean sensitive; - GtkWidget *label; - - authtype = gtk_object_get_data (GTK_OBJECT (widget), "authtype"); - - gtk_object_set_data (GTK_OBJECT (editor), "source_authmech", authtype->authproto); - - if (authtype->need_password) - sensitive = TRUE; - else - sensitive = FALSE; - - label = glade_xml_get_widget (editor->gui, "lblSourcePasswd"); - gtk_widget_set_sensitive (label, sensitive); - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_passwd), sensitive); - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_save_passwd), sensitive); -} + MailConfigService *source = editor->gui->account->source; + MailAccountGuiService *gsrc = &editor->gui->source; + char *url; -static void -source_auth_init (MailAccountEditor *editor, CamelURL *url) -{ - GtkWidget *menu, *item, *authmech = NULL; - CamelServiceAuthType *authtype; - GList *authtypes = NULL; - guint i = 0, history = 0; - - menu = gtk_menu_new (); - gtk_option_menu_remove_menu (editor->source_auth); - - if (!url || !mail_config_check_service (url, CAMEL_PROVIDER_STORE, FALSE, &authtypes)) { - gtk_option_menu_set_menu (editor->source_auth, menu); - + if (page_num != 2) return; - } - - if (authtypes) { - GList *l; - - l = authtypes; - while (l) { - authtype = l->data; - - item = gtk_menu_item_new_with_label (authtype->name); - gtk_object_set_data (GTK_OBJECT (item), "authtype", authtype); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (source_auth_type_changed), - editor); - - gtk_menu_append (GTK_MENU (menu), item); - - gtk_widget_show (item); - - if (!authmech || (url->authmech && !g_strcasecmp (authtype->authproto, url->authmech))) { - authmech = item; - history = i; - } - - l = l->next; - i++; - } - } - - gtk_option_menu_set_menu (editor->source_auth, menu); - - if (authmech) { - gtk_signal_emit_by_name (GTK_OBJECT (authmech), "activate", editor); - gtk_option_menu_set_history (editor->source_auth, history); - } -} -static void -transport_auth_type_changed (GtkWidget *widget, gpointer user_data) -{ - MailAccountEditor *editor = user_data; - CamelServiceAuthType *authtype; - GtkWidget *user, *passwd; - gboolean sensitive; - - authtype = gtk_object_get_data (GTK_OBJECT (widget), "authtype"); - - gtk_object_set_data (GTK_OBJECT (editor), "transport_authmech", - authtype ? authtype->authproto : NULL); - - if (authtype && authtype->need_password) - sensitive = TRUE; + if (gsrc->provider && !strncmp (gsrc->provider->protocol, source->url, + strlen (gsrc->provider->protocol))) + url = source->url; else - sensitive = FALSE; - - user = glade_xml_get_widget (editor->gui, "lblTransportUser"); - passwd = glade_xml_get_widget (editor->gui, "lblTransportPasswd"); - gtk_widget_set_sensitive (user, sensitive); - gtk_widget_set_sensitive (passwd, sensitive); - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_user), sensitive); - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_passwd), sensitive); - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_save_passwd), sensitive); -} - -static void -transport_auth_init (MailAccountEditor *editor, CamelURL *url) -{ - GtkWidget *authmech = NULL; - GtkWidget *menu, *item; - CamelServiceAuthType *authtype; - GList *authtypes = NULL; - guint i = 0, history = 0; - - menu = gtk_menu_new (); - gtk_option_menu_remove_menu (editor->transport_auth); - - if (!url || !mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, FALSE, &authtypes)) { - gtk_option_menu_set_menu (editor->transport_auth, menu); - - return; - } - - menu = gtk_menu_new (); - - if (CAMEL_PROVIDER_ALLOWS (editor->transport, CAMEL_URL_ALLOW_AUTH) && - !CAMEL_PROVIDER_NEEDS (editor->transport, CAMEL_URL_NEED_AUTH)) { - /* It allows auth, but doesn't require it so give the user a - way to say he doesn't need it */ - item = gtk_menu_item_new_with_label (_("None")); - gtk_object_set_data (GTK_OBJECT (item), "authtype", NULL); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (transport_auth_type_changed), - editor); - - gtk_menu_append (GTK_MENU (menu), item); - - gtk_widget_show (item); - - authmech = item; - history = i; - i++; - } - - if (authtypes) { - GList *l; - - l = authtypes; - while (l) { - authtype = l->data; - - item = gtk_menu_item_new_with_label (authtype->name); - gtk_object_set_data (GTK_OBJECT (item), "authtype", authtype); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (transport_auth_type_changed), - editor); - - gtk_menu_append (GTK_MENU (menu), item); - - gtk_widget_show (item); - - if (!authmech || (url->authmech && !g_strcasecmp (authtype->authproto, url->authmech))) { - authmech = item; - history = i; - } - - l = l->next; - i++; - } - } - - gtk_option_menu_set_menu (editor->transport_auth, menu); - - if (authmech) { - gtk_signal_emit_by_name (GTK_OBJECT (authmech), "activate", editor); - gtk_option_menu_set_history (editor->transport_auth, history); - if (url->authmech) { - gtk_entry_set_text (editor->transport_user, url->user ? url->user : ""); - gtk_entry_set_text (editor->transport_passwd, url->passwd ? url->passwd : ""); - } else { - gtk_entry_set_text (editor->transport_user, ""); - gtk_entry_set_text (editor->transport_passwd, ""); - } - } -} - -static void -transport_type_changed (GtkWidget *widget, gpointer user_data) -{ - MailAccountEditor *editor = user_data; - CamelProvider *provider; - GtkWidget *label; - - provider = gtk_object_get_data (GTK_OBJECT (widget), "provider"); - editor->transport = provider; - - /* hostname */ - label = glade_xml_get_widget (editor->gui, "lblTransportHost"); - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST)) { - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_host), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_entry_set_text (editor->transport_host, ""); - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_host), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* username */ - label = glade_xml_get_widget (editor->gui, "lblTransportUser"); - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) { - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_user), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_entry_set_text (editor->transport_user, ""); - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_user), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* password */ - label = glade_xml_get_widget (editor->gui, "lblTransportPasswd"); - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) { - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_passwd), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_save_passwd), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_entry_set_text (editor->transport_passwd, ""); - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_passwd), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_save_passwd), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* auth */ - label = glade_xml_get_widget (editor->gui, "lblTransportAuth"); - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) { - CamelURL *url; - char *host; - - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_auth), TRUE); - gtk_widget_set_sensitive (label, TRUE); - - /* regen the auth list */ - url = g_new0 (CamelURL, 1); - url->protocol = g_strdup (provider->protocol); - host = gtk_entry_get_text (editor->transport_host); - if (host && *host) - url->host = g_strdup (host); - else - url->host = g_strdup ("localhost"); - transport_auth_init (editor, url); - camel_url_free (url); - } else { - gtk_widget_set_sensitive (GTK_WIDGET (editor->transport_auth), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } -} + url = NULL; -static void -transport_type_init (MailAccountEditor *editor, CamelURL *url) -{ - GtkWidget *menu, *xport = NULL; - GList *providers, *l; - guint i = 0, history = 0; - - menu = gtk_menu_new (); - gtk_option_menu_remove_menu (GTK_OPTION_MENU (editor->transport_auth)); - - providers = camel_session_list_providers (session, TRUE); - l = providers; - while (l) { - CamelProvider *provider = l->data; - - if (strcmp (provider->domain, "mail")) { - l = l->next; - continue; - } - - if (provider->object_types[CAMEL_PROVIDER_TRANSPORT]) { - GtkWidget *item; - - item = gtk_menu_item_new_with_label (provider->name); - gtk_object_set_data (GTK_OBJECT (item), "provider", provider); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (transport_type_changed), - editor); - - gtk_menu_append (GTK_MENU (menu), item); - - gtk_widget_show (item); - - if (!xport && !g_strcasecmp (provider->protocol, url->protocol)) { - xport = item; - history = i; - } - - i++; - } - - l = l->next; - } - - gtk_option_menu_set_menu (GTK_OPTION_MENU (editor->transport_type), menu); - - if (xport) { - gtk_signal_emit_by_name (GTK_OBJECT (xport), "activate", editor); - gtk_option_menu_set_history (GTK_OPTION_MENU (editor->transport_type), history); - } + mail_account_gui_build_extra_conf (editor->gui, url); } static void -auto_check_toggled (GtkToggleButton *button, gpointer data) +construct (MailAccountEditor *editor, MailConfigAccount *account) { - MailAccountEditor *editor = data; - - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_auto_timeout), gtk_toggle_button_get_active (button)); -} + editor->gui = mail_account_gui_new (account); -static void -source_check (MailAccountEditor *editor, CamelURL *url) -{ - GList *providers, *l; - - providers = camel_session_list_providers (session, TRUE); - l = providers; - while (l) { - CamelProvider *provider = l->data; - - if (strcmp (provider->domain, "mail")) { - l = l->next; - continue; - } - - if (provider->object_types[CAMEL_PROVIDER_STORE] && provider->flags & CAMEL_PROVIDER_IS_SOURCE) { - if (!url || !g_strcasecmp (provider->protocol, url->protocol)) { - GtkWidget *label; - - /* keep-on-server */ - if (url && !(provider->flags & CAMEL_PROVIDER_IS_STORAGE)) - gtk_widget_set_sensitive (GTK_WIDGET (editor->keep_on_server), TRUE); - else - gtk_widget_set_sensitive (GTK_WIDGET (editor->keep_on_server), FALSE); - - /* host */ - label = glade_xml_get_widget (editor->gui, "lblSourceHost"); - if (url && CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST)) { - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_host), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_host), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* user */ - label = glade_xml_get_widget (editor->gui, "lblSourceUser"); - if (url && CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_USER)) { - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_user), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_user), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* path */ - label = glade_xml_get_widget (editor->gui, "lblSourcePath"); - if (url && CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_PATH)) { - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_path), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_path), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* auth */ - label = glade_xml_get_widget (editor->gui, "lblSourceAuth"); - if (url && CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) { - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_auth), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_auth), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* passwd */ - label = glade_xml_get_widget (editor->gui, "lblSourcePasswd"); - if (url && CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_PASSWORD)) { - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_passwd), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_save_passwd), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_passwd), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_save_passwd), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - break; - } - } - - l = l->next; - } -} + /* get our toplevel widget and reparent it */ + editor->notebook = GTK_NOTEBOOK (glade_xml_get_widget (editor->gui->xml, "account_editor_notebook")); + gtk_widget_reparent (GTK_WIDGET (editor->notebook), GNOME_DIALOG (editor)->vbox); + gtk_signal_connect (GTK_OBJECT (editor->notebook), "switch-page", + GTK_SIGNAL_FUNC (switch_page), editor); -static void -construct (MailAccountEditor *editor, const MailConfigAccount *account) -{ - GtkWidget *toplevel, *entry; - GladeXML *gui; - CamelURL *url; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "mail-account-editor"); - editor->gui = gui; - - /* get our toplevel widget */ - toplevel = glade_xml_get_widget (gui, "toplevel"); - - /* reparent */ - gtk_widget_reparent (toplevel, GNOME_DIALOG (editor)->vbox); - /* give our dialog an OK button and title */ gtk_window_set_title (GTK_WINDOW (editor), _("Evolution Account Editor")); gtk_window_set_policy (GTK_WINDOW (editor), FALSE, TRUE, TRUE); @@ -745,7 +173,7 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account) GNOME_STOCK_BUTTON_APPLY, GNOME_STOCK_BUTTON_CANCEL, NULL); - + gnome_dialog_button_connect (GNOME_DIALOG (editor), 0 /* OK */, GTK_SIGNAL_FUNC (ok_clicked), editor); @@ -755,148 +183,17 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account) gnome_dialog_button_connect (GNOME_DIALOG (editor), 2 /* CANCEL */, GTK_SIGNAL_FUNC (cancel_clicked), editor); - - /* General */ - editor->account_name = GTK_ENTRY (glade_xml_get_widget (gui, "txtAccountName")); - e_utf8_gtk_entry_set_text (editor->account_name, account->name ? account->name : _("Unspecified")); - gtk_signal_connect (GTK_OBJECT (editor->account_name), "changed", entry_changed, editor); - editor->name = GTK_ENTRY (glade_xml_get_widget (gui, "txtName")); - e_utf8_gtk_entry_set_text (editor->name, account->id->name ? account->id->name : ""); - gtk_signal_connect (GTK_OBJECT (editor->name), "changed", entry_changed, editor); - editor->email = GTK_ENTRY (glade_xml_get_widget (gui, "txtAddress")); - e_utf8_gtk_entry_set_text (editor->email, account->id->address ? account->id->address : ""); - gtk_signal_connect (GTK_OBJECT (editor->email), "changed", entry_changed, editor); - editor->reply_to = GTK_ENTRY (glade_xml_get_widget (gui, "txtReplyTo")); - if (editor->reply_to) - e_utf8_gtk_entry_set_text (editor->reply_to, account->id->reply_to ? account->id->reply_to : ""); - editor->organization = GTK_ENTRY (glade_xml_get_widget (gui, "txtOrganization")); - if (editor->organization) - e_utf8_gtk_entry_set_text (editor->organization, account->id->organization ? - account->id->organization : ""); - editor->signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileSignature")); - if (editor->signature) { - entry = gnome_file_entry_gtk_entry (editor->signature); - gtk_entry_set_text (GTK_ENTRY (entry), account->id->signature ? account->id->signature : ""); - } - - /* Servers */ - if (account->source->url) - url = camel_url_new (account->source->url, NULL); - else - url = NULL; - - editor->source_type = glade_xml_get_widget (gui, "txtSourceType"); - if (GTK_IS_LABEL (editor->source_type)) - gtk_label_set_text (GTK_LABEL (editor->source_type), url ? url->protocol : _("None")); - else - gtk_entry_set_text (GTK_ENTRY (editor->source_type), url ? url->protocol : _("None")); - editor->source_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourceHost")); - gtk_entry_set_text (editor->source_host, url && url->host ? url->host : ""); - if (url && url->port) { - char port[10]; - - g_snprintf (port, 9, ":%d", url->port); - gtk_entry_append_text (editor->source_host, port); - } - editor->source_user = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourceUser")); - gtk_entry_set_text (editor->source_user, url && url->user ? url->user : ""); - editor->source_passwd = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourcePasswd")); - gtk_entry_set_text (editor->source_passwd, url && url->passwd ? url->passwd : ""); - editor->source_path = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourcePath")); - if (url && url->path && *(url->path)) { - GList *providers; - CamelProvider *provider = NULL; - - providers = camel_session_list_providers (session, TRUE); - while (providers) { - provider = providers->data; - - if (strcmp (provider->domain, "mail")) { - provider = NULL; - providers = providers->next; - continue; - } - - if (provider->object_types[CAMEL_PROVIDER_STORE] && provider->flags & CAMEL_PROVIDER_IS_SOURCE) - if (!url || !g_strcasecmp (provider->protocol, url->protocol)) - break; - - provider = NULL; - providers = providers->next; - } - - if (provider) { - if (provider->url_flags & CAMEL_URL_PATH_IS_ABSOLUTE) - gtk_entry_set_text (editor->source_path, url->path ? url->path : ""); - else - gtk_entry_set_text (editor->source_path, url->path + 1 ? url->path + 1 : ""); - } else { - /* we've got a serious problem if we ever get to here */ - g_assert_not_reached (); - } - } - editor->source_save_passwd = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkSourceSavePasswd")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_save_passwd), account->source->save_passwd); - editor->source_auth = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuSourceAuth")); - editor->keep_on_server = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkKeepMailOnServer")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->keep_on_server), account->source->keep_on_server); - editor->source_auto_timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinAutoCheckTimeout")); - gtk_spin_button_set_value (editor->source_auto_timeout, - (gfloat) (account->source->auto_check_time * 1.0)); - editor->source_auto_check = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkAutoCheckMail")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_auto_check), account->source->auto_check); - gtk_signal_connect (GTK_OBJECT (editor->source_auto_check), "toggled", auto_check_toggled, editor); - gtk_widget_set_sensitive (GTK_WIDGET (editor->source_auto_timeout), account->source->auto_check); - editor->source_enabled = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkEnabled")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->source_enabled), account->source->enabled); - source_check (editor, url); - source_auth_init (editor, url); - if (url) - camel_url_free (url); - - /* Transport */ - if (account->transport->url) - url = camel_url_new (account->transport->url, NULL); - else - url = NULL; - - editor->transport_type = glade_xml_get_widget (gui, "omenuTransportType"); - editor->transport_host = GTK_ENTRY (glade_xml_get_widget (gui, "txtTransportHost")); - gtk_entry_set_text (editor->transport_host, url && url->host ? url->host : ""); - if (url && url->port) { - char port[10]; - - g_snprintf (port, 9, ":%d", url->port); - gtk_entry_append_text (editor->transport_host, port); - } - editor->transport_auth = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuTransportAuth")); - editor->transport_user = GTK_ENTRY (glade_xml_get_widget (gui, "txtTransportUser")); - gtk_entry_set_text (editor->transport_user, url && url->user ? url->user : ""); - editor->transport_passwd = GTK_ENTRY (glade_xml_get_widget (gui, "txtTransportPasswd")); - gtk_entry_set_text (editor->transport_passwd, url && url->passwd ? url->passwd : ""); - editor->transport_save_passwd = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkTransportSavePasswd")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->transport_save_passwd), account->transport->save_passwd); - if (GTK_IS_OPTION_MENU (editor->transport_type)) - transport_type_init (editor, url); - else - gtk_label_set_text (GTK_LABEL (editor->transport_type), - url && url->protocol ? url->protocol : _("None")); - - transport_auth_init (editor, url); - - if (url) - camel_url_free (url); - - editor->account = account; + + mail_account_gui_setup (editor->gui, GTK_WIDGET (editor)); } MailAccountEditor * -mail_account_editor_new (const MailConfigAccount *account) +mail_account_editor_new (MailConfigAccount *account) { MailAccountEditor *new; - + new = (MailAccountEditor *) gtk_type_new (mail_account_editor_get_type ()); construct (new, account); - + return new; } diff --git a/mail/mail-account-editor.h b/mail/mail-account-editor.h index b53991236a..ad4bec94bb 100644 --- a/mail/mail-account-editor.h +++ b/mail/mail-account-editor.h @@ -28,57 +28,20 @@ extern "C" { #pragma } #endif /* __cplusplus */ -#include -#include -#include -#include "mail-config.h" +#include +#include "mail-account-gui.h" #define MAIL_ACCOUNT_EDITOR_TYPE (mail_account_editor_get_type ()) #define MAIL_ACCOUNT_EDITOR(o) (GTK_CHECK_CAST ((o), MAIL_ACCOUNT_EDITOR_TYPE, MailAccountEditor)) #define MAIL_ACCOUNT_EDITOR_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_ACCOUNT_EDITOR_TYPE, MailAccountEditorClass)) -#define IS_MAIL_ACCOUNT_EDITOR(o) (GTK_CHECK_TYPE ((o), MAIL_ACCOUNT_EDITOR_TYPE)) -#define IS_MAIL_ACCOUNT_EDITOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_ACCOUNT_EDITOR_TYPE)) +#define MAIL_IS_ACCOUNT_EDITOR(o) (GTK_CHECK_TYPE ((o), MAIL_ACCOUNT_EDITOR_TYPE)) +#define MAIL_IS_ACCOUNT_EDITOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_ACCOUNT_EDITOR_TYPE)) struct _MailAccountEditor { GnomeDialog parent; - const MailConfigAccount *account; - - GladeXML *gui; - - /* Identity / General */ - GtkEntry *account_name; - GtkEntry *name; - GtkEntry *email; - GtkEntry *reply_to; - GtkEntry *organization; - GnomeFileEntry *signature; - - /* Source */ - GtkWidget *source_type; /* this is generic because we don't know the widget-type */ - GtkEntry *source_host; - GtkEntry *source_user; - GtkEntry *source_passwd; - GtkEntry *source_path; - GtkCheckButton *source_save_passwd; - GtkOptionMenu *source_auth; - - GtkCheckButton *keep_on_server; - - GtkCheckButton *source_auto_check; - GtkSpinButton *source_auto_timeout; - - GtkCheckButton *source_enabled; - - /* Transport */ - GtkWidget *transport_type; /* Same here... */ - GtkEntry *transport_host; - GtkOptionMenu *transport_auth; - GtkEntry *transport_user; - GtkEntry *transport_passwd; - GtkCheckButton *transport_save_passwd; - - const CamelProvider *transport; + MailAccountGui *gui; + GtkNotebook *notebook; }; typedef struct _MailAccountEditor MailAccountEditor; @@ -92,7 +55,7 @@ typedef struct { GtkType mail_account_editor_get_type (void); -MailAccountEditor *mail_account_editor_new (const MailConfigAccount *account); +MailAccountEditor *mail_account_editor_new (MailConfigAccount *account); #ifdef __cplusplus } diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c new file mode 100644 index 0000000000..0cf07a58fc --- /dev/null +++ b/mail/mail-account-gui.c @@ -0,0 +1,1086 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: + * Dan Winship + * Jeffrey Stedfast + * + * Copyright 2001 Ximian, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + +#include "config.h" + +#include + +#include + +#include "mail-account-gui.h" +#include "mail-session.h" + +static void save_service (MailAccountGuiService *gsvc, GHashTable *extra_conf, MailConfigService *service); + +static gboolean +is_email (const char *address) +{ + const char *at, *hname; + + at = strchr (address, '@'); + /* make sure we have an '@' and that it's not the first or last char */ + if (!at || at == address || *(at + 1) == '\0') + return FALSE; + + hname = at + 1; + /* make sure the first and last chars aren't '.' */ + if (*hname == '.' || hname[strlen (hname) - 1] == '.') + return FALSE; + + return strchr (hname, '.') != NULL; +} + +gboolean +mail_account_gui_identity_complete (MailAccountGui *gui) +{ + char *text; + + text = gtk_entry_get_text (gui->full_name); + if (!text || !*text) + return FALSE; + text = gtk_entry_get_text (gui->email_address); + if (!text || !is_email (text)) + return FALSE; + + return TRUE; +} + +static gboolean +service_complete (MailAccountGuiService *service) +{ + const CamelProvider *prov = service->provider; + char *text; + + if (!prov) + return TRUE; + + if (CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_HOST)) { + text = gtk_entry_get_text (service->hostname); + if (!text || !*text) + return FALSE; + } + if (CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_USER)) { + text = gtk_entry_get_text (service->username); + if (!text || !*text) + return FALSE; + } + if (CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_PATH)) { + text = gtk_entry_get_text (service->path); + if (!text || !*text) + return FALSE; + } + + return TRUE; +} + +gboolean +mail_account_gui_source_complete (MailAccountGui *gui) +{ + return service_complete (&gui->source); +} + +gboolean +mail_account_gui_transport_complete (MailAccountGui *gui) +{ + if (!service_complete (&gui->transport)) + return FALSE; + + /* FIXME? */ + if (gtk_toggle_button_get_active (gui->transport_needs_auth) && + CAMEL_PROVIDER_ALLOWS (gui->transport.provider, CAMEL_URL_PART_USER)) { + char *text = gtk_entry_get_text (gui->transport.username); + + if (!text || !*text) + return FALSE; + } + + return TRUE; +} + +gboolean +mail_account_gui_management_complete (MailAccountGui *gui) +{ + char *text; + + text = gtk_entry_get_text (gui->account_name); + return text && *text; +} + + + + +static void +service_authtype_changed (GtkWidget *widget, gpointer user_data) +{ + MailAccountGuiService *service = user_data; + CamelServiceAuthType *authtype; + + service->authitem = widget; + authtype = gtk_object_get_data (GTK_OBJECT (widget), "authtype"); + + gtk_widget_set_sensitive (GTK_WIDGET (service->remember), authtype->need_password); +} + +static void +build_auth_menu (MailAccountGuiService *service, GList *authtypes) +{ + GtkWidget *menu, *item, *first = NULL; + CamelServiceAuthType *authtype; + GList *l; + + menu = gtk_menu_new (); + + for (l = authtypes; l; l = l->next) { + authtype = l->data; + + item = gtk_menu_item_new_with_label (_(authtype->name)); + gtk_object_set_data (GTK_OBJECT (item), "authtype", authtype); + gtk_signal_connect (GTK_OBJECT (item), "activate", + service_authtype_changed, service); + + gtk_menu_append (GTK_MENU (menu), item); + + gtk_widget_show (item); + + if (!first) + first = item; + } + + gtk_option_menu_remove_menu (service->authtype); + gtk_option_menu_set_menu (service->authtype, menu); + + if (first) + gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", service); +} + +static void +source_type_changed (GtkWidget *widget, gpointer user_data) +{ + MailAccountGui *gui = user_data; + GtkWidget *label, *frame, *dwidget = NULL; + CamelProvider *provider; + + provider = gtk_object_get_data (GTK_OBJECT (widget), "provider"); + + gui->source.provider = provider; + + frame = glade_xml_get_widget (gui->xml, "source_frame"); + if (provider) { + gtk_widget_show (frame); + + /* hostname */ + label = glade_xml_get_widget (gui->xml, "source_host_label"); + if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST)) { + dwidget = GTK_WIDGET (gui->source.hostname); + gtk_widget_show (GTK_WIDGET (gui->source.hostname)); + gtk_widget_show (label); + } else { + gtk_widget_hide (GTK_WIDGET (gui->source.hostname)); + gtk_widget_hide (label); + } + + /* username */ + label = glade_xml_get_widget (gui->xml, "source_user_label"); + if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_USER)) { + if (!dwidget) + dwidget = GTK_WIDGET (gui->source.username); + gtk_widget_show (GTK_WIDGET (gui->source.username)); + gtk_widget_show (label); + } else { + gtk_widget_hide (GTK_WIDGET (gui->source.username)); + gtk_widget_hide (label); + } + + /* path */ + label = glade_xml_get_widget (gui->xml, "source_path_label"); + if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_PATH)) { + if (!dwidget) + dwidget = GTK_WIDGET (gui->source.path); + + if (!strcmp (provider->protocol, "mbox")) { + char *path; + + if (getenv ("MAIL")) + path = g_strdup (getenv ("MAIL")); + else + path = g_strdup_printf (SYSTEM_MAIL_DIR "/%s", g_get_user_name ()); + gtk_entry_set_text (gui->source.path, path); + g_free (path); + } else if (!strcmp (provider->protocol, "maildir") && + getenv ("MAILDIR")) { + gtk_entry_set_text (gui->source.path, getenv ("MAILDIR")); + } else { + gtk_entry_set_text (gui->source.path, ""); + } + + gtk_widget_show (GTK_WIDGET (gui->source.path)); + gtk_widget_show (label); + } else { + gtk_entry_set_text (gui->source.path, ""); + gtk_widget_hide (GTK_WIDGET (gui->source.path)); + gtk_widget_hide (label); + } + + /* ssl */ +#ifdef HAVE_NSS + if (provider && provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL) + gtk_widget_show (GTK_WIDGET (gui->source.use_ssl)); + else +#endif + gtk_widget_hide (GTK_WIDGET (gui->source.use_ssl)); + + /* auth */ + frame = glade_xml_get_widget (gui->xml, "source_auth_frame"); + if (provider && CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) { + build_auth_menu (&gui->source, provider->authtypes); + gtk_widget_show (frame); + } else + gtk_widget_hide (frame); + } else { + gtk_widget_hide (frame); + frame = glade_xml_get_widget (gui->xml, "source_auth_frame"); + gtk_widget_hide (frame); + } + + gtk_signal_emit_by_name (GTK_OBJECT (gui->source.username), "changed"); + + if (dwidget) + gtk_widget_grab_focus (dwidget); +} + + +static void +transport_needs_auth_toggled (GtkToggleButton *toggle, gpointer data) +{ + MailAccountGui *gui = data; + gboolean need = gtk_toggle_button_get_active (toggle); + GtkWidget *widget; + + widget = glade_xml_get_widget (gui->xml, "transport_auth_frame"); + gtk_widget_set_sensitive (widget, need); +} + +static void +transport_type_changed (GtkWidget *widget, gpointer user_data) +{ + MailAccountGui *gui = user_data; + CamelProvider *provider; + GtkWidget *label, *frame; + + provider = gtk_object_get_data (GTK_OBJECT (widget), "provider"); + gui->transport.provider = provider; + + frame = glade_xml_get_widget (gui->xml, "transport_frame"); + if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST) || + (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH) && + !CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_AUTH))) { + gtk_widget_show (frame); + + label = glade_xml_get_widget (gui->xml, "transport_host_label"); + if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST)) { + gtk_widget_grab_focus (GTK_WIDGET (gui->transport.hostname)); + gtk_widget_show (GTK_WIDGET (gui->transport.hostname)); + gtk_widget_show (label); + } else { + gtk_widget_hide (GTK_WIDGET (gui->transport.hostname)); + gtk_widget_hide (label); + } + + /* ssl */ +#ifdef HAVE_NSS + if (provider && provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL) + gtk_widget_show (GTK_WIDGET (gui->transport.use_ssl)); + else +#endif + gtk_widget_hide (GTK_WIDGET (gui->transport.use_ssl)); + + /* auth */ + if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH) && + !CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_AUTH)) + gtk_widget_show (GTK_WIDGET (gui->transport_needs_auth)); + else + gtk_widget_hide (GTK_WIDGET (gui->transport_needs_auth)); + } else + gtk_widget_hide (frame); + + frame = glade_xml_get_widget (gui->xml, "transport_auth_frame"); + if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) { + gtk_widget_show (frame); + + label = glade_xml_get_widget (gui->xml, "transport_user_label"); + if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_USER)) { + gtk_widget_show (GTK_WIDGET (gui->transport.username)); + gtk_widget_show (label); + } else { + gtk_widget_hide (GTK_WIDGET (gui->transport.username)); + gtk_widget_hide (label); + } + + build_auth_menu (&gui->transport, provider->authtypes); + transport_needs_auth_toggled (gui->transport_needs_auth, gui); + } else + gtk_widget_hide (frame); + + gtk_signal_emit_by_name (GTK_OBJECT (gui->transport.hostname), "changed"); +} + +static void +service_changed (GtkEntry *entry, gpointer user_data) +{ + MailAccountGuiService *service = user_data; + + gtk_widget_set_sensitive (GTK_WIDGET (service->check_supported), + service_complete (service)); +} + +static void +service_check_supported (GtkButton *button, gpointer user_data) +{ + MailAccountGuiService *gsvc = user_data; + MailConfigService *service; + GList *authtypes = NULL; + + service = g_new0 (MailConfigService, 1); + save_service (gsvc, NULL, service); + + if (mail_config_check_service (service->url, CAMEL_PROVIDER_STORE, &authtypes)) { + build_auth_menu (gsvc, authtypes); + g_list_free (authtypes); + } + + service_destroy (service); +} + + +static void +toggle_sensitivity (GtkToggleButton *toggle, GtkWidget *widget) +{ + gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (toggle)); +} + +static void +setup_toggle (GtkWidget *widget, const char *depname, MailAccountGui *gui) +{ + GtkToggleButton *toggle; + + if (!strcmp (depname, "UNIMPLEMENTED")) { + gtk_widget_set_sensitive (widget, FALSE); + return; + } + + toggle = g_hash_table_lookup (gui->extra_config, depname); + gtk_signal_connect (GTK_OBJECT (toggle), "toggled", + GTK_SIGNAL_FUNC (toggle_sensitivity), + widget); + toggle_sensitivity (toggle, widget); +} + +void +mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string) +{ + CamelURL *url; + GtkWidget *mailcheck_frame, *main_vbox, *cur_vbox; + CamelProviderConfEntry *entries; + GList *children, *child; + char *name; + int i; + + if (url_string) + url = camel_url_new (url_string, NULL); + else + url = NULL; + + main_vbox = glade_xml_get_widget (gui->xml, "extra_vbox"); + + mailcheck_frame = glade_xml_get_widget (gui->xml, "extra_mailcheck_frame"); + + /* Remove any additional mailcheck items. */ + children = gtk_container_children (GTK_CONTAINER (mailcheck_frame)); + if (children) { + cur_vbox = children->data; + g_list_free (children); + children = gtk_container_children (GTK_CONTAINER (cur_vbox)); + for (child = children; child; child = child->next) { + if (child != children) { + gtk_container_remove (GTK_CONTAINER (cur_vbox), + child->data); + } + } + g_list_free (children); + } + + /* Remove the contents of the extra_vbox except for the + * mailcheck_frame. + */ + children = gtk_container_children (GTK_CONTAINER (main_vbox)); + for (child = children; child; child = child->next) { + if (child != children) { + gtk_container_remove (GTK_CONTAINER (main_vbox), + child->data); + } + } + g_list_free (children); + + if (!gui->source.provider) { + gtk_widget_set_sensitive (main_vbox, FALSE); + return; + } else + gtk_widget_set_sensitive (main_vbox, TRUE); + + /* Set up our hash table. */ + if (gui->extra_config) + g_hash_table_destroy (gui->extra_config); + gui->extra_config = g_hash_table_new (g_str_hash, g_str_equal); + + entries = gui->source.provider->extra_conf; + if (!entries) + goto done; + + cur_vbox = main_vbox; + for (i = 0; ; i++) { + switch (entries[i].type) { + case CAMEL_PROVIDER_CONF_SECTION_START: + { + GtkWidget *frame; + + if (entries[i].name && !strcmp (entries[i].name, "mailcheck")) + cur_vbox = glade_xml_get_widget (gui->xml, "extra_mailcheck_vbox"); + else { + frame = gtk_frame_new (_(entries[i].text)); + gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0); + cur_vbox = gtk_vbox_new (FALSE, 4); + gtk_container_set_border_width (GTK_CONTAINER (cur_vbox), 4); + gtk_container_add (GTK_CONTAINER (frame), cur_vbox); + } + break; + } + case CAMEL_PROVIDER_CONF_SECTION_END: + cur_vbox = main_vbox; + break; + + case CAMEL_PROVIDER_CONF_CHECKBOX: + { + GtkWidget *checkbox; + gboolean active; + + checkbox = gtk_check_button_new_with_label (_(entries[i].text)); + if (url) + active = camel_url_get_param (url, entries[i].name) != NULL; + else + active = atoi (entries[i].value); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), active); + gtk_box_pack_start (GTK_BOX (cur_vbox), checkbox, FALSE, FALSE, 0); + g_hash_table_insert (gui->extra_config, entries[i].name, checkbox); + if (entries[i].depname) + setup_toggle (checkbox, entries[i].depname, gui); + break; + } + + case CAMEL_PROVIDER_CONF_ENTRY: + { + GtkWidget *hbox, *label, *entry; + const char *text; + + hbox = gtk_hbox_new (FALSE, 8); + label = gtk_label_new (_(entries[i].text)); + entry = gtk_entry_new (); + if (url) + text = camel_url_get_param (url, entries[i].name); + else + text = entries[i].value; + if (text) + gtk_entry_set_text (GTK_ENTRY (entry), text); + + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (hbox), entry, TRUE, TRUE, 0); + + gtk_box_pack_start (GTK_BOX (cur_vbox), hbox, FALSE, FALSE, 0); + g_hash_table_insert (gui->extra_config, entries[i].name, entry); + if (entries[i].depname) { + setup_toggle (entry, entries[i].depname, gui); + setup_toggle (label, entries[i].depname, gui); + } + break; + } + + case CAMEL_PROVIDER_CONF_CHECKSPIN: + { + GtkWidget *hbox, *checkbox, *spin, *label; + GtkObject *adj; + char *data, *pre, *post, *p; + double min, def, max; + gboolean enable; + + data = _(entries[i].text); + p = strstr (data, "%s"); + g_return_if_fail (p != NULL); + + pre = g_strndup (data, p - data); + post = p + 2; + + data = entries[i].value; + enable = *data++ == 'y'; + g_return_if_fail (*data == ':'); + min = strtod (++data, &data); + g_return_if_fail (*data == ':'); + def = strtod (++data, &data); + g_return_if_fail (*data == ':'); + max = strtod (++data, NULL); + + if (url) { + const char *val; + + val = camel_url_get_param (url, entries[i].name); + if (!val) + enable = FALSE; + else { + enable = TRUE; + def = atof (val); + } + } + + hbox = gtk_hbox_new (FALSE, 0); + checkbox = gtk_check_button_new_with_label (pre); + g_free (pre); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), enable); + adj = gtk_adjustment_new (def, min, max, 1, 1, 1); + spin = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 0); + label = gtk_label_new (post); + + gtk_box_pack_start (GTK_BOX (hbox), checkbox, FALSE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 4); + + gtk_box_pack_start (GTK_BOX (cur_vbox), hbox, FALSE, FALSE, 0); + g_hash_table_insert (gui->extra_config, entries[i].name, checkbox); + name = g_strdup_printf ("%s_value", entries[i].name); + g_hash_table_insert (gui->extra_config, name, spin); + if (entries[i].depname) { + setup_toggle (checkbox, entries[i].depname, gui); + setup_toggle (spin, entries[i].depname, gui); + setup_toggle (label, entries[i].depname, gui); + } + break; + } + + case CAMEL_PROVIDER_CONF_END: + goto done; + } + } + + done: + gtk_widget_show_all (main_vbox); +} + +static void +extract_values (MailAccountGuiService *source, GHashTable *extra_config, CamelURL *url) +{ + CamelProviderConfEntry *entries; + GtkToggleButton *toggle; + GtkEntry *entry; + GtkSpinButton *spin; + char *name; + int i; + + if (!source->provider || !source->provider->extra_conf) + return; + entries = source->provider->extra_conf; + + for (i = 0; ; i++) { + if (entries[i].depname) { + toggle = g_hash_table_lookup (extra_config, entries[i].depname); + if (!toggle || !gtk_toggle_button_get_active (toggle)) + continue; + } + + switch (entries[i].type) { + case CAMEL_PROVIDER_CONF_CHECKBOX: + toggle = g_hash_table_lookup (extra_config, entries[i].name); + if (gtk_toggle_button_get_active (toggle)) + camel_url_set_param (url, entries[i].name, ""); + break; + + case CAMEL_PROVIDER_CONF_ENTRY: + entry = g_hash_table_lookup (extra_config, entries[i].name); + camel_url_set_param (url, entries[i].name, gtk_entry_get_text (entry)); + break; + + case CAMEL_PROVIDER_CONF_CHECKSPIN: + toggle = g_hash_table_lookup (extra_config, entries[i].name); + if (!gtk_toggle_button_get_active (toggle)) + break; + name = g_strdup_printf ("%s_value", entries[i].name); + spin = g_hash_table_lookup (extra_config, name); + g_free (name); + name = g_strdup_printf ("%d", gtk_spin_button_get_value_as_int (spin)); + camel_url_set_param (url, entries[i].name, name); + g_free (name); + break; + + case CAMEL_PROVIDER_CONF_END: + return; + + default: + break; + } + } +} + + +static gboolean +setup_service (MailAccountGuiService *gsvc, MailConfigService *service) +{ + CamelURL *url = camel_url_new (service->url, NULL); + gboolean has_auth = FALSE; + + if (url->user && CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_USER)) + gtk_entry_set_text (gsvc->username, url->user); + if (url->host && CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_HOST)) { + char *hostname; + + if (url->port) + hostname = g_strdup_printf ("%s:%d", url->host, url->port); + else + hostname = g_strdup (url->host); + + gtk_entry_set_text (gsvc->hostname, hostname); + g_free (hostname); + } + if (url->path && CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_PATH)) + gtk_entry_set_text (gsvc->path, url->path); + if (gsvc->provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL) { + gboolean use_ssl = camel_url_get_param (url, "use_ssl") != NULL; + gtk_toggle_button_set_active (gsvc->use_ssl, use_ssl); + } + if (url->authmech && CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_AUTH)) { + GList *children, *item; + CamelServiceAuthType *authtype; + int i; + + children = gtk_container_children (GTK_CONTAINER (gtk_option_menu_get_menu (gsvc->authtype))); + for (item = children, i = 0; item; item = item->next, i++) { + authtype = gtk_object_get_data (item->data, "authtype"); + if (!authtype) + continue; + if (!strcmp (authtype->authproto, url->authmech)) { + gtk_option_menu_set_history (gsvc->authtype, i); + gtk_signal_emit_by_name (item->data, "activate"); + break; + } + } + g_list_free (children); + + gtk_toggle_button_set_active (gsvc->remember, service->save_passwd); + has_auth = TRUE; + } + + return has_auth; +} + +static gint +provider_compare (const CamelProvider *p1, const CamelProvider *p2) +{ + /* sort providers based on "location" (ie. local or remote) */ + if (p1->flags & CAMEL_PROVIDER_IS_REMOTE) { + if (p2->flags & CAMEL_PROVIDER_IS_REMOTE) + return 0; + return -1; + } else { + if (p2->flags & CAMEL_PROVIDER_IS_REMOTE) + return 1; + return 0; + } +} + +MailAccountGui * +mail_account_gui_new (MailConfigAccount *account) +{ + MailAccountGui *gui; + + gui = g_new0 (MailAccountGui, 1); + gui->account = account; + gui->xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL); + + /* Management */ + gui->account_name = GTK_ENTRY (glade_xml_get_widget (gui->xml, "management_name")); + gui->default_account = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "management_default")); + if (account->name) + e_utf8_gtk_entry_set_text (gui->account_name, account->name); + gtk_toggle_button_set_active (gui->default_account, account->default_account); + + /* Identity */ + gui->full_name = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_full_name")); + gui->email_address = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_address")); + gui->organization = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_organization")); + gui->signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui->xml, "identity_signature")); + gnome_file_entry_set_default_path (gui->signature, g_get_home_dir ()); + if (account->id) { + if (account->id->name) + e_utf8_gtk_entry_set_text (gui->full_name, account->id->name); + if (account->id->address) + gtk_entry_set_text (gui->email_address, account->id->address); + } + + /* Source */ + gui->source.type = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "source_type_omenu")); + gui->source.hostname = GTK_ENTRY (glade_xml_get_widget (gui->xml, "source_host")); + gtk_signal_connect (GTK_OBJECT (gui->source.hostname), "changed", + GTK_SIGNAL_FUNC (service_changed), &gui->source); + gui->source.username = GTK_ENTRY (glade_xml_get_widget (gui->xml, "source_user")); + gtk_signal_connect (GTK_OBJECT (gui->source.username), "changed", + GTK_SIGNAL_FUNC (service_changed), &gui->source); + gui->source.path = GTK_ENTRY (glade_xml_get_widget (gui->xml, "source_path")); + gtk_signal_connect (GTK_OBJECT (gui->source.path), "changed", + GTK_SIGNAL_FUNC (service_changed), &gui->source); + gui->source.use_ssl = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "source_use_ssl")); + gui->source.authtype = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "source_auth_omenu")); + gui->source.remember = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "source_remember_password")); + gui->source.check_supported = GTK_BUTTON (glade_xml_get_widget (gui->xml, "source_check_supported")); + gtk_signal_connect (GTK_OBJECT (gui->source.check_supported), "clicked", GTK_SIGNAL_FUNC (service_check_supported), &gui->source); + gui->source_auto_check = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "extra_auto_check")); + gui->source_auto_check_min = GTK_SPIN_BUTTON (glade_xml_get_widget (gui->xml, "extra_auto_check_min")); + + /* Transport */ + gui->transport.type = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "transport_type_omenu")); + gui->transport.hostname = GTK_ENTRY (glade_xml_get_widget (gui->xml, "transport_host")); + gtk_signal_connect (GTK_OBJECT (gui->transport.hostname), "changed", + GTK_SIGNAL_FUNC (service_changed), &gui->source); + gui->transport.username = GTK_ENTRY (glade_xml_get_widget (gui->xml, "transport_user")); + gtk_signal_connect (GTK_OBJECT (gui->transport.username), "changed", + GTK_SIGNAL_FUNC (service_changed), &gui->source); + gui->transport.use_ssl = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "transport_use_ssl")); + gui->transport_needs_auth = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "transport_needs_auth")); + gtk_signal_connect (GTK_OBJECT (gui->transport_needs_auth), "toggled", transport_needs_auth_toggled, gui); + gui->transport.authtype = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "transport_auth_omenu")); + gui->transport.remember = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "transport_remember_password")); + gui->transport.check_supported = GTK_BUTTON (glade_xml_get_widget (gui->xml, "transport_check_supported")); + gtk_signal_connect (GTK_OBJECT (gui->transport.check_supported), "clicked", GTK_SIGNAL_FUNC (service_check_supported), &gui->transport); + + return gui; +} + +void +mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top) +{ + GtkWidget *stores, *transports, *item; + GtkWidget *fstore = NULL, *ftransport = NULL; + int si = 0, hstore = 0, ti = 0, htransport = 0; + int max_width = 0; + char *max_authname = NULL; + char *source_proto, *transport_proto; + GList *providers, *l; + + if (gui->account->source && gui->account->source->url) { + source_proto = gui->account->source->url; + source_proto = g_strndup (source_proto, strcspn (source_proto, ":")); + } else + source_proto = NULL; + if (gui->account->transport && gui->account->transport->url) { + transport_proto = gui->account->transport->url; + transport_proto = g_strndup (transport_proto, strcspn (transport_proto, ":")); + } else + transport_proto = NULL; + + /* Construct source/transport option menus */ + stores = gtk_menu_new (); + transports = gtk_menu_new (); + providers = camel_session_list_providers (session, TRUE); + + /* sort the providers, remote first */ + providers = g_list_sort (providers, (GCompareFunc) provider_compare); + + for (l = providers; l; l = l->next) { + CamelProvider *provider = l->data; + + if (strcmp (provider->domain, "mail")) + continue; + + item = NULL; + if (provider->object_types[CAMEL_PROVIDER_STORE] && provider->flags & CAMEL_PROVIDER_IS_SOURCE) { + item = gtk_menu_item_new_with_label (_(provider->name)); + gtk_object_set_data (GTK_OBJECT (item), "provider", provider); + gtk_signal_connect (GTK_OBJECT (item), "activate", + GTK_SIGNAL_FUNC (source_type_changed), + gui); + + gtk_menu_append (GTK_MENU (stores), item); + + gtk_widget_show (item); + + if (!fstore) { + fstore = item; + hstore = si; + } + + if (source_proto && !g_strcasecmp (provider->protocol, source_proto)) { + fstore = item; + hstore = si; + } + + si++; + } + + if (provider->object_types[CAMEL_PROVIDER_TRANSPORT]) { + item = gtk_menu_item_new_with_label (_(provider->name)); + gtk_object_set_data (GTK_OBJECT (item), "provider", provider); + gtk_signal_connect (GTK_OBJECT (item), "activate", + GTK_SIGNAL_FUNC (transport_type_changed), + gui); + + gtk_menu_append (GTK_MENU (transports), item); + + gtk_widget_show (item); + + if (!ftransport) { + ftransport = item; + htransport = ti; + } + + if (transport_proto && !g_strcasecmp (provider->protocol, transport_proto)) { + ftransport = item; + htransport = ti; + } + + ti++; + } + + if (item && provider->authtypes) { + GdkFont *font = GTK_WIDGET (item)->style->font; + CamelServiceAuthType *at; + int width; + GList *a; + + for (a = provider->authtypes; a; a = a->next) { + at = a->data; + + width = gdk_string_width (font, _(at->name)); + if (width > max_width) { + max_authname = _(at->name); + max_width = width; + } + } + } + } + g_list_free (providers); + + /* add a "None" option to the stores menu */ + item = gtk_menu_item_new_with_label (_("None")); + gtk_object_set_data (GTK_OBJECT (item), "provider", NULL); + gtk_signal_connect (GTK_OBJECT (item), "activate", + GTK_SIGNAL_FUNC (source_type_changed), + gui); + + gtk_menu_append (GTK_MENU (stores), item); + + gtk_widget_show (item); + + if (!fstore) { + fstore = item; + hstore = si; + } + + /* set the menus on the optionmenus */ + gtk_option_menu_remove_menu (gui->source.type); + gtk_option_menu_set_menu (gui->source.type, stores); + gtk_option_menu_set_history (gui->source.type, hstore); + + gtk_option_menu_remove_menu (gui->transport.type); + gtk_option_menu_set_menu (gui->transport.type, transports); + gtk_option_menu_set_history (gui->transport.type, htransport); + + /* Force the authmenus to the width of the widest element */ + if (max_authname) { + GtkWidget *menu; + GtkRequisition size_req; + + menu = gtk_menu_new (); + item = gtk_menu_item_new_with_label (max_authname); + gtk_menu_append (GTK_MENU (menu), item); + gtk_widget_show_all (menu); + gtk_option_menu_set_menu (gui->source.authtype, menu); + gtk_widget_show (GTK_WIDGET (gui->source.authtype)); + gtk_widget_size_request (GTK_WIDGET (gui->source.authtype), + &size_req); + + gtk_widget_set_usize (GTK_WIDGET (gui->source.authtype), + size_req.width, -1); + gtk_widget_set_usize (GTK_WIDGET (gui->transport.authtype), + size_req.width, -1); + } + + gtk_widget_show_all (top); + + /* Force some other elements to keep their current sizes even if + * widgets are hidden + */ + item = glade_xml_get_widget (gui->xml, "source_frame"); + gtk_widget_set_usize (item, -1, item->allocation.height); + item = glade_xml_get_widget (gui->xml, "source_auth_frame"); + gtk_widget_set_usize (item, -1, item->allocation.height); + item = glade_xml_get_widget (gui->xml, "source_vbox"); + gtk_widget_set_usize (item, -1, item->allocation.height); + item = glade_xml_get_widget (gui->xml, "transport_frame"); + gtk_widget_set_usize (item, -1, item->allocation.height); + item = glade_xml_get_widget (gui->xml, "transport_auth_frame"); + gtk_widget_set_usize (item, -1, item->allocation.height); + item = glade_xml_get_widget (gui->xml, "transport_vbox"); + gtk_widget_set_usize (item, -1, item->allocation.height); + + if (fstore) + gtk_signal_emit_by_name (GTK_OBJECT (fstore), "activate", gui); + + if (ftransport) + gtk_signal_emit_by_name (GTK_OBJECT (ftransport), "activate", gui); + + if (source_proto) { + setup_service (&gui->source, gui->account->source); + g_free (source_proto); + if (gui->account->source->auto_check) { + gtk_toggle_button_set_active (gui->source_auto_check, TRUE); + gtk_spin_button_set_value (gui->source_auto_check_min, + gui->account->source->auto_check_time); + } + } + if (transport_proto) { + if (setup_service (&gui->transport, gui->account->transport)) + gtk_toggle_button_set_active (gui->transport_needs_auth, TRUE); + g_free (transport_proto); + } +} + +static void +save_service (MailAccountGuiService *gsvc, GHashTable *extra_config, + MailConfigService *service) +{ + CamelURL *url; + char *str; + + if (!gsvc->provider) { + g_free (service->url); + service->url = NULL; + return; + } + + url = g_new0 (CamelURL, 1); + url->protocol = g_strdup (gsvc->provider->protocol); + + if (CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_USER)) { + str = gtk_entry_get_text (gsvc->username); + if (str && *str) + url->user = g_strdup (str); + } + + if (CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_AUTH)) { + CamelServiceAuthType *authtype; + + authtype = gtk_object_get_data (GTK_OBJECT (gsvc->authitem), "authtype"); + if (authtype->authproto && *authtype->authproto) + url->authmech = g_strdup (authtype->authproto); + + service->save_passwd = gtk_toggle_button_get_active (gsvc->remember); + } + + if (CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_HOST)) { + char *pport; + + str = gtk_entry_get_text (gsvc->hostname); + if (str && *str) { + pport = strchr (str, ':'); + if (pport) { + url->host = g_strndup (str, pport - str); + url->port = atoi (pport + 1); + } else + url->host = g_strdup (str); + } + } + + if (CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_PATH)) { + str = gtk_entry_get_text (gsvc->path); + if (str && *str) + url->path = g_strdup (str); + } + + if (gsvc->provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL) { + if (gtk_toggle_button_get_active (gsvc->use_ssl)) + camel_url_set_param (url, "use_ssl", ""); + } + + if (extra_config) + extract_values (gsvc, extra_config, url); + + g_free (service->url); + service->url = camel_url_to_string (url, FALSE); + + /* Temporary until keep_on_server moves into the POP provider */ + if (camel_url_get_param (url, "keep_on_server")) + service->keep_on_server = TRUE; + + camel_url_free (url); +} + +gboolean +mail_account_gui_save (MailAccountGui *gui) +{ + MailConfigAccount *account = gui->account; + + if (!mail_account_gui_identity_complete (gui) || + !mail_account_gui_source_complete (gui) || + !mail_account_gui_transport_complete (gui) || + !mail_account_gui_management_complete (gui)) + return FALSE; + + g_free (account->name); + account->name = e_utf8_gtk_entry_get_text (gui->account_name); + account->default_account = gtk_toggle_button_get_active (gui->default_account); + + /* construct the identity */ + identity_destroy (account->id); + account->id = g_new0 (MailConfigIdentity, 1); + account->id->name = e_utf8_gtk_entry_get_text (gui->full_name); + account->id->address = e_utf8_gtk_entry_get_text (gui->email_address); + account->id->organization = e_utf8_gtk_entry_get_text (gui->organization); + account->id->signature = gnome_file_entry_get_full_path (gui->signature, TRUE); + + service_destroy (account->source); + account->source = g_new0 (MailConfigService, 1); + save_service (&gui->source, gui->extra_config, account->source); + account->source->auto_check = gtk_toggle_button_get_active (gui->source_auto_check); + if (account->source->auto_check) + account->source->auto_check_time = gtk_spin_button_get_value_as_int (gui->source_auto_check_min); + + service_destroy (account->transport); + account->transport = g_new0 (MailConfigService, 1); + save_service (&gui->transport, NULL, account->transport); + + return TRUE; +} + +void +mail_account_gui_destroy (MailAccountGui *gui) +{ + gtk_object_unref (GTK_OBJECT (gui->xml)); + if (gui->extra_config) + g_hash_table_destroy (gui->extra_config); +} + diff --git a/mail/mail-account-gui.h b/mail/mail-account-gui.h new file mode 100644 index 0000000000..2684dd934c --- /dev/null +++ b/mail/mail-account-gui.h @@ -0,0 +1,99 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors: + * Jeffrey Stedfast + * Dan Winship + * + * Copyright 2001 Ximian, Inc. (www.ximian.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef MAIL_ACCOUNT_GUI_H +#define MAIL_ACCOUNT_GUI_H + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus */ + +#include +#include +#include +#include + +#include "mail-config.h" + +typedef struct { + GtkOptionMenu *type; + GtkEntry *hostname; + GtkEntry *username; + GtkEntry *path; + GtkToggleButton *use_ssl; + GtkOptionMenu *authtype; + GtkWidget *authitem; + GtkToggleButton *remember; + GtkButton *check_supported; + + CamelProvider *provider; +} MailAccountGuiService; + +typedef struct { + GtkWidget *top; + MailConfigAccount *account; + GladeXML *xml; + + /* identity */ + GtkEntry *full_name; + GtkEntry *email_address; + GtkEntry *organization; + GnomeFileEntry *signature; + + /* incoming mail */ + MailAccountGuiService source; + GtkToggleButton *source_auto_check; + GtkSpinButton *source_auto_check_min; + + /* extra incoming config */ + GHashTable *extra_config; + + /* outgoing mail */ + MailAccountGuiService transport; + GtkToggleButton *transport_needs_auth; + + /* account management */ + GtkEntry *account_name; + GtkToggleButton *default_account; +} MailAccountGui; + + +MailAccountGui *mail_account_gui_new (MailConfigAccount *account); +void mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top); +gboolean mail_account_gui_save (MailAccountGui *gui); +void mail_account_gui_destroy (MailAccountGui *gui); + +gboolean mail_account_gui_identity_complete (MailAccountGui *gui); +gboolean mail_account_gui_source_complete (MailAccountGui *gui); +gboolean mail_account_gui_transport_complete (MailAccountGui *gui); +gboolean mail_account_gui_management_complete (MailAccountGui *gui); + +void mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* MAIL_ACCOUNT_GUI_H */ diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index dfe2a1248f..7bb2f5ca9e 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -102,7 +102,7 @@ load_accounts (MailAccountsDialog *dialog) while (node) { CamelURL *url; - gchar *text[2]; + gchar *text[3]; account = node->data; @@ -110,17 +110,17 @@ load_accounts (MailAccountsDialog *dialog) url = camel_url_new (account->source->url, NULL); else url = NULL; - - text[0] = g_strdup (account->name); - text[1] = g_strdup_printf ("%s%s", url && url->protocol ? url->protocol : _("None"), + + text[0] = (account->source && account->source->enabled) ? "+" : ""; + text[1] = account->name; + text[2] = g_strdup_printf ("%s%s", url && url->protocol ? url->protocol : _("None"), account->default_account ? _(" (default)") : ""); if (url) camel_url_free (url); gtk_clist_append (dialog->mail_accounts, text); - g_free (text[0]); - g_free (text[1]); + g_free (text[2]); /* set the account on the row */ gtk_clist_set_row_data (dialog->mail_accounts, i, (gpointer) account); @@ -132,23 +132,31 @@ load_accounts (MailAccountsDialog *dialog) gtk_clist_thaw (dialog->mail_accounts); } +#ifdef ENABLE_NTTP static void load_news (MailAccountsDialog *dialog) { /* FIXME: implement */ ; } +#endif /* mail callbacks */ static void mail_select (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data) { MailAccountsDialog *dialog = data; - + MailConfigAccount *account = gtk_clist_get_row_data (clist, row); + dialog->accounts_row = row; gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), TRUE); gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), TRUE); gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), TRUE); + gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), TRUE); + if (account->source && account->source->enabled) + gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->mail_able)->child), _("Disable")); + else + gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->mail_able)->child), _("Enable")); } static void @@ -160,6 +168,7 @@ mail_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gp gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE); } static void @@ -197,7 +206,7 @@ mail_edit (GtkButton *button, gpointer data) MailAccountsDialog *dialog = data; if (dialog->accounts_row >= 0) { - const MailConfigAccount *account; + MailConfigAccount *account; MailAccountEditor *editor; account = gtk_clist_get_row_data (dialog->mail_accounts, dialog->accounts_row); @@ -259,6 +268,7 @@ mail_delete (GtkButton *button, gpointer data) gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE); + gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE); } } } @@ -281,6 +291,24 @@ mail_default (GtkButton *button, gpointer data) } } +static void +mail_able (GtkButton *button, gpointer data) +{ + MailAccountsDialog *dialog = data; + const MailConfigAccount *account; + + if (dialog->accounts_row >= 0) { + int row; + + row = dialog->accounts_row; + account = gtk_clist_get_row_data (dialog->mail_accounts, row); + account->source->enabled = !account->source->enabled; + mail_config_write (); + load_accounts (dialog); + gtk_clist_select_row (dialog->mail_accounts, row, 0); + } +} + #ifdef ENABLE_NNTP /* news callbacks */ static void @@ -446,7 +474,7 @@ construct (MailAccountsDialog *dialog) GladeXML *gui; GtkWidget *notebook; - gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "mail-accounts-dialog"); + gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL); dialog->gui = gui; /* get our toplevel widget */ @@ -480,6 +508,9 @@ construct (MailAccountsDialog *dialog) dialog->mail_default = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailDefault")); gtk_signal_connect (GTK_OBJECT (dialog->mail_default), "clicked", GTK_SIGNAL_FUNC (mail_default), dialog); + dialog->mail_able = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailAble")); + gtk_signal_connect (GTK_OBJECT (dialog->mail_able), "clicked", + GTK_SIGNAL_FUNC (mail_able), dialog); #if defined (ENABLE_NNTP) dialog->news_accounts = GTK_CLIST (glade_xml_get_widget (gui, "clistAccounts")); diff --git a/mail/mail-accounts.h b/mail/mail-accounts.h index 016200484b..6cee8f23ab 100644 --- a/mail/mail-accounts.h +++ b/mail/mail-accounts.h @@ -54,6 +54,7 @@ struct _MailAccountsDialog { GtkButton *mail_edit; GtkButton *mail_delete; GtkButton *mail_default; + GtkButton *mail_able; const GSList *news; gint news_row; diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c index 6759879915..371769eb81 100644 --- a/mail/mail-config-druid.c +++ b/mail/mail-config-druid.c @@ -1,8 +1,10 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Authors: Jeffrey Stedfast + * Authors: + * Jeffrey Stedfast + * Dan Winship * - * Copyright 2001 Helix Code, Inc. (www.helixcode.com) + * Copyright 2001 Ximian, Inc. (www.ximian.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,18 +35,10 @@ #include #include #include - -#define d(x) x - -GtkWidget *mail_config_create_html (const char *name, const char *str1, const char *str2, - int int1, int int2); +#include static void mail_config_druid_class_init (MailConfigDruidClass *class); -static void mail_config_druid_init (MailConfigDruid *druid); -static void mail_config_druid_finalise (GtkObject *obj); - -static void construct_source_auth_menu (MailConfigDruid *druid, GList *authtypes); -static void construct_transport_auth_menu (MailConfigDruid *druid, GList *authtypes); +static void mail_config_druid_finalize (GtkObject *obj); static GtkWindowClass *parent_class; @@ -52,21 +46,21 @@ GtkType mail_config_druid_get_type (void) { static GtkType type = 0; - + if (!type) { GtkTypeInfo type_info = { "MailConfigDruid", sizeof (MailConfigDruid), sizeof (MailConfigDruidClass), (GtkClassInitFunc) mail_config_druid_class_init, - (GtkObjectInitFunc) mail_config_druid_init, + (GtkObjectInitFunc) NULL, (GtkArgSetFunc) NULL, (GtkArgGetFunc) NULL }; - + type = gtk_type_unique (gtk_window_get_type (), &type_info); } - + return type; } @@ -74,28 +68,20 @@ static void mail_config_druid_class_init (MailConfigDruidClass *class) { GtkObjectClass *object_class; - + object_class = (GtkObjectClass *) class; parent_class = gtk_type_class (gtk_window_get_type ()); - - object_class->finalize = mail_config_druid_finalise; - /* override methods */ - -} -static void -mail_config_druid_init (MailConfigDruid *o) -{ - ; + /* override methods */ + object_class->finalize = mail_config_druid_finalize; } static void -mail_config_druid_finalise (GtkObject *obj) +mail_config_druid_finalize (GtkObject *obj) { MailConfigDruid *druid = (MailConfigDruid *) obj; - - gtk_object_unref (GTK_OBJECT (druid->gui)); - + + mail_account_gui_destroy (druid->gui); ((GtkObjectClass *)(parent_class))->finalize (obj); } @@ -104,18 +90,16 @@ static struct { char *name; char *text; } info[] = { - { "htmlIdentity", - "Please enter your name and email address below. The \"optional\" fields below do not need to be filled in, unless you wish to include this information in email you send." }, - { "htmlIncoming", - "Please enter information about your incoming mail server below. If you don't know what kind of server you use, contact your system administrator or Internet Service Provider." }, - { "htmlSourceAuthentication", - "Your mail server supports the following types of authentication. Please select the type you want Evolution to use." }, - { "htmlTransport", - "Please enter information about your outgoing mail protocol below. If you don't know which protocol you use, contact your system administrator or Internet Service Provider." }, - { "htmlTransportAuthentication", - "Your mail transport supports the following types of authentication. Please select the type you want Evolution to use." }, - { "htmlAccountInfo", - "You are almost done with the mail configuration process. The identity, incoming mail server and outgoing mail transport method which you provided will be grouped together to make an Evolution mail account. Please enter a name for this account in the space below. This name will be used for display purposes only." } + { "identity_html", + N_("Please enter your name and email address below. The \"optional\" fields below do not need to be filled in, unless you wish to include this information in email you send.") }, + { "source_html", + N_("Please enter information about your incoming mail server below. If you don't know what kind of server you use, contact your system administrator or Internet Service Provider.") }, + { "extra_html", + "The following options mostly don't work yet and are here only to taunt you. Ha ha!" }, + { "transport_html", + N_("Please enter information about your outgoing mail protocol below. If you don't know which protocol you use, contact your system administrator or Internet Service Provider.") }, + { "management_html", + N_("You are almost done with the mail configuration process. The identity, incoming mail server and outgoing mail transport method which you provided will be grouped together to make an Evolution mail account. Please enter a name for this account in the space below. This name will be used for display purposes only.") } }; static int num_info = (sizeof (info) / sizeof (info[0])); @@ -125,15 +109,15 @@ html_size_req (GtkWidget *widget, GtkRequisition *requisition) requisition->height = GTK_LAYOUT (widget)->height; } -GtkWidget * -mail_config_create_html (const char *name, const char *str1, const char *str2, - int int1, int int2) +static GtkWidget * +create_html (const char *name) { GtkWidget *scrolled, *html; GtkHTMLStream *stream; GtkStyle *style; + char *utf8; int i; - + html = gtk_html_new (); GTK_LAYOUT (html)->height = 0; gtk_signal_connect (GTK_OBJECT (html), "size_request", @@ -147,26 +131,27 @@ mail_config_create_html (const char *name, const char *str1, const char *str2, &style->bg[0]); } gtk_widget_show (html); - + scrolled = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolled); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_NEVER, GTK_POLICY_NEVER); gtk_container_add (GTK_CONTAINER (scrolled), html); - + for (i = 0; i < num_info; i++) { if (!strcmp (name, info[i].name)) break; } g_return_val_if_fail (i != num_info, scrolled); - + stream = gtk_html_begin (GTK_HTML (html)); gtk_html_write (GTK_HTML (html), stream, "

", 9); - gtk_html_write (GTK_HTML (html), stream, info[i].text, - strlen (info[i].text)); + utf8 = e_utf8_from_locale_string (_(info[i].text)); + gtk_html_write (GTK_HTML (html), stream, utf8, strlen (utf8)); + g_free (utf8); gtk_html_write (GTK_HTML (html), stream, "

", 11); gtk_html_end (GTK_HTML (html), stream, GTK_HTML_STREAM_OK); - + return scrolled; } @@ -175,7 +160,7 @@ druid_cancel (GnomeDruid *druid, gpointer user_data) { /* Cancel the setup of the account */ MailConfigDruid *config = user_data; - + gtk_widget_destroy (GTK_WIDGET (config)); } @@ -184,567 +169,143 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data) { /* Cancel the setup of the account */ MailConfigDruid *druid = user_data; - MailConfigAccount *account; - MailConfigIdentity *id; - MailConfigService *source; - MailConfigService *transport; - CamelURL *url; - char *str; - - account = g_new0 (MailConfigAccount, 1); - account->name = mail_config_druid_get_account_name (druid); - account->default_account = mail_config_druid_get_default_account (druid); - - /* construct the identity */ - id = g_new0 (MailConfigIdentity, 1); - id->name = mail_config_druid_get_full_name (druid); - id->address = mail_config_druid_get_email_address (druid); - id->organization = mail_config_druid_get_organization (druid); - id->signature = mail_config_druid_get_sigfile (druid); - - /* construct the source */ - source = g_new0 (MailConfigService, 1); - source->keep_on_server = mail_config_druid_get_keep_mail_on_server (druid); - source->auto_check = mail_config_druid_get_auto_check (druid); - source->auto_check_time = mail_config_druid_get_auto_check_minutes (druid); - source->save_passwd = mail_config_druid_get_save_source_password (druid); - str = mail_config_druid_get_source_url (druid); - if (str) { - /* cache the password and rewrite the url without the password part */ - url = camel_url_new (str, NULL); - g_free (str); - source->url = camel_url_to_string (url, FALSE); - if (source->save_passwd && url->passwd) { - mail_session_set_password (source->url, url->passwd); - mail_session_remember_password (source->url); - } - camel_url_free (url); - source->enabled = TRUE; - } else { - source->url = NULL; - source->enabled = FALSE; - } - - /* construct the transport */ - transport = g_new0 (MailConfigService, 1); - transport->save_passwd = mail_config_druid_get_save_transport_password (druid); - str = mail_config_druid_get_transport_url (druid); - if (str) { - /* cache the password and rewrite the url without the password part */ - url = camel_url_new (str, NULL); - g_free (str); - transport->url = camel_url_to_string (url, FALSE); - if (transport->save_passwd && url->passwd) { - mail_session_set_password (transport->url, url->passwd); - mail_session_remember_password (transport->url); - } - camel_url_free (url); - transport->enabled = TRUE; - } - - account->id = id; - account->source = source; - account->transport = transport; - - mail_config_add_account (account); + MailAccountGui *gui = druid->gui; + GSList *mini; + + mail_account_gui_save (gui); + if (gui->account->source) + gui->account->source->enabled = TRUE; + mail_config_add_account (gui->account); mail_config_write (); - - if (source->url) { - GSList *mini; - - mini = g_slist_prepend (NULL, account); - mail_load_storages (druid->shell, mini, TRUE); - g_slist_free (mini); - } - - gtk_widget_destroy (GTK_WIDGET (druid)); -} -static gboolean -is_email (const char *address) -{ - const char *at, *hname; - - g_return_val_if_fail (address != NULL, FALSE); - - at = strchr (address, '@'); - /* make sure we have an '@' and that it's not the first or last char */ - if (!at || at == address || *(at + 1) == '\0') - return FALSE; - - hname = at + 1; - /* make sure the first and last chars aren't '.' */ - if (*hname == '.' || hname[strlen (hname) - 1] == '.') - return FALSE; - - return strchr (hname, '.') != NULL; -} + mini = g_slist_prepend (NULL, gui->account); + mail_load_storages (druid->shell, mini, TRUE); + g_slist_free (mini); -/* Identity Page */ -static void -identity_check (MailConfigDruid *druid) -{ - char *address; - - address = gtk_entry_get_text (druid->email_address); - if (gtk_entry_get_text (druid->full_name) && is_email (address)) - gnome_druid_set_buttons_sensitive (druid->druid, TRUE, TRUE, TRUE); - else - gnome_druid_set_buttons_sensitive (druid->druid, TRUE, FALSE, TRUE); + gtk_widget_destroy (GTK_WIDGET (druid)); } +/* Identity Page */ static void identity_changed (GtkWidget *widget, gpointer data) { MailConfigDruid *druid = data; - - identity_check (druid); + gboolean next_sensitive = mail_account_gui_identity_complete (druid->gui); + + gnome_druid_set_buttons_sensitive (druid->druid, TRUE, next_sensitive, TRUE); } static void identity_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; - - gtk_widget_grab_focus (GTK_WIDGET (config->full_name)); - - identity_check (config); + + gtk_widget_grab_focus (GTK_WIDGET (config->gui->full_name)); + identity_changed (NULL, config); } static gboolean identity_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { - /* go to the next page */ + MailConfigDruid *config = data; + + if (!config->identity_copied) { + char *username; + + /* Copy the username part of the email address into + * the Username field of the source and transport pages. + */ + username = gtk_entry_get_text (config->gui->email_address); + username = g_strndup (username, strcspn (username, "@")); + gtk_entry_set_text (config->gui->source.username, username); + gtk_entry_set_text (config->gui->transport.username, username); + g_free (username); + + config->identity_copied = TRUE; + } + return FALSE; } /* Incoming mail Page */ static void -incoming_check (MailConfigDruid *druid) -{ - const CamelProvider *prov = druid->source_provider; - gboolean host = TRUE, user = TRUE, path = TRUE; - gboolean next_sensitive = TRUE; - - if (prov && CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_HOST)) - host = gtk_entry_get_text (druid->incoming_hostname) != NULL; - - if (prov && CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_USER)) - user = gtk_entry_get_text (druid->incoming_username) != NULL; - - if (prov && CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_PATH)) - path = gtk_entry_get_text (druid->incoming_path) != NULL; - - next_sensitive = host && user && path; - - gnome_druid_set_buttons_sensitive (druid->druid, TRUE, next_sensitive, TRUE); -} - -static void -auto_check_toggled (GtkToggleButton *button, gpointer data) +source_changed (GtkWidget *widget, gpointer data) { MailConfigDruid *druid = data; - - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_auto_check_min), - gtk_toggle_button_get_active (button)); -} + gboolean next_sensitive = mail_account_gui_source_complete (druid->gui); -static void -incoming_changed (GtkWidget *widget, gpointer data) -{ - MailConfigDruid *druid = data; - - incoming_check (druid); + gnome_druid_set_buttons_sensitive (druid->druid, TRUE, next_sensitive, TRUE); } static void -incoming_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) +source_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; - - if (!gtk_object_get_data (GTK_OBJECT (page), "initialized")) { - char *username; - - /* Copy the username part of the email address into - * the Username field. - */ - username = gtk_entry_get_text (config->email_address); - username = g_strndup (username, strcspn (username, "@")); - gtk_entry_set_text (config->incoming_username, username); - g_free (username); - - gtk_object_set_data (GTK_OBJECT (page), "initialized", - GINT_TO_POINTER (1)); - } - - incoming_check (config); + + source_changed (NULL, config); } static gboolean -incoming_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) +source_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; GtkWidget *transport_page; - GList *authtypes = NULL; - gchar *source_url; - gboolean connect; - CamelURL *url; - - config->have_source_auth_page = TRUE; - - source_url = mail_config_druid_get_source_url (config); - if (!source_url) { - /* User opted to not setup a source for this account, - * so jump past the auth page */ - - /* Skip to transport page. */ - config->have_source_auth_page = FALSE; - transport_page = glade_xml_get_widget (config->gui, "druidTransportPage"); - gnome_druid_set_page (config->druid, GNOME_DRUID_PAGE (transport_page)); - - return TRUE; - } - - url = camel_url_new (source_url, NULL); - g_free (source_url); - - connect = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (config->incoming_check_settings)); - - /* If we can't connect, warn them and continue on to the Transport page. */ - if (!mail_config_check_service (url, CAMEL_PROVIDER_STORE, connect, &authtypes)) { - GtkWidget *dialog; - char *source, *warning; - - source = camel_url_to_string (url, FALSE); - camel_url_free (url); - - warning = g_strdup_printf (_("Failed to verify the incoming mail configuration.\n" - "You may experience problems retrieving your mail from %s"), - source); - g_free (source); - dialog = gnome_warning_dialog_parented (warning, GTK_WINDOW (config)); - g_free (warning); - - gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - - return TRUE; - } - camel_url_free (url); - - /* If this service offers authentication, go to the next page. */ - if (authtypes) { - construct_source_auth_menu (config, authtypes); + + /* FIXME: if online, check that the data is good. */ + + if (config->gui->source.provider && config->gui->source.provider->extra_conf) return FALSE; - } - + /* Otherwise, skip to transport page. */ - config->have_source_auth_page = FALSE; - transport_page = glade_xml_get_widget (config->gui, "druidTransportPage"); + transport_page = glade_xml_get_widget (config->gui->xml, "transport_page"); gnome_druid_set_page (config->druid, GNOME_DRUID_PAGE (transport_page)); - - return TRUE; -} -static void -incoming_type_changed (GtkWidget *widget, gpointer user_data) -{ - MailConfigDruid *druid = user_data; - GtkWidget *label, *dwidget = NULL; - CamelProvider *provider; - - provider = gtk_object_get_data (GTK_OBJECT (widget), "provider"); - - druid->source_provider = provider; - - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_auto_check), provider ? TRUE : FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_auto_check_min), provider ? TRUE : FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_check_settings), provider ? TRUE : FALSE); - - /* hostname */ - label = glade_xml_get_widget (druid->gui, "lblSourceHost"); - if (provider && CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST)) { - dwidget = GTK_WIDGET (druid->incoming_hostname); - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_hostname), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_entry_set_text (druid->incoming_hostname, ""); - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_hostname), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* username */ - label = glade_xml_get_widget (druid->gui, "lblSourceUser"); - if (provider && CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_USER)) { - if (!dwidget) - dwidget = GTK_WIDGET (druid->incoming_username); - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_username), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_entry_set_text (druid->incoming_username, ""); - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_username), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* password */ - label = glade_xml_get_widget (druid->gui, "lblSourcePasswd"); - if (provider && CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_PASSWORD)) { - if (!dwidget) - dwidget = GTK_WIDGET (druid->source_password); - gtk_widget_set_sensitive (GTK_WIDGET (druid->source_password), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_entry_set_text (druid->source_password, ""); - gtk_widget_set_sensitive (GTK_WIDGET (druid->source_password), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* auth */ - label = glade_xml_get_widget (druid->gui, "lblSourceAuthType"); - if (provider && CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) { - gtk_widget_set_sensitive (GTK_WIDGET (druid->source_auth_type), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_widget_set_sensitive (GTK_WIDGET (druid->source_auth_type), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* path */ - label = glade_xml_get_widget (druid->gui, "lblSourcePath"); - /* FIXME */ - if (provider && !strcmp (provider->protocol, "imap")) - gtk_label_set_text (GTK_LABEL (label), _("Namespace:")); - else - gtk_label_set_text (GTK_LABEL (label), _("Path:")); - if (provider && CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_PATH)) { - if (!dwidget) - dwidget = GTK_WIDGET (druid->incoming_path); - - if (!strcmp (provider->protocol, "mbox")) { - char *path; - - if (getenv ("MAIL")) - path = g_strdup (getenv ("MAIL")); - else - path = g_strdup_printf (SYSTEM_MAIL_DIR "/%s", g_get_user_name ()); - gtk_entry_set_text (druid->incoming_path, path); - g_free (path); - } else if (!strcmp (provider->protocol, "maildir") && - getenv ("MAILDIR")) { - gtk_entry_set_text (druid->incoming_path, getenv ("MAILDIR")); - } else { - gtk_entry_set_text (druid->incoming_path, ""); - } - - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_path), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_entry_set_text (druid->incoming_path, ""); - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_path), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* keep mail on server */ - if (provider && !(provider->flags & CAMEL_PROVIDER_IS_STORAGE)) - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_keep_mail), TRUE); - else - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_keep_mail), FALSE); - - incoming_check (druid); - - if (dwidget) - gtk_widget_grab_focus (dwidget); -} - -/* Source Authentication Page */ -static void -source_auth_check (MailConfigDruid *druid) -{ - if (mail_config_druid_get_save_source_password (druid)) { - char *passwd = gtk_entry_get_text (druid->source_password); - - if (passwd && *passwd) - gnome_druid_set_buttons_sensitive (druid->druid, TRUE, TRUE, TRUE); - else - gnome_druid_set_buttons_sensitive (druid->druid, TRUE, FALSE, TRUE); - } else { - gnome_druid_set_buttons_sensitive (druid->druid, TRUE, TRUE, TRUE); - } -} - -static void -source_auth_changed (GtkWidget *widget, gpointer data) -{ - MailConfigDruid *druid = data; - - source_auth_check (druid); + return TRUE; } +/* Extra Config Page */ static void -source_auth_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) +extra_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; - - source_auth_check (config); -} - -static gboolean -source_auth_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) -{ - /* go to the next page */ - return FALSE; -} -static void -source_auth_type_changed (GtkWidget *widget, gpointer user_data) -{ - MailConfigDruid *druid = user_data; - CamelServiceAuthType *authtype; - GtkWidget *label; - gboolean sensitive; - - authtype = gtk_object_get_data (GTK_OBJECT (widget), "authtype"); - - gtk_object_set_data (GTK_OBJECT (druid), "source_authmech", authtype->authproto); - - if (authtype->need_password) - sensitive = TRUE; - else - sensitive = FALSE; - - label = glade_xml_get_widget (druid->gui, "lblSourcePasswd"); - gtk_widget_set_sensitive (GTK_WIDGET (druid->source_password), sensitive); - gtk_widget_set_sensitive (GTK_WIDGET (druid->save_source_password), sensitive); - gtk_widget_set_sensitive (label, sensitive); - - if (!sensitive) - gtk_entry_set_text (druid->source_password, ""); - - source_auth_check (druid); -} - -static void -construct_source_auth_menu (MailConfigDruid *druid, GList *authtypes) -{ - GtkWidget *menu, *item, *first = NULL; - CamelServiceAuthType *authtype; - GList *l; - - menu = gtk_menu_new (); - - l = authtypes; - while (l) { - authtype = l->data; - - item = gtk_menu_item_new_with_label (authtype->name); - gtk_object_set_data (GTK_OBJECT (item), "authtype", authtype); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (source_auth_type_changed), - druid); - - gtk_menu_append (GTK_MENU (menu), item); - - gtk_widget_show (item); - - if (!first) - first = item; - - l = l->next; + if (config->gui->source.provider != config->last_source) { + config->last_source = config->gui->source.provider; + mail_account_gui_build_extra_conf (config->gui, NULL); } - - if (first) - gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", druid); - - gtk_option_menu_remove_menu (druid->source_auth_type); - gtk_option_menu_set_menu (druid->source_auth_type, menu); } /* Transport Page */ -static void -transport_check (MailConfigDruid *druid) -{ - const CamelProvider *prov = druid->transport_provider; - gboolean next_sensitive = TRUE; - - if (prov && CAMEL_PROVIDER_NEEDS (prov, CAMEL_URL_PART_HOST)) - next_sensitive = gtk_entry_get_text (druid->outgoing_hostname) != NULL; - - gnome_druid_set_buttons_sensitive (druid->druid, TRUE, next_sensitive, TRUE); -} - static void transport_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; - - transport_check (config); + gboolean next_sensitive = mail_account_gui_transport_complete (config->gui); + + gnome_druid_set_buttons_sensitive (config->druid, TRUE, next_sensitive, TRUE); } static gboolean transport_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { - MailConfigDruid *config = data; - GtkWidget *management_page; - GList *authtypes = NULL; - gboolean connect; - char *xport_url; - CamelURL *url; - - xport_url = mail_config_druid_get_transport_url (config); - if (!xport_url) - return TRUE; - - url = camel_url_new (xport_url, NULL); - g_free (xport_url); - - connect = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (config->outgoing_check_settings)); - - /* If we can't connect, don't let them continue. */ - if (!mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, connect, &authtypes)) { - GtkWidget *dialog; - char *transport, *warning; - - transport = camel_url_to_string (url, FALSE); - - warning = g_strdup_printf (_("Failed to verify the outgoing mail configuration.\n" - "You may experience problems sending your mail using %s"), - transport); - g_free (transport); - dialog = gnome_warning_dialog_parented (warning, GTK_WINDOW (config)); - g_free (warning); - - gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - } - - camel_url_free (url); - - /* If this service offers authentication, go to the next page. */ - if (authtypes && mail_config_druid_get_transport_requires_auth (config)) { - construct_transport_auth_menu (config, authtypes); - return FALSE; - } - - /* Otherwise, skip to management page. */ - config->have_transport_auth_page = FALSE; - management_page = glade_xml_get_widget (config->gui, "druidManagementPage"); - gnome_druid_set_page (config->druid, GNOME_DRUID_PAGE (management_page)); - - return TRUE; + /* FIXME: if online, check that the data is good. */ + return FALSE; } static gboolean transport_back (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; - - if (config->have_source_auth_page) { + + if (config->gui->source.provider && config->gui->source.provider->extra_conf) return FALSE; - } else { - /* jump to the source page, skipping over the auth page */ + else { + /* jump to the source page, skipping over the extra page */ GtkWidget *widget; - - widget = glade_xml_get_widget (config->gui, "druidSourcePage"); + + widget = glade_xml_get_widget (config->gui->xml, "source_page"); gnome_druid_set_page (config->druid, GNOME_DRUID_PAGE (widget)); - + return TRUE; } } @@ -752,154 +313,7 @@ transport_back (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) static void transport_changed (GtkWidget *widget, gpointer data) { - MailConfigDruid *druid = data; - - transport_check (druid); -} - -static void -transport_type_changed (GtkWidget *widget, gpointer user_data) -{ - MailConfigDruid *druid = user_data; - CamelProvider *provider; - GtkWidget *label; - - provider = gtk_object_get_data (GTK_OBJECT (widget), "provider"); - druid->transport_provider = provider; - - /* hostname */ - label = glade_xml_get_widget (druid->gui, "lblTransportHost"); - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST)) { - gtk_widget_grab_focus (GTK_WIDGET (druid->outgoing_hostname)); - gtk_widget_set_sensitive (GTK_WIDGET (druid->outgoing_hostname), TRUE); - gtk_widget_set_sensitive (label, TRUE); - } else { - gtk_entry_set_text (druid->outgoing_hostname, ""); - gtk_widget_set_sensitive (GTK_WIDGET (druid->outgoing_hostname), FALSE); - gtk_widget_set_sensitive (label, FALSE); - } - - /* auth */ - if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) - gtk_widget_set_sensitive (GTK_WIDGET (druid->outgoing_requires_auth), TRUE); - else - gtk_widget_set_sensitive (GTK_WIDGET (druid->outgoing_requires_auth), FALSE); - - transport_check (druid); -} - -/* Transport Authentication Page */ -static void -transport_auth_check (MailConfigDruid *druid) -{ - char *user = gtk_entry_get_text (druid->transport_username); - gboolean sensitive = FALSE; - - if (user && *user) { - if (mail_config_druid_get_save_transport_password (druid)) { - char *passwd = gtk_entry_get_text (druid->transport_password); - - if (passwd && *passwd) - sensitive = TRUE; - } else { - sensitive = TRUE; - } - } - - gnome_druid_set_buttons_sensitive (druid->druid, TRUE, sensitive, TRUE); -} - -static void -transport_auth_changed (GtkWidget *widget, gpointer data) -{ - MailConfigDruid *druid = data; - - transport_auth_check (druid); -} - -static void -transport_auth_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) -{ - MailConfigDruid *config = data; - - transport_auth_check (config); -} - -static gboolean -transport_auth_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) -{ - /* go to the next page */ - return FALSE; -} - -static void -transport_auth_type_changed (GtkWidget *widget, gpointer user_data) -{ - MailConfigDruid *druid = user_data; - CamelServiceAuthType *authtype; - GtkWidget *label; - gboolean sensitive; - - authtype = gtk_object_get_data (GTK_OBJECT (widget), "authtype"); - - gtk_object_set_data (GTK_OBJECT (druid), "transport_authmech", authtype->authproto); - - if (authtype->need_password) - sensitive = TRUE; - else - sensitive = FALSE; - - label = glade_xml_get_widget (druid->gui, "lblTransportUsername"); - gtk_widget_set_sensitive (GTK_WIDGET (druid->transport_username), sensitive); - gtk_widget_set_sensitive (label, sensitive); - - label = glade_xml_get_widget (druid->gui, "lblTransportPasswd"); - gtk_widget_set_sensitive (GTK_WIDGET (druid->transport_password), sensitive); - gtk_widget_set_sensitive (GTK_WIDGET (druid->save_transport_password), sensitive); - gtk_widget_set_sensitive (label, sensitive); - - if (!sensitive) { - gtk_entry_set_text (druid->transport_username, ""); - gtk_entry_set_text (druid->transport_password, ""); - } - - transport_auth_check (druid); -} - -static void -construct_transport_auth_menu (MailConfigDruid *druid, GList *authtypes) -{ - GtkWidget *menu, *item, *first = NULL; - CamelServiceAuthType *authtype; - GList *l; - - menu = gtk_menu_new (); - - l = authtypes; - while (l) { - authtype = l->data; - - item = gtk_menu_item_new_with_label (authtype->name); - gtk_object_set_data (GTK_OBJECT (item), "authtype", authtype); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (transport_auth_type_changed), - druid); - - gtk_menu_append (GTK_MENU (menu), item); - - gtk_widget_show (item); - - if (!first) - first = item; - - l = l->next; - } - - if (first) - gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", druid); - - gtk_option_menu_remove_menu (druid->transport_auth_type); - gtk_option_menu_set_menu (druid->transport_auth_type, menu); + transport_prepare (NULL, NULL, data); } /* Management page */ @@ -907,9 +321,11 @@ static void management_check (MailConfigDruid *druid) { gboolean next_sensitive; - - next_sensitive = gtk_entry_get_text (druid->account_name) != NULL; - + char *text; + + text = gtk_entry_get_text (druid->gui->account_name); + next_sensitive = text && *text; + gnome_druid_set_buttons_sensitive (druid->druid, TRUE, next_sensitive, TRUE); } @@ -918,13 +334,11 @@ management_prepare (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) { MailConfigDruid *config = data; char *name; - - name = e_utf8_gtk_entry_get_text (config->email_address); - if (name) { - e_utf8_gtk_entry_set_text (config->account_name, name); - g_free (name); - } - + + name = gtk_entry_get_text (config->gui->email_address); + if (name && *name) + gtk_entry_set_text (config->gui->account_name, name); + management_check (config); } @@ -932,211 +346,33 @@ static void management_changed (GtkWidget *widget, gpointer data) { MailConfigDruid *druid = data; - - management_check (druid); -} -static gboolean -management_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) -{ - return FALSE; + management_check (druid); } -static gboolean -management_back (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) -{ - MailConfigDruid *config = data; - - if (config->have_transport_auth_page) { - return FALSE; - } else { - /* jump to the source page, skipping over the auth page */ - GtkWidget *widget; - - widget = glade_xml_get_widget (config->gui, "druidTransportPage"); - gnome_druid_set_page (config->druid, GNOME_DRUID_PAGE (widget)); - - return TRUE; - } -} -static gint -provider_compare (const CamelProvider *p1, const CamelProvider *p2) +static MailConfigAccount * +make_default_account (void) { - /* sort providers based on "location" (ie. local or remote) */ - if (p1->flags & CAMEL_PROVIDER_IS_REMOTE) { - if (p2->flags & CAMEL_PROVIDER_IS_REMOTE) - return 0; - return -1; - } else { - if (p2->flags & CAMEL_PROVIDER_IS_REMOTE) - return 1; - return 0; - } -} + MailConfigAccount *account; + char *name, *user; + struct utsname uts; -static gboolean -is_domain (const char *domain) -{ - /* domain && *domain should be enough but linux's - getdomainname() likes to return "(none)" */ - return domain && *domain && strcmp (domain, "(none)"); -} + account = g_new0 (MailConfigAccount, 1); + if (!mail_config_get_default_account) + account->default_account = TRUE; -static void -set_defaults (MailConfigDruid *druid) -{ - const MailConfigService *default_xport; - GtkWidget *stores, *transports, *item; - GtkWidget *fstore = NULL, *ftransport = NULL; - int si = 0, hstore = 0, ti = 0, htransport = 0; - char *user, *realname; - char hostname[1024]; - char domain[1024]; - CamelURL *url; - GList *l; - - /* set the default Name field */ - realname = g_get_real_name (); - if (realname) - e_utf8_gtk_entry_set_text (druid->full_name, realname); - - /* set the default E-Mail Address field */ + account->id = g_new0 (MailConfigIdentity, 1); + name = g_get_real_name (); + account->id->name = g_strdup (name); user = getenv ("USER"); - if (user && !gethostname (hostname, 1023)) { - char *address; - - memset (domain, 0, sizeof (domain)); - getdomainname (domain, 1023); - - address = g_strdup_printf ("%s@%s%s%s", user, hostname, is_domain (domain) ? "." : "", - is_domain (domain) ? domain : ""); - - gtk_entry_set_text (druid->email_address, address); - g_free (address); - } - - /* construct incoming/outgoing option menus */ - stores = gtk_menu_new (); - transports = gtk_menu_new (); - druid->providers = camel_session_list_providers (session, TRUE); - - /* get the default transport */ - default_xport = mail_config_get_default_transport (); - if (default_xport && default_xport->url) - url = camel_url_new (default_xport->url, NULL); - else - url = NULL; - - /* sort the providers, remote first */ - druid->providers = g_list_sort (druid->providers, (GCompareFunc) provider_compare); - - l = druid->providers; - while (l) { - CamelProvider *provider = l->data; - - if (strcmp (provider->domain, "mail")) { - l = l->next; - continue; - } - - if (provider->object_types[CAMEL_PROVIDER_STORE] && provider->flags & CAMEL_PROVIDER_IS_SOURCE) { - item = gtk_menu_item_new_with_label (provider->name); - gtk_object_set_data (GTK_OBJECT (item), "provider", provider); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (incoming_type_changed), - druid); - - gtk_menu_append (GTK_MENU (stores), item); - - gtk_widget_show (item); - - if (!fstore) { - fstore = item; - hstore = si; - } - - si++; - } - - if (provider->object_types[CAMEL_PROVIDER_TRANSPORT]) { - item = gtk_menu_item_new_with_label (provider->name); - gtk_object_set_data (GTK_OBJECT (item), "provider", provider); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (transport_type_changed), - druid); - - gtk_menu_append (GTK_MENU (transports), item); - - gtk_widget_show (item); - - if (!ftransport) { - ftransport = item; - htransport = ti; - } - - if (url && !g_strcasecmp (provider->protocol, url->protocol)) { - ftransport = item; - htransport = ti; - } - - ti++; - } - - l = l->next; - } - - /* add a "None" option to the stores menu */ - item = gtk_menu_item_new_with_label (_("None")); - gtk_object_set_data (GTK_OBJECT (item), "provider", NULL); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (incoming_type_changed), - druid); - - gtk_menu_append (GTK_MENU (stores), item); - - gtk_widget_show (item); - - if (!fstore) { - fstore = item; - hstore = si; - } - - /* set the menus on the optionmenus */ - gtk_option_menu_remove_menu (druid->incoming_type); - gtk_option_menu_set_menu (druid->incoming_type, stores); - gtk_option_menu_set_history (druid->incoming_type, hstore); - - gtk_option_menu_remove_menu (druid->outgoing_type); - gtk_option_menu_set_menu (druid->outgoing_type, transports); - gtk_option_menu_set_history (druid->outgoing_type, htransport); - - if (fstore) - gtk_signal_emit_by_name (GTK_OBJECT (fstore), "activate", druid); - - if (ftransport) - gtk_signal_emit_by_name (GTK_OBJECT (ftransport), "activate", druid); - - if (url) { - if (url->host) { - char *hostname; - - if (url->port) - hostname = g_strdup_printf ("%s:%d", url->host, url->port); - else - hostname = g_strdup (url->host); - - gtk_entry_set_text (druid->outgoing_hostname, hostname); - g_free (hostname); - } - camel_url_free (url); - } -} + if (user && !uname (&uts) && strchr (uts.nodename, '.')) + account->id->address = g_strdup_printf ("%s@%s", user, uts.nodename); -static gboolean -start_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data) -{ - return FALSE; + if (mail_config_get_default_transport ()) + account->transport = service_copy (mail_config_get_default_transport ()); + + return account; } static struct { @@ -1146,42 +382,32 @@ static struct { GtkSignalFunc back_func; GtkSignalFunc finish_func; } pages[] = { - { "druidStartPage", - GTK_SIGNAL_FUNC (start_next), - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, - { "druidIdentityPage", + { "identity_page", GTK_SIGNAL_FUNC (identity_next), GTK_SIGNAL_FUNC (identity_prepare), GTK_SIGNAL_FUNC (NULL), GTK_SIGNAL_FUNC (NULL) }, - { "druidSourcePage", - GTK_SIGNAL_FUNC (incoming_next), - GTK_SIGNAL_FUNC (incoming_prepare), + { "source_page", + GTK_SIGNAL_FUNC (source_next), + GTK_SIGNAL_FUNC (source_prepare), GTK_SIGNAL_FUNC (NULL), GTK_SIGNAL_FUNC (NULL) }, - { "druidSourceAuthPage", - GTK_SIGNAL_FUNC (source_auth_next), - GTK_SIGNAL_FUNC (source_auth_prepare), + { "extra_page", + GTK_SIGNAL_FUNC (NULL), + GTK_SIGNAL_FUNC (extra_prepare), GTK_SIGNAL_FUNC (NULL), GTK_SIGNAL_FUNC (NULL) }, - { "druidTransportPage", + { "transport_page", GTK_SIGNAL_FUNC (transport_next), GTK_SIGNAL_FUNC (transport_prepare), GTK_SIGNAL_FUNC (transport_back), GTK_SIGNAL_FUNC (NULL) }, - { "druidTransportAuthPage", - GTK_SIGNAL_FUNC (transport_auth_next), - GTK_SIGNAL_FUNC (transport_auth_prepare), + { "management_page", GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, - { "druidManagementPage", - GTK_SIGNAL_FUNC (management_next), GTK_SIGNAL_FUNC (management_prepare), - GTK_SIGNAL_FUNC (management_back), + GTK_SIGNAL_FUNC (NULL), GTK_SIGNAL_FUNC (NULL) }, - { "druidFinishPage", + { "finish_page", GTK_SIGNAL_FUNC (NULL), GTK_SIGNAL_FUNC (NULL), GTK_SIGNAL_FUNC (NULL), @@ -1196,33 +422,31 @@ static struct { static void construct (MailConfigDruid *druid) { - GladeXML *gui; - GtkWidget *widget; + GtkWidget *widget, *vbox; + MailConfigAccount *account; int i; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "mail-config-druid"); - druid->gui = gui; - - /* get our toplevel widget */ - widget = glade_xml_get_widget (gui, "druid"); - - /* reparent */ + + account = make_default_account (); + druid->gui = mail_account_gui_new (account); + + /* get our toplevel widget and reparent it */ + widget = glade_xml_get_widget (druid->gui->xml, "druid"); gtk_widget_reparent (widget, GTK_WIDGET (druid)); - + druid->druid = GNOME_DRUID (widget); - + /* set window title */ gtk_window_set_title (GTK_WINDOW (druid), _("Evolution Account Wizard")); - gtk_window_set_policy (GTK_WINDOW (druid), FALSE, TRUE, TRUE); + gtk_window_set_policy (GTK_WINDOW (druid), FALSE, TRUE, FALSE); gtk_window_set_modal (GTK_WINDOW (druid), TRUE); gtk_object_set (GTK_OBJECT (druid), "type", GTK_WINDOW_DIALOG, NULL); - + /* attach to druid page signals */ for (i = 0; pages[i].name != NULL; i++) { - GnomeDruidPage *page; - - page = GNOME_DRUID_PAGE (glade_xml_get_widget (gui, pages[i].name)); - + GtkWidget *page; + + page = glade_xml_get_widget (druid->gui->xml, pages[i].name); + if (pages[i].next_func) gtk_signal_connect (GTK_OBJECT (page), "next", pages[i].next_func, druid); @@ -1237,273 +461,65 @@ construct (MailConfigDruid *druid) pages[i].finish_func, druid); } gtk_signal_connect (GTK_OBJECT (druid->druid), "cancel", druid_cancel, druid); - - /* get our cared-about widgets */ - druid->account_text = glade_xml_get_widget (gui, "htmlAccountInfo"); - druid->account_name = GTK_ENTRY (glade_xml_get_widget (gui, "txtAccountName")); - gtk_signal_connect (GTK_OBJECT (druid->account_name), "changed", management_changed, druid); - druid->default_account = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkAccountDefault")); - - druid->identity_text = glade_xml_get_widget (gui, "htmlIdentity"); - druid->full_name = GTK_ENTRY (glade_xml_get_widget (gui, "txtFullName")); - gtk_signal_connect (GTK_OBJECT (druid->full_name), "changed", identity_changed, druid); - druid->email_address = GTK_ENTRY (glade_xml_get_widget (gui, "txtAddress")); - gtk_signal_connect (GTK_OBJECT (druid->email_address), "changed", identity_changed, druid); - druid->organization = GTK_ENTRY (glade_xml_get_widget (gui, "txtOrganization")); - druid->signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileSignature")); - - druid->incoming_text = glade_xml_get_widget (gui, "htmlIncoming"); - druid->incoming_type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuIncomingType")); - druid->incoming_hostname = GTK_ENTRY (glade_xml_get_widget (gui, "txtIncomingHostname")); - gtk_signal_connect (GTK_OBJECT (druid->incoming_hostname), "changed", incoming_changed, druid); - druid->incoming_username = GTK_ENTRY (glade_xml_get_widget (gui, "txtIncomingUsername")); - gtk_signal_connect (GTK_OBJECT (druid->incoming_username), "changed", incoming_changed, druid); - druid->incoming_path = GTK_ENTRY (glade_xml_get_widget (gui, "txtIncomingPath")); - gtk_signal_connect (GTK_OBJECT (druid->incoming_path), "changed", incoming_changed, druid); - druid->incoming_keep_mail = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkIncomingKeepMail")); - druid->incoming_auto_check = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkAutoCheck")); - gtk_signal_connect (GTK_OBJECT (druid->incoming_auto_check), "toggled", auto_check_toggled, druid); - druid->incoming_auto_check_min = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinAutoCheckMinutes")); - gtk_widget_set_sensitive (GTK_WIDGET (druid->incoming_auto_check_min), - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->incoming_auto_check))); - druid->incoming_check_settings = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkIncomingCheckSettings")); - - druid->have_source_auth_page = TRUE; - druid->source_auth_text = glade_xml_get_widget (gui, "htmlSourceAuthentication"); - druid->source_auth_type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuSourceAuthType")); - druid->source_password = GTK_ENTRY (glade_xml_get_widget (gui, "txtSourceAuthPasswd")); - gtk_signal_connect (GTK_OBJECT (druid->source_password), "changed", source_auth_changed, druid); - druid->save_source_password = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkSourceAuthSavePasswd")); - gtk_signal_connect (GTK_OBJECT (druid->save_source_password), "toggled", source_auth_changed, druid); - - druid->outgoing_text = glade_xml_get_widget (gui, "htmlTransport"); - druid->outgoing_type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuTransportType")); - druid->outgoing_hostname = GTK_ENTRY (glade_xml_get_widget (gui, "txtTransportHostname")); - gtk_signal_connect (GTK_OBJECT (druid->outgoing_hostname), "changed", transport_changed, druid); - druid->outgoing_requires_auth = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkTransportNeedsAuth")); - druid->outgoing_check_settings = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkOutgoingCheckSettings")); - - druid->have_transport_auth_page = FALSE; - druid->transport_auth_text = glade_xml_get_widget (gui, "htmlTransportAuthentication"); - druid->transport_auth_type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuTransportAuthType")); - druid->transport_username = GTK_ENTRY (glade_xml_get_widget (gui, "txtTransportAuthUsername")); - gtk_signal_connect (GTK_OBJECT (druid->transport_username), "changed", transport_auth_changed, druid); - druid->transport_password = GTK_ENTRY (glade_xml_get_widget (gui, "txtTransportAuthPasswd")); - gtk_signal_connect (GTK_OBJECT (druid->transport_password), "changed", transport_auth_changed, druid); - druid->save_transport_password = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkTransportAuthSavePasswd")); - gtk_signal_connect (GTK_OBJECT (druid->save_transport_password), "toggled", transport_auth_changed, druid); - - set_defaults (druid); - + + /* Fill in the druid pages */ + vbox = glade_xml_get_widget (druid->gui->xml, "druid_identity_vbox"); + widget = create_html ("identity_html"); + gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); + widget = glade_xml_get_widget (druid->gui->xml, "identity_required_frame"); + gtk_widget_reparent (widget, vbox); + gtk_box_set_child_packing (GTK_BOX (vbox), widget, FALSE, FALSE, 0, GTK_PACK_START); + widget = glade_xml_get_widget (druid->gui->xml, "identity_optional_frame"); + gtk_widget_reparent (widget, vbox); + gtk_box_set_child_packing (GTK_BOX (vbox), widget, FALSE, FALSE, 0, GTK_PACK_START); + + vbox = glade_xml_get_widget (druid->gui->xml, "druid_source_vbox"); + widget = create_html ("source_html"); + gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); + widget = glade_xml_get_widget (druid->gui->xml, "source_vbox"); + gtk_widget_reparent (widget, vbox); + + vbox = glade_xml_get_widget (druid->gui->xml, "druid_extra_vbox"); + widget = create_html ("extra_html"); + gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); + widget = glade_xml_get_widget (druid->gui->xml, "extra_vbox"); + gtk_widget_reparent (widget, vbox); + + vbox = glade_xml_get_widget (druid->gui->xml, "druid_transport_vbox"); + widget = create_html ("transport_html"); + gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); + widget = glade_xml_get_widget (druid->gui->xml, "transport_vbox"); + gtk_widget_reparent (widget, vbox); + + vbox = glade_xml_get_widget (druid->gui->xml, "druid_management_vbox"); + widget = create_html ("management_html"); + gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); + widget = glade_xml_get_widget (druid->gui->xml, "management_frame"); + gtk_widget_reparent (widget, vbox); + + /* set up signals, etc */ + gtk_signal_connect (GTK_OBJECT (druid->gui->account_name), "changed", management_changed, druid); + gtk_signal_connect (GTK_OBJECT (druid->gui->full_name), "changed", identity_changed, druid); + gtk_signal_connect (GTK_OBJECT (druid->gui->email_address), "changed", identity_changed, druid); + gtk_signal_connect (GTK_OBJECT (druid->gui->source.hostname), "changed", source_changed, druid); + gtk_signal_connect (GTK_OBJECT (druid->gui->source.username), "changed", source_changed, druid); + gtk_signal_connect (GTK_OBJECT (druid->gui->source.path), "changed", source_changed, druid); + gtk_signal_connect (GTK_OBJECT (druid->gui->transport.hostname), "changed", transport_changed, druid); + gtk_signal_connect (GTK_OBJECT (druid->gui->transport.username), "changed", transport_changed, druid); + gnome_druid_set_buttons_sensitive (druid->druid, FALSE, TRUE, TRUE); + + mail_account_gui_setup (druid->gui, GTK_WIDGET (druid)); } MailConfigDruid * mail_config_druid_new (GNOME_Evolution_Shell shell) { MailConfigDruid *new; - + new = (MailConfigDruid *) gtk_type_new (mail_config_druid_get_type ()); construct (new); new->shell = shell; - - return new; -} - -char * -mail_config_druid_get_account_name (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), NULL); - - return e_utf8_gtk_entry_get_text (druid->account_name); -} - - -gboolean -mail_config_druid_get_default_account (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), FALSE); - - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->default_account)); -} - - -char * -mail_config_druid_get_full_name (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), NULL); - - return e_utf8_gtk_entry_get_text (druid->full_name); -} - - -char * -mail_config_druid_get_email_address (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), NULL); - - return e_utf8_gtk_entry_get_text (druid->email_address); -} - - -char * -mail_config_druid_get_organization (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), NULL); - - return e_utf8_gtk_entry_get_text (druid->organization); -} - -char * -mail_config_druid_get_sigfile (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), NULL); - - return gnome_file_entry_get_full_path (druid->signature, TRUE); -} - - -char * -mail_config_druid_get_source_url (MailConfigDruid *druid) -{ - char *source_url, *host, *pport, *str; - const CamelProvider *provider; - gboolean show_passwd; - CamelURL *url; - int port = 0; - - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), NULL); - - provider = druid->source_provider; - if (!provider) - return NULL; - - url = g_new0 (CamelURL, 1); - url->protocol = g_strdup (provider->protocol); - - str = gtk_entry_get_text (druid->incoming_username); - url->user = str && *str ? g_strdup (str) : NULL; - - str = gtk_object_get_data (GTK_OBJECT (druid), "source_authmech"); - url->authmech = str && *str ? g_strdup (str) : NULL; - - str = gtk_entry_get_text (druid->source_password); - url->passwd = str && *str ? g_strdup (str) : NULL; - - host = g_strdup (gtk_entry_get_text (druid->incoming_hostname)); - if (host && (pport = strchr (host, ':'))) { - port = atoi (pport + 1); - *pport = '\0'; - } - url->host = host; - url->port = port; - url->path = g_strdup (gtk_entry_get_text (druid->incoming_path)); - - /* only 'show password' if we intend to save it */ - show_passwd = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->save_source_password)); - source_url = camel_url_to_string (url, show_passwd); - camel_url_free (url); - - return source_url; -} - - -gboolean -mail_config_druid_get_keep_mail_on_server (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), FALSE); - - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->incoming_keep_mail)); -} - - -gboolean -mail_config_druid_get_auto_check (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), FALSE); - - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->incoming_auto_check)); -} - - -gint -mail_config_druid_get_auto_check_minutes (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), 0); - - return gtk_spin_button_get_value_as_int (druid->incoming_auto_check_min); -} - -gboolean -mail_config_druid_get_save_source_password (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), FALSE); - - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->save_source_password)); -} - -char * -mail_config_druid_get_transport_url (MailConfigDruid *druid) -{ - char *transport_url, *host, *pport; - const CamelProvider *provider; - gboolean show_passwd; - CamelURL *url; - int port = 0; - - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), NULL); - - provider = druid->transport_provider; - if (!provider) - return NULL; - - url = g_new0 (CamelURL, 1); - url->protocol = g_strdup (provider->protocol); - - if (mail_config_druid_get_transport_requires_auth (druid)) { - char *str; - - str = gtk_object_get_data (GTK_OBJECT (druid), "transport_authmech"); - if (str && *str) { - url->authmech = g_strdup (str); - - str = gtk_entry_get_text (druid->transport_username); - url->user = str && *str ? g_strdup (str) : NULL; - - str = gtk_entry_get_text (druid->transport_password); - url->passwd = str && *str ? g_strdup (str) : NULL; - } - } - - host = g_strdup (gtk_entry_get_text (druid->outgoing_hostname)); - if (host && (pport = strchr (host, ':'))) { - port = atoi (pport + 1); - *pport = '\0'; - } - url->host = host; - url->port = port; - - /* only 'show password' if we intend to save it */ - show_passwd = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->save_transport_password)); - transport_url = camel_url_to_string (url, show_passwd); - camel_url_free (url); - - return transport_url; -} - -gboolean -mail_config_druid_get_save_transport_password (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), FALSE); - - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->save_transport_password)); -} - -gboolean -mail_config_druid_get_transport_requires_auth (MailConfigDruid *druid) -{ - g_return_val_if_fail (IS_MAIL_CONFIG_DRUID (druid), FALSE); - - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (druid->outgoing_requires_auth)); + return new; } diff --git a/mail/mail-config-druid.h b/mail/mail-config-druid.h index c8c492316e..cc37c5aaaa 100644 --- a/mail/mail-config-druid.h +++ b/mail/mail-config-druid.h @@ -32,74 +32,24 @@ extern "C" { #include #include #include "shell/Evolution.h" +#include "mail-account-gui.h" #define MAIL_CONFIG_DRUID_TYPE (mail_config_druid_get_type ()) #define MAIL_CONFIG_DRUID(o) (GTK_CHECK_CAST ((o), MAIL_CONFIG_DRUID_TYPE, MailConfigDruid)) #define MAIL_CONFIG_DRUID_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_CONFIG_DRUID_TYPE, MailConfigDruidClass)) -#define IS_MAIL_CONFIG_DRUID(o) (GTK_CHECK_TYPE ((o), MAIL_CONFIG_DRUID_TYPE)) -#define IS_MAIL_CONFIG_DRUID_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_CONFIG_DRUID_TYPE)) +#define MAIL_IS_CONFIG_DRUID(o) (GTK_CHECK_TYPE ((o), MAIL_CONFIG_DRUID_TYPE)) +#define MAIL_IS_CONFIG_DRUID_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_CONFIG_DRUID_TYPE)) -struct _MailConfigDruid { +typedef struct { GtkWindow parent; - GNOME_Evolution_Shell shell; - - GladeXML *gui; - - GList *providers; - GnomeDruid *druid; - - /* account management */ - GtkWidget *account_text; - GtkEntry *account_name; - GtkCheckButton *default_account; - - /* identity */ - GtkWidget *identity_text; - GtkEntry *full_name; - GtkEntry *email_address; - GtkEntry *organization; - GnomeFileEntry *signature; - - /* incoming mail */ - GtkWidget *incoming_text; - GtkOptionMenu *incoming_type; - GtkEntry *incoming_hostname; - GtkEntry *incoming_username; - GtkEntry *incoming_path; - GtkCheckButton *incoming_keep_mail; - GtkCheckButton *incoming_auto_check; - GtkSpinButton *incoming_auto_check_min; - GtkCheckButton *incoming_check_settings; - - /* source authentication */ - gboolean have_source_auth_page; - GtkWidget *source_auth_text; - GtkOptionMenu *source_auth_type; - GtkEntry *source_password; - GtkCheckButton *save_source_password; - - /* outgoing mail */ - GtkWidget *outgoing_text; - GtkOptionMenu *outgoing_type; - GtkEntry *outgoing_hostname; - GtkCheckButton *outgoing_requires_auth; - GtkCheckButton *outgoing_check_settings; - - /* transport authentication */ - gboolean have_transport_auth_page; - GtkWidget *transport_auth_text; - GtkOptionMenu *transport_auth_type; - GtkEntry *transport_username; - GtkEntry *transport_password; - GtkCheckButton *save_transport_password; - - const CamelProvider *source_provider; - const CamelProvider *transport_provider; -}; + MailAccountGui *gui; -typedef struct _MailConfigDruid MailConfigDruid; + GNOME_Evolution_Shell shell; + gboolean identity_copied; + CamelProvider *last_source; +} MailConfigDruid; typedef struct { GtkWindowClass parent_class; @@ -115,13 +65,8 @@ MailConfigDruid *mail_config_druid_new (GNOME_Evolution_Shell shell); char *mail_config_druid_get_account_name (MailConfigDruid *druid); gboolean mail_config_druid_get_default_account (MailConfigDruid *druid); -char *mail_config_druid_get_full_name (MailConfigDruid *druid); -char *mail_config_druid_get_email_address (MailConfigDruid *druid); -char *mail_config_druid_get_reply_to (MailConfigDruid *druid); -char *mail_config_druid_get_organization (MailConfigDruid *druid); -char *mail_config_druid_get_sigfile (MailConfigDruid *druid); - char *mail_config_druid_get_source_url (MailConfigDruid *druid); + gboolean mail_config_druid_get_keep_mail_on_server (MailConfigDruid *druid); gboolean mail_config_druid_get_save_source_password (MailConfigDruid *druid); gboolean mail_config_druid_get_auto_check (MailConfigDruid *druid); diff --git a/mail/mail-config.c b/mail/mail-config.c index a4748e35e5..41b1b482bf 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -69,7 +69,6 @@ identity_copy (const MailConfigIdentity *id) new = g_new0 (MailConfigIdentity, 1); new->name = g_strdup (id->name); new->address = g_strdup (id->address); - new->reply_to = g_strdup (id->reply_to); new->organization = g_strdup (id->organization); new->signature = g_strdup (id->signature); @@ -84,7 +83,6 @@ identity_destroy (MailConfigIdentity *id) g_free (id->name); g_free (id->address); - g_free (id->reply_to); g_free (id->organization); g_free (id->signature); @@ -238,9 +236,6 @@ config_read (void) path = g_strdup_printf ("identity_name_%d", i); id->name = gnome_config_get_string (path); g_free (path); - path = g_strdup_printf ("identity_replyto_%d", i); - id->reply_to = gnome_config_get_string (path); - g_free (path); path = g_strdup_printf ("identity_address_%d", i); id->address = gnome_config_get_string (path); g_free (path); @@ -309,6 +304,7 @@ config_read (void) } gnome_config_pop_prefix (); +#ifdef ENABLE_NNTP /* News */ str = g_strdup_printf ("=%s/config/News=/Sources/", evolution_dir); gnome_config_push_prefix (str); @@ -328,6 +324,7 @@ config_read (void) config->news = g_slist_append (config->news, n); } gnome_config_pop_prefix (); +#endif /* Format */ str = g_strdup_printf ("=%s/config/Mail=/Format/send_html", @@ -472,6 +469,7 @@ mail_config_write (void) } gnome_config_pop_prefix (); +#ifdef ENABLE_NNTP /* News */ str = g_strdup_printf ("=%s/config/News=/Sources/", evolution_dir); gnome_config_push_prefix (str); @@ -490,6 +488,7 @@ mail_config_write (void) g_free (path); } gnome_config_pop_prefix (); +#endif gnome_config_sync (); } @@ -880,9 +879,8 @@ mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix) struct _check_msg { struct _mail_msg msg; - char *url; + const char *url; CamelProviderType type; - gboolean connect; GList **authtypes; gboolean *success; }; @@ -891,66 +889,49 @@ static void check_service_check(struct _mail_msg *mm) { struct _check_msg *m = (struct _check_msg *)mm; CamelService *service = NULL; - - if (m->authtypes) { - service = camel_session_get_service (session, m->url, m->type, &mm->ex); - if (!service) - return; - if (m->connect) - *m->authtypes = camel_service_query_auth_types (service, &mm->ex); - else - *m->authtypes = g_list_copy (service->provider->authtypes); - } else if (m->connect) { - service = camel_session_get_service_connected (session, m->url, m->type, &mm->ex); - } - if (service) - camel_object_unref (CAMEL_OBJECT (service)); - *m->success = !camel_exception_is_set(&mm->ex); -} + service = camel_session_get_service (session, m->url, m->type, &mm->ex); + if (!service) + return; -static void check_service_free(struct _mail_msg *mm) -{ - struct _check_msg *m = (struct _check_msg *)mm; + if (m->authtypes) + *m->authtypes = camel_service_query_auth_types (service, &mm->ex); + else + camel_service_connect (service, &mm->ex); - g_free(m->url); + camel_object_unref (CAMEL_OBJECT (service)); + *m->success = !camel_exception_is_set(&mm->ex); } static struct _mail_msg_op check_service_op = { NULL, check_service_check, NULL, - check_service_free + NULL }; /** * mail_config_check_service: * @url: service url * @type: provider type - * @connect: whether or not the check service should connect - * @authtypes: list of auth types gathered by this method - * - * Checks the service for validity. If @connect is TRUE then a - * connection with the server is attempted and if successful will fill - * in the @authtypes list. If @connect is FALSE then @authtypes will - * be generated without a connection and thus will not necessarily - * reflect what the server supports. + * @authtypes: set to list of supported authtypes on return if non-%NULL. * - * Returns TRUE on success or FALSE on error. + * 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 (CamelURL *url, CamelProviderType type, gboolean connect, GList **authtypes) +mail_config_check_service (const char *url, CamelProviderType type, GList **authtypes) { gboolean ret = FALSE; struct _check_msg *m; int id; m = mail_msg_new(&check_service_op, NULL, sizeof(*m)); - m->url = camel_url_to_string(url, TRUE); + m->url = url; m->type = type; - m->connect = connect; m->authtypes = authtypes; m->success = &ret; diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 53fa0649b4..efd09518e4 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -6,7 +6,7 @@ config src - pixmaps + ../art C True True @@ -17,66 +17,46 @@ GtkWindow - mail-config-druid + druid_window False - Mail Configuration Druid + window1 GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER - True - 450 - 350 + GTK_WIN_POS_NONE + False False True - True + False GnomeDruid druid - - cancel - druid_cancel - Thu, 09 Nov 2000 21:35:32 GMT - GnomeDruidPageStart - druidStartPage + druidpagestart1 Mail Configuration Welcome to the Evolution Mail Configuration Druid. Click "Next" to begin. 255,255,255 0,0,0 - 25,25,112 - 25,25,112 + 0,0,0 + 0,0,0 255,255,255 - fetch-mail.png GnomeDruidPageStandard - druidIdentityPage - - prepare - identity_prepare - Tue, 07 Nov 2000 21:08:00 GMT - - - next - identity_next - Tue, 07 Nov 2000 21:08:07 GMT - + identity_page Identity 255,255,255 - 25,25,112 - 25,25,112 - malehead.png + 0,0,0 + 0,0,0 GtkVBox GnomeDruidPageStandard:vbox - druid-vbox1 - 5 + druid_identity_vbox False 0 @@ -86,332 +66,23 @@ Click "Next" to begin. - GtkVBox - vbox4 - False - 0 - - 0 - True - True - - - - Custom - htmlIdentity - mail_config_create_html - 0 - 0 - Thu, 02 Nov 2000 17:26:09 GMT - - 0 - False - True - - - - - GtkFrame - identity-required-frame - 3 - 76 - - 0 - GTK_SHADOW_ETCHED_IN - - 5 - False - True - - - - GtkTable - table1 - 4 - 2 - 2 - False - 4 - 4 - - - GtkEntry - txtFullName - 80 - 20 - True - True - True - True - 50 - - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - txtAddress - True - True - True - 50 - - - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - identity-address-label - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - identity-name-label - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - - - GtkVBox - vbox5 - False - 0 - - 0 - False - True - - - - GtkFrame - identity-optional-frame - 3 - 102 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkTable - table2 - 4 - 2 - 2 - False - 4 - 4 - - - GtkLabel - identity-organization-label - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - False - False - - - - - GtkLabel - identity-signature-label - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - False - False - - - - - GtkEntry - txtOrganization - True - True - True - 0 - - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GnomeFileEntry - fileSignature - 10 - False - False - - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - GtkEntry - GnomeEntry:entry - identity-signature-entry - True - True - True - 0 - - - - - - + Placeholder GnomeDruidPageStandard - druidSourcePage - - prepare - incoming_prepare - Wed, 03 Jan 2001 19:22:09 GMT - - - next - incoming_next - Wed, 03 Jan 2001 19:22:16 GMT - + source_page Receiving Email 255,255,255 - 25,25,112 - 25,25,112 - evolution-inbox.png + 0,0,0 + 0,0,0 GtkVBox GnomeDruidPageStandard:vbox - druid-vbox2 + druid_source_vbox False 0 @@ -421,401 +92,23 @@ Click "Next" to begin. - GtkVBox - vbox6 - 5 - False - 0 - - 0 - True - True - - - - Custom - htmlIncoming - mail_config_create_html - 0 - 0 - Thu, 02 Nov 2000 17:27:42 GMT - - 0 - True - True - - - - - GtkTable - table3 - 4 - 1 - 2 - False - 4 - 2 - - 4 - False - True - - - - GtkLabel - source-type-label - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 2 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkOptionMenu - omenuIncomingType - True - - 0 - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - - GtkFrame - source-frame - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkVBox - vbox7 - False - 0 - - - GtkTable - table4 - 4 - 3 - 2 - False - 4 - 4 - - 4 - False - True - - - - GtkLabel - lblSourceHost - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - lblSourceUser - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - txtIncomingHostname - True - True - True - 0 - - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - txtIncomingUsername - True - True - True - 0 - - - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - txtIncomingPath - True - True - True - 0 - - - 1 - 2 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - lblSourcePath - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 0 - 0 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - - GtkCheckButton - chkIncomingKeepMail - True - - False - True - - 0 - False - False - - - - - GtkHBox - hbox39 - False - 0 - - 0 - False - False - - - - GtkCheckButton - chkAutoCheck - True - - False - True - - 0 - False - False - - - - - GtkSpinButton - spinAutoCheckMinutes - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - False - False - 10 - 0 - 1440 - 1 - 10 - 10 - - 2 - False - True - - - - - GtkLabel - lblMinutes - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - - GtkCheckButton - chkIncomingCheckSettings - True - - True - True - - 0 - False - False - - - - + Placeholder GnomeDruidPageStandard - druidSourceAuthPage - - prepare - source_auth_prepare - Tue, 06 Mar 2001 21:58:17 GMT - - - next - source_auth_next - Tue, 06 Mar 2001 21:58:08 GMT - - Authentication + extra_page + Receiving Email 255,255,255 - 25,25,112 - 25,25,112 - registration.png + 0,0,0 + 0,0,0 GtkVBox GnomeDruidPageStandard:vbox - druid-vbox3 + druid_extra_vbox False 0 @@ -825,201 +118,23 @@ Click "Next" to begin. - GtkVBox - vboxSourceAuth - 6 - False - 0 - - 0 - True - True - - - - Custom - htmlSourceAuthentication - mail_config_create_html - 0 - 0 - Thu, 02 Nov 2000 17:31:34 GMT - - 0 - True - True - - - - - GtkFrame - authentication-frame - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkVBox - vbox9 - False - 0 - - - GtkHBox - hbox25 - 4 - False - 4 - - 0 - False - True - - - - GtkLabel - lblSourceAuthType - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 0 - 0 - - 0 - False - True - - - - - GtkOptionMenu - omenuSourceAuthType - True - - 0 - - 0 - True - True - - - - - - GtkTable - authentication-password-table - 4 - 1 - 2 - False - 4 - 4 - - 0 - False - True - - - - GtkEntry - txtSourceAuthPasswd - True - True - False - 0 - - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - lblSourcePasswd - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - - GtkCheckButton - chkSourceAuthSavePasswd - 4 - True - - False - True - - 0 - False - False - - - - + Placeholder GnomeDruidPageStandard - druidTransportPage - - prepare - transport_prepare - Thu, 09 Nov 2000 19:21:41 GMT - - - next - transport_next - Thu, 09 Nov 2000 19:21:51 GMT - + transport_page Sending Email 255,255,255 - 25,25,112 - 25,25,112 - send.png + 0,0,0 + 0,0,0 GtkVBox GnomeDruidPageStandard:vbox - druid-vbox4 + druid_transport_vbox False 0 @@ -1029,249 +144,23 @@ Click "Next" to begin. - GtkVBox - vbox10 - False - 0 - - 0 - True - True - - - - GtkVBox - vbox11 - 5 - False - 0 - - 0 - True - True - - - - Custom - htmlTransport - mail_config_create_html - 0 - 0 - Thu, 02 Nov 2000 17:37:47 GMT - - 0 - True - True - - - - - GtkTable - table5 - 4 - 1 - 2 - False - 4 - 2 - - 4 - False - True - - - - GtkLabel - transport-type-label - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 2 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkOptionMenu - omenuTransportType - True - - 0 - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - - GtkFrame - transport-frame - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkVBox - vbox12 - False - 0 - - - GtkTable - table6 - 4 - 1 - 2 - False - 4 - 4 - - 4 - False - True - - - - GtkLabel - lblTransportHost - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - txtTransportHostname - True - True - True - 0 - - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - - GtkCheckButton - chkTransportNeedsAuth - 3 - True - - False - True - - 0 - False - False - - - - - GtkCheckButton - chkOutgoingCheckSettings - 3 - True - - True - True - - 0 - False - False - - - - - + Placeholder GnomeDruidPageStandard - druidTransportAuthPage - - prepare - transport_auth_prepare - Tue, 07 Nov 2000 22:31:02 GMT - - - next - transport_auth_next - Tue, 07 Nov 2000 22:31:08 GMT - - Transport Authentication + management_page + Account Management 255,255,255 - 25,25,112 - 25,25,112 - registration.png + 0,0,0 + 0,0,0 GtkVBox GnomeDruidPageStandard:vbox - druid-vbox4 + druid_management_vbox False 0 @@ -1281,387 +170,14 @@ Click "Next" to begin. - GtkVBox - vboxTransportAuth - 6 - False - 0 - - 0 - True - True - - - - Custom - htmlTransportAuthentication - mail_config_create_html - 0 - 0 - Thu, 02 Nov 2000 17:31:34 GMT - - 0 - True - True - - - - - GtkFrame - frmTransportAuth - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkVBox - vbox9 - False - 0 - - - GtkHBox - hbox25 - 4 - False - 4 - - 0 - False - True - - - - GtkLabel - lblTransportAuthType - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 0 - 0 - - 0 - False - True - - - - - GtkOptionMenu - omenuTransportAuthType - True - - 0 - - 0 - True - True - - - - - - GtkTable - tableTransportAuth - 4 - 2 - 2 - False - 4 - 4 - - 0 - False - True - - - - GtkLabel - lblTransportUsername - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - txtTransportAuthUsername - True - True - False - 0 - - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - lblTransportPasswd - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - txtTransportAuthPasswd - True - True - False - 0 - - - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - - GtkCheckButton - chkTransportAuthSavePasswd - 4 - True - - False - True - - 0 - False - False - - - - - - - - - - GnomeDruidPageStandard - druidManagementPage - - prepare - management_prepare - Thu, 09 Nov 2000 19:22:01 GMT - - - next - management_next - Thu, 09 Nov 2000 21:46:21 GMT - - Account Management - 255,255,255 - 25,25,112 - 25,25,112 - evolution-tasks.png - - - GtkVBox - GnomeDruidPageStandard:vbox - druid-vbox5 - False - 0 - - 0 - True - True - - - - GtkVBox - vbox29 - 5 - False - 0 - - 0 - True - True - - - - Custom - htmlAccountInfo - mail_config_create_html - 0 - 0 - Thu, 02 Nov 2000 17:38:22 GMT - - 0 - True - True - - - - - GtkFrame - management-frame - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkVBox - vbox31 - False - 0 - - - GtkHBox - hbox24 - 3 - False - 5 - - 0 - False - True - - - - GtkLabel - management-name-label - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkEntry - txtAccountName - True - True - True - 0 - - - 0 - True - True - - - - - GtkCheckButton - chkAccountDefault - True - - False - True - - 0 - False - False - - - - - - GtkLabel - - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - + Placeholder GnomeDruidPageFinish - druidFinishPage + finish_page Done Congratulations, your mail configuration is complete. @@ -1669,655 +185,836 @@ You are now ready to send and receive email using Evolution. Click "Finish" to save your settings. - 25,25,112 - 25,25,112 + 0,0,0 + 0,0,0 255,255,255 0,0,0 255,255,255 - house.png - GnomeDialog - mail-accounts-dialog + GtkWindow + account_editor_window False - Evolution Mail Configuration + window1 GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER + GTK_WIN_POS_NONE False - 350 - 240 False True - True - False - False + False - GtkVBox - GnomeDialog:vbox - vbox37 - False - 8 - - 4 - True - True - - - - GtkHButtonBox - GnomeDialog:action_area - hbuttonbox2 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - cmdOK - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - cmdCancel - True - True - GNOME_STOCK_BUTTON_CANCEL - - + GtkNotebook + account_editor_notebook + True + True + True + GTK_POS_TOP + False + 2 + 2 + False - GtkNotebook - notebook - True - True - True - GTK_POS_TOP - False - 2 - 2 - False - - 0 - True - True - + GtkVBox + identity_vbox + 4 + False + 4 - GtkHBox - hbox36 - False - 0 + GtkFrame + management_frame + 3 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + True + - GtkScrolledWindow - scrolledwindow1 - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - True - True - + GtkVBox + vbox31 + False + 0 - GtkCList - clistAccounts - True - 2 - 150,80 - GTK_SELECTION_SINGLE - True - GTK_SHADOW_IN + GtkHBox + hbox24 + 3 + False + 5 + + 0 + False + True + GtkLabel - CList:title - lblAccount - + management_name_label + GTK_JUSTIFY_CENTER False 0.5 0.5 0 0 + + 0 + False + False + - GtkLabel - CList:title - lblType - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 + GtkEntry + management_name + True + True + True + 0 + + + 0 + True + True + + + + GtkCheckButton + management_default + True + + False + True + + 0 + False + False + + + + + + GtkFrame + identity_required_frame + 3 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + True + - GtkVButtonBox - vbuttonbox1 - GTK_BUTTONBOX_START - 0 - 85 - 27 - 7 - 0 - - 0 - False - False - + GtkTable + table1 + 4 + 2 + 2 + False + 4 + 4 - GtkButton - cmdMailAdd - True + GtkEntry + identity_full_name + 80 + 20 True - - GTK_RELIEF_NORMAL + True + True + True + 50 + + + 1 + 2 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + - GtkButton - cmdMailEdit - True + GtkEntry + identity_address True - - GTK_RELIEF_NORMAL + True + True + 50 + + + 1 + 2 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + - GtkButton - cmdMailDelete - True - True - - GTK_RELIEF_NORMAL + GtkLabel + identity_address_label + + GTK_JUSTIFY_RIGHT + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + - GtkButton - cmdMailDefault - True - True - - GTK_RELIEF_NORMAL + GtkLabel + identity_full_name_label + + GTK_JUSTIFY_RIGHT + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + - GtkLabel - Notebook:tab - lblMail - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkHBox - hbox37 - False - 0 + GtkFrame + identity_optional_frame + 3 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + True + - GtkScrolledWindow - scrolledwindow2 - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - True - True - + GtkTable + table2 + 4 + 2 + 2 + False + 4 + 4 - GtkCList - clistNews + GtkEntry + identity_organization True - 1 - 80 - GTK_SELECTION_SINGLE - True - GTK_SHADOW_IN - - - GtkLabel - CList:title - lblSources - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 + True + True + 0 + + + 1 + 2 + 0 + 1 0 0 - + True + False + False + False + True + False + - - - - GtkVButtonBox - vbuttonbox2 - GTK_BUTTONBOX_START - 0 - 85 - 27 - 7 - 0 - - 0 - False - False - - GtkButton - cmdNewsAdd - True - True - - GTK_RELIEF_NORMAL + GnomeFileEntry + identity_signature + 10 + False + False + + 1 + 2 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + + + GtkEntry + GnomeEntry:entry + identity_signature_entry + True + True + True + 0 + + - GtkButton - cmdNewsEdit - True - True - - GTK_RELIEF_NORMAL + GtkLabel + identity_signature_label + + GTK_JUSTIFY_RIGHT + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + - GtkButton - cmdNewsDelete - True - True - - GTK_RELIEF_NORMAL + GtkLabel + identity_organization_label + + GTK_JUSTIFY_RIGHT + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + - - GtkLabel - Notebook:tab - lblNews - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - + + GtkLabel + Notebook:tab + label31 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkVBox + source_vbox + False + 0 - GtkVBox - vbox38 + GtkTable + table3 + 3 + 1 + 2 False - 4 + 0 + 2 + + 0 + False + False + - GtkCheckButton - chkSendHTML - True - - False - True + GtkLabel + source_type_label + + GTK_JUSTIFY_RIGHT + False + 1 + 0.5 + 2 + 0 - 0 - False - False + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False - GtkHBox - hbox42 - False - 0 + GtkOptionMenu + source_type_omenu + True + POP +IMAPv4 +Standard Unix mbox +Qmail maildir +None + + 0 - 0 - False - True + 1 + 2 + 0 + 1 + 0 + 0 + False + False + False + False + False + False + + - - GtkCheckButton - chckHighlightCitations - True - - False - True - - 0 - False - False - - + + GtkFrame + source_frame + 3 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + False + - - GnomeColorPicker - colorpickerCitations - True - True - False - Pick a color - - 0 - False - False - - + + GtkTable + table4 + 3 + 4 + 2 + False + 3 + 3 GtkLabel - label1 - - GTK_JUSTIFY_CENTER + source_host_label + + GTK_JUSTIFY_RIGHT False - 0.5 + 1 0.5 0 0 - 0 - False - False + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False - - - - GtkHBox - hbox38 - False - 0 - - 0 - False - True - GtkLabel - lblMarkAsRead - - GTK_JUSTIFY_CENTER + source_user_label + + GTK_JUSTIFY_RIGHT False - 0.5 + 1 0.5 - 4 + 0 0 - 0 - False - False + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False - GtkSpinButton - spinMarkTimeout + GtkEntry + source_host True - 1 - 1 - True - GTK_UPDATE_IF_VALID - False - False - 1.5 - 0 - 10 - 0.1 - 1 - 1 + True + True + 0 + - 0 - False - True + 1 + 2 + 0 + 1 + 0 + 0 + True + False + False + False + True + False - GtkLabel - lblSeconds - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 4 - 0 + GtkEntry + source_user + True + True + True + 0 + - 0 - False - False + 1 + 2 + 1 + 2 + 0 + 0 + True + False + False + False + True + False - - - GtkHBox - hbox41 - False - 0 - - 0 - False - True - + + GtkEntry + source_path + True + True + True + 0 + + + 1 + 2 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + + GtkLabel - lblPgpPath - - GTK_JUSTIFY_CENTER + source_path_label + + GTK_JUSTIFY_RIGHT False - 0.5 + 1 0.5 - 4 + 0 0 - 0 - False - False + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False - GnomeFileEntry - filePgpPath - 10 - Select PGP binary - False - True + GtkCheckButton + source_use_ssl + True + + False + True - 4 - True - True + 0 + 2 + 3 + 4 + 0 + 0 + False + False + False + False + True + False - - - GtkEntry - GnomeEntry:entry - combo-entry1 - True - True - True - 0 - - - GtkLabel - Notebook:tab - lblOther - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - + GtkFrame + source_auth_frame + 3 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + False + - - GnomeDialog - mail-account-editor - False - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - True - True - True - False - False + + GtkVBox + vbox60 + 3 + False + 0 - - GtkVBox - GnomeDialog:vbox - dialog-vbox4 - False - 8 - - 4 - True - True - + + GtkHBox + hbox44 + False + 3 + + 0 + True + True + - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area4 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - + + GtkLabel + source_auth_label + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + - - GtkButton - button1 - True - True - GNOME_STOCK_BUTTON_OK - + + GtkOptionMenu + source_auth_omenu + True + Password +Kerberos + + 0 + + 0 + False + False + + - - GtkButton - button2 - True - True - GNOME_STOCK_BUTTON_APPLY - + + GtkAlignment + alignment1 + 1 + 0.5 + 1 + 1 + + 0 + False + False + GTK_PACK_END + - - GtkButton - button3 - True - True - GNOME_STOCK_BUTTON_CANCEL + + GtkButton + source_check_supported + True + + GTK_RELIEF_NORMAL + + + + + + GtkCheckButton + source_remember_password + True + + False + True + + 0 + False + False + + + - GtkNotebook - toplevel - True - True - True - GTK_POS_TOP - False - 2 - 2 - False - - 0 - True - True - + GtkLabel + Notebook:tab + label32 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkVBox + extra_vbox + 4 + False + 0 - GtkVBox - vboxGeneral - False - 0 + GtkFrame + extra_mailcheck_frame + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + True + - GtkFrame - frameMailAccount + GtkVBox + extra_mailcheck_vbox 4 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - + False + 0 - GtkVBox - vboxMailAccount + GtkHBox + hbox53 False 0 + + 0 + False + True + - GtkLabel - labelDirections - - GTK_JUSTIFY_LEFT - True - 0.5 - 0.5 - 0 - 4 + GtkCheckButton + extra_auto_check + True + + False + True 0 False @@ -2326,52 +1023,175 @@ Click "Finish" to save your settings. - GtkEntry - txtAccountName + GtkSpinButton + extra_auto_check_min True - True - True - 0 - + 1 + 0 + True + GTK_UPDATE_ALWAYS + False + False + 10 + 1 + 1440 + 1 + 10 + 10 + + 0 + False + True + + + + + GtkLabel + label36 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 - 2 + 0 False False + + + + + GtkLabel + Notebook:tab + label33 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkVBox + transport_vbox + False + 0 + + + GtkTable + table5 + 3 + 1 + 2 + False + 0 + 2 + + 0 + False + True + + + + GtkLabel + transport_type_label + + GTK_JUSTIFY_RIGHT + False + 1 + 0.5 + 2 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + - GtkFrame - frameIdentity - 4 - - 0 - GTK_SHADOW_ETCHED_IN + GtkOptionMenu + transport_type_omenu + True + SMTP +Sendmail + + 0 - 0 - True - True + 1 + 2 + 0 + 1 + 0 + 0 + False + False + False + False + False + False + + + + + GtkFrame + transport_frame + 3 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + True + + + + GtkVBox + vbox12 + 3 + False + 0 GtkTable - tableIdentity - 4 - 5 + table6 + 1 2 False 4 4 + + 4 + False + True + GtkLabel - lblName - - GTK_JUSTIFY_CENTER + transport_host_label + + GTK_JUSTIFY_RIGHT False - 0 + 1 0.5 0 0 @@ -2392,23 +1212,21 @@ Click "Finish" to save your settings. - GtkLabel - lblEmailAddress - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 + GtkEntry + transport_host + True + True + True + 0 + - 0 - 1 - 1 - 2 + 1 + 2 + 0 + 1 0 0 - False + True False False False @@ -2416,959 +1234,817 @@ Click "Finish" to save your settings. False + - - GtkLabel - lblReplyTo - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - + + GtkCheckButton + transport_use_ssl + True + + False + True + + 0 + False + False + + - - GtkLabel - lblOrganization - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 3 - 4 - 0 - 0 - False - False - False - False - True - False - - + + GtkCheckButton + transport_needs_auth + True + + False + True + + 0 + False + False + + + + + + + GtkFrame + transport_auth_frame + 3 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + True + + + + GtkVBox + vbox61 + 3 + False + 4 + + + GtkHBox + hbox49 + False + 3 + + 0 + False + True + GtkLabel - lblSignature - + transport_auth_label + GTK_JUSTIFY_CENTER False - 0 + 0.5 0.5 0 0 - 0 - 1 - 4 - 5 - 0 - 0 - False - False - False - False - True - False + 0 + False + False - GtkEntry - txtName + GtkOptionMenu + transport_auth_omenu True - True - True - 0 - + Password +Kerberos + + 0 - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False + 0 + False + False - GtkEntry - txtAddress - True - True - True - 0 - + GtkAlignment + alignment2 + 1 + 0.5 + 1 + 1 - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False + 0 + False + False + GTK_PACK_END + + + GtkButton + transport_check_supported + True + + GTK_RELIEF_NORMAL + + + + + GtkHBox + hbox52 + False + 4 + + 0 + False + False + - GtkEntry - txtReplyTo - True - True - True - 0 - + GtkLabel + transport_user_label + + GTK_JUSTIFY_RIGHT + False + 1 + 0.5 + 0 + 0 - 1 - 2 - 2 - 3 - 0 - 0 - True - False - False - False - True - False + 0 + False + False GtkEntry - txtOrganization + transport_user True True True 0 - 1 - 2 - 3 - 4 - 0 - 0 - True - False - False - False - True - False + 0 + True + True + - - GnomeFileEntry - fileSignature - 10 - Select signature file - False - True - - 1 - 2 - 4 - 5 - 0 - 0 - True - False - False - False - True - False - - - - GtkEntry - GnomeEntry:entry - txtSignature - True - True - True - 0 - - - + + GtkCheckButton + transport_remember_password + True + + False + True + + 0 + False + False + + - - GtkLabel - Notebook:tab - lblGeneral - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - + + GtkLabel + Notebook:tab + label34 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkVBox + folders_vbox + False + 0 - GtkTable - tableSource - 4 - 7 - 2 - False - 4 - 4 + GtkFrame + folders_frame + 3 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + True + - GtkLabel - lblIncomingServerType - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - + GtkTable + table7 + 3 + 2 + 2 + False + 4 + 4 - - GtkLabel - lblSourceHost - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 + + GtkLabel + drafts_label + + GTK_JUSTIFY_RIGHT + False + 1 + 0.5 0 0 - False - False - False - False - True - False - - + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + - - GtkEntry - txtSourceHost - True - True - True - 0 - - - 1 - 2 - 1 - 2 + + GtkLabel + sent_label + + GTK_JUSTIFY_RIGHT + False + 1 + 0.5 0 0 - True - False - False - False - True - False - - + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + - - GtkLabel - lblSourceUser - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 3 - 4 - 0 - 0 - False - False - False - False - True - False - + + GtkButton + sent_button + True + + GTK_RELIEF_NORMAL + + 1 + 2 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + + + + GtkButton + drafts_button + True + + GTK_RELIEF_NORMAL + + 1 + 2 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + + + + + + + GtkLabel + Notebook:tab + label35 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + + GtkWindow + mail_accounts_window + False + window1 + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + + + GtkNotebook + notebook + True + True + True + GTK_POS_TOP + False + 2 + 2 + False + + + GtkHBox + hbox54 + False + 0 + + + GtkScrolledWindow + scrolledwindow1 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + - GtkEntry - txtSourceUser + GtkCList + clistAccounts True - True - True - 0 - - - 1 - 2 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - - + 3 + 20,150,80 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_IN - - GtkLabel - lblSourcePasswd - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 4 - 5 + + GtkLabel + CList:title + lblEnable + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 0 0 - False - False - False - False - True - False - - + - - GtkEntry - txtSourcePasswd - True - True - False - 0 - - - 1 - 2 - 4 - 5 + + GtkLabel + CList:title + lblAccount + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 0 0 - True - False - False - False - True - False - - + - - GtkCheckButton - chkSourceSavePasswd - True - - False - True - - 1 - 2 - 5 - 6 + + GtkLabel + CList:title + lblType + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 0 0 - False - False - False - False - True - False - + + + + + GtkVBox + vbox62 + False + 0 + + 0 + False + True + - GtkLabel - lblSourcePath - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 + GtkVButtonBox + vbuttonbox1 + GTK_BUTTONBOX_START + 0 + 85 + 27 + 7 + 0 - 0 - 1 - 6 - 7 - 0 - 0 - False - False - False - False - True - False + 0 + True + True + + + GtkButton + cmdMailAdd + True + True + + GTK_RELIEF_NORMAL + + + + GtkButton + cmdMailEdit + True + True + + GTK_RELIEF_NORMAL + + + + GtkButton + cmdMailDelete + True + True + + GTK_RELIEF_NORMAL + - GtkEntry - txtSourcePath - True - True - True - 0 - + GtkHSeparator + hseparator1 - 1 - 2 - 6 - 7 - 0 - 0 - True - False - False - False - True - False + 0 + True + True - GtkLabel - lblSourceAuth - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 + GtkVButtonBox + vbuttonbox3 + GTK_BUTTONBOX_END + 0 + 85 + 27 + 7 + 0 - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - False + 0 + True + True + + + GtkButton + cmdMailDefault + True + True + + GTK_RELIEF_NORMAL + + + + GtkButton + cmdMailAble + True + True + + GTK_RELIEF_NORMAL + + + + + + GtkLabel + Notebook:tab + accounts_config_label + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkHBox + hbox37 + False + 0 + + + GtkScrolledWindow + scrolledwindow2 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + - GtkOptionMenu - omenuSourceAuth + GtkCList + clistNews True - Plain Text -Kerberos -CRAM-MD5 -DIGEST-MD5 - - 0 - - 1 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - + 1 + 80 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_IN - - GtkLabel - txtSourceType - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 0 - 1 + + GtkLabel + CList:title + lblSources + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 0 0 - False - False - False - False - True - False - + - GtkLabel - Notebook:tab - lblSource - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkTable - tableTransport - 4 - 6 - 2 - False - 4 - 4 + GtkVButtonBox + vbuttonbox2 + GTK_BUTTONBOX_START + 0 + 85 + 27 + 7 + 0 + + 0 + False + False + - GtkLabel - lblOutgoingServerType - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - + GtkButton + cmdNewsAdd + True + True + + GTK_RELIEF_NORMAL - GtkOptionMenu - omenuTransportType + GtkButton + cmdNewsEdit + True True - Sendmail -SMTP - - 0 - - 1 - 2 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - + + GTK_RELIEF_NORMAL + + + + GtkButton + cmdNewsDelete + True + True + + GTK_RELIEF_NORMAL + + + + + GtkLabel + Notebook:tab + news_config_label + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkVBox + vbox38 + False + 4 + + + GtkCheckButton + chkSendHTML + True + + False + True + + 0 + False + False + + + + + GtkHBox + hbox42 + False + 0 + + 0 + False + True + - GtkLabel - lblTransportHost - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 + GtkCheckButton + chckHighlightCitations + True + + False + True - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False + 0 + False + False - GtkEntry - txtTransportHost + GnomeColorPicker + colorpickerCitations True - True - True - 0 - + True + False + Pick a color - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False + 0 + False + False GtkLabel - lblTransportUser - + label1 + GTK_JUSTIFY_CENTER False - 0 + 0.5 0.5 0 0 - 0 - 1 - 3 - 4 - 0 - 0 - False - False - False - False - True - False + 0 + False + False + - - GtkEntry - txtTransportUser - True - True - True - 0 - - - 1 - 2 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - - + + GtkHBox + hbox38 + False + 0 + + 0 + False + True + GtkLabel - lblTransportPasswd - + lblMarkAsRead + GTK_JUSTIFY_CENTER False - 0 + 0.5 0.5 - 0 + 4 0 - 0 - 1 - 4 - 5 - 0 - 0 - False - False - False - False - True - False + 0 + False + False - GtkEntry - txtTransportPasswd + GtkSpinButton + spinMarkTimeout True - True - False - 0 - + 1 + 1 + True + GTK_UPDATE_IF_VALID + False + False + 1.5 + 0 + 10 + 0.1 + 1 + 1 - 1 - 2 - 4 - 5 - 0 - 0 - True - False - False - False - True - False + 0 + False + True GtkLabel - lblTransportAuth - + lblSeconds + GTK_JUSTIFY_CENTER False - 0 + 0.5 0.5 - 0 + 4 0 - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkOptionMenu - omenuTransportAuth - True - None -CRAM-MD5 - - 0 - - 1 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkCheckButton - chkTransportSavePasswd - True - - False - True - - 1 - 2 - 5 - 6 - 0 - 0 - False - False - False - False - True - False + 0 + False + False - GtkLabel - Notebook:tab - lblTransport - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkVBox - vboxAdvanced + GtkHBox + hbox41 False 0 + + 0 + False + True + - GtkHBox - hboxAutoCheckMail - False - 4 - - 0 - False - True - - - - GtkCheckButton - chkAutoCheckMail - True - - False - True - - 0 - False - False - - - - - GtkSpinButton - spinAutoCheckTimeout - False - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - False - False - 10 - 0 - 100 - 1 - 10 - 10 - - 0 - False - True - - - - - GtkLabel - lblMinutes - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - - GtkCheckButton - chkKeepMailOnServer - True - - False - True + GtkLabel + lblPgpPath + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 4 + 0 0 False @@ -3377,32 +2053,43 @@ CRAM-MD5 - GtkCheckButton - chkEnabled - True - - False - True + GnomeFileEntry + filePgpPath + 10 + Select PGP binary + False + True - 0 - False - False + 4 + True + True + + + GtkEntry + GnomeEntry:entry + combo-entry1 + True + True + True + 0 + + + - - GtkLabel - Notebook:tab - lblAdvanced - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - + + GtkLabel + Notebook:tab + other_config_label + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 diff --git a/mail/mail-config.h b/mail/mail-config.h index f800e48275..5a293ef9ce 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -34,7 +34,6 @@ extern "C" { typedef struct { gchar *name; gchar *address; - gchar *reply_to; gchar *organization; gchar *signature; } MailConfigIdentity; @@ -44,9 +43,8 @@ typedef struct { gboolean keep_on_server; gboolean auto_check; gint auto_check_time; - gboolean enabled; - gboolean save_passwd; + gboolean enabled; } MailConfigService; typedef struct { @@ -132,7 +130,7 @@ GSList *mail_config_get_sources (void); /* static utility functions */ char *mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix); -gboolean mail_config_check_service (CamelURL *url, CamelProviderType type, gboolean connect, GList **authtypes); +gboolean mail_config_check_service (const char *url, CamelProviderType type, GList **authtypes); #ifdef __cplusplus } -- cgit