From 46368a262142530299854ae9225b6fe3d0214527 Mon Sep 17 00:00:00 2001 From: kotontrion Date: Mon, 17 Jun 2024 11:23:16 +0200 Subject: add get_default method to obtain the singleton instance --- src/tray.vala | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/tray.vala b/src/tray.vala index d1dfdd2..8f67194 100644 --- a/src/tray.vala +++ b/src/tray.vala @@ -115,6 +115,16 @@ namespace AstalTray { return _items.get(service); } + private static Tray? instance; + + public static unowned Tray get_default() { + + if (instance == null) instance = new Tray(); + + return instance; + } + + } } -- cgit v1.2.3