Hello everybody,
while I am currently in the process of rewriting Genesis along the lines
of my previous e-mail, some questions about how to properly integrate
with the D-Bus server and other clients came up. I guess it now shows
that I’m not a computer scientist, so I need some assistance from
somebody with more profound knowledge.
1. Getting sync reports from third party sessions.
One of my attempts for the re-write is to better integrate
Genesis with other clients, like sync-ui. So I want to show that
a sync is in progress (animated icon) and a result report
(notification bubble) for syncs triggered by other clients.
I can easily listen to the `StatusChanged` signal of a newly
created session and show that a sync is in progress by waiting
for the 'done' status. But when I want to get the result of that
sync by calling `session.GetReports(0, 1)`, it fails with a
D-Bus error. I guess that this is because sync-ui already called
`session.Detach()`.
So what would be the best way to get a sync report from a
session that I did not create by myself? Is there a way to
"attach" to a third-party session in order to prevent it from
being destroyed?
2. Getting information about the purpose of a session
When I want to sync, I create a session. Because I have to wait
for the session to become ready, I connect to the
`SessionChanged` signal. But of course, I get a `SessionChanged`
for all sessions, not just the one I just requested for syncing.
So how do I know that the session I am getting notified about is
the one I requested for the sync?
Currently, I am storing the purpose of a session, along the
lines of
session_path = syncevo_server.StartSession(server)
sessions[session_path] = 'sync'
Then, when I get the `SessionChanged` signal, I can ask for the
purpose:
if sessions[session_path] == 'sync':
session.Sync('', {})
But there is a race condition between storing the sync info and
getting the `SessionChanged` signal. So I used a sleep:
while not session_path in sessions:
time.sleep(0.1)
But this is a) ugly, and b) only works assuming all sessions are
created by myself, because a session created by a third-party
client will never show up in `sessions`.
So to make a long story short: How would I properly know if a
session I get the `SessionChanged` signal for is requested by me
in order to perform a sync?
(I tried to understand what sync-ui does, but miserably failed
reading the source code. That is way too deep for me.)
Thanks in advance,
kind regards,
Frederik
_______________________________________________
SyncEvolution mailing list
[email protected]
http://lists.syncevolution.org/listinfo/syncevolution