diff --git a/examples/glib/dbus-browser.cpp b/examples/glib/dbus-browser.cpp index 382d07f..94a3936 100644 --- a/examples/glib/dbus-browser.cpp +++ b/examples/glib/dbus-browser.cpp @@ -126,7 +126,10 @@ int main(int argc, char *argv[]) dispatcher.attach(NULL); + // activate one of both for either system or session bus + // TODO: choose in the GUI DBus::Connection conn = DBus::Connection::SessionBus(); + //DBus::Connection conn = DBus::Connection::SystemBus(); DBusBrowser browser(conn); diff --git a/src/connection.cpp b/src/connection.cpp index db38d17..b882eda 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -384,9 +384,17 @@ void Connection::request_name(const char *name, int flags) debug_log("%s: registering bus name %s", unique_name(), name); - dbus_bus_request_name(_pvt->conn, name, flags, e); //we deliberately don't check return value + /* + * TODO: + * Think about giving back the 'ret' value. Some people on the list + * requested about this... + */ + int ret = dbus_bus_request_name(_pvt->conn, name, flags, e); - if (e) throw Error(e); + if (ret == -1) + { + if (e) throw Error(e); + } // this->remove_match("destination");