MCPcopy Create free account
hub / github.com/crossuo/crossuo / pythonDbusPresent

Function pythonDbusPresent

external/tinyfiledialogs.c:4076–4106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4074
4075
4076static int pythonDbusPresent(void)
4077{
4078 static int lDbusPresent = -1 ;
4079 char lPythonCommand[256];
4080 char lPythonParams[256] =
4081"-c \"try:\n\timport dbus;bus=dbus.SessionBus();\
4082notif=bus.get_object('org.freedesktop.Notifications','/org/freedesktop/Notifications');\
4083notify=dbus.Interface(notif,'org.freedesktop.Notifications');\nexcept:\n\tprint(0);\"";
4084
4085 if ( lDbusPresent < 0 )
4086 {
4087 lDbusPresent = 0 ;
4088 if ( python2Present() )
4089 {
4090 strcpy(gPythonName , gPython2Name ) ;
4091 sprintf( lPythonCommand , "%s %s" , gPythonName , lPythonParams ) ;
4092 lDbusPresent = tryCommand(lPythonCommand) ;
4093 }
4094
4095 if ( ! lDbusPresent && python3Present() )
4096 {
4097 strcpy(gPythonName , gPython3Name ) ;
4098 sprintf( lPythonCommand , "%s %s" , gPythonName , lPythonParams ) ;
4099 lDbusPresent = tryCommand(lPythonCommand) ;
4100 }
4101
4102 if (tinyfd_verbose) printf("lDbusPresent %d\n", lDbusPresent) ;
4103 if (tinyfd_verbose) printf("gPythonName %s\n", gPythonName) ;
4104 }
4105 return lDbusPresent && graphicMode() && !(isDarwin() && getenv("SSH_TTY") );
4106}
4107
4108
4109static void sigHandler(int sig)

Callers 1

tinyfiledialogs.cFile · 0.85

Calls 5

python2PresentFunction · 0.85
tryCommandFunction · 0.85
python3PresentFunction · 0.85
graphicModeFunction · 0.85
isDarwinFunction · 0.85

Tested by

no test coverage detected