diff --git a/lib/Drawing/StyleManager.vala b/lib/Drawing/StyleManager.vala index 8740de010..265c5d138 100644 --- a/lib/Drawing/StyleManager.vala +++ b/lib/Drawing/StyleManager.vala @@ -36,7 +36,7 @@ public class Gala.Drawing.StyleManager : Object { private static GLib.Once instance; public static StyleManager get_instance () { - return instance.once (() => {return new StyleManager ();}); + return instance.once (() => new StyleManager ()); } public ColorScheme prefers_color_scheme { get; private set; default = LIGHT; } diff --git a/src/Background/BackgroundCache.vala b/src/Background/BackgroundCache.vala index 02025dcb4..d28c4eadf 100644 --- a/src/Background/BackgroundCache.vala +++ b/src/Background/BackgroundCache.vala @@ -5,26 +5,17 @@ */ public class Gala.BackgroundCache : Object { - private static BackgroundCache? instance = null; - + private static GLib.Once instance; public static unowned BackgroundCache get_default () { - if (instance == null) - instance = new BackgroundCache (); - - return instance; + return instance.once (() => new BackgroundCache ()); } public signal void file_changed (string filename); private Gee.HashMap file_monitors; private BackgroundSource background_source; - private Animation animation; - public BackgroundCache () { - Object (); - } - construct { file_monitors = new Gee.HashMap (); } diff --git a/src/PluginManager.vala b/src/PluginManager.vala index aa81c6c11..dbaed722a 100644 --- a/src/PluginManager.vala +++ b/src/PluginManager.vala @@ -5,12 +5,9 @@ */ public class Gala.PluginManager : Object { - private static PluginManager? instance = null; + private static GLib.Once instance; public static unowned PluginManager get_default () { - if (instance == null) - instance = new PluginManager (); - - return instance; + return instance.once (() => new PluginManager ()); } public delegate PluginInfo RegisterPluginFunction (); diff --git a/src/Widgets/MultitaskingView/StaticWindowContainer.vala b/src/Widgets/MultitaskingView/StaticWindowContainer.vala index 42224ad5d..205d634a2 100644 --- a/src/Widgets/MultitaskingView/StaticWindowContainer.vala +++ b/src/Widgets/MultitaskingView/StaticWindowContainer.vala @@ -12,7 +12,7 @@ public class Gala.StaticWindowContainer : ActorTarget { private static GLib.Once instance; public static StaticWindowContainer get_instance (Meta.Display display) { - return instance.once (() => { return new StaticWindowContainer (display); }); + return instance.once (() => new StaticWindowContainer (display)); } public signal void window_changed (Meta.Window window, bool is_static); diff --git a/src/WindowDragProvider.vala b/src/WindowDragProvider.vala index b71a6fdc9..0ff25660a 100644 --- a/src/WindowDragProvider.vala +++ b/src/WindowDragProvider.vala @@ -9,7 +9,7 @@ public class Gala.WindowDragProvider : Object { private static GLib.Once instance; public static WindowDragProvider get_instance () { - return instance.once (() => { return new WindowDragProvider (); }); + return instance.once (() => new WindowDragProvider ()); } public signal void enter (uint64 window_id);