refactor(AModule): hoist format/tooltip resolution to the base module
Move resolveTooltipFormat() (and add resolveFormat()) from ALabel down into AModule, and add a generic updateTooltip(Gtk::Widget&, ...) helper. This lets modules that are not ALabel-derived reuse the shared tooltip logic instead of re-implementing it. Migrate gamemode (the only non-ALabel module reading tooltip-format) to updateTooltip(box_, ...). ALabel inherits the resolvers.
This commit is contained in:
@@ -210,10 +210,7 @@ auto Gamemode::update() -> void {
|
||||
lastStatus = status;
|
||||
|
||||
// Tooltip
|
||||
if (tooltip) {
|
||||
std::string text = fmt::format(fmt::runtime(tooltip_format), fmt::arg("count", gameCount));
|
||||
box_.set_tooltip_markup(text);
|
||||
}
|
||||
updateTooltip(box_, tooltip_format, fmt::arg("count", gameCount));
|
||||
|
||||
// Label format
|
||||
std::string str = fmt::format(fmt::runtime(showAltText ? format_alt : format),
|
||||
|
||||
Reference in New Issue
Block a user