Hi,
I have refactored the use of notifications in syncevo-dbus-server,
making it generic through the use of design patterns such as factories
and backends.
There is a NotificationManagerFactory object that creates a
NotificationManager that uses the right backend (MLite, libnotify, or a
dummy no-op backend) and syncevo-dbus-server.cpp is now agnostic to
what's happening behind the scene.
This architecture might seem overly complicated, but it would be really
easy to expand in the future, should the need arise.
Here's some stats, and please check the patches attached. You can also
find the code in the "notifications" branches in syncevolution's
gitorious repository.
$ git diff master --stat
configure-pre.in | 18 +++-
src/Makefile-gen.am | 8 +-
src/NotificationBackendBase.h | 42 +++++++
src/NotificationBackendLibnotify.cpp | 126 +++++++++++++++++++++
src/NotificationBackendLibnotify.h | 76 +++++++++++++
src/NotificationBackendMLite.cpp | 65 +++++++++++
src/NotificationBackendMLite.h | 44 +++++++
src/NotificationBackendNoop.cpp | 44 +++++++
src/NotificationBackendNoop.h | 44 +++++++
src/NotificationManager.cpp | 52 +++++++++
src/NotificationManager.h | 75 +++++++++++++
src/NotificationManagerBase.h | 43 +++++++
src/NotificationManagerFactory.cpp | 57 ++++++++++
src/NotificationManagerFactory.h | 43 +++++++
src/dbus/interfaces/syncevo-server-full.xml | 8 ++
src/syncevo-dbus-server.cpp | 161 ++++++---------------------
16 files changed, 773 insertions(+), 133 deletions(-)
$ git log --pretty=oneline 9a849f6588052ef093aaed038bddc23a10bf952b..HEAD
b16777e603daa259d67332a2f0f401927527d296 syncevo-dbus-server: use a "factory" to
create the appropriate NotificationManager.
b7bcad6c01c9364a39b5b5730b02fc66dcf0d207 syncevo-dbus-server: update MNotification
parameters to correct ones.
507e5a308b288faf400bf0f09bfd4143d7fbad43 syncevo-dbus-server: use #defines for the dbus
parameters.
fe2e6d17335aa8884f0252784c8148202737b503 syncevo-dbus-server: initial implementation of
mlite backend.
94abeee4f52c278ef3cdadf2e8e1964d8169c5dc syncevo-dbus-server: added inclusion for Noop
notification backend.
011c750c6c91c735fd2f0bfa52d141f884af92bc syncevo-dbus-server: semi-working stub for mlite
notifications.
9978e870f532cb0787959c32fa4ae8a9e1ffcc17 syncevo-dbus-server: notifications system made
more generic.
Regards,
Salvatore.
--
Salvatore Iovene <salvatore.iovene(a)linux.intel.com>
Linux Software Engineer
Intel Open Source Technology Center, Finland
Tel.: +358504804026