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.

Answers


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.


Need Your Help

C++ destructors as virtual functions?

c++ destructor virtual-functions

I just read recently that its a good practice to implement C++ destructors as virtual functions[1]. Why is this so? Is this a general good practice? If not, in what conditions/cases is a destructor...

Delete files with special characters in filenames

php solaris filenames character unlink

I need to delete old files with special characters in filenames like space,,,(,),! and so on via PHP. Classic unlink($filename) does not work for these files. How can I transform filenames to filen...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.