DBus: Use fences for code blocks
@@ -61,40 +61,56 @@ Alternatively, (with the option announce=once) only a single message is send:
The recommended way is to globally mount the plugin:
+```sh
kdb global-mount dbus
+```
Alternatively one can mount the plugin additionally to a storage plugin, e.g.:
+```sh
kdb mount file.dump / dump dbus
+```
For openicc one would use (mounts with announce=once):
+```sh
kdb mount-openicc
+```
### Shell
Then we can receive the notification events using:
+```sh
dbus-monitor type='signal',interface='org.libelektra',path='/org/libelektra/configuration'
+```
Or via the supplied test program:
+```sh
kdb testmod_dbus receive_session
+```
We can trigger a message with:
+```sh
kdb set user/dbus/x b
+```
Note that changes in `user` fire on the dbus `session`,
and changes in namespace `system` in the dbus `system` bus.
To receive `system` changes we will use:
+```sh
kdb testmod_dbus receive_system
dbus-monitor --system type='signal',interface='org.libelektra',path='/org/libelektra/configuration'
+```
And then fire it with:
+```sh
kdb set system/dbus/y a
+```
### C
@@ -110,21 +126,27 @@ Here a small example for QDBusConnection:
Place this in your Qt class header:
+```cpp
public slots:
void configChanged( QString msg );
+```
Put this in your Qt class, e.g. the constructor:
+```cpp
if( QDBusConnection::sessionBus().connect( QString(), "/org/libelektra/configuration", "org.libelektra", QString(),
this, SLOT( configChanged( QString ) )) )
fprintf(stderr, "=================== Done connect\n" );
+```
Here comes the org.libelektra signals:
+```cpp
void SynnefoApp::configChanged( QString msg )
{
fprintf( stdout, "config changed: %s\n", msg.toLocal8Bit().data() );
};
+```
### Python
