| 80 | } |
| 81 | |
| 82 | void Module::set_parent_actor_addr(caf::actor_addr addr) { |
| 83 | |
| 84 | |
| 85 | parent_actor_addr_ = addr; |
| 86 | if (!attribute_events_group_) { |
| 87 | attribute_events_group_ = |
| 88 | self()->home_system().spawn<broadcast::BroadcastActor>(self()); |
| 89 | try { |
| 90 | auto prefs = global_store::GlobalStoreHelper(self()->home_system()); |
| 91 | // only on init.. |
| 92 | utility::JsonStore j; |
| 93 | auto a = caf::actor_cast<caf::event_based_actor *>(self()); |
| 94 | if (a) { |
| 95 | join_broadcast(a, prefs.get_group(j)); |
| 96 | } else { |
| 97 | auto b = caf::actor_cast<caf::blocking_actor *>(self()); |
| 98 | if (b) { |
| 99 | join_broadcast(b, prefs.get_group(j)); |
| 100 | } |
| 101 | } |
| 102 | update_attrs_from_preferences(j); |
| 103 | |
| 104 | } catch (std::exception &e) { |
| 105 | spdlog::warn("{} {}", __PRETTY_FUNCTION__, e.what()); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | // we can't add hotkeys until the parent actor has been set. Subclasses of |
| 110 | // Module should define hotkeys in the virtual register_hotkeys() function |
| 111 | } |
| 112 | |
| 113 | void Module::delete_attribute(const utility::Uuid &attribute_uuid) { |
| 114 | for (auto p = attributes_.begin(); p != attributes_.end(); ++p) { |
no test coverage detected