Re: Saving objects in goffice



Jody Goldberg wrote:

On Sat, Feb 21, 2004 at 11:44:19AM +0100, Jean Brefort wrote:
Hi,

I am writing the code to add error bars in graphs. I am ipmlementing
error bars as properties in GogSeries. My concern is that I don't think
necessary to have anything about error bars saved when the default (no
bars) applies. With the current implementation (use of the GogPersistDOM
interface), we'll have always something saved. This is also true for
GogStyle even when the default is used.

A simple solution to this is to change the GogPersistDOM interface so t
that the save method returns a boolean value:

<    void     (*save) (GogPersistDOM *gpd, xmlNode *parent);
        gboolean     (*save) (GogPersistDOM *gpd, xmlNode *parent);
and in gog_object_write_property:

        case G_TYPE_OBJECT:
                val_obj = g_value_get_object (&value);
                if (val_obj != NULL) {
                        if (IS_GOG_PERSIST_DOM (val_obj)) {
<                            gog_persist_dom_save (GOG_PERSIST_DOM (val_obj), node);
                                success = gog_persist_dom_save (GOG_PERSIST_DOM (val_obj), node);
                        } else

Also, success should be FALSE if val_obj is NULL.

Hmm, that does not fit well with my plans to ditch the DOM interface
and move to SAX alone.  For that we won't have the luxery of knowing
not to export the wrapper if the object's export fails.

Why is the val_obj != NULL test insufficient ?
The node will be saved even if empty since by default success is TRUE.




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