Michael K.
Michael K.

Reputation: 21

Emit D-Bus signal using GDBus without owning a well-known name

I would like to use dbus to signal other instances of the same family of applications. It seems that to issue a signal I must execute a g_bus_own_name, emit the signal when the name is acquired, then g_bus_unown_name. This seems like a bit of palava just to send a signal. When the name is acquired, another instance of the application will hang waiting for this instance to 'unown' the name.

The deprecated way of dbus_message_new_signal/dbus_connection_send was much more straight forward.

Is there a simpler way to send the signal (without owning the name).

Upvotes: 0

Views: 1046

Answers (1)

Philip Withnall
Philip Withnall

Reputation: 5713

Yes, as Michael K says, use g_dbus_connection_emit_signal(). You only have to own a well-known name if you want other users of the bus to be able to address your application by that well-known name, rather than a unique name which changes every time you connect to the bus.

Upvotes: 0

Related Questions