Increased library logging for appindicator

This commit is contained in:
nathan 2016-09-26 23:32:16 +02:00
parent 20653c92dd
commit 36229e8aaa

View File

@ -33,7 +33,6 @@ public
class AppIndicator { class AppIndicator {
public static boolean isVersion3 = false; public static boolean isVersion3 = false;
private static boolean isLoaded = false; private static boolean isLoaded = false;
private static boolean LIBRARY_DEBUG = false;
/** /**
* Loader for AppIndicator, because it is absolutely mindboggling how those whom maintain the standard, can't agree to what that * Loader for AppIndicator, because it is absolutely mindboggling how those whom maintain the standard, can't agree to what that
@ -53,8 +52,8 @@ class AppIndicator {
if (SystemTray.FORCE_TRAY_TYPE == SystemTray.TYPE_GTK_STATUSICON) { if (SystemTray.FORCE_TRAY_TYPE == SystemTray.TYPE_GTK_STATUSICON) {
// if we force GTK type system tray, don't attempt to load AppIndicator libs // if we force GTK type system tray, don't attempt to load AppIndicator libs
if (LIBRARY_DEBUG) { if (SystemTray.DEBUG) {
logger.error("Forcing GTK tray, not using appindicator"); logger.debug("Forcing GTK tray, not using appindicator");
} }
isLoaded = true; isLoaded = true;
} }
@ -67,8 +66,8 @@ class AppIndicator {
isLoaded = true; isLoaded = true;
} }
} catch (Throwable e) { } catch (Throwable e) {
if (LIBRARY_DEBUG) { if (SystemTray.DEBUG) {
logger.error("Error loading library: {}", "appindicator1", e); logger.debug("Error loading library: {}", "appindicator1", e);
} }
} }
} }
@ -88,8 +87,8 @@ class AppIndicator {
final NativeLibrary library = JnaHelper.register(nameToCheck1, AppIndicator.class); final NativeLibrary library = JnaHelper.register(nameToCheck1, AppIndicator.class);
String s = library.getName(); String s = library.getName();
if (LIBRARY_DEBUG) { if (SystemTray.DEBUG) {
logger.error("Loading library (first attempt): {}", s); logger.debug("Loading library (first attempt): {}", s);
} }
if (s.contains("appindicator3")) { if (s.contains("appindicator3")) {
@ -98,8 +97,8 @@ class AppIndicator {
isLoaded = true; isLoaded = true;
} catch (Throwable e) { } catch (Throwable e) {
if (LIBRARY_DEBUG) { if (SystemTray.DEBUG) {
logger.error("Error loading library: {}", nameToCheck1, e); logger.debug("Error loading library: {}", nameToCheck1, e);
} }
} }
} }
@ -108,8 +107,8 @@ class AppIndicator {
// Super hacky way to do this. // Super hacky way to do this.
if (!isLoaded) { if (!isLoaded) {
if (Gtk.isGtk2) { if (Gtk.isGtk2) {
if (LIBRARY_DEBUG) { if (SystemTray.DEBUG) {
logger.error("Checking GTK2 first for appIndicator"); logger.debug("Checking GTK2 first for appIndicator");
} }
// have to check gtk2 first // have to check gtk2 first
@ -120,15 +119,15 @@ class AppIndicator {
String s = library.getName(); String s = library.getName();
if (LIBRARY_DEBUG) { if (SystemTray.DEBUG) {
logger.error("Loading library: {}", s); logger.debug("Loading library: {}", s);
} }
// version 3 WILL NOT work with icons in the menu. This allows us to show a warning (in the System tray initialization) // version 3 WILL NOT work with icons in the menu. This allows us to show a warning (in the System tray initialization)
if (i == 3 || s.contains("appindicator3")) { if (i == 3 || s.contains("appindicator3")) {
isVersion3 = true; isVersion3 = true;
if (LIBRARY_DEBUG) { if (SystemTray.DEBUG) {
logger.error("Unloading library: {}", s); logger.debug("Unloading library: {}", s);
} }
Native.unregister(AppIndicator.class); Native.unregister(AppIndicator.class);
} }
@ -136,8 +135,8 @@ class AppIndicator {
isLoaded = true; isLoaded = true;
break; break;
} catch (Throwable e) { } catch (Throwable e) {
if (LIBRARY_DEBUG) { if (SystemTray.DEBUG) {
logger.error("Error loading library: {}", "appindicator" + i, e); logger.debug("Error loading library: {}", "appindicator" + i, e);
} }
} }
} }
@ -152,8 +151,8 @@ class AppIndicator {
String s = library.getName(); String s = library.getName();
if (LIBRARY_DEBUG) { if (SystemTray.DEBUG) {
logger.error("Loading library: {}", s); logger.debug("Loading library: {}", s);
} }
// version 3 WILL NOT work with icons in the menu. This allows us to show a warning (in the System tray initialization) // version 3 WILL NOT work with icons in the menu. This allows us to show a warning (in the System tray initialization)
@ -164,8 +163,8 @@ class AppIndicator {
isLoaded = true; isLoaded = true;
break; break;
} catch (Throwable e) { } catch (Throwable e) {
if (LIBRARY_DEBUG) { if (SystemTray.DEBUG) {
logger.error("Error loading library: {}", "appindicator" + i, e); logger.debug("Error loading library: {}", "appindicator" + i, e);
} }
} }
} }
@ -192,8 +191,8 @@ class AppIndicator {
JnaHelper.register(nameToCheck1, AppIndicator.class); JnaHelper.register(nameToCheck1, AppIndicator.class);
isLoaded = true; isLoaded = true;
} catch (Throwable e) { } catch (Throwable e) {
if (LIBRARY_DEBUG) { if (SystemTray.DEBUG) {
logger.error("Error loading library: {}", nameToCheck1, e); logger.debug("Error loading library: {}", nameToCheck1, e);
} }
} }
} }
@ -204,8 +203,8 @@ class AppIndicator {
JnaHelper.register(nameToCheck2, AppIndicator.class); JnaHelper.register(nameToCheck2, AppIndicator.class);
isLoaded = true; isLoaded = true;
} catch (Throwable e) { } catch (Throwable e) {
if (LIBRARY_DEBUG) { if (SystemTray.DEBUG) {
logger.error("Error loading library: {}", nameToCheck2, e); logger.debug("Error loading library: {}", nameToCheck2, e);
} }
} }
} }