summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Kühl <chrisk@openismus.com>2012-01-25 16:13:57 +0100
committerChris Kühl <chrisk@openismus.com>2012-01-25 17:03:45 +0100
commit8911af5e27d798baef53ae4a8e04830e4bb066f0 (patch)
tree766c8a9eb4de1181e00dffd8477aa349f8012563
parent7189b2385a36e83c52eea01ecf272c7aa0dd0e44 (diff)
Add 'done' signal in helper and connect to done() in SessionResourceconcurrent-sync-sessions
-rw-r--r--src/dbus/server/server.cpp2
-rw-r--r--src/dbus/server/server.h2
-rw-r--r--src/dbus/server/session-resource.cpp2
-rw-r--r--src/dbus/server/session-resource.h2
-rw-r--r--src/dbus/server/session.cpp10
-rw-r--r--src/dbus/server/session.h5
6 files changed, 11 insertions, 12 deletions
diff --git a/src/dbus/server/server.cpp b/src/dbus/server/server.cpp
index e39d1735..e1e2833d 100644
--- a/src/dbus/server/server.cpp
+++ b/src/dbus/server/server.cpp
@@ -332,7 +332,7 @@ void Server::run(LogRedirect &redirect)
}
SE_LOG_INFO(NULL, NULL, "%s", "Should enter main loop");
- // while (!m_shutdownRequested)
+ while (!m_shutdownRequested)
{
g_main_loop_run(m_loop);
diff --git a/src/dbus/server/server.h b/src/dbus/server/server.h
index 5e75d4fc..55ada544 100644
--- a/src/dbus/server/server.h
+++ b/src/dbus/server/server.h
@@ -96,7 +96,7 @@ class Server : public GDBusCXX::DBusObjectHelper,
typedef std::list< boost::weak_ptr<SessionResource> > SessionResources_t;
/**
- * A lis of active or idle Sessions.
+ * A list of active or idle Sessions.
*
* SessionResource objects are removed once the Session D-Bus
* interface disappears.
diff --git a/src/dbus/server/session-resource.cpp b/src/dbus/server/session-resource.cpp
index 4db06e2c..9b8c6e00 100644
--- a/src/dbus/server/session-resource.cpp
+++ b/src/dbus/server/session-resource.cpp
@@ -453,6 +453,7 @@ void SessionResource::onSessionConnect(const GDBusCXX::DBusConnectionPtr &conn)
// Activate signal watch on helper signals.
m_sessionProxy->m_statusChanged.activate (boost::bind(&SessionResource::statusChangedCb, this, _1, _2, _3));
m_sessionProxy->m_progressChanged.activate(boost::bind(&SessionResource::progressChangedCb, this, _1, _2));
+ m_sessionProxy->m_done.activate (boost::bind(&SessionResource::done, this));
SE_LOG_INFO(NULL, NULL, "onSessionConnect called in session-resource (path: %s interface: %s)",
m_sessionProxy->getPath(), m_sessionProxy->getInterface());
@@ -499,6 +500,7 @@ SessionResource::SessionResource(Server &server,
m_path(std::string("/org/syncevolution/Session/") + session),
m_configName(configName),
m_setConfig(false),
+ m_done(false),
m_forkExecParent(SyncEvo::ForkExecParent::create("syncevo-dbus-helper")),
emitStatus(*this, "StatusChanged"),
emitProgress(*this, "ProgressChanged")
diff --git a/src/dbus/server/session-resource.h b/src/dbus/server/session-resource.h
index d1956713..8913cda4 100644
--- a/src/dbus/server/session-resource.h
+++ b/src/dbus/server/session-resource.h
@@ -68,12 +68,12 @@ public:
GDBusCXX::DBusClientCall2<int32_t,
SessionCommon::SourceProgresses_t> m_getProgress;
GDBusCXX::DBusClientCall0 m_restore;
- GDBusCXX::DBusClientCall1<std::string> m_checkPresence;
GDBusCXX::DBusClientCall0 m_execute;
GDBusCXX::SignalWatch3<std::string, uint32_t,
SessionCommon::SourceStatuses_t> m_statusChanged;
GDBusCXX::SignalWatch2<int32_t,
SessionCommon::SourceProgresses_t> m_progressChanged;
+ GDBusCXX::SignalWatch0 m_done;
};
/**
diff --git a/src/dbus/server/session.cpp b/src/dbus/server/session.cpp
index 8de139a5..cea1bf1c 100644
--- a/src/dbus/server/session.cpp
+++ b/src/dbus/server/session.cpp
@@ -415,7 +415,8 @@ Session::Session(GMainLoop *loop,
m_runOperation(OP_NULL),
m_listener(NULL),
emitStatus(*this, "StatusChanged"),
- emitProgress(*this, "ProgressChanged")
+ emitProgress(*this, "ProgressChanged"),
+ emitDone(*this, "Done")
{
add(static_cast<ReadOperations *>(this), &ReadOperations::getNamedConfig, "GetNamedConfig");
add(this, &Session::setNamedConfig, "SetNamedConfig");
@@ -428,19 +429,14 @@ Session::Session(GMainLoop *loop,
add(this, &Session::getStatus, "GetStatus");
add(this, &Session::getProgress, "GetProgress");
add(this, &Session::restore, "Restore");
- add(this, &Session::checkPresence, "CheckPresence");
add(this, &Session::execute, "Execute");
add(emitStatus);
add(emitProgress);
+ add(emitDone);
SE_LOG_DEBUG(NULL, NULL, "session %s created", getPath());
}
-void Session::done()
-{
- // Emit done signal session
-}
-
Session::~Session()
{
SE_LOG_DEBUG(NULL, NULL, "session %s deconstructing", getPath());
diff --git a/src/dbus/server/session.h b/src/dbus/server/session.h
index d6b36711..a8d9a78d 100644
--- a/src/dbus/server/session.h
+++ b/src/dbus/server/session.h
@@ -203,6 +203,7 @@ class Session : public GDBusCXX::DBusObjectHelper,
/** Session.ProgressChanged */
GDBusCXX::EmitSignal2<int32_t,
const SessionCommon::SourceProgresses_t &> emitProgress;
+ GDBusCXX::EmitSignal0 emitDone;
static string syncStatusToString(SessionCommon::SyncStatus state);
@@ -229,8 +230,8 @@ public:
/** access to the GMainLoop reference used by this Session instance */
GMainLoop *getLoop() { return m_loop; }
- /** explicitly mark the session as completed, even if it doesn't get deleted yet */
- void done();
+ /** explicitly notify SessionResource we're done. */
+ void done() { emitDone(); }
private:
Session(GMainLoop *loop,