From 936490012d0c39fa0439b684acf25b3051afb07f Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 21 Jun 2008 13:26:09 +0000 Subject: ** Fixes bug #310988 2008-06-21 Matthew Barnes ** Fixes bug #310988 * e-msg-composer.c: Don't even show the "send-options" action unless an Exchange or GroupWise account appears in the From combo box. svn path=/trunk/; revision=35667 --- composer/e-msg-composer.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'composer/e-msg-composer.c') diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 27cb33f33d..6ccbde98f6 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1717,6 +1717,45 @@ exit: e_msg_composer_show_sig_file (composer); } +static void +msg_composer_account_list_changed_cb (EMsgComposer *composer) +{ + EComposerHeaderTable *table; + EAccountList *account_list; + EIterator *iterator; + gboolean visible = FALSE; + + /* Determine whether to show the "send-options" action by + * examining the account list for account types that support it. + * + * XXX I'd prefer a more general way of doing this. The composer + * should not know about particular account types. Perhaps + * add a "supports advanced send options" flag to EAccount. */ + + table = E_COMPOSER_HEADER_TABLE (composer->priv->header_table); + account_list = e_composer_header_table_get_account_list (table); + iterator = e_list_get_iterator (E_LIST (account_list)); + + while (!visible && e_iterator_is_valid (iterator)) { + EAccount *account; + const gchar *url; + + /* XXX EIterator misuses const. */ + account = (EAccount *) e_iterator_get (iterator); + e_iterator_next (iterator); + + if (!account->enabled) + continue; + + url = account->transport->url; + visible |= (strstr (url, "exchange") != NULL); + visible |= (strstr (url, "groupwise") != NULL); + } + + gtk_action_set_visible (ACTION (SEND_OPTIONS), visible); + g_object_unref (iterator); +} + static void msg_composer_attach_message (EMsgComposer *composer, CamelMimeMessage *msg) @@ -2763,6 +2802,9 @@ msg_composer_init (EMsgComposer *composer) g_signal_connect_swapped ( table, "notify::account", G_CALLBACK (msg_composer_account_changed_cb), composer); + g_signal_connect_swapped ( + table, "notify::account-list", + G_CALLBACK (msg_composer_account_list_changed_cb), composer); g_signal_connect_swapped ( table, "notify::destinations-bcc", G_CALLBACK (msg_composer_notify_header_cb), composer); @@ -2786,6 +2828,7 @@ msg_composer_init (EMsgComposer *composer) G_CALLBACK (msg_composer_notify_header_cb), composer); msg_composer_account_changed_cb (composer); + msg_composer_account_list_changed_cb (composer); /* Attachment Bar */ @@ -2846,14 +2889,12 @@ static EMsgComposer * create_composer (gint visible_mask) { EMsgComposer *composer; - EMsgComposerPrivate *p; EComposerHeaderTable *table; GtkToggleAction *action; gboolean active; composer = g_object_new (E_TYPE_MSG_COMPOSER, NULL); table = E_COMPOSER_HEADER_TABLE (composer->priv->header_table); - p = composer->priv; /* Configure View Menu */ -- cgit v1.2.3