The logic for creating a shared_ptr for the active session
was flawed: it assumed that the session must be owned by
a client, which is not true if some other entity (like
a Connection) owns it.
As a result of this flaw, DBusServer::m_syncSession wasn't
set when running a sync via the Connection API, which
crashed when the Connection destructed itself and the
session while some of the session code was still active.
Fixed by keeping both a plain pointer (for the case when
the weak_ptr doesn't provide it anymore while shutting
itself down) and a weak_ptr (which avoids searching for
the shared_ptr).
The Session.Sync() parameters are a special case of temporarily
overriding the source properties of all or some sources. This
patch uses the new per-source config filters to transfer the
parameters to the core sync engine.
This patch also introduces Session members for temporary config
changes, which is another way of setting these and other parameters.
These Session members must be set in SetConfig(temporary=true) calls
(not done yet).
Selecting active sources during a sync or status check was done with a
combination of setting a sync mode via a source config filter and
setting a list of active sources. Now the SyncConfig supports a source
filter which is applied to all sources and source filters for each
source. The latter override the former.
This is powerful enough to start syncs with full control over which
sources are active in which mode, as described in the new D-Bus API.
As part of this patch, the command line semantic is implemented
entirely using a combination of different source filters.
The Session keeps the sync progress and status in the format expected
by the D-Bus interface. That way it is available without the corresponding
sync engine.
To run a sync, the Session.Sync() method creates a DBusSync, derived
from SyncContext. With an eye towards peer-to-peer sync the
new class and member are named just "sync" instead of using the too
specific "client". When that instance is ready, the g_main_loop_run()
call in DBusServer::run() is stopped and DBusServer::run() hands
over control to Session::run().
That call transfers control to SyncContext::sync(), which
retains control as long as the sync runs. Occassionally (via
progress calls) control is returned temporarily. These calls could be used
to check for D-Bus requests, but currently that is only done when
the sync blocks while transferring messages, by configuring the
SoupTransportAgent to use the same GMainLoop as the D-Bus binding.
The implementation of the D-Bus interface is still very much incomplete.
All of the missing bits and pieces are marked as TODO in the source.
Both methods are to be implemented inside the ReadOperations
class, which has the server configuration name as sole data item.
The Server methods are provided by glue code which instantiates
a ReadOperations object and calls the real methods.
From a C++ class design perspective the Server glue methods
should be declared static and the ReadOperations methods as const.
However, both qualifiers are not currently supported by the C++
binding.
This is basically a rewrite from scratch, targeting the revised D-Bus
API. The core infrastructure for handling client requests is in place,
including the work queue for sessions and unexpected disconnects.
Many of the related D-Bus methods (Server.Connect(),
Server.StartSession(), Connection.Close(), Session.Close()) are
implemented.
Rudimentary testing is done with the test/dbus-server-connect.py
script.
The intention is to get rid of the historic and inconsistent
naming of some classes and their corresponding files:
* EvolutionSyncClient = class derived from Funambol's SyncClient,
* SyncEvolutionConfig = SyncEvolution's config
With the strict 'namespace SyncEvo' and the syncevo/ path prefix for
most header files it is no longer necessary to have "SyncEvolution" or
"Evolution" in the names. This patch thus renames as follows:
EvolutionSyncClient => SyncContext
EvolutionSmartPtr => SmartPtr
SyncEvolutionCmdline => Cmdline
SyncEvolutionConfig => SyncConfig
SyncEvolutionUtil => util
The former EvolutionSyncClient always had a role that went beyond just
running a sync, for example it also provided config access. With the
upcoming server support it also won't be just a client. Thus the new
name "SyncContext".
The 'syncevo/' prefix is used throughout the code now.
removed whenever the prefix made it clear that the file belongs
to SyncEvolution. This helps finding incorrect include paths.
Quotes should be used exclusively for SyncEvolution files which don't
have a specific prefix yet (test.h, config.h) to help identifying
them.
The main motivation for this change is that it allows the implementor
of a backend to choose the implementations for the different aspects
of a datasource (change tracking, item import/export, logging, ...)
independently of each other. For example, change tracking via revision
strings can now be combined with exchanging data with the Synthesis
engine via a single string (the traditional method in SyncEvolution)
and with direct access to the Synthesis field list (now possible for
the first time).
The new backend API is based on the concept of providing
implementations for certain functionality via function objects instead
of implementing certain virtual methods. The advantage is that
implementors can define their own, custom interfaces and mix and match
implementations of the different groups of functionality.
Logging (see SyncSourceLogging in a later commit) can be done by
wrapping some arbitrary other item import/export function objects
(decorator design pattern).
The class hierarchy is now this:
- SyncSourceBase: interface for common utility code, all other
classes are derived from it and thus can use that code
- SyncSource: base class which implements SyncSourceBase and
hooks a datasource into the SyncEvolution core;
its "struct Operations" holds the function objects which
can be implemented in different ways
- TestingSyncSource: combines some of the following classes
into an interface that is expected by the client-test
program; backends only have to derive from (and implement this)
if they want to use the automated testing
- TrackingSyncSource: provides the same functionality as
before (change tracking via revision strings, item import/export
as string) in a single interface; the description of the pure
virtual methods are duplicated so that developers can go through
this class and find everything they need to know to implement
it
The following classes contain the code that was previously
found in the EvolutionSyncSource base class. Implementors
can derive from them and call the init() methods to inherit
and activate the functionality:
- SyncSourceSession: binds Synthesis session callbacks to
virtual methods beginSync(), endSync()
- SyncSourceChanges: implements Synthesis item tracking callbacks
with set of LUIDs that the user of the class has to fill
- SyncSourceDelete: binds Synthesis delete callback to
virtual method
- SyncSourceRaw: read and write items in the backends format,
used for testing and backup/restore
- SyncSourceSerialize: exchanges items with Synthesis engine
using a string representation of the data; this is how
EvolutionSyncSource has traditionally worked, so much of the
same virtual methods are now in this class
- SyncSourceRevisions: utility class which does change tracking
via some kind of "revision" string which changes each time
an item is modified; this code was previously in the
TrackingSyncSource
All calls to syncevo_get_server_config() resulted in
EvolutionSyncConfig.copy() call, which can be expensive.
There is no reason to copy except when copying from a
template.
Fixes#5021
With g++ 4.4.1 (?) on Fedora 11 there's an error message
about the "server = strstr(...)" assignment. I suspect that
strstr() is overloaded and returns a const pointer for its
const argument.
"const char *server" should fix that problem.
According to the D-Bus glib docs, this function must be called
once at program startup. It didn't seem to matter that it wasn't
called, or it was called indirectly. In any case, better call it.
dbus_g_type_get_struct() was called without the terminating G_TYPE_INVALID,
causing random (or rather, in my debug build, constant) glib CRITICAL
warnings and crashes.
in dbus server syncevo_get_server_config() and
syncevo_get_template_config() did not set a return variable
to NULL when returning error. The client checked for non-NULLness
even on errors, however.... Both issues fixed.
Fixes#4556
support isConsumerReady in dbus api (GetServers, GetTemplates
and also in the options in GetServerConfig). Use the flag in
sync-ui to hide non-ready templates.
Fix#3336
Got an undefined reference to C++ GNOME keyring functions
which in reality should have been plain C functions. Reason
was that /usr/include/gnome-keyring-1/gnome-keyring.h (from 2.24.1)
didn't have an 'extern "C"' declarations.
Adding those in our source code fixed that and should be safe,
because double nesting of it is safe and the header is
unlikely to contain real C++ declarations.
password in config file must be "-" so SyncClient:AskPassword()
gets called (which uses gnome-keyring in syncevo-dbus-server).
Also remove protocol key from gnome-keyring calls.
lease enter the commit message for your changes. Lines starting
emitting "need-password" over D-Bus was not implemented and
was never a good solution anyway. Current options are:
* use passwords saved in SyncEvolution config
* use a supported keyring system (now gnome-keyring)
Setting a password over D-Bus when saving a server with
SetServerconfig does work, but the password is not given in
GetServerConfig.
The GTK+/Moblin UI now only uses gnome-keyring.
D-Bus service supports it but it is not required.
I think I will remove the authentication over dbus altogether,
it's just a bad idea. Then choices would be:
* authentication saved in config files, not changeable via dbus
* authentication via supported keyring methods
(currently gnome-keyring)
Add a source option that tells whether source is
supported locally.
Don't show or enable unsupported sources in main window
Don't include unsupported sources in sync
Fixes#1977
Due to a git mishap this commit has two commits worth of changes:
* use webURL in service list linkbuttons, use iconURI in main window
and service list.
* Improve n window and service list layout