Re: [evolution-patches] Patch for 72275 (Can't use Shift+F10 to popup context menu for link in message)
- From: Not Zed <notzed ximian com>
- To: Harry Lu <Harry Lu Sun COM>
- Cc: evolution-patches <evolution-patches ximian com>
- Subject: Re: [evolution-patches] Patch for 72275 (Can't use Shift+F10 to popup context menu for link in message)
- Date: Tue, 08 Feb 2005 10:44:00 +0800
You shouldn't need to change the popup handler in em-folder-view. This is pretty busted, you're calling a lower-level object to then proxy a call back to the higher level one(s).
Can't you just hook onto the 'popup' signal of the gtkhtml from within em-format-html-display and do this?
On Mon, 2005-02-07 at 16:06 +0800, Harry Lu wrote:
Hi, NotZed,
Here is a patch for 72275. Please review it.
Thanks!
Harry
text/plain attachment (popupmenu2.diff)
|
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3569
diff -u -r1.3569 ChangeLog
--- ChangeLog 4 Feb 2005 04:14:22 -0000 1.3569
+++ ChangeLog 7 Feb 2005 07:58:04 -0000
@@ -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
Index: em-folder-view.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-view.c,v
retrieving revision 1.104
diff -u -r1.104 em-folder-view.c
--- em-folder-view.c 1 Feb 2005 19:30:49 -0000 1.104
+++ em-folder-view.c 7 Feb 2005 07:58:27 -0000
@@ -2160,9 +2160,15 @@
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 */
+ 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 +2294,10 @@
}
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;
}
Index: em-format-html-display.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-html-display.c,v
retrieving revision 1.61
diff -u -r1.61 em-format-html-display.c
--- em-format-html-display.c 21 Jan 2005 06:38:29 -0000 1.61
+++ em-format-html-display.c 7 Feb 2005 07:58:52 -0000
@@ -612,6 +612,41 @@
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 = "" != NULL
+ || (url = "" 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)
{
Index: em-format-html-display.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-html-display.h,v
retrieving revision 1.3
diff -u -r1.3 em-format-html-display.h
--- em-format-html-display.h 7 Jan 2004 14:29:06 -0000 1.3
+++ em-format-html-display.h 7 Feb 2005 07:58:53 -0000
@@ -58,6 +58,8 @@
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 *);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]