diff options
author | Nickolay V. Shmyrev <nshmyrev@src.gnome.org> | 2005-10-17 18:41:22 (GMT) |
---|---|---|
committer | Nickolay V. Shmyrev <nshmyrev@src.gnome.org> | 2005-10-17 18:41:22 (GMT) |
commit | 0ecfeba326af04a2b9cd27776aa84827f1f638a7 (patch) | |
tree | 032f41ba03e670e4686e87f9684d4c2beb8958d5 /dvi/dvi-document.c | |
parent | 0c56e0840f68b6594dd54040a99440d94286a5e6 (diff) |
Save a copy implemented for various backends.
* configure.ac:
* djvu/djvu-document.c: (djvu_document_load), (djvu_document_save),
(djvu_document_finalize):
* dvi/dvi-document.c: (dvi_document_load), (dvi_document_save),
(dvi_document_finalize):
* pixbuf/pixbuf-document.c: (pixbuf_document_load),
(pixbuf_document_save), (pixbuf_document_finalize):
* tiff/tiff-document.c: (tiff_document_load), (tiff_document_save),
(tiff_document_finalize):
Save a copy implemented for various backends.
Diffstat (limited to 'dvi/dvi-document.c')
-rw-r--r-- | dvi/dvi-document.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/dvi/dvi-document.c b/dvi/dvi-document.c index d462758..6ecbc3a 100644 --- a/dvi/dvi-document.c +++ b/dvi/dvi-document.c @@ -29,6 +29,10 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> +#include <libgnomevfs/gnome-vfs-uri.h> +#include <libgnomevfs/gnome-vfs-utils.h> +#include <libgnomevfs/gnome-vfs-ops.h> +#include <libgnomevfs/gnome-vfs-xfer.h> GMutex *dvi_context_mutex = NULL; @@ -54,6 +58,8 @@ struct _DviDocument double base_width; double base_height; + + gchar *uri; }; typedef struct _DviDocumentClass DviDocumentClass; @@ -113,6 +119,8 @@ dvi_document_load (EvDocument *document, dvi_context_mutex = g_mutex_new (); + g_free (dvi_document->uri); + dvi_document->uri = g_strdup (uri); return TRUE; } @@ -123,7 +131,32 @@ dvi_document_save (EvDocument *document, const char *uri, GError **error) { - g_warning ("dvi_document_save not implemented"); /* FIXME */ + DviDocument *dvi_document = DVI_DOCUMENT (document); + GnomeVFSResult result; + GnomeVFSURI *source_uri; + GnomeVFSURI *target_uri; + + if (!dvi_document->uri) + return FALSE; + + source_uri = gnome_vfs_uri_new (dvi_document->uri); + target_uri = gnome_vfs_uri_new (uri); + + result = gnome_vfs_xfer_uri (source_uri, target_uri, + GNOME_VFS_XFER_DEFAULT | GNOME_VFS_XFER_FOLLOW_LINKS, + GNOME_VFS_XFER_ERROR_MODE_ABORT, + GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE, + NULL, + NULL); + gnome_vfs_uri_unref (target_uri); + gnome_vfs_uri_unref (source_uri); + + if (result != GNOME_VFS_OK) + g_set_error (error, + EV_DOCUMENT_ERROR, + 0, + gnome_vfs_result_to_string (result)); + return (result == GNOME_VFS_OK); return TRUE; } @@ -210,6 +243,8 @@ dvi_document_finalize (GObject *object) if (dvi_document->params) g_free (dvi_document->params); + + g_free (dvi_document->uri); G_OBJECT_CLASS (dvi_document_parent_class)->finalize (object); } |