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 /mail | |
parent | 43594a8b6eeeb072a672041cd72b2b211dd56958 (diff) | |
download | gsoc2013-evolution-e841a0b22395bae0097f89a208c8b5309f77166b.tar gsoc2013-evolution-e841a0b22395bae0097f89a208c8b5309f77166b.tar.gz gsoc2013-evolution-e841a0b22395bae0097f89a208c8b5309f77166b.tar.bz2 gsoc2013-evolution-e841a0b22395bae0097f89a208c8b5309f77166b.tar.lz gsoc2013-evolution-e841a0b22395bae0097f89a208c8b5309f77166b.tar.xz gsoc2013-evolution-e841a0b22395bae0097f89a208c8b5309f77166b.tar.zst gsoc2013-evolution-e841a0b22395bae0097f89a208c8b5309f77166b.zip |
Bug 594863 - Message body doesn't allow right click pop up menu
Diffstat (limited to 'mail')
-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 |
3 files changed, 70 insertions, 4 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, |