[evolution-patches] (mail) displaying only those account which are enabled in "From" field of composer window



Hi,
The attached patch displays only those accounts that are enabled in the
"From" header of the composer window. 

So, when you have multiple accounts configured, but only one (or a
subset of the configured accounts), only those that are actually enabled
in the Edit->preferences would be shown.

If the default account is disabled, it is not shown.

If none of the accounts are enabled, and you try to compose and message
and send it across, it just stays in the outbox, until an account is
enabled and sent. A better way probably would be to gray out the "Send"
button when no account is enabled. But i really could not figure how to
do that atm.

Cheers,
partha

Index: mail/mail-config.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.c,v
retrieving revision 1.320
diff -u -p -r1.320 mail-config.c
--- mail/mail-config.c	11 Aug 2005 03:55:17 -0000	1.320
+++ mail/mail-config.c	18 Oct 2005 07:10:40 -0000
@@ -741,7 +741,7 @@ mail_config_get_default_transport (void)
 	EIterator *iter;
 	
 	account = mail_config_get_default_account ();
-	if (account && account->transport && account->transport->url && account->transport->url[0])
+	if (account && account->enabled && account->transport && account->transport->url && account->transport->url[0])
 		return account->transport;
 	
 	/* return the first account with a transport? */
@@ -749,7 +749,7 @@ mail_config_get_default_transport (void)
 	while (e_iterator_is_valid (iter)) {
 		account = (EAccount *) e_iterator_get (iter);
 		
-		if (account->transport && account->transport->url && account->transport->url[0]) {
+		if (account->enabled && account->transport && account->transport->url && account->transport->url[0]) {
 			g_object_unref (iter);
 			
 			return account->transport;
Index: mail/em-composer-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-composer-utils.c,v
retrieving revision 1.43
diff -u -p -r1.43 em-composer-utils.c
--- mail/em-composer-utils.c	28 Sep 2005 10:34:18 -0000	1.43
+++ mail/em-composer-utils.c	18 Oct 2005 07:10:40 -0000
@@ -593,6 +593,13 @@ create_new_composer (const char *subject
 	if (fromuri)
 		account = mail_config_get_account_by_source_url(fromuri);
 
+	/* If the account corresponding to the fromuri is not enabled.
+	 * We get the preffered account from the composer and use that
+	 * as the account to send the mail.
+	 */
+	if (!account)
+		account = e_msg_composer_get_preferred_account (composer);
+
 	e_msg_composer_set_headers (composer, account?account->name:NULL, NULL, NULL, NULL, subject);
 
 	em_composer_utils_setup_default_callbacks (composer);
@@ -1270,7 +1277,7 @@ generate_account_hash (void)
 	
 	/* add the default account to the hash first */
 	if ((def = mail_config_get_default_account ())) {
-		if (def->id->address)
+		if (def->enabled && def->id->address)
 			g_hash_table_insert (account_hash, (char *) def->id->address, (void *) def);
 	}
 	
@@ -1278,7 +1285,7 @@ generate_account_hash (void)
 	while (e_iterator_is_valid (iter)) {
 		account = (EAccount *) e_iterator_get (iter);
 		
-		if (account->id->address) {
+		if (account->enabled && account->id->address) {
 			EAccount *acnt;
 			
 			/* Accounts with identical email addresses that are enabled
Index: composer/e-msg-composer-hdrs.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer-hdrs.c,v
retrieving revision 1.145
diff -u -p -r1.145 e-msg-composer-hdrs.c
--- composer/e-msg-composer-hdrs.c	5 Oct 2005 10:38:01 -0000	1.145
+++ composer/e-msg-composer-hdrs.c	18 Oct 2005 07:10:41 -0000
@@ -391,7 +391,7 @@ create_from_optionmenu (EMsgComposerHdrs
 			continue;
 		}
 		
-		if (account->id->address && *account->id->address && account_can_send (account)) {
+		if (account->enabled && account->id->address && *account->id->address && account_can_send (account)) {
 			/* If the account has a unique email address, just
 			 * show that. Otherwise include the account name.
 			 */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]