#pragma once #include #include #include #include #include "connection/dbus/dbus.hpp" #include "giomm/dbusconnection.h" #include "giomm/dbusownname.h" #include "glib.h" const Glib::ustring introspection_xml = R"( )"; class NotificationService : public DbusConnection { public: NotificationService() : notificationIdCounter(1) { Gio::DBus::own_name( Gio::DBus::BusType::SESSION, "org.freedesktop.Notifications", sigc::mem_fun(*this, &NotificationService::onBusAcquired), {}, // Name acquired slot (optional) {}, // Name lost slot (optional) Gio::DBus::BusNameOwnerFlags::REPLACE); } void onBusAcquired(const Glib::RefPtr &connection, const Glib::ustring &name); private: guint notificationIdCounter; const Gio::DBus::InterfaceVTable &getMessageInterfaceVTable(); void on_method_call(const Glib::RefPtr &connection, const Glib::ustring &sender, const Glib::ustring &object_path, const Glib::ustring &interface_name, const Glib::ustring &method_name, const Glib::VariantContainerBase ¶meters, const Glib::RefPtr &invocation); void handle_notify(const Glib::VariantContainerBase ¶meters, const Glib::RefPtr &invocation); void createNotificationPopup(const Glib::ustring &title, const Glib::ustring &message); };