diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-09-13 11:35:45 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-09-13 11:35:45 +0800 |
commit | e841a0b22395bae0097f89a208c8b5309f77166b (patch) | |
tree | 7d29aee2c1fd0b1addbacd3517dc47cc5b99bb9b | |
parent | 43594a8b6eeeb072a672041cd72b2b211dd56958 (diff) | |
download | gsoc2013-evolution-e841a0b22395bae0097f89a208c8b5309f77166b.tar.gz gsoc2013-evolution-e841a0b22395bae0097f89a208c8b5309f77166b.tar.zst gsoc2013-evolution-e841a0b22395bae0097f89a208c8b5309f77166b.zip |
Bug 594863 - Message body doesn't allow right click pop up menu
-rw-r--r-- | mail/e-mail-browser.c | 55 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 17 | ||||
-rw-r--r-- | mail/e-mail-reader.h | 2 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-content.c | 20 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-private.c | 45 | ||||
-rw-r--r-- | plugins/mail-to-task/org-gnome-mail-to-task.eplug.xml | 16 | ||||
-rw-r--r-- | ui/evolution-mail-reader.ui | 13 | ||||
-rw-r--r-- | widgets/misc/e-web-view.c | 5 |
8 files changed, 163 insertions, 10 deletions
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index 69199bfa1a..181daf8fa7 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -215,6 +215,34 @@ mail_browser_message_selected_cb (EMailBrowser *browser, camel_folder_free_message_info (message_list->folder, info); } +static gboolean +mail_browser_popup_event_cb (EMailBrowser *browser, + GdkEventButton *event, + const gchar *uri) +{ + EMailReader *reader; + GtkMenu *menu; + + if (uri != NULL) + return FALSE; + + reader = E_MAIL_READER (browser); + menu = e_mail_reader_get_popup_menu (reader); + + e_mail_reader_update_actions (reader); + + if (event == NULL) + gtk_menu_popup ( + menu, NULL, NULL, NULL, NULL, + 0, gtk_get_current_event_time ()); + else + gtk_menu_popup ( + menu, NULL, NULL, NULL, NULL, + event->button, event->time); + + return TRUE; +} + static void mail_browser_status_message_cb (EMailBrowser *browser, const gchar *status_message) @@ -363,7 +391,7 @@ mail_browser_constructed (GObject *object) GtkUIManager *ui_manager; GtkWidget *container; GtkWidget *widget; - GtkHTML *html; + EWebView *web_view; const gchar *domain; const gchar *key; const gchar *id; @@ -381,7 +409,7 @@ mail_browser_constructed (GObject *object) shell = e_shell_backend_get_shell (shell_backend); e_shell_watch_window (shell, GTK_WINDOW (object)); - html = EM_FORMAT_HTML (html_display)->html; + web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html); /* The message list is a widget, but it is not shown in the browser. * Unfortunately, the widget is inseparable from its model, and the @@ -394,7 +422,11 @@ mail_browser_constructed (GObject *object) G_CALLBACK (mail_browser_message_selected_cb), object); g_signal_connect_swapped ( - html, "status-message", + web_view, "popup-event", + G_CALLBACK (mail_browser_popup_event_cb), object); + + g_signal_connect_swapped ( + web_view, "status-message", G_CALLBACK (mail_browser_status_message_cb), object); e_mail_reader_init (reader); @@ -433,7 +465,7 @@ mail_browser_constructed (GObject *object) priv->statusbar = g_object_ref (widget); gtk_widget_show (widget); - widget = e_mail_search_bar_new (E_WEB_VIEW (html)); + widget = e_mail_search_bar_new (web_view); gtk_box_pack_end (GTK_BOX (container), widget, FALSE, FALSE, 0); priv->search_bar = g_object_ref (widget); gtk_widget_hide (widget); @@ -534,6 +566,20 @@ mail_browser_get_message_list (EMailReader *reader) return MESSAGE_LIST (priv->message_list); } +static GtkMenu * +mail_browser_get_popup_menu (EMailReader *reader) +{ + EMailBrowser *browser; + GtkUIManager *ui_manager; + GtkWidget *widget; + + browser = E_MAIL_BROWSER (reader); + ui_manager = e_mail_browser_get_ui_manager (browser); + widget = gtk_ui_manager_get_widget (ui_manager, "/mail-preview-popup"); + + return GTK_MENU (widget); +} + static EShellBackend * mail_browser_get_shell_backend (EMailReader *reader) { @@ -638,6 +684,7 @@ mail_browser_iface_init (EMailReaderIface *iface) iface->get_hide_deleted = mail_browser_get_hide_deleted; iface->get_html_display = mail_browser_get_html_display; iface->get_message_list = mail_browser_get_message_list; + iface->get_popup_menu = mail_browser_get_popup_menu; iface->get_shell_backend = mail_browser_get_shell_backend; iface->get_window = mail_browser_get_window; iface->set_message = mail_browser_set_message; diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index eb3fe06f2a..9366121192 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -1509,6 +1509,10 @@ static GtkActionEntry mail_reader_entries[] = { static EPopupActionEntry mail_reader_popup_entries[] = { + { "mail-popup-clipboard-copy", + NULL, + "mail-clipboard-copy" }, + { "mail-popup-copy", NULL, "mail-copy" }, @@ -2690,6 +2694,19 @@ e_mail_reader_get_message_list (EMailReader *reader) return iface->get_message_list (reader); } +GtkMenu * +e_mail_reader_get_popup_menu (EMailReader *reader) +{ + EMailReaderIface *iface; + + g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); + + iface = E_MAIL_READER_GET_IFACE (reader); + g_return_val_if_fail (iface->get_popup_menu != NULL, NULL); + + return iface->get_popup_menu (reader); +} + EShellBackend * e_mail_reader_get_shell_backend (EMailReader *reader) { diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index d1b713d051..e9f9a3a9e4 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -83,6 +83,7 @@ struct _EMailReaderIface { EMFormatHTMLDisplay * (*get_html_display) (EMailReader *reader); MessageList * (*get_message_list) (EMailReader *reader); + GtkMenu * (*get_popup_menu) (EMailReader *reader); EShellBackend * (*get_shell_backend) (EMailReader *reader); GtkWindow * (*get_window) (EMailReader *reader); @@ -110,6 +111,7 @@ gboolean e_mail_reader_get_hide_deleted (EMailReader *reader); EMFormatHTMLDisplay * e_mail_reader_get_html_display (EMailReader *reader); MessageList * e_mail_reader_get_message_list (EMailReader *reader); +GtkMenu * e_mail_reader_get_popup_menu (EMailReader *reader); EShellBackend * e_mail_reader_get_shell_backend (EMailReader *reader); GtkWindow * e_mail_reader_get_window (EMailReader *reader); void e_mail_reader_set_folder (EMailReader *reader, diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index 60ddde7727..10c714a176 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -588,6 +588,25 @@ mail_shell_content_get_message_list (EMailReader *reader) return MESSAGE_LIST (priv->message_list); } +static GtkMenu * +mail_shell_content_get_popup_menu (EMailReader *reader) +{ + EShellView *shell_view; + EShellWindow *shell_window; + EShellContent *shell_content; + GtkUIManager *ui_manager; + GtkWidget *widget; + + shell_content = E_SHELL_CONTENT (reader); + shell_view = e_shell_content_get_shell_view (shell_content); + shell_window = e_shell_view_get_shell_window (shell_view); + + ui_manager = e_shell_window_get_ui_manager (shell_window); + widget = gtk_ui_manager_get_widget (ui_manager, "/mail-preview-popup"); + + return GTK_MENU (widget); +} + static EShellBackend * mail_shell_content_get_shell_backend (EMailReader *reader) { @@ -720,6 +739,7 @@ mail_shell_content_reader_init (EMailReaderIface *iface) iface->get_hide_deleted = mail_shell_content_get_hide_deleted; iface->get_html_display = mail_shell_content_get_html_display; iface->get_message_list = mail_shell_content_get_message_list; + iface->get_popup_menu = mail_shell_content_get_popup_menu; iface->get_shell_backend = mail_shell_content_get_shell_backend; iface->get_window = mail_shell_content_get_window; iface->set_folder = mail_shell_content_set_folder; diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index 7f48329136..db0d3e39e4 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -162,6 +162,36 @@ mail_shell_view_message_list_right_click_cb (EShellView *shell_view, return TRUE; } +static gboolean +mail_shell_view_popup_event_cb (EMailShellView *mail_shell_view, + GdkEventButton *event, + const gchar *uri) +{ + EShellView *shell_view; + EMailReader *reader; + GtkMenu *menu; + + if (uri != NULL) + return FALSE; + + shell_view = E_SHELL_VIEW (mail_shell_view); + reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); + menu = e_mail_reader_get_popup_menu (reader); + + e_shell_view_update_actions (shell_view); + + if (event == NULL) + gtk_menu_popup ( + menu, NULL, NULL, NULL, NULL, + 0, gtk_get_current_event_time ()); + else + gtk_menu_popup ( + menu, NULL, NULL, NULL, NULL, + event->button, event->time); + + return TRUE; +} + static void mail_shell_view_reader_changed_cb (EMailShellView *mail_shell_view, EMailReader *reader) @@ -318,7 +348,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) GtkUIManager *ui_manager; MessageList *message_list; EMailReader *reader; - GtkHTML *html; + EWebView *web_view; const gchar *source; guint merge_id; gint ii = 0; @@ -356,7 +386,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree)); - html = EM_FORMAT_HTML (html_display)->html; + web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html); g_signal_connect_swapped ( folder_tree, "folder-selected", @@ -415,18 +445,23 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) mail_shell_view); g_signal_connect_swapped ( - html, "key-press-event", + web_view, "key-press-event", G_CALLBACK (mail_shell_view_key_press_event_cb), mail_shell_view); + g_signal_connect_swapped ( + web_view, "popup-event", + G_CALLBACK (mail_shell_view_popup_event_cb), + mail_shell_view); + g_signal_connect_data ( - html, "scroll", + web_view, "scroll", G_CALLBACK (mail_shell_view_scroll_cb), mail_shell_view, (GClosureNotify) NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED); g_signal_connect_swapped ( - html, "status-message", + web_view, "status-message", G_CALLBACK (mail_shell_view_reader_status_message_cb), mail_shell_view); 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 a02e2a540f..c708ee3ad1 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 @@ -19,6 +19,14 @@ </menu> </placeholder> </menubar> + <popup name="mail-preview-popup"> + <placeholder name="mail-message-popup-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> + </popup> </ui-manager> <ui-manager id="org.gnome.evolution.mail" callback="mail_shell_view_init"> @@ -42,6 +50,14 @@ <menuitem action="mail-convert-to-memo"/> </placeholder> </popup> + <popup name="mail-preview-popup"> + <placeholder name="mail-message-popup-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> + </popup> </ui-manager> </hook> diff --git a/ui/evolution-mail-reader.ui b/ui/evolution-mail-reader.ui index acc8dd3d47..12dea8bf50 100644 --- a/ui/evolution-mail-reader.ui +++ b/ui/evolution-mail-reader.ui @@ -136,4 +136,17 @@ <menuitem action='mail-popup-print'/> </placeholder> </popup> + <popup name='mail-preview-popup'> + <menuitem action='mail-popup-clipboard-copy'/> + <separator/> + <menuitem action='mail-popup-reply-sender'/> + <menuitem action='mail-popup-reply-all'/> + <menuitem action='mail-popup-forward'/> + <separator/> + <menuitem action='mail-popup-message-edit'/> + <menuitem action='mail-popup-save-as'/> + <menuitem action='mail-popup-print'/> + <separator/> + <placeholder name='mail-message-popup-actions'/> + </popup> </ui> diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c index a49fd22527..afbe2d9455 100644 --- a/widgets/misc/e-web-view.c +++ b/widgets/misc/e-web-view.c @@ -346,7 +346,7 @@ web_view_button_press_event_cb (EWebView *web_view, uri = e_web_view_extract_uri (web_view, event, frame); - if (uri == NULL || g_str_has_prefix (uri, "##")) { + if (uri != NULL && g_str_has_prefix (uri, "##")) { g_free (uri); return FALSE; } @@ -637,6 +637,9 @@ web_view_popup_event (EWebView *web_view, GdkEventButton *event, const gchar *uri) { + if (uri == NULL) + return FALSE; + e_web_view_set_selected_uri (web_view, uri); e_web_view_show_popup_menu (web_view, event, NULL, NULL); |