Re: [PATCH] GNOME VFS support for dia



On 24 Nov 2003, W. Michael Petullo wrote:
Two so far: Shouldn't Gnome fall back on normal file opening if VFS
fails?

I'm of the opinion that it should not.  GNOME's VFS is a pretty
fundamental module within the desktop.  If file:///foo.dia can't be
opened then I think it should be assumed that it doesn't exist.  Falling
back to stdio seems like it would just add complexity.

Not if VFS lookup fails, but if VFS itself fails to load.  The #define
GNOME area in your patch just bails out when it can't find VFS, where it
could just fall back on ordinary fopen.

And the bit about creating a tmp file is the way it is for Win32
compatibility. 

The new code will have to be used when GNOME is #define'd until I find
a gsf/gnomevfs-happy mkstemp.  I'll put the Win32 code back in as the
default, though.

Good.  I don't think Gnome exists under Win32, anyway.

The import and export filters ought to be redone to call just one file
opening function, then.  We don't want to have this complexity in 15 
different places.

Right.  I did a quick analysis of dia's plugins and this is what I
discovered:

Type          File                    Import/Export   Interface
====          ====                    =============   =========
png           export_png.c            export          libpng 
                                              (need to use png_set_read_fn)
ps            diapsrenderer.c         export          fprintf
cgm           plugins/cgm             export          putc
dxf           plugins/dxf             both            fprintf/fgets
hpgl          plugins/hpgl            export          fprintf
metapost      plugins/metapost        export          fprintf
pixbuf                plugins/pixbuf          both            gdk_pixbuf_save/
                                                      gdk_pixbuf_new_from_file
pstricks      plugins/pstricks        export          fprintf
shape         plugins/svg             export          libxml2?
svg           plugins/svg             both            libxml2?
wpg           plugins/wpg             export          fwrite
xfig          plugins/xfig            both            fprintf/fscanf
xslt          plugins/xslt            both            libxml2?

Since most plugins use stdio, I think I should write a #ifdef'ed
mini-library that provides GNOME VFS if available but falls back on
direct stdio.  All of these modules could then cleanly use that code.
And the exceptions (like export_png.c/libpng and pixbuf/gdk_pixbuf_save)
could be provided a couple of lines of wrapper to glue them in.

The result should be little or no #ifdef's in plugin code.

Oh, it doesn't just open a FILE*?  That's annoying.  But if you can make a
clean wrapper, that'll be fine.

-Lars

-- 
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| HÃrdgrim of Numenor
"I do not agree with a word that you say, but I   |----------------------------
will defend to the death your right to say it."   | Where are we going, and
    --Evelyn Beatrice Hall paraphrasing Voltaire  | what's with the handbasket?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]