fix bar crashing on monitor add/remove
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <giomm.h>
|
||||
#include <gtkmm.h>
|
||||
#include <sigc++/sigc++.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "connection/dbus/dbus.hpp"
|
||||
|
||||
@@ -43,7 +44,17 @@ const Glib::ustring introspection_xml = R"(
|
||||
|
||||
class NotificationService : public DbusConnection {
|
||||
public:
|
||||
NotificationService() : notificationIdCounter(1) {
|
||||
static std::shared_ptr<NotificationService> getInstance() {
|
||||
if (NotificationService::instance == nullptr) {
|
||||
NotificationService::instance = std::shared_ptr<NotificationService>(new NotificationService());
|
||||
}
|
||||
return NotificationService::instance;
|
||||
}
|
||||
|
||||
void onBusAcquired(const Glib::RefPtr<Gio::DBus::Connection> &connection, const Glib::ustring &name);
|
||||
|
||||
private:
|
||||
NotificationService() {
|
||||
Gio::DBus::own_name(
|
||||
Gio::DBus::BusType::SESSION,
|
||||
"org.freedesktop.Notifications",
|
||||
@@ -53,10 +64,9 @@ class NotificationService : public DbusConnection {
|
||||
Gio::DBus::BusNameOwnerFlags::REPLACE);
|
||||
}
|
||||
|
||||
void onBusAcquired(const Glib::RefPtr<Gio::DBus::Connection> &connection, const Glib::ustring &name);
|
||||
static inline std::shared_ptr<NotificationService> instance = nullptr;
|
||||
|
||||
private:
|
||||
guint notificationIdCounter;
|
||||
guint notificationIdCounter = 0;
|
||||
const Gio::DBus::InterfaceVTable &getMessageInterfaceVTable();
|
||||
void on_method_call(const Glib::RefPtr<Gio::DBus::Connection> &connection,
|
||||
const Glib::ustring &sender,
|
||||
|
||||
Reference in New Issue
Block a user