diff options
author | kotontrion <[email protected]> | 2024-06-17 11:23:16 +0200 |
---|---|---|
committer | kotontrion <[email protected]> | 2024-06-17 11:23:16 +0200 |
commit | 46368a262142530299854ae9225b6fe3d0214527 (patch) | |
tree | dd6d90a427c7488e0b8555797f7635e52908ba88 /src | |
parent | 6974f2021e6b49e7b49adb9cba0c166f59b203b7 (diff) |
add get_default method to obtain the singleton instance
Diffstat (limited to 'src')
-rw-r--r-- | src/tray.vala | 10 |
1 files changed, 10 insertions, 0 deletions
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; + } + + } } |