refactor notifications

This commit is contained in:
2026-02-01 16:10:42 +01:00
parent 17aef717b7
commit 178a4451d4
18 changed files with 449 additions and 236 deletions

View File

@@ -0,0 +1,33 @@
#pragma once
#include <cstdint>
#include <functional>
#include <string>
#include <map>
#include <vector>
#include "glibmm/variant.h"
struct MprisPlayer2Message {
std::string title;
std::string artist;
std::string artwork_url;
std::function<void()> play_pause;
std::function<void()> next;
std::function<void()> previous;
};
struct NotifyMessage {
std::string app_name;
uint32_t replaces_id;
std::string app_icon;
std::string summary;
std::string body;
std::vector<std::string> actions;
std::map<std::string, Glib::VariantBase> hints;
int32_t expire_timeout;
// Callback to invoke when an action is triggered
std::function<void(const std::string& action_id)> on_action;
};

View File

@@ -1,20 +1,10 @@
#pragma once
#include <giomm.h>
#include <string>
#include <vector>
class MprisController {
public:
struct MprisPlayer2Message {
std::string title;
std::string artist;
std::string artwork_url;
std::function<void()> play_pause;
std::function<void()> next;
std::function<void()> previous;
};
MprisController();

View File

@@ -3,11 +3,8 @@
#include <fcntl.h>
#include <giomm.h>
#include <gtkmm.h>
#include <memory>
#include <sigc++/sigc++.h>
#include <vector>
#include "gdkmm/monitor.h"
#include "giomm/dbusconnection.h"
#include "giomm/dbusownname.h"
#include "glib.h"
@@ -43,7 +40,6 @@ const Glib::ustring introspection_xml = R"(
)";
class NotificationService {
public:
NotificationService() : notificationIdCounter(1) {
Gio::DBus::own_name(