[Kde-bindings] Ruby: various DBus int variants
Sylvain Sauvage
Sylvain.L.Sauvage at free.fr
Tue Aug 3 18:57:41 UTC 2010
Arno Rehn, mardi 3 août 2010, 14:41:02 CEST
>[…]
> > But it doesn’t work anymore:
> > Qt::Variant.fromValue( 0, 'uint' )
> > => #<Qt::Variant:0x7f3a5b86bdb0 typeName=int>
> >
> > Is there a new way?
> The type name has changed to 'unsigned int' - however it then crashes. Have to
> investigate that.
Ah, me #@!, I thought I tried that but I must have just tried
'unsigned'…
It doesn’t crash here (Debian Sid, it’s almost up to date with
the trunk). I use it for a org.freedesktop.Notifications and it
works great:
####
require 'Qt4'
app = Qt::Application.new([])
bus = Qt::DBusConnection.session_bus()
exit unless bus.connected?
msg = Qt::DBusMessage.create_method_call( 'org.freedesktop.Notifications',
'/org/freedesktop/Notifications',
'org.freedesktop.Notifications',
'Notify' )
msg.arguments = [ 'Coucou', Qt::Variant.from_value( 0, "unsigned int" ),
'dialog-information', 'Title', 'blah', [], {}, -1 ]
rep = bus.call( msg )
if rep.type == Qt::DBusMessage
puts "#{rep.error_name()}: #{rep.error_message()}"
end
####
It’s even quicker than with libdbus-ruby! (which uses
introspection)
Thanks a lot!
(Still, I can’t see a way for (u)int16 as there is not even a
QVariant for shorts in C++. Or are DBus (u)int16 never used?)
--
Sylvain Sauvage
More information about the Kde-bindings
mailing list