MCPcopy Create free account
hub / github.com/black-sliver/PopTracker / pythonDbusPresent

Function pythonDbusPresent

lib/tinyfiledialogs/tinyfiledialogs.cpp:4332–4362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4330
4331
4332static 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();\
4338notif=bus.get_object('org.freedesktop.Notifications','/org/freedesktop/Notifications');\
4339notify=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
4365static void sigHandler(int signum)

Callers 2

tinyfd_messageBoxFunction · 0.85
tinyfd_notifyPopupFunction · 0.85

Calls 5

python2PresentFunction · 0.85
tryCommandFunction · 0.85
python3PresentFunction · 0.85
graphicModeFunction · 0.85
tfd_isDarwinFunction · 0.85

Tested by

no test coverage detected