1

I'm making a gtk application in C that once executed, I want to be able to somehow contact the process (hopefully from python) and tell it to execute a function. I have everything else working, just need some way to execute a function from outside the process.

Current main (based on gtk tutorial):

int main (int argc, char **argv) { GtkApplication *app; int status; app = gtk_application_new(NULL, G_APPLICATION_FLAGS_NONE); custom_setup(); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); status = g_application_run (G_APPLICATION (app), NULL, NULL); g_object_unref (app); return status; } 

Thank you.

1 Answer 1

1

Your app will have to expose a DBus interface to other apps, with a method they can call which executes your function.

A nice shortcut to doing this is to add a GAction to your app, which is described here. Then other apps can call the org.gtk.Actions.Activate DBus method to activate the GAction and execute your function.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.