aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac3
-rw-r--r--mail/e-mail-browser.c6
-rw-r--r--mail/e-mail-reader.c533
-rw-r--r--mail/e-mail-reader.h1
-rw-r--r--plugins/mail-to-task/mail-to-task.c135
-rw-r--r--plugins/mail-to-task/org-gnome-mail-to-task.eplug.xml26
-rw-r--r--plugins/mailing-list-actions/Makefile.am5
-rw-r--r--plugins/mailing-list-actions/mailing-list-actions.c262
-rw-r--r--plugins/mailing-list-actions/org-gnome-mailing-list-actions.eplug.xml92
-rw-r--r--plugins/mailing-list-actions/org-gnome-mailing-list-actions.xml25
-rw-r--r--ui/evolution-mail-reader.ui1
11 files changed, 649 insertions, 440 deletions
diff --git a/configure.ac b/configure.ac
index 0b601aa2e3..1f709dc44e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1786,14 +1786,13 @@ plugins_experimental="$plugins_experimental_always $IPOD_SYNC $TNEF_ATTACHMENTS"
all_plugins_experimental="$plugins_experimental_always ipod-sync tnef-attachments"
dnl Temporary KILL-BONOBO hack
-enable_plugins="attachment-reminder addressbook-file audio-inline backup-restore bbdb bogo-junk-plugin caldav calendar-file calendar-http calendar-weather default-mailer default-source email-custom-header external-editor face google-account-setup hula-account-setup imap-features itip-formatter mail-notification mail-to-task mark-all-read plugin-manager prefer-plain profiler pst-import publish-calendar sa-junk-plugin save-calendar startup-wizard subject-thread templates $TNEF_ATTACHMENTS vcard-inline webdav-account-setup"
+enable_plugins="attachment-reminder addressbook-file audio-inline backup-restore bbdb bogo-junk-plugin caldav calendar-file calendar-http calendar-weather default-mailer default-source email-custom-header external-editor face google-account-setup hula-account-setup imap-features itip-formatter mailing-list-actions mail-notification mail-to-task mark-all-read plugin-manager prefer-plain profiler pst-import publish-calendar sa-junk-plugin save-calendar startup-wizard subject-thread templates $TNEF_ATTACHMENTS vcard-inline webdav-account-setup"
dnl PLUGINS NOT BUILDING YET
dnl ------------------------
dnl exchange-operations
dnl groupwise-features
dnl ipod-sync
-dnl mailing-list-actions
case x"$enable_plugins" in
xno)
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
index fb79932653..ea860c016f 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -26,6 +26,7 @@
#include <camel/camel-folder.h>
#include "e-util/e-util.h"
+#include "e-util/e-plugin-ui.h"
#include "e-util/gconf-bridge.h"
#include "shell/e-shell.h"
@@ -372,6 +373,7 @@ mail_browser_constructed (GObject *object)
GtkHTML *html;
const gchar *domain;
const gchar *key;
+ const gchar *id;
guint merge_id;
priv = E_MAIL_BROWSER_GET_PRIVATE (object);
@@ -479,6 +481,10 @@ mail_browser_constructed (GObject *object)
object = G_OBJECT (reader);
key = "/apps/evolution/mail/display/show_deleted";
gconf_bridge_bind_property (bridge, key, object, "show-deleted");
+
+ id = "org.gnome.evolution.mail.browser";
+ e_plugin_ui_register_manager (ui_manager, id, object);
+ e_plugin_ui_enable_manager (ui_manager, id);
}
static gboolean
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 96ed8cf379..72f79181f8 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -54,6 +54,7 @@ enum {
CHANGED,
FOLDER_LOADED,
SHOW_SEARCH_BAR,
+ UPDATE_ACTIONS,
LAST_SIGNAL
};
@@ -1883,6 +1884,269 @@ mail_reader_set_message (EMailReader *reader,
}
static void
+mail_reader_update_actions (EMailReader *reader)
+{
+ EShell *shell;
+ EShellBackend *shell_backend;
+ EShellSettings *shell_settings;
+ GtkAction *action;
+ GtkActionGroup *action_group;
+ const gchar *action_name;
+ gboolean sensitive;
+ guint32 state;
+
+ /* Be descriptive. */
+ gboolean any_messages_selected;
+ gboolean disable_printing;
+ gboolean enable_flag_clear;
+ gboolean enable_flag_completed;
+ gboolean enable_flag_for_followup;
+ gboolean have_an_account;
+ gboolean multiple_messages_selected;
+ gboolean selection_has_deleted_messages;
+ gboolean selection_has_important_messages;
+ gboolean selection_has_junk_messages;
+ gboolean selection_has_not_junk_messages;
+ gboolean selection_has_read_messages;
+ gboolean selection_has_undeleted_messages;
+ gboolean selection_has_unimportant_messages;
+ gboolean selection_has_unread_messages;
+ gboolean selection_is_mailing_list;
+ gboolean single_message_selected;
+
+ action_group = e_mail_reader_get_action_group (reader);
+ state = e_mail_reader_check_state (reader);
+
+ shell_backend = e_mail_reader_get_shell_backend (reader);
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ disable_printing = e_shell_settings_get_boolean (
+ shell_settings, "disable-printing");
+
+ have_an_account =
+ (state & E_MAIL_READER_HAVE_ACCOUNT);
+ single_message_selected =
+ (state & E_MAIL_READER_SELECTION_SINGLE);
+ multiple_messages_selected =
+ (state & E_MAIL_READER_SELECTION_MULTIPLE);
+ /* FIXME Missing CAN_ADD_SENDER */
+ enable_flag_clear =
+ (state & E_MAIL_READER_SELECTION_FLAG_CLEAR);
+ enable_flag_completed =
+ (state & E_MAIL_READER_SELECTION_FLAG_COMPLETED);
+ enable_flag_for_followup =
+ (state & E_MAIL_READER_SELECTION_FLAG_FOLLOWUP);
+ selection_has_deleted_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_DELETED);
+ selection_has_important_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_IMPORTANT);
+ selection_has_junk_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_JUNK);
+ selection_has_not_junk_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_NOT_JUNK);
+ selection_has_read_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_READ);
+ selection_has_undeleted_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_UNDELETED);
+ selection_has_unimportant_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_UNIMPORTANT);
+ selection_has_unread_messages =
+ (state & E_MAIL_READER_SELECTION_HAS_UNREAD);
+ selection_is_mailing_list =
+ (state & E_MAIL_READER_SELECTION_IS_MAILING_LIST);
+
+ any_messages_selected =
+ (single_message_selected || multiple_messages_selected);
+
+ action_name = "mail-check-for-junk";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-copy";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-delete";
+ sensitive = selection_has_undeleted_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-filters-apply";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-forward";
+ sensitive = have_an_account && any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-forward-attached";
+ sensitive = have_an_account && any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-forward-inline";
+ sensitive = have_an_account && single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-forward-quoted";
+ sensitive = have_an_account && single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-load-images";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-mark-important";
+ sensitive = selection_has_unimportant_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-mark-junk";
+ sensitive = selection_has_not_junk_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-mark-notjunk";
+ sensitive = selection_has_junk_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-mark-read";
+ sensitive = selection_has_unread_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-mark-unimportant";
+ sensitive = selection_has_important_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-mark-unread";
+ sensitive = selection_has_read_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-message-edit";
+ sensitive = have_an_account && single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-message-new";
+ sensitive = have_an_account;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-message-open";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-move";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-next-important";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-next-thread";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-next-unread";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-previous-important";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-previous-unread";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-print";
+ sensitive = single_message_selected && !disable_printing;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-print-preview";
+ sensitive = single_message_selected && !disable_printing;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-redirect";
+ sensitive = have_an_account && single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-reply-all";
+ sensitive = have_an_account && single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-reply-list";
+ sensitive = have_an_account && single_message_selected &&
+ selection_is_mailing_list;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-reply-sender";
+ sensitive = have_an_account && single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-save-as";
+ sensitive = any_messages_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-select-all";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-show-source";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-undelete";
+ sensitive = selection_has_deleted_messages;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-zoom-100";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-zoom-in";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+
+ action_name = "mail-zoom-out";
+ sensitive = single_message_selected;
+ action = e_mail_reader_get_action (reader, action_name);
+ gtk_action_set_sensitive (action, sensitive);
+}
+
+static void
mail_reader_init_charset_actions (EMailReader *reader)
{
GtkActionGroup *action_group;
@@ -1916,6 +2180,7 @@ mail_reader_class_init (EMailReaderIface *iface)
{
iface->set_folder = mail_reader_set_folder;
iface->set_message = mail_reader_set_message;
+ iface->update_actions = mail_reader_update_actions;
signals[CHANGED] = g_signal_new (
"changed",
@@ -1941,6 +2206,15 @@ mail_reader_class_init (EMailReaderIface *iface)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+
+ signals[UPDATE_ACTIONS] = g_signal_new (
+ "update-actions",
+ G_OBJECT_CLASS_TYPE (iface),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EMailReaderIface, update_actions),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
GType
@@ -2289,266 +2563,9 @@ e_mail_reader_check_state (EMailReader *reader)
void
e_mail_reader_update_actions (EMailReader *reader)
{
- EShell *shell;
- EShellBackend *shell_backend;
- EShellSettings *shell_settings;
- GtkAction *action;
- GtkActionGroup *action_group;
- const gchar *action_name;
- gboolean sensitive;
- guint32 state;
-
- /* Be descriptive. */
- gboolean any_messages_selected;
- gboolean disable_printing;
- gboolean enable_flag_clear;
- gboolean enable_flag_completed;
- gboolean enable_flag_for_followup;
- gboolean have_an_account;
- gboolean multiple_messages_selected;
- gboolean selection_has_deleted_messages;
- gboolean selection_has_important_messages;
- gboolean selection_has_junk_messages;
- gboolean selection_has_not_junk_messages;
- gboolean selection_has_read_messages;
- gboolean selection_has_undeleted_messages;
- gboolean selection_has_unimportant_messages;
- gboolean selection_has_unread_messages;
- gboolean selection_is_mailing_list;
- gboolean single_message_selected;
-
g_return_if_fail (E_IS_MAIL_READER (reader));
- action_group = e_mail_reader_get_action_group (reader);
- state = e_mail_reader_check_state (reader);
-
- shell_backend = e_mail_reader_get_shell_backend (reader);
- shell = e_shell_backend_get_shell (shell_backend);
- shell_settings = e_shell_get_shell_settings (shell);
-
- disable_printing = e_shell_settings_get_boolean (
- shell_settings, "disable-printing");
-
- have_an_account =
- (state & E_MAIL_READER_HAVE_ACCOUNT);
- single_message_selected =
- (state & E_MAIL_READER_SELECTION_SINGLE);
- multiple_messages_selected =
- (state & E_MAIL_READER_SELECTION_MULTIPLE);
- /* FIXME Missing CAN_ADD_SENDER */
- enable_flag_clear =
- (state & E_MAIL_READER_SELECTION_FLAG_CLEAR);
- enable_flag_completed =
- (state & E_MAIL_READER_SELECTION_FLAG_COMPLETED);
- enable_flag_for_followup =
- (state & E_MAIL_READER_SELECTION_FLAG_FOLLOWUP);
- selection_has_deleted_messages =
- (state & E_MAIL_READER_SELECTION_HAS_DELETED);
- selection_has_important_messages =
- (state & E_MAIL_READER_SELECTION_HAS_IMPORTANT);
- selection_has_junk_messages =
- (state & E_MAIL_READER_SELECTION_HAS_JUNK);
- selection_has_not_junk_messages =
- (state & E_MAIL_READER_SELECTION_HAS_NOT_JUNK);
- selection_has_read_messages =
- (state & E_MAIL_READER_SELECTION_HAS_READ);
- selection_has_undeleted_messages =
- (state & E_MAIL_READER_SELECTION_HAS_UNDELETED);
- selection_has_unimportant_messages =
- (state & E_MAIL_READER_SELECTION_HAS_UNIMPORTANT);
- selection_has_unread_messages =
- (state & E_MAIL_READER_SELECTION_HAS_UNREAD);
- selection_is_mailing_list =
- (state & E_MAIL_READER_SELECTION_IS_MAILING_LIST);
-
- any_messages_selected =
- (single_message_selected || multiple_messages_selected);
-
- action_name = "mail-check-for-junk";
- sensitive = any_messages_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-copy";
- sensitive = any_messages_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-delete";
- sensitive = selection_has_undeleted_messages;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-filters-apply";
- sensitive = any_messages_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-forward";
- sensitive = have_an_account && any_messages_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-forward-attached";
- sensitive = have_an_account && any_messages_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-forward-inline";
- sensitive = have_an_account && single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-forward-quoted";
- sensitive = have_an_account && single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-load-images";
- sensitive = single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-mark-important";
- sensitive = selection_has_unimportant_messages;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-mark-junk";
- sensitive = selection_has_not_junk_messages;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-mark-notjunk";
- sensitive = selection_has_junk_messages;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-mark-read";
- sensitive = selection_has_unread_messages;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-mark-unimportant";
- sensitive = selection_has_important_messages;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-mark-unread";
- sensitive = selection_has_read_messages;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-message-edit";
- sensitive = have_an_account && single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-message-new";
- sensitive = have_an_account;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-message-open";
- sensitive = any_messages_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-move";
- sensitive = any_messages_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-next-important";
- sensitive = single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-next-thread";
- sensitive = single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-next-unread";
- sensitive = single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-previous-important";
- sensitive = single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-previous-unread";
- sensitive = single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-print";
- sensitive = single_message_selected && !disable_printing;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-print-preview";
- sensitive = single_message_selected && !disable_printing;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-redirect";
- sensitive = have_an_account && single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-reply-all";
- sensitive = have_an_account && single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-reply-list";
- sensitive = have_an_account && single_message_selected &&
- selection_is_mailing_list;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-reply-sender";
- sensitive = have_an_account && single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-save-as";
- sensitive = any_messages_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-select-all";
- sensitive = single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-show-source";
- sensitive = single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-undelete";
- sensitive = selection_has_deleted_messages;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-zoom-100";
- sensitive = single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-zoom-in";
- sensitive = single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
-
- action_name = "mail-zoom-out";
- sensitive = single_message_selected;
- action = e_mail_reader_get_action (reader, action_name);
- gtk_action_set_sensitive (action, sensitive);
+ g_signal_emit (reader, signals[UPDATE_ACTIONS], 0);
}
GtkAction *
diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h
index 6830e4f84c..d1b713d051 100644
--- a/mail/e-mail-reader.h
+++ b/mail/e-mail-reader.h
@@ -94,6 +94,7 @@ struct _EMailReaderIface {
/* Signals */
void (*show_search_bar) (EMailReader *reader);
+ void (*update_actions) (EMailReader *reader);
};
GType e_mail_reader_get_type (void);
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index 1b8ad64768..cef866589d 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -46,6 +46,7 @@
#include <camel/camel-stream-mem.h>
#include <camel/camel-utf8.h>
+#include <mail/e-mail-browser.h>
#include <mail/em-utils.h>
#include <mail/em-format-html.h>
#include <mail/mail-config.h>
@@ -66,7 +67,9 @@
#define E_SHELL_WINDOW_ACTION_CONVERT_TO_TASK(window) \
E_SHELL_WINDOW_ACTION ((window), "mail-convert-to-task")
-gboolean e_plugin_ui_init (GtkUIManager *ui_manager,
+gboolean mail_browser_init (GtkUIManager *ui_manager,
+ EMailBrowser *browser);
+gboolean mail_shell_view_init (GtkUIManager *ui_manager,
EShellView *shell_view);
static gchar *
@@ -948,7 +951,11 @@ action_mail_convert_to_task_cb (GtkAction *action,
mail_to_event (E_CAL_SOURCE_TYPE_TODO, FALSE, shell_view);
}
-static GtkActionEntry entries[] = {
+/* Note, we're not using EPopupActions here because we update the state
+ * of entire actions groups instead of individual actions. EPopupActions
+ * just proxy the state of individual actions. */
+
+static GtkActionEntry multi_selection_entries[] = {
{ "mail-convert-to-event",
"appointment-new",
@@ -957,13 +964,6 @@ static GtkActionEntry entries[] = {
N_("Create a new event from the selected message"),
G_CALLBACK (action_mail_convert_to_event_cb) },
- { "mail-convert-to-meeting",
- "stock_new-meeting",
- N_("Create a _Meeting"),
- NULL,
- N_("Create a new meeting from the selected message"),
- G_CALLBACK (action_mail_convert_to_meeting_cb) },
-
{ "mail-convert-to-memo",
"stock_insert-note",
N_("Create a Mem_o"),
@@ -979,79 +979,106 @@ static GtkActionEntry entries[] = {
G_CALLBACK (action_mail_convert_to_task_cb) }
};
-static EPopupActionEntry popup_entries[] = {
-
- { "mail-popup-convert-to-event",
- NULL,
- "mail-convert-to-event" },
-
- { "mail-popup-convert-to-meeting",
- NULL,
- "mail-convert-to-meeting" },
-
- { "mail-popup-convert-to-memo",
- NULL,
- "mail-convert-to-memo" },
+static GtkActionEntry single_selection_entries[] = {
- { "mail-popup-convert-to-task",
+ { "mail-convert-to-meeting",
+ "stock_new-meeting",
+ N_("Create a _Meeting"),
NULL,
- "mail-convert-to-task" }
+ N_("Create a new meeting from the selected message"),
+ G_CALLBACK (action_mail_convert_to_meeting_cb) }
};
static void
-update_actions_cb (EShellView *shell_view)
+update_actions_any_cb (EMailReader *reader,
+ GtkActionGroup *action_group)
{
- EShellContent *shell_content;
- EShellWindow *shell_window;
- GtkAction *action;
gboolean sensitive;
guint32 state;
- shell_content = e_shell_view_get_shell_content (shell_view);
- shell_window = e_shell_view_get_shell_window (shell_view);
-
- state = e_mail_reader_check_state (E_MAIL_READER (shell_content));
+ state = e_mail_reader_check_state (reader);
sensitive =
(state & E_MAIL_READER_SELECTION_SINGLE) ||
(state & E_MAIL_READER_SELECTION_MULTIPLE);
- action = E_SHELL_WINDOW_ACTION_CONVERT_TO_EVENT (shell_window);
- gtk_action_set_sensitive (action, sensitive);
+ gtk_action_group_set_sensitive (action_group, sensitive);
+}
- action = E_SHELL_WINDOW_ACTION_CONVERT_TO_MEMO (shell_window);
- gtk_action_set_sensitive (action, sensitive);
+static void
+update_actions_one_cb (EMailReader *reader,
+ GtkActionGroup *action_group)
+{
+ gboolean sensitive;
+ guint32 state;
- action = E_SHELL_WINDOW_ACTION_CONVERT_TO_TASK (shell_window);
- gtk_action_set_sensitive (action, sensitive);
+ state = e_mail_reader_check_state (reader);
sensitive = (state & E_MAIL_READER_SELECTION_SINGLE);
- action = E_SHELL_WINDOW_ACTION_CONVERT_TO_MEETING (shell_window);
- gtk_action_set_sensitive (action, sensitive);
-
+ gtk_action_group_set_sensitive (action_group, sensitive);
}
-gboolean
-e_plugin_ui_init (GtkUIManager *ui_manager,
- EShellView *shell_view)
+static void
+setup_actions (EMailReader *reader,
+ GtkUIManager *ui_manager)
{
- EShellWindow *shell_window;
GtkActionGroup *action_group;
+ const gchar *domain = GETTEXT_PACKAGE;
+
+ action_group = gtk_action_group_new ("mail-convert-any");
+ gtk_action_group_set_translation_domain (action_group, domain);
+ gtk_action_group_add_actions (
+ action_group, multi_selection_entries,
+ G_N_ELEMENTS (multi_selection_entries), reader);
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ g_object_unref (action_group);
- shell_window = e_shell_view_get_shell_window (shell_view);
- action_group = e_shell_window_get_action_group (shell_window, "mail");
+ /* GtkUIManager now owns the action group reference.
+ * The signal we're connecting to will only be emitted
+ * during the GtkUIManager's lifetime, so the action
+ * group will not disappear on us. */
+ g_signal_connect (
+ reader, "update-actions",
+ G_CALLBACK (update_actions_any_cb), action_group);
+
+ action_group = gtk_action_group_new ("mail-convert-one");
+ gtk_action_group_set_translation_domain (action_group, domain);
gtk_action_group_add_actions (
- action_group, entries,
- G_N_ELEMENTS (entries), shell_view);
- e_action_group_add_popup_actions (
- action_group, popup_entries,
- G_N_ELEMENTS (popup_entries));
+ action_group, single_selection_entries,
+ G_N_ELEMENTS (single_selection_entries), reader);
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ g_object_unref (action_group);
+
+ /* GtkUIManager now owns the action group reference.
+ * The signal we're connecting to will only be emitted
+ * during the GtkUIManager's lifetime, so the action
+ * group will not disappear on us. */
g_signal_connect (
- shell_view, "update-actions",
- G_CALLBACK (update_actions_cb), NULL);
+ reader, "update-actions",
+ G_CALLBACK (update_actions_one_cb), action_group);
+}
+
+gboolean
+mail_browser_init (GtkUIManager *ui_manager,
+ EMailBrowser *browser)
+{
+ setup_actions (E_MAIL_READER (browser), ui_manager);
+
+ return TRUE;
+}
+
+gboolean
+mail_shell_view_init (GtkUIManager *ui_manager,
+ EShellView *shell_view)
+{
+ EShellContent *shell_content;
+
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ setup_actions (E_MAIL_READER (shell_content), ui_manager);
return TRUE;
}
diff --git a/plugins/mail-to-task/org-gnome-mail-to-task.eplug.xml b/plugins/mail-to-task/org-gnome-mail-to-task.eplug.xml
index 0170b59c6e..a02e2a540f 100644
--- a/plugins/mail-to-task/org-gnome-mail-to-task.eplug.xml
+++ b/plugins/mail-to-task/org-gnome-mail-to-task.eplug.xml
@@ -5,7 +5,23 @@
<_description>Convert a mail message to a task.</_description>
<hook class="org.gnome.evolution.ui:1.0">
- <ui-manager id="org.gnome.evolution.mail">
+ <ui-manager id="org.gnome.evolution.mail.browser"
+ callback="mail_browser_init">
+ <menubar name='main-menu'>
+ <placeholder name='custom-menus'>
+ <menu action="mail-message-menu">
+ <placeholder name="mail-message-actions">
+ <menuitem action="mail-convert-to-event"/>
+ <menuitem action="mail-convert-to-meeting"/>
+ <menuitem action="mail-convert-to-task"/>
+ <menuitem action="mail-convert-to-memo"/>
+ </placeholder>
+ </menu>
+ </placeholder>
+ </menubar>
+ </ui-manager>
+ <ui-manager id="org.gnome.evolution.mail"
+ callback="mail_shell_view_init">
<menubar name='main-menu'>
<placeholder name='custom-menus'>
<menu action="mail-message-menu">
@@ -20,10 +36,10 @@
</menubar>
<popup name="mail-message-popup">
<placeholder name="mail-message-popup-actions">
- <menuitem action="mail-popup-convert-to-event"/>
- <menuitem action="mail-popup-convert-to-meeting"/>
- <menuitem action="mail-popup-convert-to-task"/>
- <menuitem action="mail-popup-convert-to-memo"/>
+ <menuitem action="mail-convert-to-event"/>
+ <menuitem action="mail-convert-to-meeting"/>
+ <menuitem action="mail-convert-to-task"/>
+ <menuitem action="mail-convert-to-memo"/>
</placeholder>
</popup>
</ui-manager>
diff --git a/plugins/mailing-list-actions/Makefile.am b/plugins/mailing-list-actions/Makefile.am
index 80dc122e40..7f205a19b1 100644
--- a/plugins/mailing-list-actions/Makefile.am
+++ b/plugins/mailing-list-actions/Makefile.am
@@ -6,7 +6,7 @@ AM_CPPFLAGS = \
@EVO_PLUGIN_RULE@
-plugin_DATA = org-gnome-mailing-list-actions.eplug org-gnome-mailing-list-actions.xml
+plugin_DATA = org-gnome-mailing-list-actions.eplug
plugin_LTLIBRARIES = liborg-gnome-mailing-list-actions.la
liborg_gnome_mailing_list_actions_la_SOURCES = mailing-list-actions.c
@@ -27,7 +27,6 @@ CLEANFILES = $(BUILT_SOURCES)
EXTRA_DIST = \
org-gnome-mailing-list-actions.eplug.xml \
- org-gnome-mailing-list-actions.error.xml \
- org-gnome-mailing-list-actions.xml
+ org-gnome-mailing-list-actions.error.xml
-include $(top_srcdir)/git.mk
diff --git a/plugins/mailing-list-actions/mailing-list-actions.c b/plugins/mailing-list-actions/mailing-list-actions.c
index f3ca8d1651..428bb187a7 100644
--- a/plugins/mailing-list-actions/mailing-list-actions.c
+++ b/plugins/mailing-list-actions/mailing-list-actions.c
@@ -35,16 +35,28 @@
#include "camel/camel-exception.h"
#include "camel/camel-folder.h"
#include "composer/e-msg-composer.h"
+#include "mail/e-mail-browser.h"
+#include "mail/e-mail-reader.h"
#include "mail/em-composer-utils.h"
#include "mail/em-format-hook.h"
-#include "mail/em-format.h"
-#include "mail/em-menu.h"
#include "mail/em-config.h"
+#include "mail/em-utils.h"
#include "mail/mail-ops.h"
#include "mail/mail-mt.h"
#include "mail/mail-config.h"
#include "e-util/e-util.h"
#include "e-util/e-error.h"
+#include "shell/e-shell-view.h"
+#include "shell/e-shell-window.h"
+#include "shell/e-shell-window-actions.h"
+
+/* EError Message IDs */
+#define MESSAGE_PREFIX "org.gnome.mailing-list-actions:"
+#define MESSAGE_NO_ACTION MESSAGE_PREFIX "no-action"
+#define MESSAGE_NO_HEADER MESSAGE_PREFIX "no-header"
+#define MESSAGE_ASK_SEND_MESSAGE MESSAGE_PREFIX "ask-send-message"
+#define MESSAGE_MALFORMED_HEADER MESSAGE_PREFIX "malformed-header"
+#define MESSAGE_POSTING_NOT_ALLOWED MESSAGE_PREFIX "posting-not-allowed"
typedef enum {
EMLA_ACTION_HELP,
@@ -70,38 +82,22 @@ const EmlaActionHeader emla_action_headers[] = {
{ EMLA_ACTION_ARCHIVE, FALSE, "List-Archive" },
};
-const gint emla_n_action_headers = sizeof(emla_action_headers) / sizeof(EmlaActionHeader);
-
-void emla_list_action (EPlugin *item, EMMenuTargetSelect* sel, EmlaAction action);
-void emla_list_help (EPlugin *item, EMMenuTargetSelect* sel);
-void emla_list_unsubscribe (EPlugin *item, EMMenuTargetSelect* sel);
-void emla_list_subscribe (EPlugin *item, EMMenuTargetSelect* sel);
-void emla_list_post (EPlugin *item, EMMenuTargetSelect* sel);
-void emla_list_owner (EPlugin *item, EMMenuTargetSelect* sel);
-void emla_list_archive (EPlugin *item, EMMenuTargetSelect* sel);
-
-void emla_list_action_do (CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data);
+gboolean mail_browser_init (GtkUIManager *ui_manager,
+ EMailBrowser *browser);
+gboolean mail_shell_view_init (GtkUIManager *ui_manager,
+ EShellView *shell_view);
typedef struct {
+ EMailReader *reader;
EmlaAction action;
gchar * uri;
} emla_action_data;
-void emla_list_action (EPlugin *item, EMMenuTargetSelect* sel, EmlaAction action)
-{
- emla_action_data *data;
-
- g_return_if_fail (sel->uids->len == 1);
-
- data = (emla_action_data *) malloc (sizeof (emla_action_data));
- data->action = action;
- data->uri = strdup (sel->uri);
-
- mail_get_message (sel->folder, (const gchar *) g_ptr_array_index (sel->uids, 0),
- emla_list_action_do, data, mail_msg_unordered_push);
-}
-
-void emla_list_action_do (CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, gpointer data)
+static void
+emla_list_action_do (CamelFolder *folder,
+ const gchar *uid,
+ CamelMimeMessage *msg,
+ gpointer data)
{
emla_action_data *action_data = (emla_action_data *) data;
EmlaAction action = action_data->action;
@@ -111,11 +107,14 @@ void emla_list_action_do (CamelFolder *folder, const gchar *uid, CamelMimeMessag
EMsgComposer *composer;
gint send_message_response;
EAccount *account;
+ GtkWindow *parent;
if (msg == NULL)
return;
- for (t = 0; t < emla_n_action_headers; t++) {
+ parent = e_mail_reader_get_window (action_data->reader);
+
+ for (t = 0; t < G_N_ELEMENTS (emla_action_headers); t++) {
if (emla_action_headers[t].action == action &&
(header = camel_medium_get_header (CAMEL_MEDIUM (msg), emla_action_headers[t].header)) != NULL)
break;
@@ -123,7 +122,7 @@ void emla_list_action_do (CamelFolder *folder, const gchar *uid, CamelMimeMessag
if (!header) {
/* there was no header matching the action */
- e_error_run (NULL, "org.gnome.mailing-list-actions:no-header", NULL);
+ e_error_run (parent, MESSAGE_NO_HEADER, NULL);
goto exit;
}
@@ -132,7 +131,7 @@ void emla_list_action_do (CamelFolder *folder, const gchar *uid, CamelMimeMessag
if (action == EMLA_ACTION_POST) {
while (*headerpos == ' ') headerpos++;
if (g_ascii_strcasecmp (headerpos, "NO") == 0) {
- e_error_run (NULL, "org.gnome.mailing-list-actions:posting-not-allowed", NULL);
+ e_error_run (parent, MESSAGE_POSTING_NOT_ALLOWED, NULL);
goto exit;
}
}
@@ -142,7 +141,9 @@ void emla_list_action_do (CamelFolder *folder, const gchar *uid, CamelMimeMessag
/* skip whitespace */
while (*headerpos == ' ') headerpos++;
if (*headerpos != '<' || (end = strchr (headerpos++, '>')) == NULL) {
- e_error_run (NULL, "org.gnome.mailing-list-actions:malformed-header", emla_action_headers[t].header, header, NULL);
+ e_error_run (
+ parent, MESSAGE_MALFORMED_HEADER,
+ emla_action_headers[t].header, header, NULL);
goto exit;
}
@@ -153,7 +154,9 @@ void emla_list_action_do (CamelFolder *folder, const gchar *uid, CamelMimeMessag
if (emla_action_headers[t].interactive)
send_message_response = GTK_RESPONSE_NO;
else
- send_message_response = e_error_run (NULL, "org.gnome.mailing-list-actions:ask-send-message", url, NULL);
+ send_message_response = e_error_run (
+ parent, MESSAGE_ASK_SEND_MESSAGE,
+ url, NULL);
if (send_message_response == GTK_RESPONSE_YES) {
/* directly send message */
@@ -162,7 +165,7 @@ void emla_list_action_do (CamelFolder *folder, const gchar *uid, CamelMimeMessag
e_composer_header_table_set_account (
e_msg_composer_get_header_table (composer),
account);
- em_utils_composer_send_cb (composer, NULL);
+ e_msg_composer_send (composer);
} else if (send_message_response == GTK_RESPONSE_NO) {
/* show composer */
em_utils_compose_new_message_with_mailto (url, action_data->uri);
@@ -170,8 +173,7 @@ void emla_list_action_do (CamelFolder *folder, const gchar *uid, CamelMimeMessag
goto exit;
} else {
- /* FIXME Pass a parent window. */
- e_show_uri (NULL, url);
+ e_show_uri (parent, url);
goto exit;
}
g_free (url);
@@ -186,40 +188,196 @@ void emla_list_action_do (CamelFolder *folder, const gchar *uid, CamelMimeMessag
}
/* if we got here, there's no valid action */
- e_error_run (NULL, "org.gnome.mailing-list-actions:no-action", header, NULL);
+ e_error_run (parent, MESSAGE_NO_ACTION, header, NULL);
exit:
- free (action_data->uri);
- free (action_data);
- g_free(url);
+ g_object_unref (action_data->reader);
+ g_free (action_data->uri);
+ g_free (action_data);
+ g_free (url);
+}
+
+static void
+emla_list_action (EMailReader *reader,
+ EmlaAction action)
+{
+ MessageList *message_list;
+ CamelFolder *folder;
+ GPtrArray *uids;
+ emla_action_data *data;
+ const gchar *folder_uri;
+
+ message_list = e_mail_reader_get_message_list (reader);
+
+ folder = message_list->folder;
+ folder_uri = message_list->folder_uri;
+ uids = message_list_get_selected (message_list);
+ g_return_if_fail (uids->len == 1);
+
+ data = g_malloc (sizeof (emla_action_data));
+ data->reader = g_object_ref (reader);
+ data->action = action;
+ data->uri = g_strdup (folder_uri);
+
+ mail_get_message (
+ folder, uids->pdata[0],
+ emla_list_action_do, data,
+ mail_msg_unordered_push);
+
+ em_utils_uids_free (uids);
+}
+
+static void
+action_mailing_list_archive_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ emla_list_action (reader, EMLA_ACTION_ARCHIVE);
+}
+
+static void
+action_mailing_list_help_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ emla_list_action (reader, EMLA_ACTION_HELP);
+}
+
+static void
+action_mailing_list_owner_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ emla_list_action (reader, EMLA_ACTION_OWNER);
}
-void emla_list_help (EPlugin *item, EMMenuTargetSelect* sel)
+static void
+action_mailing_list_post_cb (GtkAction *action,
+ EMailReader *reader)
{
- emla_list_action (item, sel, EMLA_ACTION_HELP);
+ emla_list_action (reader, EMLA_ACTION_POST);
}
-void emla_list_unsubscribe (EPlugin *item, EMMenuTargetSelect* sel)
+static void
+action_mailing_list_subscribe_cb (GtkAction *action,
+ EMailReader *reader)
{
- emla_list_action (item, sel, EMLA_ACTION_UNSUBSCRIBE);
+ emla_list_action (reader, EMLA_ACTION_SUBSCRIBE);
}
-void emla_list_subscribe (EPlugin *item, EMMenuTargetSelect* sel)
+static void
+action_mailing_list_unsubscribe_cb (GtkAction *action,
+ EMailReader *reader)
{
- emla_list_action (item, sel, EMLA_ACTION_SUBSCRIBE);
+ emla_list_action (reader, EMLA_ACTION_UNSUBSCRIBE);
}
-void emla_list_post (EPlugin *item, EMMenuTargetSelect* sel)
+static GtkActionEntry mailing_list_entries[] = {
+
+ { "mailing-list-archive",
+ NULL,
+ N_("Get List _Archive"),
+ NULL,
+ N_("Get an archive of the list this message belongs to"),
+ G_CALLBACK (action_mailing_list_archive_cb) },
+
+ { "mailing-list-help",
+ NULL,
+ N_("Get List _Usage Information"),
+ NULL,
+ N_("Get information about the usage of the list this message belongs to"),
+ G_CALLBACK (action_mailing_list_help_cb) },
+
+ { "mailing-list-owner",
+ NULL,
+ N_("Contact List _Owner"),
+ NULL,
+ N_("Contact the owner of the mailing list this message belongs to"),
+ G_CALLBACK (action_mailing_list_owner_cb) },
+
+ { "mailing-list-post",
+ NULL,
+ N_("_Post Message to List"),
+ NULL,
+ N_("Post a message to the mailing list this message belongs to"),
+ G_CALLBACK (action_mailing_list_post_cb) },
+
+ { "mailing-list-subscribe",
+ NULL,
+ N_("_Subscribe to List"),
+ NULL,
+ N_("Subscribe to the mailing list this message belongs to"),
+ G_CALLBACK (action_mailing_list_subscribe_cb) },
+
+ { "mailing-list-unsubscribe",
+ NULL,
+ N_("_Unsubscribe from List"),
+ NULL,
+ N_("Unsubscribe from the mailing list this message belongs to"),
+ G_CALLBACK (action_mailing_list_unsubscribe_cb) },
+
+ /*** Menus ***/
+
+ { "mailing-list-menu",
+ NULL,
+ N_("Mailing _List"),
+ NULL,
+ NULL,
+ NULL }
+};
+
+static void
+update_actions_cb (EMailReader *reader,
+ GtkActionGroup *action_group)
+{
+ gboolean sensitive;
+ guint32 state;
+
+ state = e_mail_reader_check_state (reader);
+ sensitive = (state & E_MAIL_READER_SELECTION_IS_MAILING_LIST);
+ gtk_action_group_set_sensitive (action_group, sensitive);
+}
+
+static void
+setup_actions (EMailReader *reader,
+ GtkUIManager *ui_manager)
{
- emla_list_action (item, sel, EMLA_ACTION_POST);
+ GtkActionGroup *action_group;
+ const gchar *domain = GETTEXT_PACKAGE;
+
+ action_group = gtk_action_group_new ("mailing-list");
+ gtk_action_group_set_translation_domain (action_group, domain);
+ gtk_action_group_add_actions (
+ action_group, mailing_list_entries,
+ G_N_ELEMENTS (mailing_list_entries), reader);
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ g_object_unref (action_group);
+
+ /* GtkUIManager now owns the action group reference.
+ * The signal we're connecting to will only be emitted
+ * during the GtkUIManager's lifetime, so the action
+ * group will not disappear on us. */
+
+ g_signal_connect (
+ reader, "update-actions",
+ G_CALLBACK (update_actions_cb), action_group);
}
-void emla_list_owner (EPlugin *item, EMMenuTargetSelect* sel)
+gboolean
+mail_browser_init (GtkUIManager *ui_manager,
+ EMailBrowser *browser)
{
- emla_list_action (item, sel, EMLA_ACTION_OWNER);
+ setup_actions (E_MAIL_READER (browser), ui_manager);
+
+ return TRUE;
}
-void emla_list_archive (EPlugin *item, EMMenuTargetSelect* sel)
+gboolean
+mail_shell_view_init (GtkUIManager *ui_manager,
+ EShellView *shell_view)
{
- emla_list_action (item, sel, EMLA_ACTION_ARCHIVE);
+ EShellContent *shell_content;
+
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ setup_actions (E_MAIL_READER (shell_content), ui_manager);
+
+ return TRUE;
}
diff --git a/plugins/mailing-list-actions/org-gnome-mailing-list-actions.eplug.xml b/plugins/mailing-list-actions/org-gnome-mailing-list-actions.eplug.xml
index 7b0861c70e..464ade9053 100644
--- a/plugins/mailing-list-actions/org-gnome-mailing-list-actions.eplug.xml
+++ b/plugins/mailing-list-actions/org-gnome-mailing-list-actions.eplug.xml
@@ -1,44 +1,54 @@
<?xml version="1.0"?>
<e-plugin-list>
- <e-plugin
- type="shlib"
- id="org.gnome.plugin.mailing-list.actions"
- domain="@GETTEXT_PACKAGE@"
- location="@PLUGINDIR@/liborg-gnome-mailing-list-actions@SOEXT@"
- _name="Mailing List Actions">
- <author name="Meilof Veeningen" email="meilof@wanadoo.nl"/>
- <_description>Perform common mailing list actions (subscribe, unsubscribe, etc.).</_description>
- <hook class="org.gnome.evolution.mail.bonobomenu:1.0">
- <menu id="org.gnome.evolution.mail.browser" target="select">
- <ui file="@PLUGINDIR@/org-gnome-mailing-list-actions.xml"/>
- <item type="item" verb="ListHelp" path="/commands/ListHelp" enable="mailing_list" activate="emla_list_help"/>
- <item type="item" verb="ListSubscribe" path="/commands/ListSubscribe" enable="mailing_list" activate="emla_list_subscribe"/>
- <item type="item" verb="ListUnsubscribe" path="/commands/ListUnsubscribe" enable="mailing_list" activate="emla_list_unsubscribe"/>
- <item type="item" verb="ListPost" path="/commands/ListPost" enable="mailing_list" activate="emla_list_post"/>
- <item type="item" verb="ListOwner" path="/commands/ListOwner" enable="mailing_list" activate="emla_list_owner"/>
- <item type="item" verb="ListArchive" path="/commands/ListArchive" enable="mailing_list" activate="emla_list_archive"/>
- </menu>
- <menu id="org.gnome.evolution.mail.messagebrowser" target="select">
- <ui file="@PLUGINDIR@/org-gnome-mailing-list-actions.xml"/>
- <item type="item" verb="ListHelp" path="/commands/ListHelp" enable="mailing_list" activate="emla_list_help"/>
- <item type="item" verb="ListSubscribe" path="/commands/ListSubscribe" enable="mailing_list" activate="emla_list_subscribe"/>
- <item type="item" verb="ListUnsubscribe" path="/commands/ListUnsubscribe" enable="mailing_list" activate="emla_list_unsubscribe"/>
- <item type="item" verb="ListPost" path="/commands/ListPost" enable="mailing_list" activate="emla_list_post"/>
- <item type="item" verb="ListOwner" path="/commands/ListOwner" enable="mailing_list" activate="emla_list_owner"/>
- <item type="item" verb="ListArchive" path="/commands/ListArchive" enable="mailing_list" activate="emla_list_archive"/>
- </menu>
- </hook>
- <hook class="org.gnome.evolution.mail.popup:1.0">
- <menu id="org.gnome.mail.folderview.popup.select" target="select">
- <item type="bar" path="96.list" visible="mailing_list" activate=""/>
- <item type="submenu" path="96.list.00" visible="mailing_list" activate="" _label="Mailing _List"/>
- <item type="item" verb="ListHelp" path="96.list.00/00.help" _label="Get list _usage information" visible="mailing_list" activate="emla_list_help"/>
- <item type="item" verb="ListSubscribe" path="96.list.00/10.subscribe" _label="_Subscribe to list" visible="mailing_list" activate="emla_list_subscribe"/>
- <item type="item" verb="ListUnsubscribe" path="96.list.00/20.unsubscribe" _label="_Un-subscribe to list" visible="mailing_list" activate="emla_list_unsubscribe"/>
- <item type="item" verb="ListPost" path="96.list.00/30.post" _label="_Post message to list" visible="mailing_list" activate="emla_list_post"/>
- <item type="item" verb="ListOwner" path="96.list.00/40.owner" _label="Contact list _owner" visible="mailing_list" activate="emla_list_owner"/>
- <item type="item" verb="ListArchive" path="96.list.00/50.archive" _label="Get list _archive" visible="mailing_list" activate="emla_list_archive"/>
- </menu>
- </hook>
- </e-plugin>
+ <e-plugin
+ type="shlib"
+ id="org.gnome.plugin.mailing-list.actions"
+ domain="@GETTEXT_PACKAGE@"
+ location="@PLUGINDIR@/liborg-gnome-mailing-list-actions@SOEXT@"
+ _name="Mailing List Actions">
+ <author name="Meilof Veeningen" email="meilof@wanadoo.nl"/>
+ <_description>Perform common mailing list actions (subscribe, unsubscribe, etc.).</_description>
+
+ <hook class="org.gnome.evolution.ui:1.0">
+ <ui-manager id="org.gnome.evolution.mail"
+ callback="mail_shell_view_init">
+ <menubar name='main-menu'>
+ <placeholder name='custom-menus'>
+ <menu action='mail-message-menu'>
+ <placeholder name='mail-message-custom-menus'>
+ <menu action='mailing-list-menu'>
+ <menuitem action='mailing-list-help'/>
+ <menuitem action='mailing-list-subscribe'/>
+ <menuitem action='mailing-list-unsubscribe'/>
+ <menuitem action='mailing-list-post'/>
+ <menuitem action='mailing-list-owner'/>
+ <menuitem action='mailing-list-archive'/>
+ </menu>
+ </placeholder>
+ </menu>
+ </placeholder>
+ </menubar>
+ </ui-manager>
+ <ui-manager id="org.gnome.evolution.mail.browser"
+ callback="mail_browser_init">
+ <menubar name='main-menu'>
+ <placeholder name='custom-menus'>
+ <menu action='mail-message-menu'>
+ <placeholder name='mail-message-custom-menus'>
+ <menu action='mailing-list-menu'>
+ <menuitem action='mailing-list-help'/>
+ <menuitem action='mailing-list-subscribe'/>
+ <menuitem action='mailing-list-unsubscribe'/>
+ <menuitem action='mailing-list-post'/>
+ <menuitem action='mailing-list-owner'/>
+ <menuitem action='mailing-list-archive'/>
+ </menu>
+ </placeholder>
+ </menu>
+ </placeholder>
+ </menubar>
+ </ui-manager>
+ </hook>
+
+ </e-plugin>
</e-plugin-list>
diff --git a/plugins/mailing-list-actions/org-gnome-mailing-list-actions.xml b/plugins/mailing-list-actions/org-gnome-mailing-list-actions.xml
deleted file mode 100644
index 980f15bdd7..0000000000
--- a/plugins/mailing-list-actions/org-gnome-mailing-list-actions.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<Root>
- <commands>
- <cmd name="ListHelp" _tip="Get information about the usage of the list this message belongs to"/>
- <cmd name="ListSubscribe" _tip="Subscribe to the mailing list this message belongs to"/>
- <cmd name="ListUnsubscribe" _tip="Unsubscribe to the mailing list this message belongs to"/>
- <cmd name="ListPost" _tip="Post a message to the mailing list this message belongs to"/>
- <cmd name="ListOwner" _tip="Contact the owner of the mailing list this message belongs to"/>
- <cmd name="ListArchive" _tip="Get an archive of the list this message belongs to"/>
- </commands>
-
- <menu>
- <placeholder name="MessagePlaceholder">
- <submenu name="Message">
- <submenu name="List" _label="Mailing _List">
- <menuitem verb="ListHelp" _label="Get List _Usage Information"/>
- <menuitem verb="ListSubscribe" _label="_Subscribe to List"/>
- <menuitem verb="ListUnsubscribe" _label="_Unsubscribe from List"/>
- <menuitem verb="ListPost" _label="_Post Message to List"/>
- <menuitem verb="ListOwner" _label="Contact List _Owner"/>
- <menuitem verb="ListArchive" _label="Get List _Archive"/>
- </submenu>
- </submenu>
- </placeholder>
- </menu>
-</Root>
diff --git a/ui/evolution-mail-reader.ui b/ui/evolution-mail-reader.ui
index 374db8f8e4..acc8dd3d47 100644
--- a/ui/evolution-mail-reader.ui
+++ b/ui/evolution-mail-reader.ui
@@ -102,6 +102,7 @@
<menuitem action='mail-search-folder-from-recipients'/>
<menuitem action='mail-search-folder-from-mailing-list'/>
</menu>
+ <placeholder name='mail-message-custom-menus'/>
<separator/>
<placeholder name='mail-message-actions'/>
</menu>