Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/DMDirc/Plugins into dev3
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Holmes committed Feb 1, 2015
2 parents ef74c60 + b29cf18 commit 03b6900
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package com.dmdirc.addons.channelwho;

import com.dmdirc.ClientModule;
import com.dmdirc.DMDircMBassador;
import com.dmdirc.plugins.PluginDomain;
import com.dmdirc.util.LoggingScheduledExecutorService;

Expand Down Expand Up @@ -53,7 +52,7 @@ public String getSettingsDomain() {

@Provides
@Named("channelwho")
public ScheduledExecutorService getExecutorService(final DMDircMBassador eventBus) {
return new LoggingScheduledExecutorService(1, eventBus, "channelwho");
public ScheduledExecutorService getExecutorService() {
return new LoggingScheduledExecutorService(1, "channelwho");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,15 @@

import com.dmdirc.ClientModule.GlobalConfig;
import com.dmdirc.ClientModule.UserConfig;
import com.dmdirc.DMDircMBassador;
import com.dmdirc.config.prefs.PluginPreferencesCategory;
import com.dmdirc.config.prefs.PreferencesCategory;
import com.dmdirc.config.prefs.PreferencesDialogModel;
import com.dmdirc.config.prefs.PreferencesSetting;
import com.dmdirc.config.prefs.PreferencesType;
import com.dmdirc.events.ClientPrefsOpenedEvent;
import com.dmdirc.events.UserErrorEvent;
import com.dmdirc.interfaces.config.AggregateConfigProvider;
import com.dmdirc.interfaces.config.ConfigChangeListener;
import com.dmdirc.interfaces.config.ConfigProvider;
import com.dmdirc.logger.ErrorLevel;
import com.dmdirc.plugins.PluginDomain;
import com.dmdirc.plugins.PluginInfo;
import com.dmdirc.plugins.implementations.PluginFilesHelper;
Expand All @@ -50,11 +47,17 @@
import javax.inject.Inject;
import javax.inject.Singleton;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.engio.mbassy.listener.Handler;

import static com.dmdirc.util.LogUtils.USER_ERROR;

@Singleton
public class FDManager implements ConfigChangeListener {

private static final Logger LOG = LoggerFactory.getLogger(FDManager.class);
/** Global configuration. */
private final AggregateConfigProvider config;
/** User configuration. */
Expand All @@ -63,8 +66,6 @@ public class FDManager implements ConfigChangeListener {
private final String domain;
/** Plugin files helper. */
private final PluginFilesHelper filesHelper;
/** The event bus to post errors to. */
private final DMDircMBassador eventBus;
private final PluginInfo pluginInfo;
/** notification timeout. */
private int timeout;
Expand All @@ -81,13 +82,11 @@ public FDManager(
@UserConfig final ConfigProvider userConfig,
@PluginDomain(FreeDesktopNotificationsPlugin.class) final String domain,
final PluginFilesHelper filesHelper,
final DMDircMBassador eventBus,
@PluginDomain(FreeDesktopNotificationsPlugin.class) final PluginInfo pluginInfo) {
this.domain = domain;
this.config = config;
this.userConfig = userConfig;
this.filesHelper = filesHelper;
this.eventBus = eventBus;
this.pluginInfo = pluginInfo;
}

Expand Down Expand Up @@ -126,9 +125,11 @@ public boolean showNotification(final String title, final String message) {
try {
myProcess.waitFor();
} catch (InterruptedException e) {
//Not a problem, carry on
}
return true;
} catch (SecurityException | IOException e) {
LOG.info(USER_ERROR, "Unable to show notification", e);
}

return false;
Expand Down Expand Up @@ -173,9 +174,8 @@ public void onLoad() {
filesHelper.extractResourcesEndingWith(".py");
filesHelper.extractResourcesEndingWith(".png");
} catch (IOException ex) {
eventBus.publishAsync(new UserErrorEvent(ErrorLevel.MEDIUM, ex,
"Unable to extract files for Free desktop notifications: " + ex.getMessage(),
""));
LOG.warn(USER_ERROR, "Unable to extract files for Free desktop notifications: {}",
ex.getMessage(), ex);
}
}

Expand Down

0 comments on commit 03b6900

Please sign in to comment.