diff options
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | e-util/e-plugin-ui.c | 22 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view.c | 6 | ||||
-rw-r--r-- | plugins/mail-to-task/Makefile.am | 5 | ||||
-rw-r--r-- | plugins/mail-to-task/mail-to-task.c | 251 | ||||
-rw-r--r-- | plugins/mail-to-task/org-gnome-mail-to-task.eplug.xml | 101 | ||||
-rw-r--r-- | plugins/mail-to-task/org-gnome-mail-to-task.xml | 28 | ||||
-rw-r--r-- | plugins/mark-all-read/mark-all-read.c | 7 | ||||
-rw-r--r-- | shell/e-shell-view.c | 63 | ||||
-rw-r--r-- | ui/evolution-mail-reader.ui | 2 | ||||
-rw-r--r-- | ui/evolution-mail.ui | 6 |
11 files changed, 265 insertions, 229 deletions
diff --git a/configure.ac b/configure.ac index 78a5748543..a27a3b9b1a 100644 --- a/configure.ac +++ b/configure.ac @@ -1790,7 +1790,7 @@ 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 bbdb bogo-junk-plugin caldav calendar-file calendar-http default-mailer default-source email-custom-header external-editor face google-account-setup hula-account-setup imap-features mail-notification mark-all-read plugin-manager prefer-plain profiler sa-junk-plugin save-calendar subject-thread templates $TNEF_ATTACHMENTS vcard-inline webdav-account-setup" +enable_plugins="attachment-reminder addressbook-file audio-inline bbdb bogo-junk-plugin caldav calendar-file calendar-http default-mailer default-source email-custom-header external-editor face google-account-setup hula-account-setup imap-features mail-notification mail-to-task mark-all-read plugin-manager prefer-plain profiler sa-junk-plugin save-calendar subject-thread templates $TNEF_ATTACHMENTS vcard-inline webdav-account-setup" dnl PLUGINS NOT BUILDING YET dnl ------------------------ @@ -1801,7 +1801,6 @@ dnl groupwise-features dnl ipod-sync dnl itip-formatter dnl mailing-list-actions -dnl mail-to-task dnl mono dnl pst-import dnl publish-calendar diff --git a/e-util/e-plugin-ui.c b/e-util/e-plugin-ui.c index 2331af0f63..4f948fbb2f 100644 --- a/e-util/e-plugin-ui.c +++ b/e-util/e-plugin-ui.c @@ -375,10 +375,13 @@ plugin_ui_hook_construct (EPluginHook *hook, /* Chain up to parent's construct() method. */ E_PLUGIN_HOOK_CLASS (parent_class)->construct (hook, plugin, node); - for (node = node->children; node != NULL; node = node->next) { + for (node = xmlFirstElementChild (node); node != NULL; + node = xmlNextElementSibling (node)) { + xmlNodePtr child; xmlBufferPtr buffer; - const gchar *content; + GString *content; + const gchar *temp; gchar *id; if (strcmp ((gchar *) node->name, "ui-manager") != 0) @@ -390,18 +393,21 @@ plugin_ui_hook_construct (EPluginHook *hook, continue; } + content = g_string_sized_new (1024); + /* Extract the XML content below <ui-manager> */ buffer = xmlBufferCreate (); - child = node->children; - while (child != NULL && xmlNodeIsText (child)) - child = child->next; - if (child != NULL) + for (child = xmlFirstElementChild (node); child != NULL; + child = xmlNextElementSibling (child)) { + xmlNodeDump (buffer, node->doc, child, 2, 1); - content = (const gchar *) xmlBufferContent (buffer); + temp = (const gchar *) xmlBufferContent (buffer); + g_string_append (content, temp); + } g_hash_table_insert ( priv->ui_definitions, - id, g_strdup (content)); + id, g_string_free (content, FALSE)); xmlBufferFree (buffer); } diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c index ce18936eb8..fb045905e6 100644 --- a/modules/mail/e-mail-shell-view.c +++ b/modules/mail/e-mail-shell-view.c @@ -60,9 +60,6 @@ mail_shell_view_toggled (EShellView *shell_view) const gchar *basename; gboolean view_is_active; - /* Chain up to parent's toggled() method. */ - E_SHELL_VIEW_CLASS (parent_class)->toggled (shell_view); - priv = E_MAIL_SHELL_VIEW_GET_PRIVATE (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); @@ -80,7 +77,8 @@ mail_shell_view_toggled (EShellView *shell_view) priv->merge_id = 0; } - gtk_ui_manager_ensure_update (ui_manager); + /* Chain up to parent's toggled() method. */ + E_SHELL_VIEW_CLASS (parent_class)->toggled (shell_view); } static void diff --git a/plugins/mail-to-task/Makefile.am b/plugins/mail-to-task/Makefile.am index 5261fbcf97..4c7db0682c 100644 --- a/plugins/mail-to-task/Makefile.am +++ b/plugins/mail-to-task/Makefile.am @@ -6,7 +6,7 @@ INCLUDES = \ @EVO_PLUGIN_RULE@ -plugin_DATA = org-gnome-mail-to-task.eplug org-gnome-mail-to-task.xml +plugin_DATA = org-gnome-mail-to-task.eplug plugin_LTLIBRARIES = liborg-gnome-mail-to-task.la liborg_gnome_mail_to_task_la_SOURCES = mail-to-task.c @@ -18,8 +18,7 @@ liborg_gnome_mail_to_task_la_LIBADD = \ $(EVOLUTION_CALENDAR_LIBS) \ $(EVOLUTION_MAIL_LIBS) -EXTRA_DIST = org-gnome-mail-to-task.eplug.xml \ - org-gnome-mail-to-task.xml +EXTRA_DIST = org-gnome-mail-to-task.eplug.xml BUILT_SOURCES = org-gnome-mail-to-task.eplug CLEANFILES = $(BUILT_SOURCES) diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c index e7fa727ff1..49b67a528a 100644 --- a/plugins/mail-to-task/mail-to-task.c +++ b/plugins/mail-to-task/mail-to-task.c @@ -32,10 +32,12 @@ #include <string.h> #include <stdio.h> +#include <gtkhtml/gtkhtml.h> #include <gconf/gconf-client.h> #include <libecal/e-cal.h> #include <libedataserver/e-account.h> #include <libedataserverui/e-source-selector-dialog.h> + #include <camel/camel-folder.h> #include <camel/camel-medium.h> #include <camel/camel-mime-message.h> @@ -43,15 +45,31 @@ #include <camel/camel-stream.h> #include <camel/camel-stream-mem.h> #include <camel/camel-utf8.h> -#include "mail/em-menu.h" -#include "mail/em-popup.h" -#include "mail/em-utils.h" -#include "mail/em-folder-view.h" -#include "mail/em-format-html.h" -#include "mail/mail-config.h" -#include "e-util/e-dialog-utils.h" -#include <gtkhtml/gtkhtml.h> + +#include <mail/em-menu.h> +#include <mail/em-popup.h> +#include <mail/em-utils.h> +#include <mail/em-folder-view.h> +#include <mail/em-format-html.h> +#include <mail/mail-config.h> +#include <e-util/e-account-utils.h> +#include <e-util/e-dialog-utils.h> #include <calendar/common/authentication.h> +#include <misc/e-popup-action.h> +#include <shell/e-shell-view.h> +#include <shell/e-shell-window-actions.h> + +#define E_SHELL_WINDOW_ACTION_CONVERT_TO_EVENT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-convert-to-event") +#define E_SHELL_WINDOW_ACTION_CONVERT_TO_MEETING(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-convert-to-meeting") +#define E_SHELL_WINDOW_ACTION_CONVERT_TO_MEMO(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-convert-to-memo") +#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, + EShellView *shell_view); static gchar * clean_name(const guchar *s) @@ -214,7 +232,7 @@ set_organizer (ECalComponent *comp) ECalComponentOrganizer organizer = {NULL, NULL, NULL, NULL}; gchar *res; - account = mail_config_get_default_account (); + account = e_get_default_account (); if (!account) return NULL; @@ -476,12 +494,6 @@ do_mail_to_event (AsyncData *data) return TRUE; } -static void -copy_uids (gchar *uid, GPtrArray *uid_array) -{ - g_ptr_array_add (uid_array, g_strdup (uid)); -} - static gboolean text_contains_nonwhitespace (const gchar *text, gint len) { @@ -509,47 +521,51 @@ text_contains_nonwhitespace (const gchar *text, gint len) /* should be freed with g_free after done with it */ static gchar * -get_selected_text (EMFolderView *emfv) +get_selected_text (EMailReader *reader) { + EMFormatHTMLDisplay *html_display; + GtkHTML *html; gchar *text = NULL; gint len; - if (!emfv || !emfv->preview || !gtk_html_command (((EMFormatHTML *)emfv->preview)->html, "is-selection-active")) + html_display = e_mail_reader_get_html_display (reader); + html = EM_FORMAT_HTML (html_display)->html; + + if (!gtk_html_command (html, "is-selection-active")) return NULL; - if (gtk_html_command (((EMFormatHTML *)emfv->preview)->html, "is-selection-active") - && (text = gtk_html_get_selection_plain_text (((EMFormatHTML *)emfv->preview)->html, &len)) - && len && text && text[0] && text_contains_nonwhitespace (text, len)) { - /* selection is ok, so use it as returned from gtkhtml widget */ - } else { + text = gtk_html_get_selection_plain_text (html, &len); + + if (text == NULL || !text_contains_nonwhitespace (text, len)) { g_free (text); - text = NULL; + return NULL; } return text; } static void -mail_to_event (ECalSourceType source_type, gboolean with_attendees, GPtrArray *uids, CamelFolder *folder, EMFolderView *emfv) +mail_to_event (ECalSourceType source_type, + gboolean with_attendees, + EShellView *shell_view) { - GPtrArray *uid_array = NULL; + EShellContent *shell_content; + EMailReader *reader; + MessageList *message_list; + CamelFolder *folder; + GPtrArray *selected; ESourceList *source_list = NULL; gboolean done = FALSE; GSList *groups, *p; ESource *source = NULL; GError *error = NULL; - g_return_if_fail (uids != NULL); - g_return_if_fail (folder != NULL); - g_return_if_fail (emfv != NULL); + shell_content = e_shell_view_get_shell_content (shell_view); - if (uids->len > 0) { - uid_array = g_ptr_array_new (); - g_ptr_array_foreach (uids, (GFunc)copy_uids, (gpointer) uid_array); - } else { - /* nothing selected */ - return; - } + reader = E_MAIL_READER (shell_content); + message_list = e_mail_reader_get_message_list (reader); + selected = message_list_get_selected (message_list); + folder = message_list->folder; if (!e_cal_get_sources (&source_list, source_type, &error)) { e_notice (NULL, GTK_MESSAGE_ERROR, _("Cannot get source list. %s"), error ? error->message : _("Unknown error.")); @@ -615,11 +631,11 @@ mail_to_event (ECalSourceType source_type, gboolean with_attendees, GPtrArray *u data = g_new0 (AsyncData, 1); data->client = client; data->folder = folder; - data->uids = uid_array; + data->uids = selected; data->with_attendees = with_attendees; - if (uid_array->len == 1) - data->selected_text = get_selected_text (emfv); + if (selected->len == 1) + data->selected_text = get_selected_text (reader); else data->selected_text = NULL; @@ -633,70 +649,135 @@ mail_to_event (ECalSourceType source_type, gboolean with_attendees, GPtrArray *u g_object_unref (source_list); } -/* ************************************************************************* */ - -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); -void org_gnome_mail_to_event (gpointer ep, EMPopupTargetSelect *t); -void org_gnome_mail_to_event_menu (EPlugin *ep, EMMenuTargetSelect *t); -void org_gnome_mail_to_meeting (gpointer ep, EMPopupTargetSelect *t); -void org_gnome_mail_to_meeting_menu (EPlugin *ep, EMMenuTargetSelect *t); -void org_gnome_mail_to_task (gpointer ep, EMPopupTargetSelect *t); -void org_gnome_mail_to_task_menu (EPlugin *ep, EMMenuTargetSelect *t); -void org_gnome_mail_to_memo (gpointer ep, EMPopupTargetSelect *t); -void org_gnome_mail_to_memo_menu (EPlugin *ep, EMMenuTargetSelect *t); - -gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +static void +action_mail_convert_to_event_cb (GtkAction *action, + EShellView *shell_view) { - return 0; + mail_to_event (E_CAL_SOURCE_TYPE_EVENT, FALSE, shell_view); } -void -org_gnome_mail_to_event (gpointer ep, EMPopupTargetSelect *t) +static void +action_mail_convert_to_meeting_cb (GtkAction *action, + EShellView *shell_view) { - mail_to_event (E_CAL_SOURCE_TYPE_EVENT, FALSE, t->uids, t->folder, (EMFolderView *) t->target.widget); + mail_to_event (E_CAL_SOURCE_TYPE_EVENT, TRUE, shell_view); } -void -org_gnome_mail_to_event_menu (EPlugin *ep, EMMenuTargetSelect *t) +static void +action_mail_convert_to_memo_cb (GtkAction *action, + EShellView *shell_view) { - mail_to_event (E_CAL_SOURCE_TYPE_EVENT, FALSE, t->uids, t->folder, (EMFolderView *) t->target.widget); + mail_to_event (E_CAL_SOURCE_TYPE_JOURNAL, FALSE, shell_view); } -void -org_gnome_mail_to_meeting (gpointer ep, EMPopupTargetSelect *t) +static void +action_mail_convert_to_task_cb (GtkAction *action, + EShellView *shell_view) { - mail_to_event (E_CAL_SOURCE_TYPE_EVENT, TRUE, t->uids, t->folder, (EMFolderView *) t->target.widget); + mail_to_event (E_CAL_SOURCE_TYPE_TODO, FALSE, shell_view); } -void -org_gnome_mail_to_meeting_menu (EPlugin *ep, EMMenuTargetSelect *t) -{ - mail_to_event (E_CAL_SOURCE_TYPE_EVENT, TRUE, t->uids, t->folder, (EMFolderView *) t->target.widget); -} +static GtkActionEntry entries[] = { + + { "mail-convert-to-event", + "appointment-new", + N_("Convert to an _Event"), + NULL, + N_("Convert the selected messages to an event"), + G_CALLBACK (action_mail_convert_to_event_cb) }, + + { "mail-convert-to-meeting", + "stock_new-meeting", + N_("Convert to a _Meeting"), + NULL, + N_("Convert the selected messages to a meeting"), + G_CALLBACK (action_mail_convert_to_meeting_cb) }, + + { "mail-convert-to-memo", + "stock_insert-note", + N_("Convert to a Mem_o"), + NULL, + N_("Convert the selected messages to a memo"), + G_CALLBACK (action_mail_convert_to_memo_cb) }, + + { "mail-convert-to-task", + "stock_todo", + N_("Convert to a _Task"), + NULL, + N_("Convert the selected messages to a task"), + G_CALLBACK (action_mail_convert_to_task_cb) } +}; -void -org_gnome_mail_to_task (gpointer ep, EMPopupTargetSelect *t) -{ - mail_to_event (E_CAL_SOURCE_TYPE_TODO, TRUE, t->uids, t->folder, (EMFolderView *) t->target.widget); -} +static EPopupActionEntry popup_entries[] = { -void -org_gnome_mail_to_task_menu (EPlugin *ep, EMMenuTargetSelect *t) -{ - mail_to_event (E_CAL_SOURCE_TYPE_TODO, TRUE, t->uids, t->folder, (EMFolderView *) t->target.widget); -} + { "mail-popup-convert-to-event", + NULL, + "mail-convert-to-event" }, -void -org_gnome_mail_to_memo (gpointer ep, EMPopupTargetSelect *t) + { "mail-popup-convert-to-meeting", + NULL, + "mail-convert-to-meeting" }, + + { "mail-popup-convert-to-memo", + NULL, + "mail-convert-to-memo" }, + + { "mail-popup-convert-to-task", + NULL, + "mail-convert-to-task" } +}; + +static void +update_actions_cb (EShellView *shell_view) { - /* do not set organizer and attendees for memos */ - mail_to_event (E_CAL_SOURCE_TYPE_JOURNAL, FALSE, t->uids, t->folder, (EMFolderView *) t->target.widget); + 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)); + + 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); + + action = E_SHELL_WINDOW_ACTION_CONVERT_TO_MEETING (shell_window); + gtk_action_set_sensitive (action, sensitive); + + action = E_SHELL_WINDOW_ACTION_CONVERT_TO_MEMO (shell_window); + gtk_action_set_sensitive (action, sensitive); + + action = E_SHELL_WINDOW_ACTION_CONVERT_TO_TASK (shell_window); + gtk_action_set_sensitive (action, sensitive); } -void -org_gnome_mail_to_memo_menu (EPlugin *ep, EMMenuTargetSelect *t) +gboolean +e_plugin_ui_init (GtkUIManager *ui_manager, + EShellView *shell_view) { - /* do not set organizer and attendees for memos */ - mail_to_event (E_CAL_SOURCE_TYPE_JOURNAL, FALSE, t->uids, t->folder, (EMFolderView *) t->target.widget); + EShellWindow *shell_window; + GtkActionGroup *action_group; + + shell_window = e_shell_view_get_shell_window (shell_view); + action_group = e_shell_window_get_action_group (shell_window, "mail"); + + 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)); + + g_signal_connect ( + shell_view, "update-actions", + G_CALLBACK (update_actions_cb), NULL); + + 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 65ae2f4a7b..614da8cf3b 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 @@ -1,80 +1,33 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> <e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.plugin.mailToTask" - location="@PLUGINDIR@/liborg-gnome-mail-to-task@SOEXT@" - _name="Mail-to-Task"> - <_description>Convert a mail message to a task.</_description> + <e-plugin type="shlib" location="/home/mbarnes/local/lib/evolution/2.28/plugins/liborg-gnome-mail-to-task.so" id="org.gnome.evolution.plugin.mailToTask" name="Mail-to-Task"> <author name="Rodrigo Moya" email="rodrigo@novell.com"/> + <_description>Convert a mail message to a task.</_description> - <!-- hook into the uri popup menu --> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.folderview.popup" target="select"> - <item - type="item" - path="70.mail_to_event1" - icon="appointment-new" - _label="Convert to an _Event" - enable="many" - visible="many" - activate="org_gnome_mail_to_event"/> - <item - type="item" - path="70.mail_to_event2" - icon="stock_new-meeting" - _label="Convert to a _Meeting" - enable="many" - visible="many" - activate="org_gnome_mail_to_meeting"/> - <item - type="item" - path="70.mail_to_event3" - icon="stock_todo" - _label="Convert to a _Task" - enable="many" - visible="many" - activate="org_gnome_mail_to_task"/> - <item - type="item" - path="70.mail_to_event4" - icon="stock_insert-note" - _label="Convert to a Mem_o" - enable="many" - visible="many" - activate="org_gnome_mail_to_memo"/> - </menu> + <hook class="org.gnome.evolution.ui:1.0"> + <ui-manager id="org.gnome.evolution.mail"> + <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> + <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"/> + </placeholder> + </popup> + </ui-manager> </hook> - <hook class="org.gnome.evolution.mail.bonobomenu:1.0"> - <menu id="org.gnome.evolution.mail.browser" target="select"> - <!-- the path to the bonobo menu description --> - <ui file="@PLUGINDIR@/org-gnome-mail-to-task.xml"/> - <item - type="item" - verb="ConvertEvent" - path="/commands/ConvertEvent" - enable="many" - activate="org_gnome_mail_to_event_menu"/> - <item - type="item" - verb="ConvertMeeting" - path="/commands/ConvertMeeting" - enable="many" - activate="org_gnome_mail_to_meeting_menu"/> - <item - type="item" - verb="ConvertTask" - path="/commands/ConvertTask" - enable="many" - activate="org_gnome_mail_to_task_menu"/> - <item - type="item" - verb="ConvertMemo" - path="/commands/ConvertMemo" - enable="many" - activate="org_gnome_mail_to_memo_menu"/> - </menu> - </hook> - + </e-plugin> </e-plugin-list> diff --git a/plugins/mail-to-task/org-gnome-mail-to-task.xml b/plugins/mail-to-task/org-gnome-mail-to-task.xml deleted file mode 100644 index 98accf4c6c..0000000000 --- a/plugins/mail-to-task/org-gnome-mail-to-task.xml +++ /dev/null @@ -1,28 +0,0 @@ -<Root> - <commands> - <cmd name="ConvertEvent" _label="Convert to an _Event" - _tip="Convert the selected message to a new event" - pixtype="stock" pixname="appointment-new"/> - <cmd name="ConvertMeeting" _label="Convert to a _Meeting" - _tip="Convert the selected message to a new meeting" - pixtype="stock" pixname="stock_new-meeting"/> - <cmd name="ConvertTask" _label="Convert to a _Task" - _tip="Convert the selected message to a new task" - pixtype="stock" pixname="stock_todo"/> - <cmd name="ConvertMemo" _label="Convert to a Mem_o" - _tip="Convert the selected message to a new memo" - pixtype="stock" pixname="stock_insert-note"/> - </commands> - - <menu> - <placeholder name="MessagePlaceholder"> - <submenu name="Message"> - <separator f="" name="emaillist5"/> - <menuitem name="ConvertEvent" verb=""/> - <menuitem name="ConvertMeeting" verb=""/> - <menuitem name="ConvertTask" verb=""/> - <menuitem name="ConvertMemo" verb=""/> - </submenu> - </placeholder> - </menu> -</Root> diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c index 0a59b69f33..662bd137c3 100644 --- a/plugins/mark-all-read/mark-all-read.c +++ b/plugins/mark-all-read/mark-all-read.c @@ -38,7 +38,6 @@ #include <shell/e-shell-sidebar.h> #include <shell/e-shell-view.h> #include <shell/e-shell-window.h> -#include <shell/e-shell-window-actions.h> #define PRIMARY_TEXT \ N_("Also mark messages in subfolders?") @@ -283,6 +282,8 @@ action_mail_mark_read_recursive_cb (GtkAction *action, mail_get_folder ( folder_uri, 0, mar_got_folder, NULL, mail_msg_unordered_push); + + g_object_unref (folder_tree); } static GtkActionEntry entries[] = { @@ -303,9 +304,9 @@ e_plugin_ui_init (GtkUIManager *ui_manager, GtkActionGroup *action_group; shell_window = e_shell_view_get_shell_window (shell_view); - action_group = E_SHELL_WINDOW_ACTION_GROUP_SHELL (shell_window); + action_group = e_shell_window_get_action_group (shell_window, "mail"); - /* Add actions to the "shell" action group. */ + /* Add actions to the "mail" action group. */ gtk_action_group_add_actions ( action_group, entries, G_N_ELEMENTS (entries), shell_view); diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index d1ab1af4a4..5808f9e027 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -188,6 +188,31 @@ shell_view_state_timeout_cb (EShellView *shell_view) return FALSE; } +static gboolean +shell_view_register_ui_manager (EShellView *shell_view) +{ + EShellViewClass *shell_view_class; + EShellWindow *shell_window; + GtkUIManager *ui_manager; + const gchar *id; + + /* This is a one-time, post-construction idle callback. */ + + shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + ui_manager = e_shell_window_get_ui_manager (shell_window); + id = shell_view_class->ui_manager_id; + + e_plugin_ui_register_manager (ui_manager, id, shell_view); + + if (e_shell_view_is_active (shell_view)) { + e_plugin_ui_enable_manager (ui_manager, id); + e_shell_view_update_actions (shell_view); + } + + return FALSE; +} + static void shell_view_emit_toggled (EShellView *shell_view) { @@ -394,35 +419,34 @@ shell_view_finalize (GObject *object) static void shell_view_constructed (GObject *object) { - EShellWindow *shell_window; + EShellViewClass *shell_view_class; EShellView *shell_view; - EShellViewClass *class; - GtkUIManager *ui_manager; GtkWidget *widget; - const gchar *id; shell_view = E_SHELL_VIEW (object); - class = E_SHELL_VIEW_GET_CLASS (object); + shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); - shell_window = e_shell_view_get_shell_window (shell_view); - ui_manager = e_shell_window_get_ui_manager (shell_window); - id = class->ui_manager_id; - - e_plugin_ui_register_manager (ui_manager, id, shell_view); + /* Defer EPluginUI registration to an idle callback to give the + * shell view subclass a chance to register its own actions and + * action groups. Registration will immediately load EPlugins + * that specify the shell view's GtkUIManager ID, and their + * initialization routines may require those actions or action + * groups that have not yet been added. */ + g_idle_add ((GSourceFunc) shell_view_register_ui_manager, shell_view); shell_view_load_state (shell_view); /* Invoke factory methods. */ - widget = class->new_shell_content (shell_view); + widget = shell_view_class->new_shell_content (shell_view); shell_view->priv->shell_content = g_object_ref_sink (widget); gtk_widget_show (widget); - widget = class->new_shell_sidebar (shell_view); + widget = shell_view_class->new_shell_sidebar (shell_view); shell_view->priv->shell_sidebar = g_object_ref_sink (widget); gtk_widget_show (widget); - widget = class->new_shell_taskbar (shell_view); + widget = shell_view_class->new_shell_taskbar (shell_view); shell_view->priv->shell_taskbar = g_object_ref_sink (widget); gtk_widget_show (widget); } @@ -431,24 +455,25 @@ static void shell_view_toggled (EShellView *shell_view) { EShellViewPrivate *priv = shell_view->priv; - EShellViewClass *class; + EShellViewClass *shell_view_class; EShellWindow *shell_window; GtkUIManager *ui_manager; - const gchar *basename; + const gchar *basename, *id; gboolean view_is_active; - class = E_SHELL_VIEW_GET_CLASS (shell_view); + shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view); shell_window = e_shell_view_get_shell_window (shell_view); ui_manager = e_shell_window_get_ui_manager (shell_window); view_is_active = e_shell_view_is_active (shell_view); - basename = class->ui_definition; + basename = shell_view_class->ui_definition; + id = shell_view_class->ui_manager_id; if (view_is_active && priv->merge_id == 0) { priv->merge_id = e_load_ui_definition (ui_manager, basename); - e_plugin_ui_enable_manager (ui_manager, class->ui_manager_id); + e_plugin_ui_enable_manager (ui_manager, id); } else if (!view_is_active && priv->merge_id != 0) { - e_plugin_ui_disable_manager (ui_manager, class->ui_manager_id); + e_plugin_ui_disable_manager (ui_manager, id); gtk_ui_manager_remove_ui (ui_manager, priv->merge_id); priv->merge_id = 0; } diff --git a/ui/evolution-mail-reader.ui b/ui/evolution-mail-reader.ui index 1000fe5e2c..374db8f8e4 100644 --- a/ui/evolution-mail-reader.ui +++ b/ui/evolution-mail-reader.ui @@ -102,6 +102,8 @@ <menuitem action='mail-search-folder-from-recipients'/> <menuitem action='mail-search-folder-from-mailing-list'/> </menu> + <separator/> + <placeholder name='mail-message-actions'/> </menu> </placeholder> </menubar> diff --git a/ui/evolution-mail.ui b/ui/evolution-mail.ui index a73cfd0a18..c676cf524e 100644 --- a/ui/evolution-mail.ui +++ b/ui/evolution-mail.ui @@ -37,6 +37,7 @@ <menu action='mail-folder-menu'> <menuitem action='mail-folder-new'/> <menuitem action='mail-tools-subscriptions'/> + <menuitem action='mail-folder-unsubscribe'/> <separator/> <menuitem action='mail-folder-copy'/> <menuitem action='mail-folder-move'/> @@ -51,11 +52,8 @@ <menuitem action='mail-folder-refresh'/> <menuitem action='mail-folder-delete'/> <separator/> - <menuitem action='mail-folder-unsubscribe'/> - <separator/> <menuitem action='mail-folder-properties'/> </menu> - <menu action='mail-message-menu'/> </placeholder> <menu action='search-menu'> <placeholder name='search-actions'> @@ -110,6 +108,8 @@ <separator/> <menuitem action='mail-label-new'/> </menu> + <separator/> + <placeholder name='mail-message-popup-actions'/> </popup> <popup name='mail-search-options'> <menuitem action='mail-search-subject-or-sender-contains'/> |