From e4177ed4c0de5eaa4294c756a43e072f1373cb0f Mon Sep 17 00:00:00 2001 From: infirit Date: Sat, 26 Jul 2014 12:15:01 +0200 Subject: Allow handling multiple clipboard data formats from one menu entry The new class "snapshots" the required data from the given EomImage and keeps it around for clipboard usage until the clipboard gets reset. Based on eog commit dcb56b03e9c9282138b9da94eddcedfc401ab750 From Felix Riemann --- src/eom-window.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/eom-window.c') diff --git a/src/eom-window.c b/src/eom-window.c index 5b4f59d..8be70e4 100644 --- a/src/eom-window.c +++ b/src/eom-window.c @@ -52,6 +52,7 @@ #include "eom-save-as-dialog-helper.h" #include "eom-plugin-engine.h" #include "eom-close-confirmation-dialog.h" +#include "eom-clipboard-handler.h" #include "eom-enum-types.h" @@ -3546,10 +3547,10 @@ static void eom_window_cmd_copy_image (GtkAction *action, gpointer user_data) { GtkClipboard *clipboard; - GdkPixbuf *pix; EomWindow *window; EomWindowPrivate *priv; EomImage *image; + EomClipboardHandler *cbhandler; g_return_if_fail (EOM_IS_WINDOW (user_data)); @@ -3560,12 +3561,12 @@ eom_window_cmd_copy_image (GtkAction *action, gpointer user_data) g_return_if_fail (EOM_IS_IMAGE (image)); - pix = eom_image_get_pixbuf (image); - clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); - gtk_clipboard_set_image (clipboard, pix); - g_object_unref (pix); + cbhandler = eom_clipboard_handler_new (image); + // cbhandler will self-destruct when it's not needed anymore + eom_clipboard_handler_copy_to_clipboard (cbhandler, clipboard); + } static void -- cgit v1.2.1