diff options
Diffstat (limited to 'mail/mail-config.c')
-rw-r--r-- | mail/mail-config.c | 118 |
1 files changed, 95 insertions, 23 deletions
diff --git a/mail/mail-config.c b/mail/mail-config.c index a55f43711e..976f6a1765 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -36,9 +36,25 @@ #include "mail.h" #include "mail-config.h" +typedef struct +{ + gboolean configured; + GSList *ids; + GSList *sources; + GSList *news; + MailConfigService *transport; + + gboolean thread_list; + gint paned_size; + gboolean send_html; +} MailConfig; + static const char GCONFPATH[] = "/apps/Evolution/Mail"; static MailConfig *config = NULL; +/* Prototypes */ +static void config_read (void); + /* Identity struct */ MailConfigIdentity * identity_copy (MailConfigIdentity *id) @@ -121,7 +137,7 @@ mail_config_init () config->sources = NULL; config->transport = NULL; - mail_config_read (); + config_read (); } void @@ -144,10 +160,16 @@ mail_config_clear () 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; + } } -void -mail_config_read () +static void +config_read () { gchar *str; gint len, i; @@ -382,6 +404,42 @@ mail_config_is_configured () return config->configured; } +gboolean +mail_config_thread_list () +{ + return config->thread_list; +} + +void +mail_config_set_thread_list (gboolean value) +{ + config->thread_list = value; +} + +gint +mail_config_paned_size () +{ + return config->paned_size; +} + +void +mail_config_set_paned_size (gint value) +{ + config->paned_size = value; +} + +gboolean +mail_config_send_html () +{ + return config->send_html; +} + +void +mail_config_set_send_html (gboolean send_html) +{ + config->send_html = send_html; +} + MailConfigIdentity * mail_config_get_default_identity () { @@ -397,6 +455,12 @@ mail_config_get_identities () return config->ids; } +void +mail_config_add_identity (MailConfigIdentity *id) +{ + config->ids = g_slist_append (config->ids, id); +} + MailConfigService * mail_config_get_default_source () { @@ -406,46 +470,54 @@ mail_config_get_default_source () return (MailConfigService *)config->sources->data; } -MailConfigService * -mail_config_get_transport () +GSList * +mail_config_get_sources () { - return config->transport; + return config->sources; } -gboolean -mail_config_send_html () +void +mail_config_add_source (MailConfigService *source) { - return config->send_html; + config->sources = g_slist_append (config->sources, source); } -gboolean -mail_config_thread_list () +MailConfigService * +mail_config_get_transport () { - return config->thread_list; + return config->transport; } void -mail_config_set_thread_list (gboolean value) +mail_config_set_transport (MailConfigService *transport) { - config->thread_list = value; + if (config->transport) + service_destroy (config->transport); + + config->transport = transport; } -gint -mail_config_paned_size () +MailConfigService * +mail_config_get_default_news () { - return config->paned_size; + if (!config->sources) + return NULL; + + return (MailConfigService *)config->sources->data; } -void -mail_config_set_paned_size (gint value) +GSList * +mail_config_get_news () { - config->paned_size = value; + return config->news; } -MailConfig * -mail_config_fetch (void) +void +mail_config_add_news (MailConfigService *news) { - return config; + config->news = g_slist_append (config->news, news); } + + |