diff options
author | Milan Crha <mcrha@redhat.com> | 2011-08-09 16:32:36 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2011-08-09 16:32:36 +0800 |
commit | 33be6d5da315a0abfd3fb4f74dccc9cc4a249f5e (patch) | |
tree | 202750515293b2c08c08f08b6d8ba257abd9a1e2 /widgets/misc | |
parent | 0d4cdfbc9cd14569a3d4c8b75e54e74acca04033 (diff) | |
download | gsoc2013-evolution-33be6d5da315a0abfd3fb4f74dccc9cc4a249f5e.tar.gz gsoc2013-evolution-33be6d5da315a0abfd3fb4f74dccc9cc4a249f5e.tar.zst gsoc2013-evolution-33be6d5da315a0abfd3fb4f74dccc9cc4a249f5e.zip |
Bug #655669 - Can't save inline pictures embedded in HTML Mails
Diffstat (limited to 'widgets/misc')
-rw-r--r-- | widgets/misc/e-web-view.c | 53 | ||||
-rw-r--r-- | widgets/misc/e-web-view.h | 3 |
2 files changed, 55 insertions, 1 deletions
diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c index 0c027431e7..f0eb3a64ba 100644 --- a/widgets/misc/e-web-view.c +++ b/widgets/misc/e-web-view.c @@ -47,6 +47,7 @@ struct _EWebViewPrivate { GtkUIManager *ui_manager; gchar *selected_uri; GdkPixbufAnimation *cursor_image; + gchar *cursor_image_src; GtkAction *open_proxy; GtkAction *print_proxy; @@ -85,7 +86,8 @@ enum { PROP_PRINT_PROXY, PROP_SAVE_AS_PROXY, PROP_SELECTED_URI, - PROP_CURSOR_IMAGE + PROP_CURSOR_IMAGE, + PROP_CURSOR_IMAGE_SRC }; enum { @@ -478,6 +480,7 @@ web_view_button_press_event_cb (EWebView *web_view, if (event) { GdkPixbufAnimation *anim; + gchar *image_src; if (frame == NULL) frame = GTK_HTML (web_view); @@ -486,6 +489,10 @@ web_view_button_press_event_cb (EWebView *web_view, e_web_view_set_cursor_image (web_view, anim); if (anim != NULL) g_object_unref (anim); + + image_src = gtk_html_get_image_src_at (frame, event->x, event->y); + e_web_view_set_cursor_image_src (web_view, image_src); + g_free (image_src); } if (event != NULL && event->button != 3) @@ -635,6 +642,11 @@ web_view_set_property (GObject *object, E_WEB_VIEW (object), g_value_get_object (value)); return; + case PROP_CURSOR_IMAGE_SRC: + e_web_view_set_cursor_image_src ( + E_WEB_VIEW (object), + g_value_get_string (value)); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -736,6 +748,11 @@ web_view_get_property (GObject *object, value, e_web_view_get_cursor_image ( E_WEB_VIEW (object))); return; + case PROP_CURSOR_IMAGE_SRC: + g_value_set_string ( + value, e_web_view_get_cursor_image_src ( + E_WEB_VIEW (object))); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -783,6 +800,11 @@ web_view_dispose (GObject *object) priv->cursor_image = NULL; } + if (priv->cursor_image_src != NULL) { + g_free (priv->cursor_image_src); + priv->cursor_image_src = NULL; + } + /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -1500,6 +1522,16 @@ e_web_view_class_init (EWebViewClass *class) GDK_TYPE_PIXBUF_ANIMATION, G_PARAM_READWRITE)); + g_object_class_install_property ( + object_class, + PROP_CURSOR_IMAGE_SRC, + g_param_spec_string ( + "cursor-image-src", + "Image source uri at the mouse cursor", + NULL, + NULL, + G_PARAM_READWRITE)); + signals[COPY_CLIPBOARD] = g_signal_new ( "copy-clipboard", G_TYPE_FROM_CLASS (class), @@ -2004,6 +2036,25 @@ e_web_view_set_cursor_image (EWebView *web_view, g_object_notify (G_OBJECT (web_view), "cursor-image"); } +const gchar * +e_web_view_get_cursor_image_src (EWebView *web_view) +{ + g_return_val_if_fail (E_IS_WEB_VIEW (web_view), NULL); + + return web_view->priv->cursor_image_src; +} + +void +e_web_view_set_cursor_image_src (EWebView *web_view, const gchar *src_uri) +{ + g_return_if_fail (E_IS_WEB_VIEW (web_view)); + + g_free (web_view->priv->cursor_image_src); + web_view->priv->cursor_image_src = g_strdup (src_uri); + + g_object_notify (G_OBJECT (web_view), "cursor-image-src"); +} + GtkAction * e_web_view_get_open_proxy (EWebView *web_view) { diff --git a/widgets/misc/e-web-view.h b/widgets/misc/e-web-view.h index b5f368f622..1ca9915d5e 100644 --- a/widgets/misc/e-web-view.h +++ b/widgets/misc/e-web-view.h @@ -128,6 +128,9 @@ GdkPixbufAnimation * e_web_view_get_cursor_image (EWebView *web_view); void e_web_view_set_cursor_image (EWebView *web_view, GdkPixbufAnimation *animation); +const gchar * e_web_view_get_cursor_image_src (EWebView *web_view); +void e_web_view_set_cursor_image_src (EWebView *web_view, + const gchar *src_uri); GtkAction * e_web_view_get_open_proxy (EWebView *web_view); void e_web_view_set_open_proxy (EWebView *web_view, GtkAction *open_proxy); |