-2005-10-17 Daniel Gryniewicz <dang@gentoo.org >
+2005-10-17 Nickolay V. Shmyrev <<nshmyrev@yandex.ru>>
+
+ * 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.
+
+2005-10-17 Daniel Gryniewicz <dang@gentoo.org>
* configure.ac:
KEYRING_REQUIRED=0.4.2
PKG_CHECK_MODULES(LIB, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED)
-PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED)
+PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED gnome-vfs-2.0)
PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED libglade-2.0 poppler-glib >= $POPPLER_REQUIRED)
PKG_CHECK_MODULES(POPPLER, poppler-glib >= $POPPLER_REQUIRED)
PKG_CHECK_MODULES(SHELL_CORE, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED gnome-vfs-2.0 libgnomeprint-2.2 >= 2.5.1 libgnomeprintui-2.2 libglade-2.0 gconf-2.0 poppler-glib >= $POPPLER_REQUIRED gnome-keyring-1 >= $KEYRING_REQUIRED)
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf-core.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>
+
#define SCALE_FACTOR 0.2
enum {
ddjvu_context_t *d_context;
ddjvu_document_t *d_document;
ddjvu_format_t *d_format;
+
+ gchar *uri;
};
typedef struct _DjvuDocumentClass DjvuDocumentClass;
ddjvu_message_wait (djvu_document->d_context);
ddjvu_message_pop (djvu_document->d_context);
}
+ g_free (djvu_document->uri);
+ djvu_document->uri = g_strdup (uri);
return TRUE;
}
const char *uri,
GError **error)
{
- g_warning ("djvu_document_save not implemented"); /* FIXME */
- return TRUE;
+ DjvuDocument *djvu_document = DJVU_DOCUMENT (document);
+ GnomeVFSResult result;
+ GnomeVFSURI *source_uri;
+ GnomeVFSURI *target_uri;
+
+ if (!djvu_document->uri)
+ return FALSE;
+
+ source_uri = gnome_vfs_uri_new (djvu_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);
}
static int
ddjvu_context_release (djvu_document->d_context);
ddjvu_format_release (djvu_document->d_format);
+ g_free (djvu_document->uri);
G_OBJECT_CLASS (djvu_document_parent_class)->finalize (object);
}
#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;
double base_width;
double base_height;
+
+ gchar *uri;
};
typedef struct _DviDocumentClass DviDocumentClass;
dvi_context_mutex = g_mutex_new ();
+ g_free (dvi_document->uri);
+ dvi_document->uri = g_strdup (uri);
return TRUE;
}
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;
}
if (dvi_document->params)
g_free (dvi_document->params);
+
+ g_free (dvi_document->uri);
G_OBJECT_CLASS (dvi_document_parent_class)->finalize (object);
}
#include "pixbuf-document.h"
#include "ev-document-thumbnails.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>
+
struct _PixbufDocumentClass
{
GObjectClass parent_class;
GObject parent_instance;
GdkPixbuf *pixbuf;
+
+ gchar *uri;
};
typedef struct _PixbufDocumentClass PixbufDocumentClass;
return FALSE;
pixbuf_document->pixbuf = pixbuf;
+ g_free (pixbuf_document->uri);
+ pixbuf_document->uri = g_strdup (uri);
return TRUE;
}
const char *uri,
GError **error)
{
- g_warning ("pixbuf_document_save not implemented"); /* FIXME */
- return TRUE;
+ PixbufDocument *pixbuf_document = PIXBUF_DOCUMENT (document);
+ GnomeVFSResult result;
+ GnomeVFSURI *source_uri;
+ GnomeVFSURI *target_uri;
+
+ if (!pixbuf_document->uri)
+ return FALSE;
+
+ source_uri = gnome_vfs_uri_new (pixbuf_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);
}
static int
PixbufDocument *pixbuf_document = PIXBUF_DOCUMENT (object);
g_object_unref (pixbuf_document->pixbuf);
+ g_free (pixbuf_document->uri);
G_OBJECT_CLASS (pixbuf_document_parent_class)->finalize (object);
}
#include "ev-document-thumbnails.h"
#include "ev-ps-exporter.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>
+
struct _TiffDocumentClass
{
GObjectClass parent_class;
TIFF *tiff;
gint n_pages;
TIFF2PSContext *ps_export_ctx;
+
+ gchar *uri;
};
typedef struct _TiffDocumentClass TiffDocumentClass;
return FALSE;
}
tiff_document->tiff = tiff;
+ g_free (tiff_document->uri);
+ tiff_document->uri = g_strdup (uri);
pop_handlers ();
return TRUE;
tiff_document_save (EvDocument *document,
const char *uri,
GError **error)
-{
- return FALSE;
+{
+ TiffDocument *tiff_document = TIFF_DOCUMENT (document);
+ GnomeVFSResult result;
+ GnomeVFSURI *source_uri;
+ GnomeVFSURI *target_uri;
+
+ if (!tiff_document->uri)
+ return FALSE;
+
+ source_uri = gnome_vfs_uri_new (tiff_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);
}
static int
TiffDocument *tiff_document = TIFF_DOCUMENT (object);
TIFFClose (tiff_document->tiff);
+ g_free (tiff_document->uri);
G_OBJECT_CLASS (tiff_document_parent_class)->finalize (object);
}