From c0c618e5a7aeb6d1130760669ee8936e7f896458 Mon Sep 17 00:00:00 2001 From: Harry Lu Date: Tue, 8 Feb 2005 03:50:38 +0000 Subject: Fix for 72275. try to bring up menu for preivew html object. 2005-02-07 Harry Lu Fix for 72275. * em-folder-view.c: (emfv_popup_menu): try to bring up menu for preivew html object. (emfv_format_popup_event): handle event == NULL case. * em-format-html-display.c: (em_format_html_display_popup_menu): New function to popup context menu. * em-format-html-display.h: add new function declaration. svn path=/trunk/; revision=28744 --- mail/em-format-html-display.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'mail/em-format-html-display.c') diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index 8175b29df8..6f74fa0495 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -612,6 +612,41 @@ efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormat return res; } +gboolean +em_format_html_display_popup_menu (EMFormatHTMLDisplay *efhd) +{ + GtkHTML *html; + HTMLEngine *e; + HTMLObject *obj; + const char *url; + gboolean res = FALSE; + gint offset; + EMFormatPURI *puri = NULL; + char *uri = NULL; + + html = efhd->formathtml.html; + e = html->engine; + if (!efhd->caret_mode) + obj = html_engine_get_focus_object (e, &offset); + else { + obj = e->cursor->object; + offset = e->cursor->offset; + } + + if ( obj != NULL + && ((url = html_object_get_src(obj)) != NULL + || (url = html_object_get_url(obj, offset)) != NULL)) { + uri = gtk_html_get_url_object_relative(html, obj, url); + puri = em_format_find_puri((EMFormat *)efhd, uri); + } + + g_signal_emit((GtkObject *)efhd, efhd_signals[EFHD_POPUP_EVENT], 0, NULL, uri, puri?puri->part:NULL, &res); + + g_free(uri); + + return res; +} + static void efhd_html_link_clicked (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efhd) { -- cgit v1.2.3