close one notification to close all

This commit is contained in:
2026-02-02 21:46:50 +01:00
parent 49ac6cec90
commit ed1a9a8605
21 changed files with 352 additions and 146 deletions

View File

@@ -9,7 +9,7 @@
#include <giomm/dbusactiongroup.h>
#include <giomm/dbusownname.h>
#include <giomm/menumodel.h>
#include <iostream>
#include <spdlog/spdlog.h>
#include <memory>
#include <tuple>
#include <vector>
@@ -143,9 +143,9 @@ void on_simple_call_finished(GObject *source, GAsyncResult *res,
const bool isUnknownMethod =
(error->domain == G_DBUS_ERROR && error->code == G_DBUS_ERROR_UNKNOWN_METHOD);
if (!(data && data->ignoreUnknownMethod && isUnknownMethod)) {
std::cerr << "[TrayService] "
<< (data ? data->debugLabel : std::string("D-Bus call"))
<< " failed: " << error->message << std::endl;
spdlog::error("[TrayService] {} failed: {}",
(data ? data->debugLabel : std::string("D-Bus call")),
error->message);
}
g_error_free(error);
}
@@ -288,8 +288,9 @@ void TrayService::start() {
nodeInfo =
Gio::DBus::NodeInfo::create_for_xml(kWatcherIntrospection);
} catch (const Glib::Error &err) {
std::cerr << "[TrayService] Failed to parse introspection data: "
<< err.what() << std::endl;
spdlog::error(
"[TrayService] Failed to parse introspection data: {}",
err.what());
return;
}
}
@@ -577,9 +578,9 @@ bool TrayService::activate_menu_item(const std::string &id, int itemId,
const guint32 nowMs = static_cast<guint32>(g_get_real_time() / 1000);
const guint32 ts = timestampMs ? timestampMs : nowMs;
std::cerr << "[TrayService] MenuEvent id=" << id << " item=" << itemId
<< " x=" << x << " y=" << y << " button=" << button
<< " tsMs=" << ts << std::endl;
spdlog::debug(
"[TrayService] MenuEvent id={} item={} x={} y={} button={} tsMs={}",
id, itemId, x, y, button, ts);
// dbusmenu Event signature: (i s v u)
// Some handlers (e.g., media players) look for both "timestamp" and
@@ -637,8 +638,7 @@ void TrayService::on_bus_acquired(
auto interface_info = nodeInfo->lookup_interface(kWatcherInterface);
if (!interface_info) {
std::cerr << "[TrayService] Missing interface info for watcher."
<< std::endl;
spdlog::error("[TrayService] Missing interface info for watcher.");
return;
}
@@ -646,8 +646,9 @@ void TrayService::on_bus_acquired(
registrationId = connection->register_object(kWatcherObjectPath,
interface_info, vtable);
} catch (const Glib::Error &err) {
std::cerr << "[TrayService] Failed to register watcher object: "
<< err.what() << std::endl;
spdlog::error(
"[TrayService] Failed to register watcher object: {}",
err.what());
registrationId = 0;
return;
}
@@ -747,8 +748,8 @@ void TrayService::register_item(const Glib::ustring &sender,
ParsedService parsed = parse_service_identifier(sender, service);
if (parsed.busName.empty() || parsed.objectPath.empty()) {
std::cerr << "[TrayService] Invalid service registration: " << service
<< std::endl;
spdlog::warn("[TrayService] Invalid service registration: {}",
service);
return;
}
@@ -845,8 +846,9 @@ void TrayService::on_refresh_finished_static(GObject *source, GAsyncResult *res,
g_dbus_connection_call_finish(G_DBUS_CONNECTION(source), res, &error);
if (!reply) {
if (error) {
std::cerr << "[TrayService] Failed to query properties for "
<< data->id << ": " << error->message << std::endl;
spdlog::error(
"[TrayService] Failed to query properties for {}: {}",
data->id, error->message);
g_error_free(error);
}
@@ -1240,8 +1242,8 @@ Glib::RefPtr<Gdk::Paintable> TrayService::parse_icon_pixmap(GVariant *variant) {
try {
return Gdk::Texture::create_for_pixbuf(pixbuf);
} catch (const Glib::Error &err) {
std::cerr << "[TrayService] Failed to create texture: " << err.what()
<< std::endl;
spdlog::error("[TrayService] Failed to create texture: {}",
err.what());
return {};
}
}