[Evolution-hackers] online/offline in e-d-s


I am looking at supporting online/offline modes in e-d-s for evolution
2.2 release. Currently we have offline support only in mailer and the
mechansim for switching between modes is by clicking on a widget. We
want to listen to a desktop wide offline setting if possible in this
release. That may be using  a gconf setting or dbus notification,
currently nothing exists as far as i know. There has been discussions
on d-d-l about gnome wide offline
but not sure how far it is gone. The idea is to make  e-d-s  listen to
this setting and  put all the backends in offline mode  and inform all
backend  clients about the change in the state,  instead of evolution
setting the modes on the backend using ECal or EBook apis.

I am describing what i am planning to do below . Please give your
suggestions  comments , betters way to do it , or tell me if what i am
thinking   just not going to work :-)

I am planning to implement a eds-offline-listner which listens to a
gconf key to get to know of online/offline changes (this gconf will a
desktop wide one if one gets implemented or if we resort to using some
gui element in evolution to set online/offline modes , it will be a
gconf key installed by e-d-s). This listner will be instantiated in
e-d-s main function (server.c). Whenever there is a change in gconf
setting,  this listner will set the online/offline modes (dependning
upon the setting value) on e-data-cal-factory and e-data-book-factory by
calling methods like e_data_(cal/book)_factory_set_backends_mode. Here
we can just set mode on the cal and address book factories created by
e-d-s or we can query bonobo to get references of all cal/book factories
created by other processes like exchange connector and set on all of
them. Factories can set the mode on the backends which they have created
so far by calling e_(cal/book)_backend_set_mode on the backends. It also
 stores the mode in it so that it can set it on the new backends  that
can be created later.  Each backend does different things in its methods
implementations depending on the mode that has been set. For example
_open methods does not try to login if mode is offline , they just load
the items from the cache and respond to the queiries from the cache if
one exists.  If mode is online they login to server. If the  folder
which the backend is loading is marked for offline usuage, backend has
to cache the conents on the file system (using e-cal-backend-cache and
e-book-backend-cache) and install timeout handlers to get updates from
the server periodically etc. 

When a offline mode is set on the backend it has to release all the
connects it has with server and infom all of its clients (ECal and
EBook) about the change in the online/offlien state using
e_(cal/book)_backend_notify_mode. If a backend has to behave readonly
way in offline mode it has to inform all the clients about the change in
its writable state  using e_(cal/book)_notify_writable.  There will be
methods like e_(cal/book)_is_offline and e_(cal/book)_is_writable to
know about the mode and read only state of clients. Using this methods
clients can disbale the ui bits to prevent create/modify/delete
operation on read only calendars/books in offline mode. 

Evolution need to have  a account level setting to mark all the
(mail/contacts/calendar) folders for offline usuage and also per folder
level setting to mark per offline usuage. e-d-s caches contents of only
those folders which are marked for offline. Other folders can not be
user in offline mode.  

I think currently downloading items for offline usage happens actaully
when user switches to offline mode in case of mailer. Is it possible to
download them in the background when user works in online mode in
mailer ? Or even e-d-s should download only user chooses to go offline
mode ? The second approach poses problems if we want to listen to
desktop wide offline setting as applications may get notified of change
in the setting when only after network is disconnected and there may not
be any (or enought) time to download the items for caching).

I have tried this idea to an extent in eds-offline-branch, i have added
methods on necessary methods on backend factory and backend classes. I
have changed the idl files to add new methods to notify cleints about
mode and writable state changes of the backends. Groupwise address book
backends and calendar backends , webcal backend has been modified to
take care of the online/offline modes. Things seem to work so far 

There is a problem related to authenitcation when user starts evolution
in offline mode and then switches to online mode. Now backends need to
authenicate to servers but they do not have access to passwords.  Since
all the backends are already loaded in offline mode, evolution won't
call open methods on the backend again with passowrds. I am stil
thinking what to do here. 


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