| 4330 | |
| 4331 | |
| 4332 | static int pythonDbusPresent(void) |
| 4333 | { |
| 4334 | static int lPythonDbusPresent = -1 ; |
| 4335 | char lPythonCommand[384]; |
| 4336 | char lPythonParams[256] = |
| 4337 | "-c \"try:\n\timport dbus;bus=dbus.SessionBus();\ |
| 4338 | notif=bus.get_object('org.freedesktop.Notifications','/org/freedesktop/Notifications');\ |
| 4339 | notify=dbus.Interface(notif,'org.freedesktop.Notifications');\nexcept:\n\tprint(0);\""; |
| 4340 | |
| 4341 | if (lPythonDbusPresent < 0 ) |
| 4342 | { |
| 4343 | lPythonDbusPresent = 0 ; |
| 4344 | if ( python2Present() ) |
| 4345 | { |
| 4346 | strcpy(gPythonName , gPython2Name ) ; |
| 4347 | sprintf( lPythonCommand , "%s %s" , gPythonName , lPythonParams ) ; |
| 4348 | lPythonDbusPresent = tryCommand(lPythonCommand) ; |
| 4349 | } |
| 4350 | |
| 4351 | if ( !lPythonDbusPresent && python3Present() ) |
| 4352 | { |
| 4353 | strcpy(gPythonName , gPython3Name ) ; |
| 4354 | sprintf( lPythonCommand , "%s %s" , gPythonName , lPythonParams ) ; |
| 4355 | lPythonDbusPresent = tryCommand(lPythonCommand) ; |
| 4356 | } |
| 4357 | |
| 4358 | if (tinyfd_verbose) printf("lPythonDbusPresent %d\n", lPythonDbusPresent) ; |
| 4359 | if (tinyfd_verbose) printf("gPythonName %s\n", gPythonName) ; |
| 4360 | } |
| 4361 | return lPythonDbusPresent && graphicMode() && !(tfd_isDarwin() && getenv("SSH_TTY") ); |
| 4362 | } |
| 4363 | |
| 4364 | |
| 4365 | static void sigHandler(int signum) |
no test coverage detected