From cf9a0987d91a362480ba13fc6f901c27c8e40a08 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 13 May 2004 06:57:22 +0000 Subject: re-enabled the reply to selection stuff. I worked out how to make it work; 2004-05-13 Not Zed * em-folder-view.c (emfv_message_reply): re-enabled the reply to selection stuff. I worked out how to make it work; I think. * em-format-html-display.c (efhd_html_button_press_event): if we aren't on a clickable object, do a null popup event instead. * em-folder-view.c (emfv_format_popup_event): do the full popup if we aren't on anything (not on a uri or part). See #8414. svn path=/trunk/; revision=25894 --- mail/ChangeLog | 9 +++++++++ mail/em-folder-view.c | 23 +++++++++++++---------- mail/em-format-html-display.c | 19 +++++++++---------- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 23dd57e3e7..0ce3a621be 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,14 @@ 2004-05-13 Not Zed + * em-folder-view.c (emfv_message_reply): re-enabled the reply to + selection stuff. I worked out how to make it work; I think. + + * em-format-html-display.c (efhd_html_button_press_event): if we + aren't on a clickable object, do a null popup event instead. + + * em-folder-view.c (emfv_format_popup_event): do the full popup if + we aren't on anything (not on a uri or part). See #8414. + * GNOME_Evolution_Mail.server.in.in: added "email" to the uri_schema's attribute. diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index fae2f6f11f..d5c1d9c2e6 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -1237,15 +1237,9 @@ emfv_message_reply(EMFolderView *emfv, int mode) /* HACK: Nasty internal gtkhtml poking going on here */ - /* Disabled since there's no simple way to find out if - gtkhtml has the primary selection right now */ - - /* Ugh, to use the clipboard we need to request the selection - and have an async callback - painful to deal with */ - - /*clip = gtk_clipboard_get(GDK_SELECTION_PRIMARY);*/ - if (FALSE /*gtk_clipboard_get_owner(clip) == (GObject *)emfv->preview*/ + if (((EMFormatHTML *)emfv->preview)->html->engine->selection && ((EMFormatHTML *)emfv->preview)->html->engine->primary) { + /* && GTK_WIDGET_HAS_FOCUS(emfv->preview->formathtml.html)*/ CamelMimeMessage *msg, *src; struct _camel_header_raw *header; HTMLEngineSaveState *state; @@ -1275,8 +1269,6 @@ emfv_message_reply(EMFolderView *emfv, int mode) } else { em_utils_reply_to_message_by_uid (emfv->folder, emfv->list->cursor_uid, mode); } - - /*g_object_unref(clip);*/ } static void @@ -2094,6 +2086,17 @@ emfv_format_popup_event(EMFormatHTMLDisplay *efhd, GdkEventButton *event, const EMPopupTarget *target; GtkMenu *menu; + if (uri == NULL && part == NULL) { + /* So we don't try and popup with nothing selected - rather odd result! */ + GPtrArray *uids = message_list_get_selected(emfv->list); + int doit = uids->len > 0; + + message_list_free_uids(emfv->list, uids); + if (doit) + emfv_popup(emfv, event); + return doit; + } + /* FIXME: this maybe should just fit on em-html-display, it has access to the snooped part type */ diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index 2e210e743e..1ebc136303 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -584,31 +584,30 @@ efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormat const char *url; gboolean res = FALSE; gint offset; + EMFormatPURI *puri = NULL; + char *uri = NULL; if (event->button != 3) return FALSE; e = ((GtkHTML *)widget)->engine; obj = html_engine_get_object_at(e, event->x, event->y, &offset, FALSE); - if (obj == NULL) - return FALSE; d(printf("popup button pressed\n")); - if ( (url = html_object_get_src(obj)) != NULL - || (url = html_object_get_url(obj, offset)) != NULL) { - EMFormatPURI *puri; - char *uri; - + 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((GtkHTML *)widget, obj, url); puri = em_format_find_puri((EMFormat *)efhd, uri); d(printf("poup event, uri = '%s' part = '%p'\n", uri, puri?puri->part:NULL)); - - g_signal_emit((GtkObject *)efhd, efhd_signals[EFHD_POPUP_EVENT], 0, event, uri, puri?puri->part:NULL, &res); - g_free(uri); } + g_signal_emit((GtkObject *)efhd, efhd_signals[EFHD_POPUP_EVENT], 0, event, uri, puri?puri->part:NULL, &res); + + g_free(uri); + return res; } -- cgit v1.2.3