From a5d164134ee478d604c9ad5b502f3160cff5a441 Mon Sep 17 00:00:00 2001 From: gambas Date: Thu, 18 Mar 2021 17:20:30 +0100 Subject: [PATCH] Support for the GB_GUI_TRAYICON_NO_DBUS environment variable. [GB.GUI.TRAYICON] * NEW: Support for the GB_GUI_TRAYICON_NO_DBUS environment variable. --- main/lib/gui.trayicon/main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/main/lib/gui.trayicon/main.c b/main/lib/gui.trayicon/main.c index fdb5f0527..72263c697 100644 --- a/main/lib/gui.trayicon/main.c +++ b/main/lib/gui.trayicon/main.c @@ -51,11 +51,19 @@ void EXPORT GB_AFTER_INIT(void) GB_FUNCTION func; bool has_dbus_systemtray = FALSE; void (*declare_tray_icon)(); + char *env; - GB.Component.Load("gb.dbus"); + env = getenv("GB_GUI_TRAYICON_NO_DBUS"); - if (!GB.GetFunction(&func, (void *)GB.FindClass("DBus"), "_HasSystemTray", NULL, NULL)) - has_dbus_systemtray = GB.Call(&func, 0, FALSE)->_boolean.value; + if (env && *env == '1') + has_dbus_systemtray = FALSE; + else + { + GB.Component.Load("gb.dbus"); + + if (!GB.GetFunction(&func, (void *)GB.FindClass("DBus"), "_HasSystemTray", NULL, NULL)) + has_dbus_systemtray = GB.Call(&func, 0, FALSE)->_boolean.value; + } if (has_dbus_systemtray) GB.Component.Load("gb.dbus.trayicon");