From b152dd61a77f2afe0094c4fc79b8fe5479990ad9 Mon Sep 17 00:00:00 2001 From: Aylur Date: Tue, 25 Jun 2024 22:36:23 +0200 Subject: add global default getter --- src/notifd.vala | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/notifd.vala b/src/notifd.vala index f967421..45e5eb0 100644 --- a/src/notifd.vala +++ b/src/notifd.vala @@ -1,10 +1,17 @@ namespace AstalNotifd { -public enum ActiveType { - DAEMON, - PROXY, +public Notifd get_default() { + return Notifd.get_default(); } public class Notifd : Object { + private static Notifd _instance; + public static Notifd get_default() { + if (_instance == null) + _instance = new Notifd(); + + return _instance; + } + private Daemon daemon; private DaemonProxy proxy; @@ -98,4 +105,9 @@ public class Notifd : Object { }); } } + +public enum ActiveType { + DAEMON, + PROXY, +} } -- cgit v1.2.3