aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-callbacks.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r--mail/mail-callbacks.c93
1 files changed, 41 insertions, 52 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index ee9de6d195..9c7cd1e2b8 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -33,8 +33,6 @@
#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"
@@ -67,8 +65,6 @@ struct post_send_data {
static gboolean
check_configured (FolderBrowser *fb)
{
- MailConfigDruid *druid;
-
if (mail_config_is_configured ())
return TRUE;
@@ -87,9 +83,7 @@ check_configured (FolderBrowser *fb)
switch (gnome_dialog_run_and_close (GNOME_DIALOG (dialog))) {
case 0:
- /* FIXME: should we block until mail-config is done? */
- druid = mail_config_druid_new (fb->shell);
- gtk_widget_show (GTK_WIDGET (druid));
+ mail_config_druid (fb->shell);
break;
case 1:
default:
@@ -104,18 +98,17 @@ check_configured (FolderBrowser *fb)
static gboolean
check_send_configuration (FolderBrowser *fb)
{
- const MailConfigAccount *account;
+ MailConfigService *xport = NULL;
/* Check general */
+
if (!check_configured (fb)) {
return FALSE;
}
- /* Get the default account */
- account = mail_config_get_default_account ();
-
/* Check for an identity */
- if (!account) {
+
+ if (!mail_config_get_default_identity ()) {
GtkWidget *message;
message = gnome_warning_dialog_parented (_("You need to configure an identity\n"
@@ -127,7 +120,9 @@ check_send_configuration (FolderBrowser *fb)
}
/* Check for a transport */
- if (!account->transport || !account->transport->url) {
+
+ xport = mail_config_get_transport ();
+ if (!xport || !xport->url) {
GtkWidget *message;
message = gnome_warning_dialog_parented (_("You need to configure a mail transport\n"
@@ -204,14 +199,14 @@ void
send_queued_mail (GtkWidget *widget, gpointer user_data)
{
extern CamelFolder *outbox_folder;
- const MailConfigAccount *account;
+ MailConfigService *transport;
if (!mail_config_is_configured ()) {
return;
}
- account = mail_config_get_default_account ();
- if (!account->transport) {
+ transport = mail_config_get_transport ();
+ if (!transport) {
GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (user_data),
GTK_TYPE_WINDOW);
@@ -229,7 +224,7 @@ send_queued_mail (GtkWidget *widget, gpointer user_data)
return;
}
- mail_do_send_queue (outbox_folder, account->transport->url);
+ mail_do_send_queue (outbox_folder, transport->url);
}
void
@@ -296,7 +291,7 @@ composer_sent_cb(char *uri, CamelMimeMessage *message, gboolean sent, void *data
void
composer_send_cb (EMsgComposer *composer, gpointer data)
{
- const MailConfigAccount *account = NULL;
+ MailConfigService *xport = NULL;
CamelMimeMessage *message;
const CamelInternetAddress *iaddr;
const char *subject;
@@ -304,7 +299,7 @@ composer_send_cb (EMsgComposer *composer, gpointer data)
struct _send_data *send;
/* Config info */
- account = mail_config_get_default_account ();
+ xport = mail_config_get_transport ();
/* Get the message */
message = e_msg_composer_get_message (composer);
@@ -333,13 +328,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 (account->transport->url, message, composer_sent_cb, send);
+ mail_send_mail(xport->url, message, composer_sent_cb, send);
}
void
@@ -379,25 +374,25 @@ composer_postpone_cb (EMsgComposer *composer, gpointer data)
static GtkWidget *
create_msg_composer (const char *url)
{
- 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;
+ 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;
}
void
@@ -504,15 +499,13 @@ 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;
-
- 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 ());
+ MailConfigIdentity *id;
+
+ id = mail_config_get_default_identity ();
+ composer = e_msg_composer_new_with_sig_file(id?id->sig:NULL, mail_config_send_html());
if (composer) {
gtk_signal_connect (GTK_OBJECT (composer), "send",
GTK_SIGNAL_FUNC (composer_send_cb), NULL);
@@ -944,11 +937,7 @@ vfolder_edit_vfolders (BonoboUIComponent *uih, void *user_data, const char *path
void
providers_config (BonoboUIComponent *uih, void *user_data, const char *path)
{
- /* 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));
+ mail_config ((FOLDER_BROWSER (user_data))->shell);
}
/*