Re: [evolution-patches] Cal/book backends to use ESource



On Mon, 2003-11-24 at 08:09, Rodrigo Moya wrote:
> On Mon, 2003-11-24 at 06:09, Hans Petter Jansson wrote:
> > I thought I'd post the changes to make evolution-data-server backends
> > take ESources instead of just URIs, so you get a chance to pick them
> > apart before I commit anything.
> > 
> > Executive summary:
> > 
> > * ESource has two new methods to export and import standalone XML.
> > 
> > * ESource w/o ESourceGroup can fall back to internal absolute URI
> >   if created from standalone XML.
> > 
> > * EBook gets a new method, e_book_load_source ().
> > 
> > * ECal e_cal_new () takes ESource, new convenience call 
> >   e_cal_new_from_uri ().
> > 
> > * Backends get access to the ESource they were created with.
> > 
> > * Evolution proper: Calls to e_cal_new () replaced with
> >   e_cal_new_from_uri () where an ESource is not easily available.
> >   This probably needs additional adjustments to pass ESource instead
> >   of URIs in a couple of places, so properties get through, but
> >   at least it links.
> > 
> + **/
> +ECal *
> +e_cal_new_from_uri (const gchar *uri, CalObjType type)
> +{
> +       ESourceGroup *group;
> +       ESource *source;
> +       ECal *cal;
> +
> +       group = e_source_group_new ("", uri);
> +       source = e_source_new ("", "");
> +       e_source_set_group (source, group);
> +
> here, do we really need to create the group? Also, shouldn't we create a
> temporary name for the source?
> 
> +       source = e_source_new_from_standalone_xml (source_xml);
> +       if (!source) {
> +               bonobo_exception_set (ev,
> ex_GNOME_Evolution_Calendar_CalFactory_InvalidURI);
> +
> +               return CORBA_OBJECT_NIL;
> +       }
> 
> Here, also, what about a InvalidSource exception? Thus, you can
> differentiate between an invalid source error and an invalid uri error,
> managed a few lines below this code.

Its probably a nice distinction to have.

> +void
> +e_source_dump_to_xml_node (ESource *source,
> +                          xmlNodePtr parent_node)
> +{
> This should probably be static, shouldn't it?

The source group class uses this to construct the source nodes in the
source list.  We could possibly have it just pass back char * that can
be appended to a large string and then parse the entire xml string for
saving afterwards.  This might make things easier for the C# bindings
which can't wrap this function (no libxml bindings).

-JP
-- 
JP Rosevear <jpr ximian com>
Ximian, Inc.




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