From 10ba55b9e7544edd8967a22b76348e55183e3ced Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 23 Dec 2016 22:26:31 +0100 Subject: [PATCH] Code cleanup --- src/dorkbox/systemTray/jna/linux/AppIndicator.java | 5 +---- src/dorkbox/systemTray/jna/linux/Gtk.java | 9 +++++---- src/dorkbox/systemTray/util/JavaFX.java | 2 -- src/dorkbox/systemTray/util/Swt.java | 1 - 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/dorkbox/systemTray/jna/linux/AppIndicator.java b/src/dorkbox/systemTray/jna/linux/AppIndicator.java index 2245355..34d8cb1 100644 --- a/src/dorkbox/systemTray/jna/linux/AppIndicator.java +++ b/src/dorkbox/systemTray/jna/linux/AppIndicator.java @@ -33,6 +33,7 @@ import dorkbox.systemTray.jna.JnaHelper; public class AppIndicator { public static boolean isVersion3 = false; + public static boolean isLoaded = false; /** * Loader for AppIndicator, because it is absolutely mindboggling how those whom maintain the standard, can't agree to what that @@ -43,8 +44,6 @@ class AppIndicator { * This is so hacky it makes me sick. */ static { - boolean isLoaded = false; - // objdump -T /usr/lib/x86_64-linux-gnu/libappindicator.so.1 | grep foo // objdump -T /usr/lib/x86_64-linux-gnu/libappindicator3.so.1 | grep foo @@ -174,8 +173,6 @@ class AppIndicator { } } } - - } // If we are GTK2, change the order we check and load libraries diff --git a/src/dorkbox/systemTray/jna/linux/Gtk.java b/src/dorkbox/systemTray/jna/linux/Gtk.java index d57149e..845945f 100644 --- a/src/dorkbox/systemTray/jna/linux/Gtk.java +++ b/src/dorkbox/systemTray/jna/linux/Gtk.java @@ -49,12 +49,12 @@ class Gtk { // NOTE: AppIndicator uses this info to figure out WHAT VERSION OF appindicator to use: GTK2 -> appindicator1, GTK3 -> appindicator3 public static volatile boolean isGtk2 = false; + public static boolean isLoaded = false; public static Function gtk_status_icon_position_menu = null; private static boolean alreadyRunningGTK = false; - private static boolean isLoaded = false; // This is required because the EDT needs to have it's own value for this boolean, that is a different value than the main thread private static ThreadLocal isDispatch = new ThreadLocal() { @@ -193,14 +193,15 @@ class Gtk { if (!alreadyRunningGTK ) { // If JavaFX/SWT is used, this is UNNECESSARY (we can detect if the GTK main_loop is running) - if (SystemTray.DEBUG) { - logger.debug("Running GTK Native Event Loop"); - } gtkUpdateThread = new Thread() { @Override public void run() { + if (SystemTray.DEBUG) { + logger.debug("Running GTK Native Event Loop"); + } + // prep for the event loop. // GThread.g_thread_init(null); would be needed for g_idle_add() diff --git a/src/dorkbox/systemTray/util/JavaFX.java b/src/dorkbox/systemTray/util/JavaFX.java index e477e23..9800daf 100644 --- a/src/dorkbox/systemTray/util/JavaFX.java +++ b/src/dorkbox/systemTray/util/JavaFX.java @@ -71,8 +71,6 @@ class JavaFX { public static void init() { - // empty method to initialize class - if (dispatchMethod == null || isEventThreadMethod == null) { SystemTray.logger.error("Unable to initialize JavaFX! Please create an issue with your OS and Java " + "version so we may further investigate this issue."); diff --git a/src/dorkbox/systemTray/util/Swt.java b/src/dorkbox/systemTray/util/Swt.java index 0b8a786..1f71429 100644 --- a/src/dorkbox/systemTray/util/Swt.java +++ b/src/dorkbox/systemTray/util/Swt.java @@ -38,7 +38,6 @@ class Swt { public static void init() { - // empty method to initialize class if (currentDisplay == null) { logger.error("Unable to get the current display for SWT. Please create an issue with your OS and Java " + "version so we may further investigate this issue.");