]> www.fi.muni.cz Git - evince.git/commitdiff
Return a real uri instead of a filename when saving an image. Fixes images
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 16 Feb 2008 11:53:30 +0000 (11:53 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Sat, 16 Feb 2008 11:53:30 +0000 (11:53 +0000)
2008-02-16  Carlos Garcia Campos  <carlosgc@gnome.org>
* libdocument/ev-image.c: (ev_image_finalize),
(ev_image_save_tmp):
Return a real uri instead of a filename when saving an
image. Fixes images drag an drop from evince to nautilus.

svn path=/trunk/; revision=2917

ChangeLog
libdocument/ev-image.c

index 9af08da98255261e1b1c65918ed67a50e4ef0a57..a0fa0fc552f374f984a95c40ce502356fd98b986 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-02-16  Carlos Garcia Campos  <carlosgc@gnome.org>
+
+       * libdocument/ev-image.c: (ev_image_finalize),
+       (ev_image_save_tmp):
+
+       Return a real uri instead of a filename when saving an
+       image. Fixes images drag an drop from evince to nautilus. 
+       
 2008-02-16  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * backend/pdf/ev-poppler.cc:
index 4276dd482a0fd63969c74ee6e9e1c894d43256c7..1fa6bfd6dd34c7515121a1aaa2e2b0be4f370cee 100644 (file)
@@ -46,7 +46,11 @@ ev_image_finalize (GObject *object)
        }
 
        if (image->priv->tmp_uri) {
-               ev_tmp_filename_unlink (image->priv->tmp_uri);
+               gchar *filename;
+
+               filename = g_filename_from_uri (image->priv->tmp_uri, NULL, NULL);
+               ev_tmp_filename_unlink (filename);
+               g_free (filename);
                g_free (image->priv->tmp_uri);
                image->priv->tmp_uri = NULL;
        }
@@ -128,6 +132,7 @@ ev_image_save_tmp (EvImage   *image,
                   GdkPixbuf *pixbuf)
 {
        GError *error = NULL;
+       gchar  *filename;
        
        g_return_val_if_fail (EV_IS_IMAGE (image), NULL);
        g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
@@ -135,18 +140,21 @@ ev_image_save_tmp (EvImage   *image,
        if (image->priv->tmp_uri)
                return image->priv->tmp_uri;
 
-       image->priv->tmp_uri = ev_tmp_filename ("image");
-       gdk_pixbuf_save (pixbuf, image->priv->tmp_uri,
+       filename = ev_tmp_filename ("image");
+       gdk_pixbuf_save (pixbuf, filename,
                         "png", &error,
                         "compression", "3", NULL);
-       if (!error)
+       if (!error) {
+               image->priv->tmp_uri = g_filename_to_uri (filename, NULL, NULL);
+               g_free (filename);
+               
                return image->priv->tmp_uri;
+       }
 
        /* Erro saving image */
        g_warning (error->message);
        g_error_free (error);
-       g_free (image->priv->tmp_uri);
-       image->priv->tmp_uri = NULL;
+       g_free (filename);
 
        return NULL;
 }