refactor notifications
This commit is contained in:
33
include/services/dbus/messages.hpp
Normal file
33
include/services/dbus/messages.hpp
Normal 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;
|
||||
};
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user