aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-10-15 22:16:45 +0800
committerMilan Crha <mcrha@redhat.com>2009-10-15 22:16:45 +0800
commit37cd058adf025c4164bc88926b2608df40a0f5b9 (patch)
tree8308f17d48837e97c4f945d2d4774db134f18ca8
parentb3b783f14644f1b736282649ad625a7ae2ea398e (diff)
downloadgsoc2013-evolution-37cd058adf025c4164bc88926b2608df40a0f5b9.tar.gz
gsoc2013-evolution-37cd058adf025c4164bc88926b2608df40a0f5b9.tar.zst
gsoc2013-evolution-37cd058adf025c4164bc88926b2608df40a0f5b9.zip
Bug #336337 - Send & receive dialog shows the default smtp server
-rw-r--r--mail/mail-ops.c10
-rw-r--r--mail/mail-send-recv.c46
2 files changed, 52 insertions, 4 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 63f7a90eb6..b65c7f3c59 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -445,9 +445,12 @@ static const gchar *resent_recipients[] = {
CAMEL_RECIPIENT_TYPE_RESENT_BCC
};
+struct _send_queue_msg;
+static void report_status (struct _send_queue_msg *m, enum camel_filter_status_t status, gint pc, const gchar *desc, ...);
+
/* send 1 message to a specific transport */
static void
-mail_send_message(CamelFolder *queue, const gchar *uid, const gchar *destination, CamelFilterDriver *driver, CamelException *ex)
+mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *uid, const gchar *destination, CamelFilterDriver *driver, CamelException *ex)
{
EAccount *account = NULL;
const CamelInternetAddress *iaddr;
@@ -499,6 +502,9 @@ mail_send_message(CamelFolder *queue, const gchar *uid, const gchar *destination
sent_folder_uri = g_strstrip(g_strdup(tmp));
}
+ /* let the dialog know the right account it is using; percentage is ignored */
+ report_status (m, CAMEL_FILTER_STATUS_ACTION, 0, transport_url ? transport_url : destination);
+
/* Check for email sending */
from = (CamelAddress *) camel_internet_address_new ();
resent_from = camel_medium_get_header (CAMEL_MEDIUM (message), "Resent-From");
@@ -741,7 +747,7 @@ send_queue_exec (struct _send_queue_msg *m)
if (!m->cancel)
camel_operation_progress (NULL, (i+1) * 100 / send_uids->len);
- mail_send_message (m->queue, send_uids->pdata[i], m->destination, m->driver, &ex);
+ mail_send_message (m, m->queue, send_uids->pdata[i], m->destination, m->driver, &ex);
if (camel_exception_is_set (&ex)) {
if (ex.id != CAMEL_EXCEPTION_USER_CANCEL) {
/* merge exceptions into one */
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 7f7c99724d..597ec61bf0 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -121,6 +121,9 @@ struct _send_info {
gchar *what;
gint pc;
+ GtkWidget *send_account_label;
+ char *send_url;
+
/*time_t update;*/
struct _send_data *data;
};
@@ -149,6 +152,7 @@ free_send_info(struct _send_info *info)
if (info->timeout_id != 0)
g_source_remove(info->timeout_id);
g_free(info->what);
+ g_free (info->send_url);
g_free(info);
}
@@ -259,12 +263,17 @@ dialog_response(GtkDialog *gd, gint button, struct _send_data *data)
}
}
+static GStaticMutex status_lock = G_STATIC_MUTEX_INIT;
+static gchar *format_url (const gchar *internal_url, const gchar *account_name);
+
static gint
operation_status_timeout(gpointer data)
{
struct _send_info *info = data;
if (info->progress_bar) {
+ g_static_mutex_lock (&status_lock);
+
gtk_progress_bar_set_fraction (
GTK_PROGRESS_BAR (info->progress_bar),
info->pc / 100.0);
@@ -272,6 +281,21 @@ operation_status_timeout(gpointer data)
gtk_label_set_text (
GTK_LABEL (info->status_label),
info->what);
+ if (info->send_url && info->send_account_label) {
+ char *tmp = format_url (info->send_url, NULL);
+
+ g_free (info->send_url);
+ info->send_url = NULL;
+
+ gtk_label_set_markup (
+ GTK_LABEL (info->send_account_label),
+ tmp);
+
+ g_free (tmp);
+ }
+
+ g_static_mutex_unlock (&status_lock);
+
return TRUE;
}
@@ -281,10 +305,24 @@ operation_status_timeout(gpointer data)
static void
set_send_status(struct _send_info *info, const gchar *desc, gint pc)
{
- /* FIXME: LOCK */
+ g_static_mutex_lock (&status_lock);
+
g_free(info->what);
info->what = g_strdup(desc);
info->pc = pc;
+
+ g_static_mutex_unlock (&status_lock);
+}
+
+static void
+set_send_account (struct _send_info *info, const char *account_url)
+{
+ g_static_mutex_lock (&status_lock);
+
+ g_free (info->send_url);
+ info->send_url = g_strdup (account_url);
+
+ g_static_mutex_unlock (&status_lock);
}
/* for camel operation status */
@@ -307,7 +345,7 @@ operation_status(CamelOperation *op, const gchar *what, gint pc, gpointer data)
}
static gchar *
-format_url(const gchar *internal_url, const gchar *account_name)
+format_url (const gchar *internal_url, const gchar *account_name)
{
CamelURL *url;
gchar *pretty_url;
@@ -615,6 +653,7 @@ build_dialog (GtkWindow *parent,
info->cancel_button = cancel_button;
info->data = data;
info->status_label = status_label;
+ info->send_account_label = label;
g_signal_connect (
cancel_button, "clicked",
@@ -679,6 +718,9 @@ receive_status (CamelFilterDriver *driver, enum camel_filter_status_t status, gi
case CAMEL_FILTER_STATUS_END:
set_send_status(info, desc, pc);
break;
+ case CAMEL_FILTER_STATUS_ACTION:
+ set_send_account (info, desc);
+ break;
default:
break;
}