diff options
-rw-r--r-- | composer/e-composer-actions.c | 32 | ||||
-rw-r--r-- | composer/e-composer-actions.h | 2 | ||||
-rw-r--r-- | composer/e-composer-private.h | 1 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 62 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 2 | ||||
-rw-r--r-- | composer/evolution-composer.ui | 2 | ||||
-rw-r--r-- | composer/mail-composer.error.xml | 5 | ||||
-rw-r--r-- | plugins/groupwise-features/mail-send-options.c | 92 | ||||
-rw-r--r-- | plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml | 15 |
9 files changed, 87 insertions, 126 deletions
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c index 93317c83f6..62372a7f1d 100644 --- a/composer/e-composer-actions.c +++ b/composer/e-composer-actions.c @@ -241,31 +241,6 @@ action_send_cb (GtkAction *action, } static void -action_send_options_cb (GtkAction *action, - EMsgComposer *composer) -{ - /* FIXME: KILL-BONOBO - should this be here when -no-undefined removed? */ - /* - EMEvent *event = em_event_peek (); - EMEventTargetComposer *target; - - target = em_event_target_new_composer ( - event, composer, EM_EVENT_COMPOSER_SEND_OPTION); - e_msg_composer_set_send_options (composer, FALSE); - - e_event_emit ( - (EEvent *) event, - "composer.selectsendoption", - (EEventTarget *) target); - */ - - if (!composer->priv->send_invoked) - e_error_run ( - GTK_WINDOW (composer), - "mail-composer:send-options-support", NULL); -} - -static void action_new_message_cb (GtkAction *action, EMsgComposer *composer) { @@ -353,13 +328,6 @@ static GtkActionEntry entries[] = { N_("Send this message"), G_CALLBACK (action_send_cb) }, - { "send-options", - NULL, - N_("_Send Options"), - NULL, - N_("Insert Send options"), - G_CALLBACK (action_send_options_cb) }, - { "new-message", "mail-message-new", N_("New _Message"), diff --git a/composer/e-composer-actions.h b/composer/e-composer-actions.h index 5d49cde158..18c75eb3be 100644 --- a/composer/e-composer-actions.h +++ b/composer/e-composer-actions.h @@ -47,8 +47,6 @@ E_COMPOSER_ACTION ((composer), "security-menu") #define E_COMPOSER_ACTION_SEND(composer) \ E_COMPOSER_ACTION ((composer), "send") -#define E_COMPOSER_ACTION_SEND_OPTIONS(composer) \ - E_COMPOSER_ACTION ((composer), "send-options") #define E_COMPOSER_ACTION_NEW_MESSAGE(composer) \ E_COMPOSER_ACTION ((composer), "new-message") #define E_COMPOSER_ACTION_SMIME_ENCRYPT(composer) \ diff --git a/composer/e-composer-private.h b/composer/e-composer-private.h index 97164e3513..7695df5179 100644 --- a/composer/e-composer-private.h +++ b/composer/e-composer-private.h @@ -115,7 +115,6 @@ struct _EMsgComposerPrivate { CamelMimeMessage *redirect; - gboolean send_invoked; gboolean is_from_message; }; diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index bc1ce20dd6..6f4aee2ff7 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1353,7 +1353,6 @@ msg_composer_account_changed_cb (EMsgComposer *composer) ESignature *signature; EAccount *account; gboolean active; - gboolean sensitive; const gchar *uid; table = e_msg_composer_get_header_table (composer); @@ -1380,57 +1379,11 @@ msg_composer_account_changed_cb (EMsgComposer *composer) signature = uid ? e_get_signature_by_uid (uid) : NULL; e_composer_header_table_set_signature (table, signature); - /* XXX This should be done more generically. The composer - * should not know about particular account types. */ - sensitive = - (strstr (account->transport->url, "exchange") != NULL) || - (strstr (account->transport->url, "groupwise") != NULL); - gtk_action_set_sensitive (ACTION (SEND_OPTIONS), sensitive); - -exit: + 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); -} - struct _drop_data { EMsgComposer *composer; @@ -2138,9 +2091,6 @@ msg_composer_init (EMsgComposer *composer) 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); g_signal_connect_swapped ( @@ -2163,7 +2113,6 @@ 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); /* Attachments */ @@ -3991,15 +3940,6 @@ e_msg_composer_get_attachment_view (EMsgComposer *composer) return E_ATTACHMENT_VIEW (composer->priv->attachment_paned); } -void -e_msg_composer_set_send_options (EMsgComposer *composer, - gboolean send_enable) -{ - g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - - composer->priv->send_invoked = send_enable; -} - GList * e_load_spell_languages (void) { diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index f1e760ff47..ab30093294 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -145,8 +145,6 @@ EComposerHeaderTable * EAttachmentView * e_msg_composer_get_attachment_view (EMsgComposer *composer); -void e_msg_composer_set_send_options (EMsgComposer *composer, - gboolean send_enable); GByteArray * e_msg_composer_get_raw_message_text (EMsgComposer *composer); diff --git a/composer/evolution-composer.ui b/composer/evolution-composer.ui index 1e72d9eafc..f0e9c01de9 100644 --- a/composer/evolution-composer.ui +++ b/composer/evolution-composer.ui @@ -39,7 +39,7 @@ <menuitem action='attach'/> <placeholder name='recent-placeholder'/> <separator/> - <menuitem action='send-options'/> + <placeholder name='send-options'/> <separator/> </placeholder> <separator/> diff --git a/composer/mail-composer.error.xml b/composer/mail-composer.error.xml index a13fe34054..d622c80520 100644 --- a/composer/mail-composer.error.xml +++ b/composer/mail-composer.error.xml @@ -76,9 +76,4 @@ Please make sure that you have the correct version of gtkhtml and libgtkhtml installed.</_secondary> </error> - - <error id="send-options-support" type="error" modal="true"> - <_primary>Send options not available.</_primary> - <_secondary>Send options available only for Novell GroupWise and Microsoft Exchange accounts.</_secondary> - </error> </error-list> diff --git a/plugins/groupwise-features/mail-send-options.c b/plugins/groupwise-features/mail-send-options.c index 3b3e8eb8a7..1db2209f4b 100644 --- a/plugins/groupwise-features/mail-send-options.c +++ b/plugins/groupwise-features/mail-send-options.c @@ -36,13 +36,14 @@ #include "mail/em-event.h" #include "composer/e-msg-composer.h" +#include "composer/e-composer-from-header.h" #include "libedataserver/e-account.h" #include "misc/e-send-options.h" static ESendOptionsDialog * dialog = NULL; -void org_gnome_composer_send_options (EPlugin *ep, EMEventTargetComposer *t); +gboolean gw_ui_composer_actions (GtkUIManager *manager, EMsgComposer *composer); void org_gnome_composer_message_reply (EPlugin *ep, EMEventTargetMessage *t); static time_t @@ -138,37 +139,86 @@ send_options_commit (EMsgComposer *comp, gpointer user_data) } } -void -org_gnome_composer_send_options (EPlugin *ep, EMEventTargetComposer *t) +static gboolean +account_is_groupwise (EAccount *account) { + const gchar *url; - EMsgComposer *comp = (struct _EMsgComposer *)t->composer; - EComposerHeaderTable *table; - EAccount *account = NULL; - gchar *temp = NULL; - - table = e_msg_composer_get_header_table (comp); - account = e_composer_header_table_get_account (table); if (!account) - return; + return FALSE; + + url = e_account_get_string (account, E_ACCOUNT_TRANSPORT_URL); + return url && g_str_has_prefix (url, "groupwise://"); +} + +static void +from_changed_cb (EComposerFromHeader *header, EMsgComposer *composer) +{ + GtkActionGroup *group; + GtkAction *action; + + g_return_if_fail (header != NULL); + g_return_if_fail (composer != NULL); + + group = gtkhtml_editor_get_action_group (GTKHTML_EDITOR (composer), "composer"); + g_return_if_fail (group != NULL); + + action = gtk_action_group_get_action (group, "gw-send-options"); + g_return_if_fail (action != NULL); + + gtk_action_set_visible (action, account_is_groupwise (e_composer_from_header_get_active (header))); +} + +static void +action_send_options_cb (GtkAction *action, EMsgComposer *composer) +{ + g_return_if_fail (action != NULL); + g_return_if_fail (composer != NULL); - temp = strstr (account->transport->url, "groupwise"); - if (!temp) { - return; - } - e_msg_composer_set_send_options (comp, TRUE); /* display the send options dialog */ if (!dialog) { - g_print ("New dialog\n\n"); dialog = e_sendoptions_dialog_new (); } - e_sendoptions_dialog_run (dialog, GTK_WIDGET (comp), E_ITEM_MAIL); + + e_sendoptions_dialog_run (dialog, GTK_WIDGET (composer), E_ITEM_MAIL); g_signal_connect (dialog, "sod_response", - G_CALLBACK (feed_input_data), comp); + G_CALLBACK (feed_input_data), composer); + + g_signal_connect (GTK_WIDGET (composer), "destroy", + G_CALLBACK (send_options_commit), dialog); +} + +gboolean +gw_ui_composer_actions (GtkUIManager *manager, EMsgComposer *composer) +{ + static GtkActionEntry entries[] = { + { "gw-send-options", + NULL, + N_("_Send Options"), + NULL, + N_("Insert Send options"), + G_CALLBACK (action_send_options_cb) } + }; + + GtkhtmlEditor *editor; + EComposerHeaderTable *headers; + EComposerHeader *header; + + editor = GTKHTML_EDITOR (composer); + + /* Add actions to the "composer" action group. */ + gtk_action_group_add_actions ( + gtkhtml_editor_get_action_group (editor, "composer"), + entries, G_N_ELEMENTS (entries), composer); + + headers = e_msg_composer_get_header_table (composer); + header = e_composer_header_table_get_header (headers, E_COMPOSER_HEADER_FROM); + + from_changed_cb (E_COMPOSER_FROM_HEADER (header), composer); + g_signal_connect (G_OBJECT (header), "changed", G_CALLBACK (from_changed_cb), composer); - g_signal_connect (GTK_WIDGET (comp), "destroy", - G_CALLBACK (send_options_commit), dialog); + return TRUE; } void diff --git a/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml b/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml index 7e7c3efdf7..e4e8a9a54f 100644 --- a/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml +++ b/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml @@ -72,9 +72,22 @@ </ui-manager> </hook> + <hook class="org.gnome.evolution.ui:1.0"> + <ui-manager id="org.gnome.evolution.composer" callback="gw_ui_composer_actions"> + <menubar name="main-menu"> + <menu action="insert-menu"> + <placeholder name="insert-menu-top"> + <placeholder name="send-options"> + <menuitem action="gw-send-options"/> + </placeholder> + </placeholder> + </menu> + </menubar> + </ui-manager> + </hook> + <hook class="org.gnome.evolution.mail.events:1.0"> <event target="message" id="message.reading" type="pass" handle="org_gnome_popup_wizard"/> - <event id="composer.selectsendoption" handle="org_gnome_composer_send_options" target="composer" enable="sendoption"/> <event id="message.replying" handle="org_gnome_composer_message_reply" target="message" enable="reply"/> </hook> |