[Evolution-hackers] ESource for Backends



As you may or may not have noticed, there have been some changes in
evolution-data-server with respect to how calendars and addressbooks are
opened.

Instead of taking URIs, they now take ESources, which are objects that
let you pass an URI along with some options (the ability to pass options
to the backends being the main motivation for this change). They also
hold information which can be useful on the frontend side of things,
like a pretty name for the source, and have methods to organize them in
groups which can be stored in GConf.

So, how does this impact your code?

* Calls to e_cal_new () now take an ESource instead of a URI. There is a
new call, e_cal_new_from_uri (), which lets you specify a simple URI
like before, but I recommend that you get used to ESource, since it's
more flexible.

* There is a new addressbook method, called e_book_load_source (). This
is similar to the existing e_book_load_uri (), but takes a source
instead of a URI.

And how to create an ESource?

This is fairly easy - see the following code:

---

ESourceGroup *group;
ESource      *source;
EBook        *book;
gboolean      success;

group  = e_source_group_new ("LDAP Servers", "ldap://";);
source = e_source_new ("My Server", "myserver.mydomain.mytld");

e_source_set_group (source, group);

book    = e_book_new ();
success = e_book_load_source (book, source, TRUE, NULL);

---

Note that an ESource URI is relative to that of the ESourceGroup it
belongs to.

I'll let you refer to the API definitions for other fun stuff to do with
ESource.

--
Hans Petter




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