55
66public class Dock.AppSystem : Object , UnityClient {
77 private static Settings settings;
8- private static GLib . Once<AppSystem > instance;
98
109 static construct {
1110 settings = new Settings (" io.elementary.dock" );
1211 }
1312
14- public static unowned AppSystem get_default () {
15- return instance. once (() = > { return new AppSystem (); });
16- }
17-
1813 public signal void app_added (App app );
1914
15+ public WindowSystem window_system { get ; construct; }
16+
2017 private GLib . HashTable<unowned string, App > id_to_app;
2118
22- private AppSystem () { }
19+ public AppSystem (WindowSystem window_system ) {
20+ Object (window_system: window_system);
21+ }
2322
2423 construct {
2524 id_to_app = new HashTable<unowned string, App > (str_hash, str_equal);
@@ -36,19 +35,19 @@ public class Dock.AppSystem : Object, UnityClient {
3635 }
3736
3837 yield sync_windows ();
39- WindowSystem . get_default () . notify[" windows" ]. connect (sync_windows);
38+ window_system . notify[" windows" ]. connect (sync_windows);
4039 }
4140
4241 private App add_app (DesktopAppInfo app_info , bool pinned ) {
43- var app = new App (app_info, pinned);
42+ var app = new App (this , app_info, pinned);
4443 id_to_app[app_info. get_id ()] = app;
4544 app. removed. connect ((_app) = > id_to_app. remove (_app. app_info. get_id ()));
4645 app_added (app);
4746 return app;
4847 }
4948
5049 public async void sync_windows () {
51- var windows = WindowSystem . get_default () . windows;
50+ var windows = window_system . windows;
5251
5352 var app_window_list = new GLib .HashTable<App , GLib .GenericArray<Window > > (direct_hash, direct_equal);
5453 foreach (var window in windows) {
0 commit comments