[Evolution-hackers] Heads-up: CamelFolderSummary API changes for 3.3.1



	Hi all,
I just committed CamelFolderSummary API changes for 3.3.1 in
evolution-data-server and then made necessary changes in evolution,
evolution-exchange, evolution-groupwise and evolution-mapi.
I was always confused with that API, thus I decided to change it a bit.
Consider this email as a head-up for an already done work.

The main change is that most public variables are placed into 'priv'
struct now and can be accessed only through API functions. Notably
counts on messages are GObject properties now and are read-only, because
summary itself updates counts transparently on its change. The other
advantage of providing these counts as properties is a possibility to
listen for changes on them. The disadvantage is that this requires
descendant's CamelMessageInfo being a descendant of
CamelMessageInfoBase. It shouldn't b any problem for most of the
providers, the only I found was CamelVeeSummary, which is part of eds
anyway.

>From the other changes, I made
   CamelFolderSummaryClass::summary_header_from_db
   CamelFolderSummaryClass::content_info_to_db
return gboolean instead of gint, thus any descendant should change tests
for values (with the gint was checked for -1/0, now it's real gboolean,
returning whether function call succeeded). Pity compiler doesn't claim
here (mine gcc didn't). This change is tricky, because without fixing
the descendant it may "think" the call of the parent class failed, when
it returns TRUE for a successful call, and the descentan checks against
zero.

There are no 'fast' API functions anymore, same as no access to folder
summary by index. If it's needed then call
camel_folder_summary_get_array() and sort them with
camel_folder_sort_uids(), if they are required in order.
This is because folder summary doesn't use GPtrArray for stored uids,
but it uses GHashTable, for quicker lookups.

I also renamed some functions, like no more
   camel_folder_summary_uid()
making it
   camel_folder_summary_get().

With counts being properties I also added useful functions
   camel_store_summary_connect_folder_summary()
   camel_store_summary_disconnect_folder_summary()
to CamelStoreSummary, which make sure that CamelStoreInfo::total and
CamelStoreInfo::unread is kept in sync with respective
CamelFolderSummary properties. I use 'connect' on folder creation and
'disconnect' in folder's dispose.

Apart of above I also made reading of rows in CamelDB less
string-comparing. I expect the order of columns doesn't change once
returned from SQLite within one Select call, thus the improvement is in
caching column names by indexes, thus the second and any further row
only translates column index into column identificator with a simple
gint->gint hash table, instead of repeated strcmp calls.

This all together may make things less confusing, avoid code duplication
(there was some on summary count updates) and certain parts quicker than
before. Feel free to object and/or file bugs if you find anything not
working well after this change. Thanks in advance.

	Bye,
	Milan



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