From: David ‘Bombe’ Roden Date: Tue, 16 Nov 2010 04:53:46 +0000 (+0100) Subject: Use a notification! X-Git-Tag: 0.3-RC1~36 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d233a386e5e8417e500265f57a3911053f813923;p=Sone.git Use a notification! --- diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index a74c125..f68fec2 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -237,6 +237,23 @@ public class WebInterface implements CoreListener { startupNotification.dismiss(); } }, "Sone Startup Notification Remover"); + + Template wotMissingNotificationTemplate = templateFactory.createTemplate(createReader("/templates/notify/wotMissingNotification.html")); + final TemplateNotification wotMissingNotification = new TemplateNotification("wot-missing-notification", wotMissingNotificationTemplate); + Ticker.getInstance().registerEvent(System.currentTimeMillis() + (15 * 1000), new Runnable() { + + @Override + @SuppressWarnings("synthetic-access") + public void run() { + if (getCore().getIdentityManager().isConnected()) { + wotMissingNotification.dismiss(); + } else { + notificationManager.addNotification(wotMissingNotification); + } + Ticker.getInstance().registerEvent(System.currentTimeMillis() + (15 * 1000), this, "Sone WoT Connector Checker"); + } + + }, "Sone WoT Connector Checker"); } /** diff --git a/src/main/resources/templates/notify/wotMissingNotification.html b/src/main/resources/templates/notify/wotMissingNotification.html new file mode 100644 index 0000000..02fc451 --- /dev/null +++ b/src/main/resources/templates/notify/wotMissingNotification.html @@ -0,0 +1,4 @@ +
+ <%= Page.WotPluginMissing.Text.WotRequired|l10n|html> + <%= Page.WotPluginMissing.Text.LoadPlugin|l10n|html|replace needle="{link}" replacement=''|replace needle="{/link}" replacement=''> +