| 296 | } |
| 297 | |
| 298 | auto waybar::modules::Bluetooth::onObjectRemoved(GDBusObjectManager* manager, GDBusObject* object, |
| 299 | gpointer user_data) -> void { |
| 300 | Bluetooth* bt = static_cast<Bluetooth*>(user_data); |
| 301 | GDBusProxy* proxy_controller; |
| 302 | |
| 303 | if (!bt->cur_controller_.has_value()) { |
| 304 | return; |
| 305 | } |
| 306 | |
| 307 | proxy_controller = G_DBUS_PROXY(g_dbus_object_get_interface(object, "org.bluez.Adapter1")); |
| 308 | |
| 309 | if (proxy_controller != NULL) { |
| 310 | std::string object_path = g_dbus_object_get_object_path(object); |
| 311 | |
| 312 | if (object_path == bt->cur_controller_->path) { |
| 313 | bt->cur_controller_ = bt->findCurController(); |
| 314 | if (bt->cur_controller_.has_value()) { |
| 315 | bt->connected_devices_.clear(); |
| 316 | bt->findConnectedDevices(bt->cur_controller_->path, bt->connected_devices_); |
| 317 | } |
| 318 | bt->dp.emit(); |
| 319 | } |
| 320 | |
| 321 | g_object_unref(proxy_controller); |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | // NOTE: only for when the org.bluez.Battery1 interface is added/removed after/before a device is |
| 326 | // connected/disconnected |
nothing calls this directly
no test coverage detected