refactor: rm direct dp.emit() call in constructor.
This commit is contained in:
@@ -624,6 +624,7 @@ void waybar::Bar::getModules(const Factory& factory, const std::string& pos,
|
||||
spdlog::error("{}: {}", ref, e.what());
|
||||
}
|
||||
});
|
||||
module->dp.emit();
|
||||
} catch (const std::exception& e) {
|
||||
spdlog::warn("module {}: {}", name.asString(), e.what());
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ waybar::modules::Backlight::Backlight(const std::string& id, const Json::Value&
|
||||
: ALabel(config, "backlight", id, "{percent}%", 2),
|
||||
preferred_device_(config["device"].isString() ? config["device"].asString() : ""),
|
||||
backend(interval_, [this] { dp.emit(); }) {
|
||||
dp.emit();
|
||||
|
||||
// Set up scroll handler
|
||||
event_box_.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
|
||||
event_box_.signal_scroll_event().connect(sigc::mem_fun(*this, &Backlight::handleScroll));
|
||||
|
||||
@@ -213,8 +213,6 @@ waybar::modules::Bluetooth::Bluetooth(const std::string& id, const Json::Value&
|
||||
#ifdef WANT_RFKILL
|
||||
rfkill_.on_update.connect(sigc::hide(sigc::mem_fun(*this, &Bluetooth::update)));
|
||||
#endif
|
||||
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
auto waybar::modules::Bluetooth::update() -> void {
|
||||
|
||||
@@ -17,7 +17,7 @@ waybar::modules::Custom::Custom(const std::string& name, const std::string& id,
|
||||
if (config.isNull()) {
|
||||
spdlog::warn("There is no configuration for 'custom/{}', element will be hidden", name);
|
||||
}
|
||||
dp.emit();
|
||||
|
||||
if (!config_["signal"].empty() && config_["interval"].empty() &&
|
||||
config_["restart-interval"].empty()) {
|
||||
waitingWorker();
|
||||
|
||||
@@ -22,7 +22,7 @@ waybar::modules::CustomGraph::CustomGraph(const std::string& name, const std::st
|
||||
if (config.isNull()) {
|
||||
spdlog::warn("There is no configuration for 'custom-graph/{}', element will be hidden", name);
|
||||
}
|
||||
dp.emit();
|
||||
|
||||
if (!config_["signal"].empty() && config_["interval"].empty() &&
|
||||
config_["restart-interval"].empty()) {
|
||||
waitingWorker();
|
||||
|
||||
@@ -20,7 +20,6 @@ Submap::Submap(const std::string& id, const Bar& bar, const Json::Value& config)
|
||||
|
||||
// register for hyprland ipc
|
||||
m_ipc.registerForIPC("submap", this);
|
||||
dp.emit();
|
||||
|
||||
if (config["icons"].isObject()) {
|
||||
const Json::Value& icons = config["icons"];
|
||||
|
||||
@@ -32,8 +32,6 @@ Window::Window(const std::string& id, const Bar& bar, const Json::Value& config)
|
||||
m_ipc.registerForIPC("changefloatingmode", this);
|
||||
m_ipc.registerForIPC("fullscreen", this);
|
||||
windowIpcUniqueLock.unlock();
|
||||
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
Window::~Window() {
|
||||
|
||||
@@ -19,7 +19,6 @@ WindowCount::WindowCount(const std::string& id, const Bar& bar, const Json::Valu
|
||||
|
||||
queryActiveWorkspace();
|
||||
update();
|
||||
dp.emit();
|
||||
|
||||
// register for hyprland ipc
|
||||
m_ipc.registerForIPC("fullscreen", this);
|
||||
|
||||
@@ -104,7 +104,6 @@ Inhibitor::Inhibitor(const std::string& id, const Bar& bar, const Json::Value& c
|
||||
inhibitors_(::getInhibitors(config)) {
|
||||
event_box_.add_events(Gdk::BUTTON_PRESS_MASK);
|
||||
event_box_.signal_button_press_event().connect(sigc::mem_fun(*this, &Inhibitor::handleToggle));
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
Inhibitor::~Inhibitor() {
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace waybar::modules::mango {
|
||||
Keymode::Keymode(const std::string& id, const Bar& bar, const Json::Value& config)
|
||||
: ALabel(config, "keymode", id, "{}", 0, false), bar_(bar) {
|
||||
IPC::getInstance().registerForIPC("monitor", this);
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
Keymode::~Keymode() { IPC::getInstance().unregisterForIPC(this); }
|
||||
|
||||
@@ -17,7 +17,6 @@ Language::Language(const std::string& id, const Bar& bar, const Json::Value& con
|
||||
|
||||
IPC::getInstance().registerForIPC("monitor", this);
|
||||
updateFromIPC();
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
Language::~Language() {
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace waybar::modules::mango {
|
||||
Layout::Layout(const std::string& id, const Bar& bar, const Json::Value& config)
|
||||
: ALabel(config, "layout", id, "{}", 0, false), bar_(bar) {
|
||||
IPC::getInstance().registerForIPC("monitor", this);
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
Layout::~Layout() { IPC::getInstance().unregisterForIPC(this); }
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace waybar::modules::mango {
|
||||
Window::Window(const std::string& id, const Bar& bar, const Json::Value& config)
|
||||
: AAppIconLabel(config, "window", id, "{title}", 0, true), bar_(bar) {
|
||||
IPC::getInstance().registerForIPC("monitor", this);
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
Window::~Window() { IPC::getInstance().unregisterForIPC(this); }
|
||||
|
||||
@@ -29,7 +29,6 @@ Workspaces::Workspaces(const std::string& id, const Bar& bar, const Json::Value&
|
||||
}
|
||||
|
||||
IPC::getInstance().registerForIPC("monitor", this);
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
Workspaces::~Workspaces() {
|
||||
|
||||
@@ -177,9 +177,6 @@ Mpris::Mpris(const std::string& id, const Json::Value& config)
|
||||
thread_.sleep_for(interval_);
|
||||
};
|
||||
}
|
||||
|
||||
// trigger initial update
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
Mpris::~Mpris() {
|
||||
|
||||
@@ -140,7 +140,6 @@ waybar::modules::Network::Network(const std::string& id, const Json::Value& conf
|
||||
createEventSocket();
|
||||
createInfoSocket();
|
||||
|
||||
dp.emit();
|
||||
// Ask for a dump of interfaces and then addresses to populate our
|
||||
// information. First the interface dump, and once done, the callback
|
||||
// will be called again which will ask for addresses dump.
|
||||
|
||||
@@ -18,7 +18,6 @@ Language::Language(const std::string& id, const Bar& bar, const Json::Value& con
|
||||
gIPC->registerForIPC("KeyboardLayoutSwitched", this);
|
||||
|
||||
updateFromIPC();
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
Language::~Language() {
|
||||
|
||||
@@ -18,8 +18,6 @@ Window::Window(const std::string& id, const Bar& bar, const Json::Value& config)
|
||||
gIPC->registerForIPC("WindowClosed", this);
|
||||
gIPC->registerForIPC("WindowFocusChanged", this);
|
||||
gIPC->registerForIPC("WindowLayoutsChanged", this);
|
||||
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
Window::~Window() { gIPC->unregisterForIPC(this); }
|
||||
|
||||
@@ -82,8 +82,6 @@ Workspaces::Workspaces(const std::string& id, const Bar& bar, const Json::Value&
|
||||
window.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
|
||||
window.signal_scroll_event().connect(sigc::mem_fun(*this, &Workspaces::handleScroll));
|
||||
}
|
||||
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
Workspaces::~Workspaces() { gIPC->unregisterForIPC(this); }
|
||||
|
||||
@@ -44,8 +44,6 @@ PowerProfilesDaemon::PowerProfilesDaemon(const std::string& id, const Json::Valu
|
||||
Gio::DBus::Proxy::create_for_bus(Gio::DBus::BusType::BUS_TYPE_SYSTEM, "net.hadess.PowerProfiles",
|
||||
"/net/hadess/PowerProfiles", "net.hadess.PowerProfiles",
|
||||
sigc::mem_fun(*this, &PowerProfilesDaemon::busConnectedCb));
|
||||
// Schedule update to set the initial visibility
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
void PowerProfilesDaemon::busConnectedCb(Glib::RefPtr<Gio::AsyncResult>& r) {
|
||||
|
||||
@@ -117,8 +117,6 @@ Privacy::Privacy(const std::string& id, const Json::Value& config, Gtk::Orientat
|
||||
geoclue_backend = util::GeoClueBackend::GeoClueBackend::getInstance();
|
||||
geoclue_backend->in_use_changed_signal_event.connect(
|
||||
sigc::mem_fun(*this, &Privacy::onGeoCluePrivacyNodesChanged));
|
||||
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
void Privacy::onPWPrivacyNodesChanged() {
|
||||
|
||||
@@ -49,7 +49,6 @@ Tray::Tray(const std::string& id, const Bar& bar, const Json::Value& config)
|
||||
box_.set_spacing(config_["spacing"].asUInt());
|
||||
}
|
||||
nb_hosts_ += 1;
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
void Tray::checkIgnoreList(std::unique_ptr<Item>* item_ptr) {
|
||||
|
||||
@@ -42,7 +42,6 @@ Language::Language(const std::string& id, const Json::Value& config)
|
||||
spdlog::error("Language: {}", e.what());
|
||||
}
|
||||
});
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
void Language::onCmd(const struct Ipc::ipc_response& res) {
|
||||
|
||||
@@ -16,7 +16,6 @@ Mode::Mode(const std::string& id, const Json::Value& config)
|
||||
spdlog::error("Mode: {}", e.what());
|
||||
}
|
||||
});
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
void Mode::onEvent(const struct Ipc::ipc_response& res) {
|
||||
|
||||
@@ -88,8 +88,6 @@ SystemdFailedUnits::SystemdFailedUnits(const std::string& id, const Json::Value&
|
||||
throw std::runtime_error("Neither system nor user status is requested.");
|
||||
|
||||
updateData();
|
||||
/* Always update for the first time. */
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
auto SystemdFailedUnits::notify_cb(const Glib::ustring& sender_name,
|
||||
|
||||
@@ -79,8 +79,6 @@ UPower::UPower(const std::string& id, const Json::Value& config)
|
||||
|
||||
resetDevices();
|
||||
setDisplayDevice();
|
||||
// Update the widget
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
UPower::~UPower() {
|
||||
|
||||
@@ -20,8 +20,6 @@ Window::Window(const std::string& id, const Bar& bar, const Json::Value& config)
|
||||
ipc->register_handler("view-app-id-changed", handler);
|
||||
|
||||
ipc->register_handler("window-rules/get-focused-view", handler);
|
||||
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
Window::~Window() { ipc->unregister_handler(handler); }
|
||||
|
||||
@@ -44,9 +44,6 @@ Workspaces::Workspaces(const std::string& id, const Bar& bar, const Json::Value&
|
||||
ipc->register_handler("window-rules/list-outputs", handler);
|
||||
ipc->register_handler("window-rules/list-wsets", handler);
|
||||
ipc->register_handler("window-rules/get-focused-output", handler);
|
||||
|
||||
// initial render
|
||||
dp.emit();
|
||||
}
|
||||
|
||||
Workspaces::~Workspaces() { ipc->unregister_handler(handler); }
|
||||
|
||||
Reference in New Issue
Block a user