From 269524c33fbd6e595d397ceb622232dbcadc0941 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Fri, 27 Jan 2006 20:12:00 +0000 Subject: Committed Rajeev's patch. svn path=/trunk/; revision=31333 --- mail/em-format-html-display.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 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 a74bc708eb..7e4d5c19af 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -80,6 +80,7 @@ #include #include +#include #include #include @@ -1430,6 +1431,46 @@ efhd_image_resized(GtkWidget *w, GtkAllocation *event, struct _attach_puri *info g_object_unref(pb); } +static void +efhd_change_cursor(GtkWidget *w, GdkEventCrossing *event, struct _attach_puri *info) +{ + if (info->shown && info->image) { + if (info->fit_width != 0) { + if (em_icon_stream_is_resized(info->puri.cid, info->fit_width, info->fit_height)) + e_cursor_set(w->window, E_CURSOR_ZOOM_IN); + + } + } +} + +static void +efhd_image_fit_width(GtkWidget *widget, GdkEventButton *event, struct _attach_puri *info) +{ + int width; + + width = ((GtkWidget *)((EMFormatHTML *)info->puri.format)->html)->allocation.width - 12; + + if (info->shown && info->image) { + if (info->fit_width != 0) { + if (em_icon_stream_is_resized(info->puri.cid, info->fit_width, info->fit_height)) { + if(info->fit_width != width) { + info->fit_width = width; + e_cursor_set (widget->window, E_CURSOR_ZOOM_IN); + } else { + info->fit_width = 0; + e_cursor_set(widget->window, E_CURSOR_ZOOM_OUT); + } + } + } else { + info->fit_width = width; + e_cursor_set (widget->window, E_CURSOR_ZOOM_IN); + } + } + + gtk_image_set_from_pixbuf(info->image, em_icon_stream_get_image(info->puri.cid, info->fit_width, info->fit_height)); +} + + static gboolean efhd_attachment_image(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) { @@ -1474,7 +1515,9 @@ efhd_attachment_image(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObjec g_signal_connect (box, "drag-data-delete", G_CALLBACK(efhd_drag_data_delete), pobject); g_signal_connect(box, "button_press_event", G_CALLBACK(efhd_image_popup), info); + g_signal_connect(box, "enter-notify-event", G_CALLBACK(efhd_change_cursor), info); g_signal_connect(box, "popup_menu", G_CALLBACK(efhd_attachment_popup_menu), info); + g_signal_connect(box, "button-press-event", G_CALLBACK(efhd_image_fit_width), info); return TRUE; } -- cgit v1.2.3