Anyway to remove interface from session bus?
Thiago Macieira
thiago at kde.org
Thu Sep 19 13:41:34 PDT 2013
On sexta-feira, 20 de setembro de 2013 04:14:06, 斟酌鵬兄 wrote:
> > 3) force a registration by passing the DBUS_NAME_FLAG_REPLACE_EXISTING
> > flag to RegisterName
>
> I am not sure how to do that.
> Can you make a simple example for me?
The simplest I can write is using QtDBus. I won't use the pre-existing wrapper
class because I've renamed the API into something that looks a little more
"Qtish" and you'll have a hard time reproducing.
In plain low-level QtDBus:
auto msg = QDBusMessage::createMethodCall("org.freedesktop.DBus",
"/org/freedesktop/DBus",
"org.freedesktop.DBus",
"RequestName");
msg << "org.freedesktop.Notifications";
msg << uint(DBUS_NAME_FLAG_DO_NOT_QUEUE | DBUS_NAME_FLAG_REPLACE_EXISTING);
QDBusConnection::sessionBus().call(msg);
With the low-level library, you'd use
dbus_message_new_method_call
dbus_message_append_args
dbus_bus_get
dbus_connection_send_with_reply_and_block
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20130919/8143ff96/attachment.pgp>
More information about the dbus
mailing list