diff options
author | Aylur <[email protected]> | 2024-06-25 22:36:23 +0200 |
---|---|---|
committer | Aylur <[email protected]> | 2024-06-25 22:36:23 +0200 |
commit | b152dd61a77f2afe0094c4fc79b8fe5479990ad9 (patch) | |
tree | 75df9886b299d1fbcbe5abd1a7ed96fbed3187a0 | |
parent | 1b726cfafa3c68e8fdf957f2279a88a1cabcaad9 (diff) |
add global default getter
-rw-r--r-- | src/notifd.vala | 18 |
1 files changed, 15 insertions, 3 deletions
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, +} } |