diff options
author | Radek Doulik <rodo@src.gnome.org> | 2001-03-23 04:17:29 +0800 |
---|---|---|
committer | Radek Doulik <rodo@src.gnome.org> | 2001-03-23 04:17:29 +0800 |
commit | 200a404bb423760bb81fd5d32273b76773044204 (patch) | |
tree | f64f98ff3b550789a8772ce056571e7823a72c75 | |
parent | 65cb1664da2ba2bb678ee78b8dff1fd01b297cc0 (diff) | |
download | gsoc2013-evolution-200a404bb423760bb81fd5d32273b76773044204.tar gsoc2013-evolution-200a404bb423760bb81fd5d32273b76773044204.tar.gz gsoc2013-evolution-200a404bb423760bb81fd5d32273b76773044204.tar.bz2 gsoc2013-evolution-200a404bb423760bb81fd5d32273b76773044204.tar.lz gsoc2013-evolution-200a404bb423760bb81fd5d32273b76773044204.tar.xz gsoc2013-evolution-200a404bb423760bb81fd5d32273b76773044204.tar.zst gsoc2013-evolution-200a404bb423760bb81fd5d32273b76773044204.zip |
(html_motion_notify_event): new handler, highlights addresses by
underline
svn path=/trunk/; revision=8900
-rw-r--r-- | mail/ChangeLog | 2 | ||||
-rw-r--r-- | mail/mail-display.c | 50 | ||||
-rw-r--r-- | mail/mail-display.h | 1 |
3 files changed, 53 insertions, 0 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 2bf7e4ea50..60e8c0be89 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -9,6 +9,8 @@ connecting to button_press_event of all iframes : plus bunch of empty methods for popup menu items - to be implemented + (html_motion_notify_event): new handler, highlights addresses by + underline * mail-format.c (write_address): revert back to raw HTML text, store name and email to Text objects, workaround gtkhtml tables diff --git a/mail/mail-display.c b/mail/mail-display.c index d949435357..9ee45bac9c 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -38,6 +38,7 @@ #include <gtkhtml/htmlengine.h> /* XXX */ #include <gtkhtml/htmlobject.h> /* XXX */ #include <gtkhtml/htmlinterval.h> /* XXX */ +#include <gtkhtml/htmltext.h> /* XXX */ #define PARENT_TYPE (gtk_vbox_get_type ()) @@ -1122,11 +1123,57 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay * return FALSE; } +static inline void +set_underline (HTMLEngine *e, HTMLObject *o, gboolean underline) +{ + HTMLText *text = HTML_TEXT (o); + + html_text_set_font_style (text, e, underline + ? html_text_get_font_style (text) | GTK_HTML_FONT_STYLE_UNDERLINE + : html_text_get_font_style (text) & ~GTK_HTML_FONT_STYLE_UNDERLINE); + html_engine_queue_draw (e, o); +} + +static gint +html_motion_notify_event (GtkWidget *widget, GdkEventMotion *event, MailDisplay *mail_display) +{ + HTMLPoint *point; + const gchar *email; + gint x, y; + + g_return_val_if_fail (widget != NULL, 0); + g_return_val_if_fail (GTK_IS_HTML (widget), 0); + g_return_val_if_fail (event != NULL, 0); + + if (!event->is_hint) { + x = event->x; + y = event->y; + } + + point = html_engine_get_point_at (GTK_HTML (widget)->engine, event->x, event->y, FALSE); + if (mail_display->last_active && (!point || mail_display->last_active != point->object)) { + set_underline (GTK_HTML (widget)->engine, HTML_OBJECT (mail_display->last_active), FALSE); + mail_display->last_active = NULL; + } + if (point) { + email = (const gchar *) html_object_get_data (point->object, "email"); + if (email && html_object_is_text (point->object)) { + set_underline (GTK_HTML (widget)->engine, point->object, TRUE); + mail_display->last_active = point->object; + } + html_point_destroy (point); + } + + return TRUE; +} + static void html_iframe_created (GtkWidget *w, GtkHTML *iframe, MailDisplay *mail_display) { gtk_signal_connect (GTK_OBJECT (iframe), "button_press_event", GTK_SIGNAL_FUNC (html_button_press_event), mail_display); + gtk_signal_connect (GTK_OBJECT (iframe), "motion_notify_event", + GTK_SIGNAL_FUNC (html_motion_notify_event), mail_display); } GtkWidget * @@ -1161,6 +1208,8 @@ mail_display_new (void) mail_display); gtk_signal_connect (GTK_OBJECT (html), "button_press_event", GTK_SIGNAL_FUNC (html_button_press_event), mail_display); + gtk_signal_connect (GTK_OBJECT (html), "motion_notify_event", + GTK_SIGNAL_FUNC (html_motion_notify_event), mail_display); gtk_signal_connect (GTK_OBJECT (html), "iframe_created", GTK_SIGNAL_FUNC (html_iframe_created), mail_display); @@ -1170,6 +1219,7 @@ mail_display_new (void) mail_display->scroll = E_SCROLL_FRAME (scroll); mail_display->html = GTK_HTML (html); mail_display->stream = NULL; + mail_display->last_active = NULL; mail_display->data = g_new0 (GData *, 1); g_datalist_init (mail_display->data); diff --git a/mail/mail-display.h b/mail/mail-display.h index 4334d7dfad..1af092e028 100644 --- a/mail/mail-display.h +++ b/mail/mail-display.h @@ -26,6 +26,7 @@ struct _MailDisplay { EScrollFrame *scroll; GtkHTML *html; GtkHTMLStream *stream; + gpointer last_active; guint idle_id; CamelMimeMessage *current_message; |