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

Re: [PATCH] GNOME VFS support for dia



>> I wrote a quick patch for dia (CVS tree as of Nov 23) that adds support
>> for opening and manipulating GNOME VFS URIs.  I did this using
>> libgnomevfs, libgsf and the gsf_xml_parser_context function.  The new
>> code is enabled as long as the GNOME preprocessor variable is #define'd
>> (--enable-gnome).

>> So now "dia file:///path/to/diagram.dia" should work, with the following
>> caveats:

>> 1.  For some reason compression is not working (it only works with
>> uncompressed files).  If anyone has experience with gsf_input_gzip_new,
>> I could use your help!

>> 2.  I have not yet looked at the import and export filters, but I suspect
>> they may need modification too.
 
> 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.

> 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.

> 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.

-- 
Mike

:wq



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK