aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2009-01-12 12:12:01 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2009-01-12 12:12:01 +0800
commitc7d3c9f95609123035ebaa267f9d2e6ecfa8c2e8 (patch)
tree246bdb714e24e1b0c9a8ce4a3e45a46b230316de /composer/e-msg-composer.c
parentf8b33bc4ebe9dd8043674141b5fe4660efaa99e8 (diff)
downloadgsoc2013-evolution-c7d3c9f95609123035ebaa267f9d2e6ecfa8c2e8.tar.gz
gsoc2013-evolution-c7d3c9f95609123035ebaa267f9d2e6ecfa8c2e8.tar.zst
gsoc2013-evolution-c7d3c9f95609123035ebaa267f9d2e6ecfa8c2e8.zip
Merge revisions 36866:37046 from trunk.
svn path=/branches/kill-bonobo/; revision=37050
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r--composer/e-msg-composer.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 7b55072653..f930d102f2 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -62,6 +62,7 @@
#include "misc/e-charset-picker.h"
#include "misc/e-expander.h"
#include "e-util/e-error.h"
+#include "e-util/e-mktemp.h"
#include "e-util/e-plugin-ui.h"
#include "e-util/e-util-private.h"
#include "e-signature-combo-box.h"
@@ -2407,6 +2408,7 @@ msg_composer_paste_clipboard (GtkhtmlEditor *editor)
EMsgComposer *composer;
GtkWidget *parent;
GtkWidget *widget;
+ GtkClipboard *clipboard;
composer = E_MSG_COMPOSER (editor);
widget = gtk_window_get_focus (GTK_WINDOW (editor));
@@ -2417,8 +2419,37 @@ msg_composer_paste_clipboard (GtkhtmlEditor *editor)
return;
}
- /* Chain up to parent's paste_clipboard() method. */
- GTKHTML_EDITOR_CLASS (parent_class)->paste_clipboard (editor);
+ clipboard = gtk_widget_get_clipboard (widget, GDK_SELECTION_CLIPBOARD);
+ if (clipboard && gtk_clipboard_wait_is_image_available (clipboard)) {
+ GdkPixbuf *pixbuf;
+
+ pixbuf = gtk_clipboard_wait_for_image (clipboard);
+ if (pixbuf) {
+ char *tmpl = g_strconcat (_("Image"), "-XXXXXX", NULL);
+ char *filename = e_mktemp (tmpl);
+
+ g_free (tmpl);
+
+ if (filename && gdk_pixbuf_save (pixbuf, filename, "png", NULL, NULL)) {
+ if (gtkhtml_editor_get_html_mode (editor)) {
+ char *uri = g_strconcat ("file://", filename, NULL);
+ /* this loads image async, thus cannot remove file from this */
+ gtkhtml_editor_insert_image (editor, uri);
+ g_free (uri);
+ } else {
+ /* this loads image immediately, remove file from cache to free up disk space */
+ e_attachment_bar_attach (E_ATTACHMENT_BAR (composer->priv->attachment_bar), filename, "image/png");
+ g_remove (filename);
+ }
+ }
+
+ g_free (filename);
+ g_object_unref (pixbuf);
+ }
+ } else {
+ /* Chain up to parent's paste_clipboard() method. */
+ GTKHTML_EDITOR_CLASS (parent_class)->paste_clipboard (editor);
+ }
}
static void
@@ -3096,7 +3127,7 @@ handle_multipart_signed (EMsgComposer *composer,
mime_part = camel_multipart_get_part (
multipart, CAMEL_MULTIPART_SIGNED_CONTENT);
- if (mime_part != NULL)
+ if (mime_part == NULL)
return;
content_type = camel_mime_part_get_content_type (mime_part);