|
@@ -24,18 +24,15 @@ package com.dmdirc.addons.freedesktop_notifications;
|
24
|
24
|
|
25
|
25
|
import com.dmdirc.ClientModule.GlobalConfig;
|
26
|
26
|
import com.dmdirc.ClientModule.UserConfig;
|
27
|
|
-import com.dmdirc.DMDircMBassador;
|
28
|
27
|
import com.dmdirc.config.prefs.PluginPreferencesCategory;
|
29
|
28
|
import com.dmdirc.config.prefs.PreferencesCategory;
|
30
|
29
|
import com.dmdirc.config.prefs.PreferencesDialogModel;
|
31
|
30
|
import com.dmdirc.config.prefs.PreferencesSetting;
|
32
|
31
|
import com.dmdirc.config.prefs.PreferencesType;
|
33
|
32
|
import com.dmdirc.events.ClientPrefsOpenedEvent;
|
34
|
|
-import com.dmdirc.events.UserErrorEvent;
|
35
|
33
|
import com.dmdirc.interfaces.config.AggregateConfigProvider;
|
36
|
34
|
import com.dmdirc.interfaces.config.ConfigChangeListener;
|
37
|
35
|
import com.dmdirc.interfaces.config.ConfigProvider;
|
38
|
|
-import com.dmdirc.logger.ErrorLevel;
|
39
|
36
|
import com.dmdirc.plugins.PluginDomain;
|
40
|
37
|
import com.dmdirc.plugins.PluginInfo;
|
41
|
38
|
import com.dmdirc.plugins.implementations.PluginFilesHelper;
|
|
@@ -50,11 +47,17 @@ import java.io.IOException;
|
50
|
47
|
import javax.inject.Inject;
|
51
|
48
|
import javax.inject.Singleton;
|
52
|
49
|
|
|
50
|
+import org.slf4j.Logger;
|
|
51
|
+import org.slf4j.LoggerFactory;
|
|
52
|
+
|
53
|
53
|
import net.engio.mbassy.listener.Handler;
|
54
|
54
|
|
|
55
|
+import static com.dmdirc.util.LogUtils.USER_ERROR;
|
|
56
|
+
|
55
|
57
|
@Singleton
|
56
|
58
|
public class FDManager implements ConfigChangeListener {
|
57
|
59
|
|
|
60
|
+ private static final Logger LOG = LoggerFactory.getLogger(FDManager.class);
|
58
|
61
|
/** Global configuration. */
|
59
|
62
|
private final AggregateConfigProvider config;
|
60
|
63
|
/** User configuration. */
|
|
@@ -63,8 +66,6 @@ public class FDManager implements ConfigChangeListener {
|
63
|
66
|
private final String domain;
|
64
|
67
|
/** Plugin files helper. */
|
65
|
68
|
private final PluginFilesHelper filesHelper;
|
66
|
|
- /** The event bus to post errors to. */
|
67
|
|
- private final DMDircMBassador eventBus;
|
68
|
69
|
private final PluginInfo pluginInfo;
|
69
|
70
|
/** notification timeout. */
|
70
|
71
|
private int timeout;
|
|
@@ -81,13 +82,11 @@ public class FDManager implements ConfigChangeListener {
|
81
|
82
|
@UserConfig final ConfigProvider userConfig,
|
82
|
83
|
@PluginDomain(FreeDesktopNotificationsPlugin.class) final String domain,
|
83
|
84
|
final PluginFilesHelper filesHelper,
|
84
|
|
- final DMDircMBassador eventBus,
|
85
|
85
|
@PluginDomain(FreeDesktopNotificationsPlugin.class) final PluginInfo pluginInfo) {
|
86
|
86
|
this.domain = domain;
|
87
|
87
|
this.config = config;
|
88
|
88
|
this.userConfig = userConfig;
|
89
|
89
|
this.filesHelper = filesHelper;
|
90
|
|
- this.eventBus = eventBus;
|
91
|
90
|
this.pluginInfo = pluginInfo;
|
92
|
91
|
}
|
93
|
92
|
|
|
@@ -126,9 +125,11 @@ public class FDManager implements ConfigChangeListener {
|
126
|
125
|
try {
|
127
|
126
|
myProcess.waitFor();
|
128
|
127
|
} catch (InterruptedException e) {
|
|
128
|
+ //Not a problem, carry on
|
129
|
129
|
}
|
130
|
130
|
return true;
|
131
|
131
|
} catch (SecurityException | IOException e) {
|
|
132
|
+ LOG.info(USER_ERROR, "Unable to show notification", e);
|
132
|
133
|
}
|
133
|
134
|
|
134
|
135
|
return false;
|
|
@@ -173,9 +174,8 @@ public class FDManager implements ConfigChangeListener {
|
173
|
174
|
filesHelper.extractResourcesEndingWith(".py");
|
174
|
175
|
filesHelper.extractResourcesEndingWith(".png");
|
175
|
176
|
} catch (IOException ex) {
|
176
|
|
- eventBus.publishAsync(new UserErrorEvent(ErrorLevel.MEDIUM, ex,
|
177
|
|
- "Unable to extract files for Free desktop notifications: " + ex.getMessage(),
|
178
|
|
- ""));
|
|
177
|
+ LOG.warn(USER_ERROR, "Unable to extract files for Free desktop notifications: {}",
|
|
178
|
+ ex.getMessage(), ex);
|
179
|
179
|
}
|
180
|
180
|
}
|
181
|
181
|
|