fix(tray): revert ustring formatting changes

This reverts commit a4d31ab10d.
This commit is contained in:
Aleksei Bavshin 2024-09-14 07:37:37 -07:00
parent f60c291b82
commit 0006e4713a
No known key found for this signature in database
GPG Key ID: 4F071603387A382A
1 changed files with 9 additions and 14 deletions

View File

@ -104,11 +104,9 @@ void Item::proxyReady(Glib::RefPtr<Gio::AsyncResult>& result) {
this->updateImage(); this->updateImage();
} catch (const Glib::Error& err) { } catch (const Glib::Error& err) {
spdlog::error("Failed to create DBus Proxy for {} {}: {}", bus_name, object_path, spdlog::error("Failed to create DBus Proxy for {} {}: {}", bus_name, object_path, err.what());
std::string(err.what()));
} catch (const std::exception& err) { } catch (const std::exception& err) {
spdlog::error("Failed to create DBus Proxy for {} {}: {}", bus_name, object_path, spdlog::error("Failed to create DBus Proxy for {} {}: {}", bus_name, object_path, err.what());
std::string(err.what()));
} }
} }
@ -126,15 +124,14 @@ ToolTip get_variant<ToolTip>(const Glib::VariantBase& value) {
result.text = get_variant<Glib::ustring>(container.get_child(2)); result.text = get_variant<Glib::ustring>(container.get_child(2));
auto description = get_variant<Glib::ustring>(container.get_child(3)); auto description = get_variant<Glib::ustring>(container.get_child(3));
if (!description.empty()) { if (!description.empty()) {
result.text = fmt::format("<b>{}</b>\n{}", std::string(result.text), std::string(description)); result.text = fmt::format("<b>{}</b>\n{}", result.text, description);
} }
return result; return result;
} }
void Item::setProperty(const Glib::ustring& name, Glib::VariantBase& value) { void Item::setProperty(const Glib::ustring& name, Glib::VariantBase& value) {
try { try {
spdlog::trace("Set tray item property: {}.{} = {}", id.empty() ? bus_name : id, spdlog::trace("Set tray item property: {}.{} = {}", id.empty() ? bus_name : id, name, value);
std::string(name), get_variant<std::string>(value));
if (name == "Category") { if (name == "Category") {
category = get_variant<std::string>(value); category = get_variant<std::string>(value);
@ -179,12 +176,10 @@ void Item::setProperty(const Glib::ustring& name, Glib::VariantBase& value) {
} }
} catch (const Glib::Error& err) { } catch (const Glib::Error& err) {
spdlog::warn("Failed to set tray item property: {}.{}, value = {}, err = {}", spdlog::warn("Failed to set tray item property: {}.{}, value = {}, err = {}",
id.empty() ? bus_name : id, std::string(name), get_variant<std::string>(value), id.empty() ? bus_name : id, name, value, err.what());
std::string(err.what()));
} catch (const std::exception& err) { } catch (const std::exception& err) {
spdlog::warn("Failed to set tray item property: {}.{}, value = {}, err = {}", spdlog::warn("Failed to set tray item property: {}.{}, value = {}, err = {}",
id.empty() ? bus_name : id, std::string(name), get_variant<std::string>(value), id.empty() ? bus_name : id, name, value, err.what());
std::string(err.what()));
} }
} }
@ -226,9 +221,9 @@ void Item::processUpdatedProperties(Glib::RefPtr<Gio::AsyncResult>& _result) {
this->updateImage(); this->updateImage();
} catch (const Glib::Error& err) { } catch (const Glib::Error& err) {
spdlog::warn("Failed to update properties: {}", std::string(err.what())); spdlog::warn("Failed to update properties: {}", err.what());
} catch (const std::exception& err) { } catch (const std::exception& err) {
spdlog::warn("Failed to update properties: {}", std::string(err.what())); spdlog::warn("Failed to update properties: {}", err.what());
} }
update_pending_.clear(); update_pending_.clear();
} }
@ -250,7 +245,7 @@ static const std::map<std::string_view, std::set<std::string_view>> signal2props
void Item::onSignal(const Glib::ustring& sender_name, const Glib::ustring& signal_name, void Item::onSignal(const Glib::ustring& sender_name, const Glib::ustring& signal_name,
const Glib::VariantContainerBase& arguments) { const Glib::VariantContainerBase& arguments) {
spdlog::trace("Tray item '{}' got signal {}", id, std::string(signal_name)); spdlog::trace("Tray item '{}' got signal {}", id, signal_name);
auto changed = signal2props.find(signal_name.raw()); auto changed = signal2props.find(signal_name.raw());
if (changed != signal2props.end()) { if (changed != signal2props.end()) {
if (update_pending_.empty()) { if (update_pending_.empty()) {