| OLD | NEW |
| 1 /* | 1 /* |
| 2 * | 2 * |
| 3 * D-Bus++ - C++ bindings for D-Bus | 3 * D-Bus++ - C++ bindings for D-Bus |
| 4 * | 4 * |
| 5 * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> | 5 * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> |
| 6 * | 6 * |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 if (!dbus_connection_register_object_path(conn()._pvt->conn, path().c_st
r(), &_vtable, this)) | 166 if (!dbus_connection_register_object_path(conn()._pvt->conn, path().c_st
r(), &_vtable, this)) |
| 167 { | 167 { |
| 168 throw ErrorNoMemory("unable to register object path"); | 168 throw ErrorNoMemory("unable to register object path"); |
| 169 } | 169 } |
| 170 | 170 |
| 171 _adaptor_table[path()] = this; | 171 _adaptor_table[path()] = this; |
| 172 } | 172 } |
| 173 | 173 |
| 174 void ObjectAdaptor::unregister_obj() | 174 void ObjectAdaptor::unregister_obj() |
| 175 { | 175 { |
| 176 if (!is_registered()) |
| 177 return; |
| 178 |
| 176 _adaptor_table.erase(path()); | 179 _adaptor_table.erase(path()); |
| 177 | 180 |
| 178 debug_log("unregistering local object %s", path().c_str()); | 181 debug_log("unregistering local object %s", path().c_str()); |
| 179 | 182 |
| 180 dbus_connection_unregister_object_path(conn()._pvt->conn, path().c_str()
); | 183 dbus_connection_unregister_object_path(conn()._pvt->conn, path().c_str()
); |
| 181 } | 184 } |
| 182 | 185 |
| 186 bool ObjectAdaptor::is_registered() |
| 187 { |
| 188 return _adaptor_table.find(path()) != _adaptor_table.end(); |
| 189 } |
| 190 |
| 183 void ObjectAdaptor::_emit_signal(SignalMessage &sig) | 191 void ObjectAdaptor::_emit_signal(SignalMessage &sig) |
| 184 { | 192 { |
| 185 sig.path(path().c_str()); | 193 sig.path(path().c_str()); |
| 186 | 194 |
| 187 conn().send(sig); | 195 conn().send(sig); |
| 188 } | 196 } |
| 189 | 197 |
| 190 struct ReturnLaterError | 198 struct ReturnLaterError |
| 191 { | 199 { |
| 192 const Tag *tag; | 200 const Tag *tag; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 InterfaceProxyTable::const_iterator ii = _interfaces.begin(); | 322 InterfaceProxyTable::const_iterator ii = _interfaces.begin(); |
| 315 while (ii != _interfaces.end()) | 323 while (ii != _interfaces.end()) |
| 316 { | 324 { |
| 317 std::string im = "type='signal',interface='"+ii->first+"',path='
"+path()+"'"; | 325 std::string im = "type='signal',interface='"+ii->first+"',path='
"+path()+"'"; |
| 318 conn().remove_match(im.c_str()); | 326 conn().remove_match(im.c_str()); |
| 319 ++ii; | 327 ++ii; |
| 320 } | 328 } |
| 321 conn().remove_filter(_filtered); | 329 conn().remove_filter(_filtered); |
| 322 } | 330 } |
| 323 | 331 |
| 332 bool ObjectProxy::is_registered() |
| 333 { |
| 334 return true; |
| 335 } |
| 336 |
| 324 Message ObjectProxy::_invoke_method(CallMessage &call) | 337 Message ObjectProxy::_invoke_method(CallMessage &call) |
| 325 { | 338 { |
| 326 if (call.path() == NULL) | 339 if (call.path() == NULL) |
| 327 call.path(path().c_str()); | 340 call.path(path().c_str()); |
| 328 | 341 |
| 329 if (call.destination() == NULL) | 342 if (call.destination() == NULL) |
| 330 call.destination(service().c_str()); | 343 call.destination(service().c_str()); |
| 331 | 344 |
| 332 return conn().send_blocking(call); | 345 return conn().send_blocking(call); |
| 333 } | 346 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 { | 381 { |
| 369 return false; | 382 return false; |
| 370 } | 383 } |
| 371 } | 384 } |
| 372 default: | 385 default: |
| 373 { | 386 { |
| 374 return false; | 387 return false; |
| 375 } | 388 } |
| 376 } | 389 } |
| 377 } | 390 } |
| OLD | NEW |