Kaynağa Gözat

Fix OSD Plugin.

pull/291/head
Greg Holmes 9 yıl önce
ebeveyn
işleme
09f11e6b89

+ 11
- 0
osd/src/com/dmdirc/addons/osd/OsdManager.java Dosyayı Görüntüle

@@ -22,6 +22,7 @@
22 22
 
23 23
 package com.dmdirc.addons.osd;
24 24
 
25
+import com.dmdirc.DMDircMBassador;
25 26
 import com.dmdirc.addons.ui_swing.UIUtilities;
26 27
 import com.dmdirc.addons.ui_swing.injection.MainWindow;
27 28
 import com.dmdirc.config.prefs.CategoryChangeListener;
@@ -82,6 +83,7 @@ public class OsdManager implements CategoryChangeListener, PreferencesInterface,
82 83
     private PreferencesSetting maxWindowsSetting;
83 84
     /** This plugin's plugin info. */
84 85
     private final PluginInfo pluginInfo;
86
+    private final DMDircMBassador eventBus;
85 87
     /** The controller to read/write settings with. */
86 88
     private final IdentityController identityController;
87 89
     /** The manager to use to parse colours. */
@@ -90,10 +92,12 @@ public class OsdManager implements CategoryChangeListener, PreferencesInterface,
90 92
     @Inject
91 93
     public OsdManager(
92 94
             @MainWindow final Window mainFrame,
95
+            final DMDircMBassador eventBus,
93 96
             final IdentityController identityController,
94 97
             final ColourManagerFactory colourManagerFactory,
95 98
             @PluginDomain(OsdPlugin.class) final PluginInfo pluginInfo) {
96 99
         this.mainFrame = mainFrame;
100
+        this.eventBus = eventBus;
97 101
         this.identityController = identityController;
98 102
         this.colourManager = colourManagerFactory.getColourManager(identityController.getGlobalConfiguration());
99 103
         this.pluginInfo = pluginInfo;
@@ -321,4 +325,11 @@ public class OsdManager implements CategoryChangeListener, PreferencesInterface,
321 325
         }
322 326
     }
323 327
 
328
+    public void onLoad() {
329
+        eventBus.subscribe(this);
330
+    }
331
+
332
+    public void onUnload() {
333
+        eventBus.subscribe(this);
334
+    }
324 335
 }

+ 10
- 0
osd/src/com/dmdirc/addons/osd/OsdPlugin.java Dosyayı Görüntüle

@@ -47,6 +47,16 @@ public class OsdPlugin extends BaseCommandPlugin {
47 47
         registerCommand(OsdCommand.class, OsdCommand.INFO);
48 48
     }
49 49
 
50
+    @Override
51
+    public void onLoad() {
52
+        osdManager.onLoad();
53
+    }
54
+
55
+    @Override
56
+    public void onUnload() {
57
+        osdManager.onUnload();
58
+    }
59
+
50 60
     /**
51 61
      * Shows an OSD with the specified message, title is ignored, exported method used for
52 62
      * showNotification.

Loading…
İptal
Kaydet