Re: [evolution-patches] Cal/book backends to use ESource
- From: Rodrigo Moya <rodrigo ximian com>
- To: Hans Petter Jansson <hpj ximian com>
- Cc: Evolution Patches <evolution-patches ximian com>, JP Rosevear <jpr ximian com>, Ettore Perazzoli <ettore ximian com>, toshok ximian com
- Subject: Re: [evolution-patches] Cal/book backends to use ESource
- Date: Mon, 24 Nov 2003 14:09:49 +0100
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.
+void
+e_source_dump_to_xml_node (ESource *source,
+ xmlNodePtr parent_node)
+{
This should probably be static, shouldn't it?
cheers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]