aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarry Lu <harry.lu@sun.com>2005-02-08 11:50:38 +0800
committerHarry Lu <haip@src.gnome.org>2005-02-08 11:50:38 +0800
commitc0c618e5a7aeb6d1130760669ee8936e7f896458 (patch)
treeb9b6777acf311b02b28ea0798f1f04fd610b1a7b
parent80f47d42b88b901c3234f923ce50eaa785397e4b (diff)
downloadgsoc2013-evolution-c0c618e5a7aeb6d1130760669ee8936e7f896458.tar
gsoc2013-evolution-c0c618e5a7aeb6d1130760669ee8936e7f896458.tar.gz
gsoc2013-evolution-c0c618e5a7aeb6d1130760669ee8936e7f896458.tar.bz2
gsoc2013-evolution-c0c618e5a7aeb6d1130760669ee8936e7f896458.tar.lz
gsoc2013-evolution-c0c618e5a7aeb6d1130760669ee8936e7f896458.tar.xz
gsoc2013-evolution-c0c618e5a7aeb6d1130760669ee8936e7f896458.tar.zst
gsoc2013-evolution-c0c618e5a7aeb6d1130760669ee8936e7f896458.zip
Fix for 72275. try to bring up menu for preivew html object.
2005-02-07 Harry Lu <harry.lu@sun.com> 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
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/em-folder-view.c17
-rw-r--r--mail/em-format-html-display.c35
-rw-r--r--mail/em-format-html-display.h2
4 files changed, 62 insertions, 2 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index b3214b4a98..58d804e2b9 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,13 @@
+2005-02-07 Harry Lu <harry.lu@sun.com>
+
+ 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.
+
2005-02-04 Not Zed <NotZed@Ximian.com>
* em-subscribe-editor.c (sub_folderinfo_get): reverted jeff's
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index a604b0a4bf..c0bb8f9cc5 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -2160,9 +2160,19 @@ emfv_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev,
static gboolean
emfv_popup_menu (GtkWidget *widget)
{
+ gboolean ret = FALSE;
EMFolderView *emfv = (EMFolderView *)widget;
- emfv_popup (emfv, NULL);
+ /* Try to bring up menu for preview html object.
+ Currently we cannot directly connect to html's "popup_menu" signal
+ since it doesn't work.
+ */
+
+ if (GTK_WIDGET_HAS_FOCUS (emfv->preview->formathtml.html))
+ ret = em_format_html_display_popup_menu (emfv->preview);
+
+ if (!ret)
+ emfv_popup (emfv, NULL);
return TRUE;
}
@@ -2288,7 +2298,10 @@ emfv_format_popup_event(EMFormatHTMLDisplay *efhd, GdkEventButton *event, const
}
menu = e_popup_create_menu_once((EPopup *)emp, target, 0);
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button, event->time);
+ 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;
}
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)
{
diff --git a/mail/em-format-html-display.h b/mail/em-format-html-display.h
index 1bf1b395d8..31a928ad5b 100644
--- a/mail/em-format-html-display.h
+++ b/mail/em-format-html-display.h
@@ -58,6 +58,8 @@ void em_format_html_display_zoom_in (EMFormatHTMLDisplay *efhd);
void em_format_html_display_zoom_out (EMFormatHTMLDisplay *efhd);
void em_format_html_display_zoom_reset (EMFormatHTMLDisplay *efhd);
+gboolean em_format_html_display_popup_menu (EMFormatHTMLDisplay *efhd);
+
/* experimental */
struct _EPopupExtension;
void em_format_html_display_set_popup(EMFormatHTMLDisplay *, struct _EPopupExtension *);