aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog17
-rw-r--r--mail/Makefile.am8
-rw-r--r--mail/component-factory.c15
-rw-r--r--mail/folder-browser-factory.c4
-rw-r--r--mail/folder-browser.c6
-rw-r--r--mail/mail-account-editor.c85
-rw-r--r--mail/mail-callbacks.c93
-rw-r--r--mail/mail-config-druid.c34
-rw-r--r--mail/mail-config-druid.glade356
-rw-r--r--mail/mail-config-druid.glade.h10
-rw-r--r--mail/mail-config.c589
-rw-r--r--mail/mail-config.h119
-rw-r--r--mail/mail-display.c2
-rw-r--r--mail/mail-format.c6
-rw-r--r--mail/mail-tools.c2
15 files changed, 808 insertions, 538 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 6e9fab8a41..757a9af399 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,20 @@
+2001-01-08 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * Makefile.am:
+ * component-factory.c:
+ * folder-browser-factory.c:
+ * folder-browser.c:
+ * mail-accounts.[c,h]:
+ * mail-account-editor.[c,h]:
+ * mail-callbacks.c:
+ * mail-config.[c,h]:
+ * mail-config-druid.[c,h]:
+ * mail-config-druid.glade:
+ * mail-display.c:
+ * mail-format.c:
+ * mail-tools.c: Brand spankin' new config druid, editor,
+ and manager.
+
2001-01-08 Dan Winship <danw@helixcode.com>
* mail-ops.c: Add an #include <errno.h>
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 559f6fcae4..e981d817cf 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -50,14 +50,18 @@ evolution_mail_SOURCES = \
folder-browser.h \
folder-browser-factory.c \
folder-browser-factory.h \
+ mail-accounts.c \
+ mail-accounts.h \
+ mail-account-editor.c \
+ mail-account-editor.h \
mail-autofilter.c \
mail-autofilter.h \
mail-callbacks.c \
mail-callbacks.h \
mail-config.c \
mail-config.h \
- mail-config-gui.c \
- mail-config-gui.h \
+ mail-config-druid.c \
+ mail-config-druid.h \
mail-crypto.c \
mail-crypto.h \
mail-display.c \
diff --git a/mail/component-factory.c b/mail/component-factory.c
index f89a9dbc80..d280388e58 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -171,12 +171,12 @@ owner_set_cb (EvolutionShellComponent *shell_component,
const char *evolution_homedir,
gpointer user_data)
{
- GSList *sources;
GNOME_Evolution_Shell corba_shell;
+ GSList *sources;
int i;
g_print ("evolution-mail: Yeeeh! We have an owner!\n"); /* FIXME */
-
+
evolution_dir = g_strdup (evolution_homedir);
mail_session_init ();
mail_config_init ();
@@ -189,15 +189,18 @@ owner_set_cb (EvolutionShellComponent *shell_component,
sources = mail_config_get_sources ();
mail_load_storages (corba_shell, sources);
- sources = mail_config_get_news ();
+ /* only this one gets free'd because it's created on-the-fly */
+ g_slist_free (sources);
+
+ sources = (GSList *) mail_config_get_news ();
mail_load_storages (corba_shell, sources);
mail_local_storage_startup (shell_client, evolution_dir);
- for (i=0;i<sizeof(standard_folders)/sizeof(standard_folders[0]);i++) {
+ for (i = 0; i < sizeof (standard_folders) / sizeof (standard_folders[0]); i++) {
char *uri = g_strdup_printf ("file://%s/local/%s", evolution_dir, standard_folders[i].name);
- mail_msg_wait(mail_get_folder(uri, got_folder, standard_folders[i].folder));
- g_free(uri);
+ mail_msg_wait (mail_get_folder (uri, got_folder, standard_folders[i].folder));
+ g_free (uri);
}
mail_session_enable_interaction (TRUE);
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c
index dba7207e81..5deaacadcc 100644
--- a/mail/folder-browser-factory.c
+++ b/mail/folder-browser-factory.c
@@ -155,7 +155,7 @@ control_activate (BonoboControl *control,
uic, EVOLUTION_DATADIR,
"evolution-mail.xml", "evolution-mail");
- if (mail_config_thread_list ())
+ if (mail_config_get_thread_list ())
bonobo_ui_component_set_prop (
uic, "/commands/ViewThreaded", "state", "1", NULL);
else
@@ -166,7 +166,7 @@ control_activate (BonoboControl *control,
uic, "ViewThreaded",
folder_browser_toggle_threads, folder_browser);
- if (mail_config_view_source ())
+ if (mail_config_get_view_source ())
bonobo_ui_component_set_prop (uic, "/commands/ViewSource",
"state", "1", NULL);
else
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 16d5c964a0..0fae4cd85d 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -175,7 +175,7 @@ got_folder(char *uri, CamelFolder *folder, void *data)
camel_folder_has_search_capability (folder));
gtk_widget_set_sensitive (GTK_WIDGET (fb->search->option),
camel_folder_has_search_capability (folder));
- message_list_set_threaded(fb->message_list, mail_config_thread_list());
+ message_list_set_threaded(fb->message_list, mail_config_get_thread_list());
message_list_set_folder(fb->message_list, folder);
done:
gtk_object_unref((GtkObject *)fb);
@@ -927,7 +927,7 @@ folder_browser_gui_init (FolderBrowser *fb)
GTK_SIGNAL_FUNC (fb_resize_cb), NULL);
e_paned_add2 (E_PANED (fb->vpaned), GTK_WIDGET (fb->mail_display));
- e_paned_set_position (E_PANED (fb->vpaned), mail_config_paned_size ());
+ e_paned_set_position (E_PANED (fb->vpaned), mail_config_get_paned_size ());
gtk_widget_show (GTK_WIDGET (fb->mail_display));
gtk_widget_show (GTK_WIDGET (fb));
}
@@ -952,7 +952,7 @@ do_mark_seen (gpointer data)
static void done_message_selected(CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data)
{
FolderBrowser *fb = data;
- int timeout = mail_config_mark_as_seen_timeout ();
+ int timeout = mail_config_get_mark_as_seen_timeout ();
if (folder != fb->folder)
return;
diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c
index 6d25d54a0a..a17fc389ad 100644
--- a/mail/mail-account-editor.c
+++ b/mail/mail-account-editor.c
@@ -86,10 +86,27 @@ mail_account_editor_finalise (GtkObject *obj)
((GtkObjectClass *)(parent_class))->finalize (obj);
}
+/* callbacks */
static void
-apply_clicked (GtkWidget *widget, gpointer data)
+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 && address && *address;
+
+ gnome_dialog_set_sensitive (GNOME_DIALOG (editor), 0, sensitive);
+ gnome_dialog_set_sensitive (GNOME_DIALOG (editor), 1, sensitive);
+}
+
+static gboolean
+apply_changes (MailAccountEditor *editor)
+{
MailConfigAccount *account;
char *host, *pport;
CamelURL *url;
@@ -143,6 +160,14 @@ apply_clicked (GtkWidget *widget, gpointer data)
account->source->save_passwd = GTK_TOGGLE_BUTTON (editor->save_passwd)->active;
account->source->keep_on_server = GTK_TOGGLE_BUTTON (editor->keep_on_server)->active;
+ /* check to make sure the source works */
+ if (!mail_config_check_service (url, CAMEL_PROVIDER_STORE, NULL)) {
+ camel_url_free (url);
+ account_destroy (account);
+ return FALSE;
+ }
+
+ /* now that we know this url works, set it */
g_free (account->source->url);
account->source->url = camel_url_to_string (url, account->source->save_passwd);
camel_url_free (url);
@@ -164,19 +189,38 @@ apply_clicked (GtkWidget *widget, gpointer data)
url->host = host;
url->port = port;
+ /* check to make sure the transport works */
+ if (!mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, NULL)) {
+ camel_url_free (url);
+ account_destroy (account);
+ return FALSE;
+ }
+
+ /* now that we know this url works, set it */
g_free (account->transport->url);
account->transport->url = camel_url_to_string (url, FALSE);
camel_url_free (url);
+
+ mail_config_write ();
+
+ return TRUE;
}
static void
-ok_clicked (GtkWidget *widget, gpointer data)
+apply_clicked (GtkWidget *widget, gpointer data)
{
MailAccountEditor *editor = data;
- apply_clicked (widget, data);
+ apply_changes (editor);
+}
+
+static void
+ok_clicked (GtkWidget *widget, gpointer data)
+{
+ MailAccountEditor *editor = data;
- gtk_widget_destroy (GTK_WIDGET (editor));
+ if (apply_changes (editor))
+ gtk_widget_destroy (GTK_WIDGET (editor));
}
static void
@@ -215,17 +259,18 @@ source_auth_init (MailAccountEditor *editor, CamelURL *url)
GList *authtypes = NULL;
menu = gtk_menu_new ();
- gtk_option_menu_set_menu (editor->source_auth, menu);
+ gtk_option_menu_remove_menu (editor->source_auth);
/* If we can't connect, don't let them continue. */
if (!mail_config_check_service (url, CAMEL_PROVIDER_STORE, &authtypes)) {
+ gtk_option_menu_set_menu (editor->source_auth, menu);
+
return;
}
if (authtypes) {
GList *l;
- menu = gtk_menu_new ();
l = authtypes;
while (l) {
authtype = l->data;
@@ -238,13 +283,19 @@ source_auth_init (MailAccountEditor *editor, CamelURL *url)
gtk_menu_append (GTK_MENU (menu), item);
+ gtk_widget_show (item);
+
if (url->authmech && !g_strcasecmp (authtype->authproto, url->authmech))
authmech = item;
+
+ l = l->next;
}
if (authmech)
gtk_signal_emit_by_name (GTK_OBJECT (authmech), "activate", editor);
}
+
+ gtk_option_menu_set_menu (editor->source_auth, menu);
}
static void
@@ -267,17 +318,19 @@ transport_construct_authmenu (MailAccountEditor *editor, CamelURL *url)
GList *authtypes = NULL;
menu = gtk_menu_new ();
- gtk_option_menu_set_menu (editor->transport_auth, menu);
+ gtk_option_menu_remove_menu (editor->transport_auth);
- /* If we can't connect, don't let them continue. */
if (!mail_config_check_service (url, CAMEL_PROVIDER_TRANSPORT, &authtypes)) {
+ gtk_option_menu_set_menu (editor->transport_auth, menu);
+
return;
}
+ menu = gtk_menu_new ();
+
if (authtypes) {
GList *l;
- menu = gtk_menu_new ();
l = authtypes;
while (l) {
authtype = l->data;
@@ -290,6 +343,8 @@ transport_construct_authmenu (MailAccountEditor *editor, CamelURL *url)
gtk_menu_append (GTK_MENU (menu), item);
+ gtk_widget_show (item);
+
if (!first)
first = item;
@@ -298,6 +353,8 @@ transport_construct_authmenu (MailAccountEditor *editor, CamelURL *url)
}
}
+ gtk_option_menu_set_menu (editor->transport_auth, menu);
+
if (preferred)
gtk_signal_emit_by_name (GTK_OBJECT (preferred), "activate", editor);
else if (first)
@@ -343,7 +400,9 @@ transport_type_init (MailAccountEditor *editor, CamelURL *url)
GList *providers, *l;
menu = gtk_menu_new ();
- providers = camel_session_list_providers (session, FALSE);
+ gtk_option_menu_remove_menu (editor->transport_auth);
+
+ providers = camel_session_list_providers (session, TRUE);
l = providers;
while (l) {
CamelProvider *provider = l->data;
@@ -364,6 +423,8 @@ transport_type_init (MailAccountEditor *editor, CamelURL *url)
gtk_menu_append (GTK_MENU (menu), item);
+ gtk_widget_show (item);
+
if (!g_strcasecmp (provider->protocol, url->protocol))
xport = item;
}
@@ -396,6 +457,7 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account)
/* 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);
+ gtk_window_set_modal (GTK_WINDOW (editor), TRUE);
gnome_dialog_append_buttons (GNOME_DIALOG (editor),
GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_APPLY,
@@ -415,10 +477,13 @@ construct (MailAccountEditor *editor, const MailConfigAccount *account)
/* General */
editor->account_name = GTK_ENTRY (glade_xml_get_widget (gui, "txtAccountName"));
gtk_entry_set_text (editor->account_name, account->name);
+ gtk_signal_connect (GTK_OBJECT (editor->account_name), "changed", entry_changed, editor);
editor->name = GTK_ENTRY (glade_xml_get_widget (gui, "txtName"));
gtk_entry_set_text (editor->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"));
gtk_entry_set_text (editor->email, 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"));
gtk_entry_set_text (editor->reply_to, account->id->reply_to);
editor->organization = GTK_ENTRY (glade_xml_get_widget (gui, "txtOrganization"));
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 9c7cd1e2b8..ee9de6d195 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -33,6 +33,8 @@
#include "mail.h"
#include "mail-callbacks.h"
#include "mail-config.h"
+#include "mail-accounts.h"
+#include "mail-config-druid.h"
#include "mail-threads.h"
#include "mail-tools.h"
#include "mail-ops.h"
@@ -65,6 +67,8 @@ struct post_send_data {
static gboolean
check_configured (FolderBrowser *fb)
{
+ MailConfigDruid *druid;
+
if (mail_config_is_configured ())
return TRUE;
@@ -83,7 +87,9 @@ check_configured (FolderBrowser *fb)
switch (gnome_dialog_run_and_close (GNOME_DIALOG (dialog))) {
case 0:
- mail_config_druid (fb->shell);
+ /* FIXME: should we block until mail-config is done? */
+ druid = mail_config_druid_new (fb->shell);
+ gtk_widget_show (GTK_WIDGET (druid));
break;
case 1:
default:
@@ -98,17 +104,18 @@ check_configured (FolderBrowser *fb)
static gboolean
check_send_configuration (FolderBrowser *fb)
{
- MailConfigService *xport = NULL;
+ const MailConfigAccount *account;
/* Check general */
-
if (!check_configured (fb)) {
return FALSE;
}
- /* Check for an identity */
+ /* Get the default account */
+ account = mail_config_get_default_account ();
- if (!mail_config_get_default_identity ()) {
+ /* Check for an identity */
+ if (!account) {
GtkWidget *message;
message = gnome_warning_dialog_parented (_("You need to configure an identity\n"
@@ -120,9 +127,7 @@ check_send_configuration (FolderBrowser *fb)
}
/* Check for a transport */
-
- xport = mail_config_get_transport ();
- if (!xport || !xport->url) {
+ if (!account->transport || !account->transport->url) {
GtkWidget *message;
message = gnome_warning_dialog_parented (_("You need to configure a mail transport\n"
@@ -199,14 +204,14 @@ void
send_queued_mail (GtkWidget *widget, gpointer user_data)
{
extern CamelFolder *outbox_folder;
- MailConfigService *transport;
+ const MailConfigAccount *account;
if (!mail_config_is_configured ()) {
return;
}
- transport = mail_config_get_transport ();
- if (!transport) {
+ account = mail_config_get_default_account ();
+ if (!account->transport) {
GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (user_data),
GTK_TYPE_WINDOW);
@@ -224,7 +229,7 @@ send_queued_mail (GtkWidget *widget, gpointer user_data)
return;
}
- mail_do_send_queue (outbox_folder, transport->url);
+ mail_do_send_queue (outbox_folder, account->transport->url);
}
void
@@ -291,7 +296,7 @@ composer_sent_cb(char *uri, CamelMimeMessage *message, gboolean sent, void *data
void
composer_send_cb (EMsgComposer *composer, gpointer data)
{
- MailConfigService *xport = NULL;
+ const MailConfigAccount *account = NULL;
CamelMimeMessage *message;
const CamelInternetAddress *iaddr;
const char *subject;
@@ -299,7 +304,7 @@ composer_send_cb (EMsgComposer *composer, gpointer data)
struct _send_data *send;
/* Config info */
- xport = mail_config_get_transport ();
+ account = mail_config_get_default_account ();
/* Get the message */
message = e_msg_composer_get_message (composer);
@@ -328,13 +333,13 @@ composer_send_cb (EMsgComposer *composer, gpointer data)
return;
}
}
-
+
send = g_malloc(sizeof(*send));
send->psd = psd;
send->composer = composer;
gtk_object_ref((GtkObject *)composer);
gtk_widget_hide((GtkWidget *)composer);
- mail_send_mail(xport->url, message, composer_sent_cb, send);
+ mail_send_mail (account->transport->url, message, composer_sent_cb, send);
}
void
@@ -374,25 +379,25 @@ composer_postpone_cb (EMsgComposer *composer, gpointer data)
static GtkWidget *
create_msg_composer (const char *url)
{
- MailConfigIdentity *id;
- gboolean send_html;
- gchar *sig_file = NULL;
- EMsgComposer *composer;
-
- id = mail_config_get_default_identity ();
- send_html = mail_config_send_html ();
-
- if (id)
- sig_file = id->sig;
-
- if (url != NULL) {
- composer = e_msg_composer_new_from_url (url);
- if (composer)
- e_msg_composer_set_send_html (composer, send_html);
- } else
- composer = e_msg_composer_new_with_sig_file (sig_file, send_html);
-
- return (GtkWidget *)composer;
+ const MailConfigAccount *account;
+ gboolean send_html;
+ gchar *sig_file = NULL;
+ EMsgComposer *composer;
+
+ account = mail_config_get_default_account ();
+ send_html = mail_config_get_send_html ();
+
+ if (account->id)
+ sig_file = account->id->signature;
+
+ if (url != NULL) {
+ composer = e_msg_composer_new_from_url (url);
+ if (composer)
+ e_msg_composer_set_send_html (composer, send_html);
+ } else
+ composer = e_msg_composer_new_with_sig_file (sig_file, send_html);
+
+ return (GtkWidget *)composer;
}
void
@@ -499,13 +504,15 @@ enumerate_msg (MessageList *ml, const char *uid, gpointer data)
}
-static EMsgComposer *forward_get_composer(const char *subject)
+static EMsgComposer *
+forward_get_composer (const char *subject)
{
+ const MailConfigAccount *account;
EMsgComposer *composer;
- MailConfigIdentity *id;
-
- id = mail_config_get_default_identity ();
- composer = e_msg_composer_new_with_sig_file(id?id->sig:NULL, mail_config_send_html());
+
+ account = mail_config_get_default_account ();
+ composer = e_msg_composer_new_with_sig_file (account && account->id ? account->id->signature : NULL,
+ mail_config_get_send_html ());
if (composer) {
gtk_signal_connect (GTK_OBJECT (composer), "send",
GTK_SIGNAL_FUNC (composer_send_cb), NULL);
@@ -937,7 +944,11 @@ vfolder_edit_vfolders (BonoboUIComponent *uih, void *user_data, const char *path
void
providers_config (BonoboUIComponent *uih, void *user_data, const char *path)
{
- mail_config ((FOLDER_BROWSER (user_data))->shell);
+ /* FIXME: should we block until mail-config is done? */
+ MailAccountsDialog *dialog;
+
+ dialog = mail_accounts_dialog_new ((FOLDER_BROWSER (user_data))->shell);
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
}
/*
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c
index 82503ca542..14126cdbde 100644
--- a/mail/mail-config-druid.c
+++ b/mail/mail-config-druid.c
@@ -224,6 +224,7 @@ druid_finish (GnomeDruidPage *page, gpointer arg1, gpointer user_data)
account->transport = transport;
mail_config_add_account (account);
+ mail_config_write ();
mini = g_slist_append (NULL, account->source);
mail_load_storages (druid->shell, mini);
@@ -335,7 +336,7 @@ incoming_next (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
/* If we can't connect, don't let them continue. */
if (!mail_config_check_service (url, CAMEL_PROVIDER_STORE, &authtypes)) {
camel_url_free (url);
- return FALSE;
+ return TRUE;
}
camel_url_free (url);
@@ -399,11 +400,16 @@ incoming_type_changed (GtkWidget *widget, gpointer user_data)
static void
authentication_check (MailConfigDruid *druid)
{
- if (mail_config_druid_get_save_password (druid) &&
- gtk_entry_get_text (druid->password) != NULL)
+ if (mail_config_druid_get_save_password (druid)) {
+ char *passwd = gtk_entry_get_text (druid->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);
- else
- gnome_druid_set_buttons_sensitive (druid->druid, TRUE, FALSE, TRUE);
+ }
}
static void
@@ -472,6 +478,8 @@ construct_auth_menu (MailConfigDruid *druid, GList *authtypes)
gtk_menu_append (GTK_MENU (menu), item);
+ gtk_widget_show (item);
+
if (!first)
first = item;
@@ -481,6 +489,7 @@ construct_auth_menu (MailConfigDruid *druid, GList *authtypes)
if (first)
gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", druid);
+ gtk_option_menu_remove_menu (druid->auth_type);
gtk_option_menu_set_menu (druid->auth_type, menu);
}
@@ -621,8 +630,8 @@ set_defaults (MailConfigDruid *druid)
memset (domain, 0, sizeof (domain));
getdomainname (domain, 1023);
- address = g_strdup_printf ("%s@%s%s%s", user, hostname, domain ? "." : "",
- domain ? domain : "");
+ address = g_strdup_printf ("%s@%s%s%s", user, hostname, domain && *domain ? "." : "",
+ domain && *domain ? domain : "");
gtk_entry_set_text (druid->email_address, address);
g_free (address);
@@ -652,6 +661,8 @@ set_defaults (MailConfigDruid *druid)
gtk_menu_append (GTK_MENU (stores), item);
+ gtk_widget_show (item);
+
if (!fstore)
fstore = item;
}
@@ -667,6 +678,8 @@ set_defaults (MailConfigDruid *druid)
gtk_menu_append (GTK_MENU (transports), item);
+ gtk_widget_show (item);
+
if (!ftransport)
ftransport = item;
}
@@ -674,7 +687,10 @@ set_defaults (MailConfigDruid *druid)
l = l->next;
}
+ gtk_option_menu_remove_menu (druid->incoming_type);
gtk_option_menu_set_menu (druid->incoming_type, stores);
+
+ gtk_option_menu_remove_menu (druid->outgoing_type);
gtk_option_menu_set_menu (druid->outgoing_type, transports);
if (fstore)
@@ -790,12 +806,13 @@ construct (MailConfigDruid *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, "txtEMail"));
+ druid->email_address = GTK_ENTRY (glade_xml_get_widget (gui, "txtAddress"));
gtk_signal_connect (GTK_OBJECT (druid->email_address), "changed", identity_changed, druid);
druid->reply_to = GTK_ENTRY (glade_xml_get_widget (gui, "txtReplyTo"));
druid->organization = GTK_ENTRY (glade_xml_get_widget (gui, "txtOrganization"));
@@ -816,6 +833,7 @@ construct (MailConfigDruid *druid)
druid->password = GTK_ENTRY (glade_xml_get_widget (gui, "txtAuthPasswd"));
gtk_signal_connect (GTK_OBJECT (druid->password), "changed", authentication_changed, druid);
druid->save_password = GTK_CHECK_BUTTON (glade_xml_get_widget (gui, "chkAuthSavePasswd"));
+ gtk_signal_connect (GTK_OBJECT (druid->save_password), "toggled", authentication_changed, druid);
druid->outgoing_text = glade_xml_get_widget (gui, "htmlTransport");
druid->outgoing_type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuTransportType"));
diff --git a/mail/mail-config-druid.glade b/mail/mail-config-druid.glade
index 4b14f39919..bd0923c246 100644
--- a/mail/mail-config-druid.glade
+++ b/mail/mail-config-druid.glade
@@ -165,7 +165,7 @@ Click &quot;Next&quot; to begin. </text>
<widget>
<class>GtkEntry</class>
- <name>txtEMail</name>
+ <name>txtAddress</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
@@ -1192,7 +1192,7 @@ Click &quot;Next&quot; to begin. </text>
<widget>
<class>GtkEntry</class>
- <name>omenuTransportHostname</name>
+ <name>txtTransportHostname</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
@@ -1750,7 +1750,7 @@ Click &quot;Finish&quot; to save your settings.</text>
<name>fileSignature</name>
<max_saved>10</max_saved>
<title>Select signature file</title>
- <directory>True</directory>
+ <directory>False</directory>
<modal>True</modal>
<child>
<left_attach>4</left_attach>
@@ -1800,7 +1800,7 @@ Click &quot;Finish&quot; to save your settings.</text>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
@@ -1826,7 +1826,7 @@ Click &quot;Finish&quot; to save your settings.</text>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
@@ -1852,7 +1852,7 @@ Click &quot;Finish&quot; to save your settings.</text>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
@@ -1878,7 +1878,7 @@ Click &quot;Finish&quot; to save your settings.</text>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
@@ -1904,7 +1904,7 @@ Click &quot;Finish&quot; to save your settings.</text>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
@@ -2017,30 +2017,6 @@ Click &quot;Finish&quot; to save your settings.</text>
</widget>
<widget>
- <class>GtkCheckButton</class>
- <name>chkSourceSSL</name>
- <sensitive>False</sensitive>
- <can_focus>True</can_focus>
- <label>This server requires a secure connection (SSL)</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <left_attach>1</left_attach>
- <right_attach>10</right_attach>
- <top_attach>7</top_attach>
- <bottom_attach>8</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
<class>GtkOptionMenu</class>
<name>omenuSourceAuth</name>
<can_focus>True</can_focus>
@@ -2067,23 +2043,21 @@ DIGEST-MD5
</widget>
<widget>
- <class>GtkLabel</class>
- <name>lblIncomingServerType</name>
- <label>Type:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
+ <class>GtkEntry</class>
+ <name>txtSourceType</name>
+ <can_focus>True</can_focus>
+ <editable>False</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
<child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
+ <left_attach>3</left_attach>
+ <right_attach>10</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>False</xexpand>
+ <xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
@@ -2093,23 +2067,21 @@ DIGEST-MD5
</widget>
<widget>
- <class>GtkLabel</class>
- <name>lblIncomingServer</name>
- <label>Hostname:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
+ <class>GtkEntry</class>
+ <name>txtSourceHost</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
<child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
+ <left_attach>3</left_attach>
+ <right_attach>10</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>False</xexpand>
+ <xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
@@ -2119,23 +2091,21 @@ DIGEST-MD5
</widget>
<widget>
- <class>GtkLabel</class>
- <name>lblUsername</name>
- <label>Username:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
+ <class>GtkEntry</class>
+ <name>txtSourceUser</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
<child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
+ <left_attach>3</left_attach>
+ <right_attach>10</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>False</xexpand>
+ <xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
@@ -2145,23 +2115,21 @@ DIGEST-MD5
</widget>
<widget>
- <class>GtkLabel</class>
- <name>lblPassword</name>
- <label>Password:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
+ <class>GtkEntry</class>
+ <name>txtSourcePasswd</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>False</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
<child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
+ <left_attach>3</left_attach>
+ <right_attach>10</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>False</xexpand>
+ <xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
@@ -2171,97 +2139,105 @@ DIGEST-MD5
</widget>
<widget>
- <class>GtkEntry</class>
- <name>txtSourceType</name>
- <can_focus>True</can_focus>
- <editable>False</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
+ <class>GtkLabel</class>
+ <name>lblIncomingServerType</name>
+ <label>Type:</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
<child>
- <left_attach>3</left_attach>
- <right_attach>10</right_attach>
+ <left_attach>1</left_attach>
+ <right_attach>3</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>True</xexpand>
+ <xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
- <class>GtkEntry</class>
- <name>txtSourceHost</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
+ <class>GtkLabel</class>
+ <name>lblIncomingServer</name>
+ <label>Hostname:</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
<child>
- <left_attach>3</left_attach>
- <right_attach>10</right_attach>
+ <left_attach>1</left_attach>
+ <right_attach>3</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>True</xexpand>
+ <xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
- <class>GtkEntry</class>
- <name>txtSourceUser</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
+ <class>GtkLabel</class>
+ <name>lblUsername</name>
+ <label>Username:</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
<child>
- <left_attach>3</left_attach>
- <right_attach>10</right_attach>
+ <left_attach>1</left_attach>
+ <right_attach>3</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>True</xexpand>
+ <xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
- <class>GtkEntry</class>
- <name>txtSourcePasswd</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
+ <class>GtkLabel</class>
+ <name>lblPassword</name>
+ <label>Password:</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
<child>
- <left_attach>3</left_attach>
- <right_attach>10</right_attach>
+ <left_attach>1</left_attach>
+ <right_attach>3</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>True</xexpand>
+ <xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
@@ -2287,7 +2263,31 @@ DIGEST-MD5
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>chkSourceSSL</name>
+ <sensitive>False</sensitive>
+ <can_focus>True</can_focus>
+ <label>This server requires a secure connection (SSL)</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>10</right_attach>
+ <top_attach>7</top_attach>
+ <bottom_attach>8</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
@@ -2356,18 +2356,18 @@ DIGEST-MD5
</widget>
<widget>
- <class>GtkCheckButton</class>
- <name>chkTransportSSL</name>
- <sensitive>False</sensitive>
+ <class>GtkOptionMenu</class>
+ <name>omenuTransportAuth</name>
<can_focus>True</can_focus>
- <label>This server requires a secure connection (SSL)</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
+ <items>None
+CRAM-MD5
+</items>
+ <initial_choice>0</initial_choice>
<child>
- <left_attach>1</left_attach>
+ <left_attach>4</left_attach>
<right_attach>10</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@@ -2380,18 +2380,42 @@ DIGEST-MD5
</widget>
<widget>
+ <class>GtkEntry</class>
+ <name>txtTransportHost</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>3</left_attach>
+ <right_attach>10</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
<class>GtkOptionMenu</class>
- <name>omenuTransportAuth</name>
+ <name>omenuTransportType</name>
<can_focus>True</can_focus>
- <items>None
-CRAM-MD5
+ <items>Sendmail
+SMTP
</items>
<initial_choice>0</initial_choice>
<child>
- <left_attach>4</left_attach>
+ <left_attach>3</left_attach>
<right_attach>10</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
@@ -2424,7 +2448,7 @@ CRAM-MD5
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
@@ -2450,7 +2474,7 @@ CRAM-MD5
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
@@ -2476,55 +2500,31 @@ CRAM-MD5
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
- <class>GtkEntry</class>
- <name>txtTransportHost</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>3</left_attach>
- <right_attach>10</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkOptionMenu</class>
- <name>omenuTransportType</name>
+ <class>GtkCheckButton</class>
+ <name>chkTransportSSL</name>
+ <sensitive>False</sensitive>
<can_focus>True</can_focus>
- <items>Sendmail
-SMTP
-</items>
- <initial_choice>0</initial_choice>
+ <label>This server requires a secure connection (SSL)</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
<child>
- <left_attach>3</left_attach>
+ <left_attach>1</left_attach>
<right_attach>10</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
+ <top_attach>4</top_attach>
+ <bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
@@ -2631,7 +2631,7 @@ SMTP
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
- <xfill>True</xfill>
+ <xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
diff --git a/mail/mail-config-druid.glade.h b/mail/mail-config-druid.glade.h
index 364b2e1b81..85c4e5dc84 100644
--- a/mail/mail-config-druid.glade.h
+++ b/mail/mail-config-druid.glade.h
@@ -58,7 +58,6 @@ gchar *s = N_("Signature:");
gchar *s = N_("General");
gchar *s = N_("Incoming Mail Server");
gchar *s = N_("Save password");
-gchar *s = N_("This server requires a secure connection (SSL)");
gchar *s = N_("Plain Text\n"
"Kerberos\n"
"CRAM-MD5\n"
@@ -69,17 +68,18 @@ gchar *s = N_("Hostname:");
gchar *s = N_("Username:");
gchar *s = N_("Password:");
gchar *s = N_("Authentication:");
-gchar *s = N_("Outgoing Mail Server");
gchar *s = N_("This server requires a secure connection (SSL)");
+gchar *s = N_("Outgoing Mail Server");
gchar *s = N_("None\n"
"CRAM-MD5\n"
"");
-gchar *s = N_("Type:");
-gchar *s = N_("Hostname:");
-gchar *s = N_("Authentication:");
gchar *s = N_("Sendmail\n"
"SMTP\n"
"");
+gchar *s = N_("Type:");
+gchar *s = N_("Hostname:");
+gchar *s = N_("Authentication:");
+gchar *s = N_("This server requires a secure connection (SSL)");
gchar *s = N_("Servers");
gchar *s = N_("Miscellaneous");
gchar *s = N_("Keep mail on server");
diff --git a/mail/mail-config.c b/mail/mail-config.c
index a9dfe99928..f67d2c7578 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -1,28 +1,23 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mail-config.c: Mail configuration dialogs/wizard. */
-
-/*
- * Authors:
- * Dan Winship <danw@helixcode.com>
- * Jeffrey Stedfast <fejj@helixcode.com>
- * JP Rosevear <jpr@helixcode.com>
+/*
+ * Authors: Jeffrey Stedfast <fejj@helixcode.com>
+ *
+ * Copyright 2001 Helix Code, Inc. (www.helixcode.com)
*
- * Copyright 2000 Helix Code, Inc. (http://www.helixcode.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 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.
*
- * 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.
*
- * 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 Place, Suite 330, Boston, MA 02111-1307
- * USA
*/
#include <config.h>
@@ -37,20 +32,18 @@
#include "e-util/e-html-utils.h"
#include "mail.h"
#include "mail-config.h"
+#include "mail-ops.h"
-typedef struct
-{
+typedef struct {
gboolean configured;
- GSList *ids;
- GSList *sources;
- GSList *news;
- MailConfigService *transport;
-
gboolean thread_list;
gboolean view_source;
gint paned_size;
gboolean send_html;
gint seen_timeout;
+
+ GSList *accounts;
+ GSList *news;
} MailConfig;
static const char GCONFPATH[] = "/apps/Evolution/Mail";
@@ -59,21 +52,22 @@ static MailConfig *config = NULL;
/* Prototypes */
static void config_read (void);
-/* Identity struct */
+/* Identity */
MailConfigIdentity *
-identity_copy (MailConfigIdentity *id)
+identity_copy (const MailConfigIdentity *id)
{
- MailConfigIdentity *newid;
+ MailConfigIdentity *new;
- g_return_val_if_fail (id, NULL);
+ g_return_val_if_fail (id != NULL, NULL);
- newid = g_new0 (MailConfigIdentity, 1);
- newid->name = g_strdup (id->name);
- newid->address = g_strdup (id->address);
- newid->org = g_strdup (id->org);
- newid->sig = g_strdup (id->sig);
+ 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);
- return newid;
+ return new;
}
void
@@ -84,32 +78,28 @@ identity_destroy (MailConfigIdentity *id)
g_free (id->name);
g_free (id->address);
- g_free (id->org);
- g_free (id->sig);
+ g_free (id->reply_to);
+ g_free (id->organization);
+ g_free (id->signature);
g_free (id);
}
-void
-identity_destroy_each (gpointer item, gpointer data)
-{
- identity_destroy ((MailConfigIdentity *)item);
-}
-
-/* Service struct */
+/* Service */
MailConfigService *
-service_copy (MailConfigService *source)
+service_copy (const MailConfigService *source)
{
- MailConfigService *newsource;
+ MailConfigService *new;
- g_return_val_if_fail (source, NULL);
+ g_return_val_if_fail (source != NULL, NULL);
- newsource = g_new0 (MailConfigService, 1);
- newsource->url = g_strdup (source->url);
- newsource->keep_on_server = source->keep_on_server;
- newsource->remember_password = source->remember_password;
+ new = g_new0 (MailConfigService, 1);
+ new->url = g_strdup (source->url);
+ new->keep_on_server = source->keep_on_server;
+ new->save_passwd = source->save_passwd;
+ new->use_ssl = source->use_ssl;
- return newsource;
+ return new;
}
void
@@ -117,7 +107,7 @@ service_destroy (MailConfigService *source)
{
if (!source)
return;
-
+
g_free (source->url);
g_free (source);
@@ -129,6 +119,46 @@ service_destroy_each (gpointer item, gpointer data)
service_destroy ((MailConfigService *)item);
}
+/* Account */
+MailConfigAccount *
+account_copy (const MailConfigAccount *account)
+{
+ MailConfigAccount *new;
+
+ g_return_val_if_fail (account != NULL, NULL);
+
+ new = g_new0 (MailConfigAccount, 1);
+ new->name = g_strdup (account->name);
+ new->default_account = account->default_account;
+
+ new->id = identity_copy (account->id);
+ new->source = service_copy (account->source);
+ new->transport = service_copy (account->transport);
+
+ return new;
+}
+
+void
+account_destroy (MailConfigAccount *account)
+{
+ if (!account)
+ return;
+
+ g_free (account->name);
+
+ identity_destroy (account->id);
+ service_destroy (account->source);
+ service_destroy (account->transport);
+
+ g_free (account);
+}
+
+void
+account_destroy_each (gpointer item, gpointer data)
+{
+ account_destroy ((MailConfigAccount *)item);
+}
+
/* Config struct routines */
void
mail_config_init (void)
@@ -137,11 +167,6 @@ mail_config_init (void)
return;
config = g_new0 (MailConfig, 1);
-
- config->ids = NULL;
- config->sources = NULL;
- config->transport = NULL;
-
config_read ();
}
@@ -151,26 +176,20 @@ mail_config_clear (void)
if (!config)
return;
- if (config->ids) {
- g_slist_foreach (config->ids, identity_destroy_each, NULL);
- g_slist_free (config->ids);
- config->ids = NULL;
- }
-
- if (config->sources) {
- g_slist_foreach (config->sources, service_destroy_each, NULL);
- g_slist_free (config->sources);
- config->sources = NULL;
+ if (config->accounts) {
+ g_slist_foreach (config->accounts, account_destroy_each, NULL);
+ g_slist_free (config->accounts);
+ config->accounts = NULL;
}
- service_destroy (config->transport);
- config->transport = NULL;
-
if (config->news) {
g_slist_foreach (config->news, service_destroy_each, NULL);
g_slist_free (config->news);
config->news = NULL;
}
+
+ /* overkill? */
+ memset (config, 0, sizeof (MailConfig));
}
static void
@@ -178,66 +197,79 @@ config_read (void)
{
gchar *str;
gint len, i;
+ gboolean have_default = FALSE;
mail_config_clear ();
-
+
/* Configured */
str = g_strdup_printf ("=%s/config/General=/General/configured", evolution_dir);
config->configured = gnome_config_get_bool (str);
g_free (str);
- /* Identities */
- str = g_strdup_printf ("=%s/config/Mail=/Identities/", evolution_dir);
+ /* Accounts */
+ str = g_strdup_printf ("=%s/config/Mail=/Accounts/", evolution_dir);
gnome_config_push_prefix (str);
g_free (str);
-
+
len = gnome_config_get_int ("num");
for (i = 0; i < len; i++) {
+ MailConfigAccount *account;
MailConfigIdentity *id;
+ MailConfigService *source;
+ MailConfigService *transport;
gchar *path;
- id = g_new0 (MailConfigIdentity, 1);
-
- path = g_strdup_printf ("name_%d", i);
+ account = g_new0 (MailConfigAccount, 1);
+ path = g_strdup_printf ("account_name_%d", i);
+ account->name = gnome_config_get_string (path);
+ g_free (path);
+ path = g_strdup_printf ("account_is_default_%d", i);
+ account->default_account = gnome_config_get_bool (path) && !have_default;
+ if (account->default_account)
+ have_default = TRUE;
+ g_free (path);
+
+ /* get the identity info */
+ id = g_new0 (MailConfigIdentity, 1);
+ path = g_strdup_printf ("identity_name_%d", i);
id->name = gnome_config_get_string (path);
g_free (path);
- path = g_strdup_printf ("address_%d", i);
+ 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);
- path = g_strdup_printf ("org_%d", i);
- id->org = gnome_config_get_string (path);
+ path = g_strdup_printf ("identity_organization_%d", i);
+ id->organization = gnome_config_get_string (path);
g_free (path);
- path = g_strdup_printf ("sig_%d", i);
- id->sig = gnome_config_get_string (path);
+ path = g_strdup_printf ("identity_signature_%d", i);
+ id->signature = gnome_config_get_string (path);
g_free (path);
-
- config->ids = g_slist_append (config->ids, id);
- }
- gnome_config_pop_prefix ();
-
- /* Sources */
- str = g_strdup_printf ("=%s/config/Mail=/Sources/", evolution_dir);
- gnome_config_push_prefix (str);
- g_free (str);
-
- len = gnome_config_get_int ("num");
- for (i = 0; i < len; i++) {
- MailConfigService *s;
- gchar *path;
-
- s = g_new0 (MailConfigService, 1);
- path = g_strdup_printf ("url_%d", i);
- s->url = gnome_config_get_string (path);
+ /* get the source */
+ source = g_new0 (MailConfigService, 1);
+ path = g_strdup_printf ("source_url_%d", i);
+ source->url = gnome_config_get_string (path);
g_free (path);
- path = g_strdup_printf ("keep_on_server_%d", i);
- s->keep_on_server = gnome_config_get_bool (path);
+ path = g_strdup_printf ("source_keep_on_server_%d", i);
+ source->keep_on_server = gnome_config_get_bool (path);
g_free (path);
- path = g_strdup_printf ("remember_password_%d", i);
- s->remember_password = gnome_config_get_bool (path);
+ path = g_strdup_printf ("source_save_passwd_%d", i);
+ source->save_passwd = gnome_config_get_bool (path);
g_free (path);
- config->sources = g_slist_append (config->sources, s);
+ /* get the transport */
+ transport = g_new0 (MailConfigService, 1);
+ path = g_strdup_printf ("transport_url_%d", i);
+ transport->url = gnome_config_get_string (path);
+ g_free (path);
+
+ account->id = id;
+ account->source = source;
+ account->transport = transport;
+
+ config->accounts = g_slist_append (config->accounts, account);
}
gnome_config_pop_prefix ();
@@ -245,53 +277,46 @@ config_read (void)
str = g_strdup_printf ("=%s/config/News=/Sources/", evolution_dir);
gnome_config_push_prefix (str);
g_free (str);
-
+
len = gnome_config_get_int ("num");
for (i = 0; i < len; i++) {
MailConfigService *n;
gchar *path;
n = g_new0 (MailConfigService, 1);
-
+
path = g_strdup_printf ("url_%d", i);
n->url = gnome_config_get_string (path);
g_free (path);
-
+
config->news = g_slist_append (config->news, n);
}
gnome_config_pop_prefix ();
- /* Transport */
- config->transport = g_new0 (MailConfigService, 1);
- str = g_strdup_printf ("=%s/config/Mail=/Transport/url",
- evolution_dir);
- config->transport->url = gnome_config_get_string (str);
- g_free (str);
-
/* Format */
str = g_strdup_printf ("=%s/config/Mail=/Format/send_html",
evolution_dir);
config->send_html = gnome_config_get_bool (str);
g_free (str);
-
+
/* Mark as seen timeout */
str = g_strdup_printf ("=%s/config/Mail=/Display/seen_timeout=1500",
evolution_dir);
config->seen_timeout = gnome_config_get_int (str);
g_free (str);
-
+
/* Show Messages Threaded */
str = g_strdup_printf ("=%s/config/Mail=/Display/thread_list",
evolution_dir);
config->thread_list = gnome_config_get_bool (str);
g_free (str);
-
+
/* Size of vpaned in mail view */
str = g_strdup_printf ("=%s/config/Mail=/Display/paned_size=200",
evolution_dir);
config->paned_size = gnome_config_get_int (str);
g_free (str);
-
+
gnome_config_sync ();
}
@@ -300,7 +325,7 @@ mail_config_write (void)
{
gchar *str;
gint len, i;
-
+
/* Configured switch */
str = g_strdup_printf ("=%s/config/General=/General/configured",
evolution_dir);
@@ -308,96 +333,90 @@ mail_config_write (void)
gnome_config_set_bool (str, config->configured);
g_free (str);
- /* Identities */
- str = g_strdup_printf ("=%s/config/Mail=/Identities/", evolution_dir);
+ /* Accounts */
+ str = g_strdup_printf ("=%s/config/Mail=/Accounts/", evolution_dir);
gnome_config_push_prefix (str);
g_free (str);
-
- len = g_slist_length (config->ids);
+
+ len = g_slist_length (config->accounts);
gnome_config_set_int ("num", len);
for (i = 0; i < len; i++) {
- MailConfigIdentity *id;
+ MailConfigAccount *account;
gchar *path;
- id = (MailConfigIdentity *)g_slist_nth_data (config->ids, i);
+ account = g_slist_nth_data (config->accounts, i);
- path = g_strdup_printf ("name_%d", i);
- gnome_config_set_string (path, id->name);
+ /* account info */
+ path = g_strdup_printf ("account_name_%d", i);
+ gnome_config_set_string (path, account->name);
g_free (path);
- path = g_strdup_printf ("address_%d", i);
- gnome_config_set_string (path, id->address);
+ path = g_strdup_printf ("account_is_default_%d", i);
+ gnome_config_set_bool (path, account->default_account);
g_free (path);
- path = g_strdup_printf ("org_%d", i);
- gnome_config_set_string (path, id->org);
+
+ /* identity info */
+ path = g_strdup_printf ("identity_name_%d", i);
+ gnome_config_set_string (path, account->id->name);
g_free (path);
- path = g_strdup_printf ("sig_%d", i);
- gnome_config_set_string (path, id->sig);
+ path = g_strdup_printf ("identity_address_%d", i);
+ gnome_config_set_string (path, account->id->address);
+ g_free (path);
+ path = g_strdup_printf ("identity_organization_%d", i);
+ gnome_config_set_string (path, account->id->organization);
+ g_free (path);
+ path = g_strdup_printf ("identity_signature_%d", i);
+ gnome_config_set_string (path, account->id->signature);
g_free (path);
- }
- gnome_config_pop_prefix ();
-
- /* Sources */
- str = g_strdup_printf ("=%s/config/Mail=/Sources/", evolution_dir);
- gnome_config_push_prefix (str);
- g_free (str);
-
- len = g_slist_length (config->sources);
- gnome_config_set_int ("num", len);
- for (i=0; i<len; i++) {
- MailConfigService *s;
- gchar *path;
-
- s = (MailConfigService *)g_slist_nth_data (config->sources, i);
- path = g_strdup_printf ("url_%d", i);
- gnome_config_set_string (path, s->url);
+ /* source info */
+ path = g_strdup_printf ("source_url_%d", i);
+ gnome_config_set_string (path, account->source->url);
g_free (path);
- path = g_strdup_printf ("keep_on_server_%d", i);
- gnome_config_set_bool (path, s->keep_on_server);
+ path = g_strdup_printf ("source_keep_on_server_%d", i);
+ gnome_config_set_bool (path, account->source->keep_on_server);
g_free (path);
- path = g_strdup_printf ("remember_password_%d", i);
- gnome_config_set_bool (path, s->remember_password);
+ path = g_strdup_printf ("source_save_passwd_%d", i);
+ gnome_config_set_bool (path, account->source->save_passwd);
+ g_free (path);
+
+ /* transport info */
+ path = g_strdup_printf ("transport_url_%d", i);
+ gnome_config_set_string (path, account->transport->url);
g_free (path);
}
gnome_config_pop_prefix ();
-
+
/* News */
str = g_strdup_printf ("=%s/config/News=/Sources/", evolution_dir);
gnome_config_push_prefix (str);
g_free (str);
-
+
len = g_slist_length (config->news);
gnome_config_set_int ("num", len);
- for (i=0; i<len; i++) {
+ for (i = 0; i < len; i++) {
MailConfigService *n;
gchar *path;
- n = (MailConfigService *)g_slist_nth_data (config->news, i);
+ n = g_slist_nth_data (config->news, i);
path = g_strdup_printf ("url_%d", i);
gnome_config_set_string (path, n->url);
g_free (path);
}
gnome_config_pop_prefix ();
-
- /* Transport */
- str = g_strdup_printf ("=%s/config/Mail=/Transport/url",
- evolution_dir);
- gnome_config_set_string (str, config->transport->url);
- g_free (str);
/* Mark as seen timeout */
str = g_strdup_printf ("=%s/config/Mail=/Display/seen_timeout",
evolution_dir);
gnome_config_set_int (str, config->seen_timeout);
g_free (str);
-
+
/* Format */
str = g_strdup_printf ("=%s/config/Mail=/Format/send_html",
evolution_dir);
gnome_config_set_bool (str, config->send_html);
g_free (str);
-
+
gnome_config_sync ();
}
@@ -407,27 +426,29 @@ mail_config_write_on_exit (void)
gchar *str;
GSList *sources;
MailConfigService *s;
-
+
/* Show Messages Threaded */
str = g_strdup_printf ("=%s/config/Mail=/Display/thread_list",
evolution_dir);
gnome_config_set_bool (str, config->thread_list);
g_free (str);
-
+
/* Size of vpaned in mail view */
str = g_strdup_printf ("=%s/config/Mail=/Display/paned_size",
evolution_dir);
gnome_config_set_int (str, config->paned_size);
g_free (str);
-
+
/* Passwords */
gnome_config_private_clean_section ("/Evolution/Passwords");
- for (sources = config->sources; sources; sources = sources->next) {
+ sources = mail_config_get_sources ();
+ for ( ; sources; sources = sources->next) {
s = sources->data;
- if (s->remember_password)
+ if (s->save_passwd)
mail_session_remember_password (s->url);
}
-
+ g_slist_free (sources);
+
gnome_config_sync ();
}
@@ -439,23 +460,23 @@ mail_config_is_configured (void)
}
gboolean
-mail_config_thread_list (void)
+mail_config_get_thread_list (void)
{
return config->thread_list;
}
-gboolean
-mail_config_view_source (void)
-{
- return config->view_source;
-}
-
void
mail_config_set_thread_list (gboolean value)
{
config->thread_list = value;
}
+gboolean
+mail_config_get_view_source (void)
+{
+ return config->view_source;
+}
+
void
mail_config_set_view_source (gboolean value)
{
@@ -463,7 +484,7 @@ mail_config_set_view_source (gboolean value)
}
gint
-mail_config_paned_size (void)
+mail_config_get_paned_size (void)
{
return config->paned_size;
}
@@ -475,7 +496,7 @@ mail_config_set_paned_size (gint value)
}
gboolean
-mail_config_send_html (void)
+mail_config_get_send_html (void)
{
return config->send_html;
}
@@ -487,7 +508,7 @@ mail_config_set_send_html (gboolean send_html)
}
gint
-mail_config_mark_as_seen_timeout (void)
+mail_config_get_mark_as_seen_timeout (void)
{
return config->seen_timeout;
}
@@ -498,68 +519,94 @@ mail_config_set_mark_as_seen_timeout (gint timeout)
config->seen_timeout = timeout;
}
-MailConfigIdentity *
-mail_config_get_default_identity (void)
+const MailConfigAccount *
+mail_config_get_default_account (void)
{
- if (!config->ids)
+ const MailConfigAccount *account;
+ GSList *l;
+
+ if (!config->accounts)
return NULL;
- return (MailConfigIdentity *)config->ids->data;
+ /* find the default account */
+ l = config->accounts;
+ while (l) {
+ account = l->data;
+ if (account->default_account)
+ return account;
+ l = l->next;
+ }
+
+ /* non are marked as default so return the first one */
+ return (MailConfigAccount *)config->accounts->data;
}
-GSList *
-mail_config_get_identities (void)
+const GSList *
+mail_config_get_accounts (void)
{
- return config->ids;
+ return config->accounts;
}
void
-mail_config_add_identity (MailConfigIdentity *id)
+mail_config_add_account (MailConfigAccount *account)
{
- MailConfigIdentity *new_id = identity_copy (id);
-
- config->ids = g_slist_append (config->ids, new_id);
-}
-
-MailConfigService *
-mail_config_get_default_source (void)
-{
- if (!config->sources)
- return NULL;
+ if (account->default_account) {
+ /* Un-defaultify other accounts */
+ GSList *node = config->accounts;
+
+ while (node) {
+ MailConfigAccount *acnt = node->data;
+
+ acnt->default_account = FALSE;
+
+ node = node->next;
+ }
+ }
- return (MailConfigService *)config->sources->data;
-}
-
-GSList *
-mail_config_get_sources (void)
-{
- return config->sources;
+ config->accounts = g_slist_append (config->accounts, account);
}
void
-mail_config_add_source (MailConfigService *source)
+mail_config_set_default_account (const MailConfigAccount *account)
{
- MailConfigService *new_source = service_copy (source);
+ GSList *node = config->accounts;
+
+ while (node) {
+ MailConfigAccount *acnt = node->data;
+
+ acnt->default_account = FALSE;
+
+ node = node->next;
+ }
- config->sources = g_slist_append (config->sources, new_source);
+ ((MailConfigAccount *) account)->default_account = TRUE;
}
-MailConfigService *
-mail_config_get_transport (void)
+const MailConfigIdentity *
+mail_config_get_default_identity (void)
{
- return config->transport;
+ const MailConfigAccount *account;
+
+ account = mail_config_get_default_account ();
+ if (account)
+ return account->id;
+ else
+ return NULL;
}
-void
-mail_config_set_transport (MailConfigService *transport)
+const MailConfigService *
+mail_config_get_default_transport (void)
{
- if (config->transport)
- service_destroy (config->transport);
-
- config->transport = transport;
+ const MailConfigAccount *account;
+
+ account = mail_config_get_default_account ();
+ if (account)
+ return account->transport;
+ else
+ return NULL;
}
-MailConfigService *
+const MailConfigService *
mail_config_get_default_news (void)
{
if (!config->news)
@@ -568,7 +615,7 @@ mail_config_get_default_news (void)
return (MailConfigService *)config->news->data;
}
-GSList *
+const GSList *
mail_config_get_news (void)
{
return config->news;
@@ -577,24 +624,104 @@ mail_config_get_news (void)
void
mail_config_add_news (MailConfigService *news)
{
- MailConfigService *new_news = service_copy (news);
+ config->news = g_slist_append (config->news, news);
+}
- config->news = g_slist_append (config->news, new_news);
+GSList *
+mail_config_get_sources (void)
+{
+ const GSList *accounts;
+ GSList *sources = NULL;
+
+ accounts = mail_config_get_accounts ();
+ while (accounts) {
+ const MailConfigAccount *account = accounts->data;
+
+ if (account->source)
+ sources = g_slist_append (sources, account->source);
+
+ accounts = accounts->next;
+ }
+
+ return sources;
}
char *
-mail_config_folder_to_cachename(CamelFolder *folder, const char *prefix)
+mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix)
{
char *url, *filename;
- url = camel_url_to_string(CAMEL_SERVICE(folder->parent_store)->url, FALSE);
+ url = camel_url_to_string (CAMEL_SERVICE (folder->parent_store)->url, FALSE);
e_filename_make_safe (url);
- filename = g_strdup_printf("%s/config/%s%s", evolution_dir, prefix, url);
- g_free(url);
+ filename = g_strdup_printf ("%s/config/%s%s", evolution_dir, prefix, url);
+ g_free (url);
+
return filename;
}
+/* Async service-checking/authtype-lookup code. */
+
+typedef struct {
+ char *url;
+ CamelProviderType type;
+ GList **authtypes;
+ gboolean success;
+} check_service_input_t;
+static char *
+describe_check_service (gpointer in_data, gboolean gerund)
+{
+ if (gerund)
+ return g_strdup (_("Connecting to server"));
+ else
+ return g_strdup (_("Connect to server"));
+}
+static void
+do_check_service (gpointer in_data, gpointer op_data, CamelException *ex)
+{
+ check_service_input_t *input = in_data;
+ CamelService *service;
+
+ if (input->authtypes) {
+ service = camel_session_get_service (
+ session, input->url, input->type, ex);
+ if (!service)
+ return;
+ *input->authtypes = camel_service_query_auth_types (service, ex);
+ } else {
+ service = camel_session_get_service_connected (
+ session, input->url, input->type, ex);
+ }
+ if (service)
+ camel_object_unref (CAMEL_OBJECT (service));
+ if (!camel_exception_is_set (ex))
+ input->success = TRUE;
+}
+
+static const mail_operation_spec op_check_service = {
+ describe_check_service,
+ 0,
+ NULL,
+ do_check_service,
+ NULL
+};
+
+gboolean
+mail_config_check_service (CamelURL *url, CamelProviderType type, GList **authtypes)
+{
+ check_service_input_t input;
+
+ input.url = camel_url_to_string (url, TRUE);
+ input.type = type;
+ input.authtypes = authtypes;
+ input.success = FALSE;
+
+ mail_operation_queue (&op_check_service, &input, FALSE);
+ mail_operation_wait_for_finish ();
+ g_free (input.url);
+
+ return input.success;
+}
diff --git a/mail/mail-config.h b/mail/mail-config.h
index bbf7176acb..5c40b832f2 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -1,7 +1,8 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
/*
- * Copyright 2000, Helix Code, Inc. (http://www.helixcode.com)
+ * Authors: Jeffrey Stedfast <fejj@helixcode.com>
+ *
+ * Copyright 2001 Helix Code, Inc. (www.helixcode.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
@@ -16,41 +17,58 @@
* 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_CONFIG_H
-#define _MAIL_CONFIG_H
-
-
+#ifndef MAIL_CONFIG_H
+#define MAIL_CONFIG_H
#include <glib.h>
-#include <camel/camel-folder.h>
+#include <camel/camel.h>
-typedef struct
-{
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+typedef struct {
gchar *name;
gchar *address;
- gchar *org;
- gchar *sig;
+ gchar *reply_to;
+ gchar *organization;
+ gchar *signature;
} MailConfigIdentity;
-typedef struct
-{
+typedef struct {
gchar *url;
gboolean keep_on_server;
- gboolean remember_password;
+ gboolean save_passwd;
+ gboolean use_ssl;
} MailConfigService;
+typedef struct {
+ gchar *name;
+ gboolean default_account;
+
+ MailConfigIdentity *id;
+ MailConfigService *source;
+ MailConfigService *transport;
+} MailConfigAccount;
+
/* Identities */
-MailConfigIdentity *identity_copy (MailConfigIdentity *id);
+MailConfigIdentity *identity_copy (const MailConfigIdentity *id);
void identity_destroy (MailConfigIdentity *id);
-void identity_destroy_each (gpointer item, gpointer data);
/* Services */
-MailConfigService *service_copy (MailConfigService *source);
+MailConfigService *service_copy (const MailConfigService *source);
void service_destroy (MailConfigService *source);
void service_destroy_each (gpointer item, gpointer data);
+/* Accounts */
+MailConfigAccount *account_copy (const MailConfigAccount *account);
+void account_destroy (MailConfigAccount *account);
+void account_destroy_each (gpointer item, gpointer data);
+
/* Configuration */
void mail_config_init (void);
void mail_config_clear (void);
@@ -58,38 +76,45 @@ void mail_config_write (void);
void mail_config_write_on_exit (void);
/* General Accessor functions */
-gboolean mail_config_is_configured (void);
-gboolean mail_config_thread_list (void);
-gboolean mail_config_view_source (void);
-gint mail_config_paned_size (void);
-void mail_config_set_thread_list (gboolean value);
-void mail_config_set_view_source (gboolean value);
-void mail_config_set_paned_size (gint size);
-gboolean mail_config_send_html (void);
-void mail_config_set_send_html (gboolean send_html);
-gint mail_config_mark_as_seen_timeout (void);
-void mail_config_set_mark_as_seen_timeout (gint timeout);
-
-/* Identity Accessor functions */
-MailConfigIdentity *mail_config_get_default_identity (void);
-void mail_config_add_identity (MailConfigIdentity *id);
-GSList *mail_config_get_identities (void);
-
-/* Service Accessor functions */
-MailConfigService *mail_config_get_default_source (void);
-GSList *mail_config_get_sources (void);
-void mail_config_add_source (MailConfigService *source);
-
-MailConfigService *mail_config_get_transport (void);
-void mail_config_set_transport (MailConfigService *transport);
-
-MailConfigService *mail_config_get_default_news (void);
-GSList *mail_config_get_news (void);
-void mail_config_add_news (MailConfigService *source);
+gboolean mail_config_is_configured (void);
+
+gboolean mail_config_get_thread_list (void);
+void mail_config_set_thread_list (gboolean value);
+
+gboolean mail_config_get_view_source (void);
+void mail_config_set_view_source (gboolean value);
+
+gint mail_config_get_paned_size (void);
+void mail_config_set_paned_size (gint size);
+
+gboolean mail_config_get_send_html (void);
+void mail_config_set_send_html (gboolean send_html);
+
+gint mail_config_get_mark_as_seen_timeout (void);
+void mail_config_set_mark_as_seen_timeout (gint timeout);
+
+const MailConfigAccount *mail_config_get_default_account (void);
+const GSList *mail_config_get_accounts (void);
+void mail_config_add_account (MailConfigAccount *account);
+void mail_config_set_default_account (const MailConfigAccount *account);
+
+const MailConfigIdentity *mail_config_get_default_identity (void);
+const MailConfigService *mail_config_get_default_transport (void);
+
+const MailConfigService *mail_config_get_default_news (void);
+const GSList *mail_config_get_news (void);
+void mail_config_add_news (MailConfigService *news);
+
+/* convenience functions to help ease the transition over to the new codebase */
+GSList *mail_config_get_sources (void);
/* static utility functions */
-char *mail_config_folder_to_cachename(CamelFolder *folder, const char *prefix);
+char *mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix);
-#endif
+gboolean mail_config_check_service (CamelURL *url, CamelProviderType type, GList **authtypes);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* MAIL_CONFIG_H */
diff --git a/mail/mail-display.c b/mail/mail-display.c
index c1fb94c5f3..43f61138ad 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -835,7 +835,7 @@ redisplay (MailDisplay *md, gboolean unscroll)
if (md->current_message) {
camel_object_ref (CAMEL_OBJECT (md->current_message));
- if (mail_config_view_source ())
+ if (mail_config_get_view_source ())
mail_format_raw_message (md->current_message, md);
else
mail_format_mime_message (md->current_message, md);
diff --git a/mail/mail-format.c b/mail/mail-format.c
index c4f9ef2b7c..aaefd4856f 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -1654,7 +1654,7 @@ mail_generate_reply (CamelMimeMessage *message, gboolean to_all)
const char *message_id, *references;
const char *name = NULL, *address = NULL;
GList *to = NULL, *cc = NULL;
- MailConfigIdentity *id;
+ const MailConfigIdentity *id;
gchar *sig_file = NULL;
const CamelInternetAddress *reply_to, *sender;
time_t date;
@@ -1662,9 +1662,9 @@ mail_generate_reply (CamelMimeMessage *message, gboolean to_all)
id = mail_config_get_default_identity ();
if (id)
- sig_file = id->sig;
+ sig_file = id->signature;
- composer = e_msg_composer_new_with_sig_file (sig_file, mail_config_send_html ());
+ composer = e_msg_composer_new_with_sig_file (sig_file, mail_config_get_send_html ());
if (!composer)
return NULL;
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index a564818b3c..ff82630e53 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -557,7 +557,7 @@ mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...)
gboolean want_plain, is_html;
gchar *text;
- want_plain = !mail_config_send_html ();
+ want_plain = !mail_config_get_send_html ();
contents = camel_medium_get_content_object (CAMEL_MEDIUM (message));
text = mail_get_message_body (contents, want_plain, &is_html);