aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@arcavia.com>2000-07-29 14:04:24 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-07-29 14:04:24 +0800
commit121d056d45b9766532ba9b7ec3f687c04582194f (patch)
tree75859f4896fce1e883e5c1f5440097092db0f7ad /mail/mail-ops.c
parentf34353458d545d679e9daebb22ade4f1f02c8e00 (diff)
downloadgsoc2013-evolution-121d056d45b9766532ba9b7ec3f687c04582194f.tar.gz
gsoc2013-evolution-121d056d45b9766532ba9b7ec3f687c04582194f.tar.zst
gsoc2013-evolution-121d056d45b9766532ba9b7ec3f687c04582194f.zip
New function to create composer with sig file set.
2000-07-28 JP Rosevear <jpr@arcavia.com> * e-msg-composer.c (e_msg_composer_new_with_sig_file): New function to create composer with sig file set. (e_msg_composer_get_sig_file): New function to get sig file (e_msg_composer_set_sig_file): New function to set sig file 2000-07-29 JP Rosevear <jpr@arcavia.com> * mail-format.c (mail_generate_reply): Use new mail config stuff * component-factory.c (create_imap_storage): Use new mail config stuff (create_news_storage): ditto * evolution-mail.schemas: Gconf schema for evolution mail * mail-config-druid.glade: Gladification of config druid * mail-config.h: New header with config structs. * mail-config.c: Rewrite of GUI configuration tools to use new config structs. Stores multiple identities and sources now. Still only uses the first one found. (mail_config_fetch): Returns MailConfig struct to caller for configuration queries. (mail_config): Renamed function to show mail config dialog. (mail_config_druid): Renamed function to show mail config druid. * mail-ops.c (create_msg_composer): Use e_msg_composer_new_with_sig_file and new config stuff (check_configured): Use new config stuff (fetch_mail): ditto (composer_send_cb): ditto svn path=/trunk/; revision=4413
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c91
1 files changed, 43 insertions, 48 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 71d0431552..281d024786 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -103,20 +103,17 @@ async_mail_exception_dialog (char *head, CamelException *ex, gpointer unused )
static gboolean
check_configured (void)
{
- char *path;
- gboolean configured;
+ const MailConfig *config;
- path = g_strdup_printf ("=%s/config=/mail/configured", evolution_dir);
- if (gnome_config_get_bool (path)) {
- g_free (path);
+ config = mail_config_fetch ();
+ if (config->configured)
return TRUE;
- }
-
+
mail_config_druid ();
- configured = gnome_config_get_bool (path);
- g_free (path);
- return configured;
+ config = mail_config_fetch ();
+
+ return config->configured;
}
static void
@@ -336,16 +333,20 @@ real_fetch_mail (gpointer user_data)
void
fetch_mail (GtkWidget *button, gpointer user_data)
{
- char *path, *url = NULL;
+ const MailConfig *config;
+ const MailConfigService *source;
+ char *url = NULL;
rfm_t *info;
if (!check_configured ())
return;
- path = g_strdup_printf ("=%s/config=/mail/source", evolution_dir);
- url = gnome_config_get_string (path);
- g_free (path);
-
+ config = mail_config_fetch ();
+ if (config->sources) {
+ source = (MailConfigService *)config->sources->data;
+ url = source->url;
+ }
+
if (!url) {
GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (user_data),
GTK_TYPE_WINDOW);
@@ -478,6 +479,8 @@ cleanup_send_mail (gpointer userdata)
static void
composer_send_cb (EMsgComposer *composer, gpointer data)
{
+ const MailConfig *config;
+ const MailConfigIdentity *id = NULL;
static CamelTransport *transport = NULL;
struct post_send_data *psd = data;
rsm_t *info;
@@ -485,21 +488,25 @@ composer_send_cb (EMsgComposer *composer, gpointer data)
const char *subject;
CamelException *ex;
CamelMimeMessage *message;
- char *name, *addr, *path;
+ char *name, *addr;
ex = camel_exception_new ();
+ config = mail_config_fetch ();
+
if (!from) {
CamelInternetAddress *ciaddr;
- path = g_strdup_printf ("=%s/config=/mail/id_name", evolution_dir);
- name = gnome_config_get_string (path);
+ if (config->ids->data) {
+ id = (MailConfigIdentity *)config->ids->data;
+ }
+ g_assert (id);
+
+ name = id->name;
g_assert (name);
- g_free (path);
- path = g_strdup_printf ("=%s/config=/mail/id_addr", evolution_dir);
- addr = gnome_config_get_string (path);
+
+ addr = id->address;
g_assert (addr);
- g_free (path);
ciaddr = camel_internet_address_new ();
camel_internet_address_add (ciaddr, name, addr);
@@ -510,11 +517,8 @@ composer_send_cb (EMsgComposer *composer, gpointer data)
if (!transport) {
char *url;
- path = g_strdup_printf ("=%s/config=/mail/transport",
- evolution_dir);
- url = gnome_config_get_string (path);
+ url = config->transport->url;
g_assert (url);
- g_free (path);
transport = camel_session_get_transport (session, url, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
@@ -563,30 +567,25 @@ free_psd (GtkWidget *composer, gpointer user_data)
static GtkWidget *
create_msg_composer (const char *url)
{
+ const MailConfig *config;
+ gchar *sig_file = NULL;
GtkWidget *composer_widget;
- gboolean send_html;
- char *path;
- char *string;
- path = g_strdup_printf ("=%s/config=/mail/msg_format", evolution_dir);
- string = gnome_config_get_string (path);
- g_free (path);
-
- if (string == NULL) {
- send_html = FALSE;
- } else {
- if (!strcasecmp(string, "plain"))
- send_html = FALSE;
- else
- send_html = TRUE;
+ config = mail_config_fetch ();
+ if (config->ids) {
+ const MailConfigIdentity *id;
+
+ id = (MailConfigIdentity *)config->ids->data;
+ sig_file = id->sig;
}
-
+
if (url != NULL)
composer_widget = e_msg_composer_new_from_url (url);
else
- composer_widget = e_msg_composer_new ();
+ composer_widget = e_msg_composer_new_with_sig_file (sig_file);
- e_msg_composer_set_send_html (E_MSG_COMPOSER (composer_widget), send_html);
+ e_msg_composer_set_send_html (E_MSG_COMPOSER (composer_widget),
+ config->send_html);
return composer_widget;
}
@@ -997,11 +996,7 @@ vfolder_edit (BonoboUIHandler *uih, void *user_data, const char *path)
void
providers_config (BonoboUIHandler *uih, void *user_data, const char *path)
{
- GtkWidget *pc;
-
- pc = providers_config_new ();
-
- gtk_widget_show (pc);
+ mail_config ();
}
void