Please recommend a good D-Bus tutorial (Linux C GTK+)
Yes, I have done a search yet found only partly working stuff. It seems to be a real maze. E.g.:
- Why do they even use g_main_loop_run()? Is it really necessary when the GTK+ program has already entered the main loop by gtk_main()?
- How should the path, the interface name and the signal name look like when invoking such functions like dbus_bus_request_name(), dbus_message_new_signal(), dbus_bus_add_match(), dbus_message_is_signal() ...?
- How afterwards should the names be correctly set in the /etc/dbus-1/system.conf file to even allow the program to use the the D-Bus interface? Surprisingly all tutorials I found simply forget to mention at all you need to edit it.
- How the messages could be caught asynchronously? Should it be done somehow like in a separate thread?
Please recommend any good GTK+ D-Bus example which could help to learn how to use it.
gtk_main is calling g_main_loop_run(), you should look into file gtk/gtkmain.c to find out.
Googling for dbug_bus_request_name gives several examples, notably dbus-example.c
And you should read a good gtk tutorial to have an idea of what signals and slots mean in the context of Gtk.
Googling for d-bus tutorial gives this dbus tutorial
At last, a good idea is to find and study the source code of the relevant free software. GtkApplication examples are calling dbus code.