diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2012-09-11 15:28:07 +0200 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2012-10-25 16:43:45 +0200 |
commit | cec68658987d99da8db3fdde4ad61b2fb44a310b (patch) | |
tree | 33c41f5a9f3de46f39fac9ee04b784a7d981bbfe /src/gdbusxx/gdbus-cxx-bridge.h | |
parent | 3004545b0ccee6657cce3f38d0bc5bae2a8d66b6 (diff) |
GDBus GIO: revamped name owning
Remove global variables and allow addditional names to be owned via
DBusConnectionPtr::ownName().
g_bus_own_name_on_connection() is given shared access to a ref-counted
OwnNameAsyncData (instead of full ownership) because that way it is
guaranteed that the instance is still around while waiting for name
acquisition in undelay().
Diffstat (limited to 'src/gdbusxx/gdbus-cxx-bridge.h')
-rw-r--r-- | src/gdbusxx/gdbus-cxx-bridge.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gdbusxx/gdbus-cxx-bridge.h b/src/gdbusxx/gdbus-cxx-bridge.h index e5bccee2..07a4ad3f 100644 --- a/src/gdbusxx/gdbus-cxx-bridge.h +++ b/src/gdbusxx/gdbus-cxx-bridge.h @@ -186,8 +186,32 @@ class DBusConnectionPtr : public boost::intrusive_ptr<GDBusConnection> void setDisconnect(const Disconnect_t &func); // #define GDBUS_CXX_HAVE_DISCONNECT 1 + /** + * Starts processing of messages, + * claims the bus name set with addName() or + * when creating the connection (legacy API, + * done that way for compatibility with GDBus for libdbus). + */ void undelay() const; void addName(const std::string &name) { m_name = name; } + + /** + * Claims another name on the connection. + * + * The callback will be invoked with true as + * parameter once the name was successfully + * claimed. If that fails, false will be passed. + * + * The caller should be prepared to get called + * again later on, when loosing an already obtained + * name. Currently this shouldn't happen, though, + * because name transfer is not enabled when + * registering the name. + * + * The callback is allowed to be empty. + */ + void ownNameAsync(const std::string &name, + const boost::function<void (bool)> &obtainedCB) const; }; class DBusMessagePtr : public boost::intrusive_ptr<GDBusMessage> |