aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-09-25 05:45:35 +0800
committerDan Winship <danw@src.gnome.org>2002-09-25 05:45:35 +0800
commit370fd18999d70acc750da8d3c621d46eee29f6bd (patch)
treead2ebe78a351cfcfc2f938d7c4675d45dbec97fb
parentefa2ba8ab068f38e435a995d05cd99dbd1eb6fd4 (diff)
downloadgsoc2013-evolution-370fd18999d70acc750da8d3c621d46eee29f6bd.tar
gsoc2013-evolution-370fd18999d70acc750da8d3c621d46eee29f6bd.tar.gz
gsoc2013-evolution-370fd18999d70acc750da8d3c621d46eee29f6bd.tar.bz2
gsoc2013-evolution-370fd18999d70acc750da8d3c621d46eee29f6bd.tar.lz
gsoc2013-evolution-370fd18999d70acc750da8d3c621d46eee29f6bd.tar.xz
gsoc2013-evolution-370fd18999d70acc750da8d3c621d46eee29f6bd.tar.zst
gsoc2013-evolution-370fd18999d70acc750da8d3c621d46eee29f6bd.zip
Only append the account name to the end of the From menu item if the email
* e-msg-composer-hdrs.c (create_from_optionmenu): Only append the account name to the end of the From menu item if the email address is not unique. (That was added for people who have multiple accounts with the same email address but different transports. The rest of us don't need to be reminded of the account name, and having it there can make the window very wide.) svn path=/trunk/; revision=18207
-rw-r--r--composer/ChangeLog9
-rw-r--r--composer/e-msg-composer-hdrs.c25
2 files changed, 30 insertions, 4 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 6ec031ae5c..d30f37e83d 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,12 @@
+2002-09-24 Dan Winship <danw@ximian.com>
+
+ * e-msg-composer-hdrs.c (create_from_optionmenu): Only append the
+ account name to the end of the From menu item if the email address
+ is not unique. (That was added for people who have multiple
+ accounts with the same email address but different transports. The
+ rest of us don't need to be reminded of the account name, and
+ having it there can make the window very wide.)
+
2002-09-24 Zbigniew Chyla <cyba@gnome.pl>
* e-msg-composer-attachment-bar.c (size_to_string):
diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c
index c26e0e0623..a6911b71fd 100644
--- a/composer/e-msg-composer-hdrs.c
+++ b/composer/e-msg-composer-hdrs.c
@@ -192,9 +192,11 @@ static GtkWidget *
create_from_optionmenu (EMsgComposerHdrs *hdrs)
{
GtkWidget *omenu, *menu, *first = NULL;
- const GSList *accounts;
+ const GSList *accounts, *a;
+ const MailConfigAccount *account;
+ GPtrArray *addresses;
GtkWidget *item, *hbox;
- int i = 0, history = 0;
+ int i = 0, history = 0, m, matches;
int default_account;
omenu = gtk_option_menu_new ();
@@ -202,9 +204,15 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs)
default_account = mail_config_get_default_account_num ();
+ /* Make list of account email addresses */
+ addresses = g_ptr_array_new ();
accounts = mail_config_get_accounts ();
+ for (a = accounts; a; a = a->next) {
+ account = a->data;
+ g_ptr_array_add (addresses, account->id->address);
+ }
+
while (accounts) {
- const MailConfigAccount *account;
char *label;
char *native_label;
@@ -217,7 +225,15 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs)
}
if (account->id->address && *account->id->address) {
- if (strcmp (account->name, account->id->address))
+ /* If the account has a unique email address, just
+ * show that. Otherwise include the account name.
+ */
+ for (m = matches = 0; m < addresses->len; m++) {
+ if (!strcmp (account->id->address, addresses->pdata[m]))
+ matches++;
+ }
+
+ if (matches > 1)
label = g_strdup_printf ("%s <%s> (%s)", account->id->name,
account->id->address, account->name);
else
@@ -247,6 +263,7 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs)
accounts = accounts->next;
}
+ g_ptr_array_free (addresses, TRUE);
gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);