Commit 260d03cd authored by Dom Lachowicz's avatar Dom Lachowicz

bug 168182, gnome-vfs support for rsvg-view

parent 901e96e1
2005-02-23 Dom Lachowicz <cinamod@hotmail.com>
* rsvg-image.c: Fix bug 168182
* test-display.c: rsvg-view now can view images on any medium that
gnome-vfs can see.
2005-02-23 Caleb Moore <c.moore@student.unsw.edu.au>
* rsvg-art-mask.c: new file with art specific masking stuff
......
......@@ -233,7 +233,7 @@ rsvg_get_file_path (const gchar * filename, const gchar *basedir)
{
gchar *absolute_filename;
if (g_path_is_absolute(filename)) {
if (g_file_test(filename, G_FILE_TEST_EXISTS) || g_path_is_absolute(filename)) {
absolute_filename = g_strdup (filename);
} else {
gchar *tmpcdir;
......
......@@ -290,6 +290,7 @@ save_svg (GObject * ignored, gpointer user_data)
{
FILE * fp;
/* todo: make this support gnome vfs */
fp = fopen(filename, "wb");
if (!fp)
{
......@@ -546,7 +547,6 @@ view_pixbuf (ViewerCbInfo * info, int xid, const char * color)
int
main (int argc, char **argv)
{
FILE * in;
GError * err = NULL;
poptContext popt_context;
double x_zoom = 1.0;
......@@ -651,49 +651,50 @@ main (int argc, char **argv)
size_data.keep_aspect_ratio = bKeepAspect;
if(from_stdin)
in = stdin;
else {
in = fopen (args[0], "rb");
base_uri = (char *)args[0];
}
if(!in)
{
g_critical (_("Couldn't open %s\n"), args[0]);
poptFreeContext (popt_context);
return 1;
}
info.base_uri = base_uri;
info.svg_bytes = g_byte_array_new ();
if(!from_stdin) {
if (base_uri == NULL)
base_uri = (char *)args[0];
info.svg_bytes = _rsvg_acquire_xlink_href_resource(args[0], base_uri, NULL);
} else {
info.svg_bytes = g_byte_array_new ();
for (;;)
{
char buf[1024 * 8];
size_t nread = fread (buf, 1, sizeof(buf), in);
if (nread > 0)
g_byte_array_append (info.svg_bytes, buf, nread);
for (;;)
{
char buf[1024 * 8];
size_t nread = fread (buf, 1, sizeof(buf), stdin);
if (nread < sizeof (buf))
if (nread > 0)
g_byte_array_append (info.svg_bytes, buf, nread);
if (nread < sizeof (buf))
{
if (ferror (in))
if (ferror (stdin))
{
g_critical (_("Error reading\n"));
g_byte_array_free (info.svg_bytes, TRUE);
poptFreeContext (popt_context);
fclose(in);
fclose(stdin);
return 1;
}
else if (feof(in))
else if (feof(stdin))
break;
}
}
fclose(stdin);
}
if(!info.svg_bytes || !info.svg_bytes->len)
{
g_critical (_("Couldn't open %s\n"), args[0]);
poptFreeContext (popt_context);
return 1;
}
fclose(in);
info.base_uri = base_uri;
poptFreeContext (popt_context);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment