Un-static part 1

Replace TrayManager.getInstance() with constructor
Pass Main to TrayManager
Create WindowHandler in TrayManager
Pass WindowHandler to RegisteredFrames
Only create ItoopieHostnameVerifier once, in gui/Main
Pass gui/Main to SettingsFrame
Pass gui/Main to ItoopieHostnameVerifier and CertificateGui
Sync on lock in ItoopieHostnameVerifier.clearRecentlyDenied()
Comment out some main() and other test code
Make some fields non-static
Remove some static initializers
Start gui/Main before the tray icon
Fixed the tray icon on Gnome with a delay in TrayManager
This commit is contained in:
zzz
2022-01-11 11:05:00 -05:00
parent 0498ea69ea
commit 25dd896d26
10 changed files with 98 additions and 97 deletions

View File

@ -10,25 +10,18 @@ import net.i2p.itoopie.util.IconLoader;
public class RegisteredFrame extends JFrame implements WindowListener{
private static final long serialVersionUID = 3351260168651061327L;
private final WindowHandler windowHandler;
public RegisteredFrame(String name) {
super(name);
super.addWindowListener(this);
WindowHandler.register(this);
this.setIconImage(IconLoader.getIcon("itoopie", 128));
public RegisteredFrame(String name, WindowHandler wh) {
super(name);
super.addWindowListener(this);
windowHandler = wh;
windowHandler.register(this);
this.setIconImage(IconLoader.getIcon("itoopie", 128));
}
public RegisteredFrame() {
super();
super.addWindowListener(this);
WindowHandler.register(this);
this.setIconImage(IconLoader.getIcon("itoopie", 128));
}
public void windowClosing(WindowEvent e) {
WindowHandler.deRegister(this);
windowHandler.deRegister(this);
this.dispose();
}