Hello,
في س، 27-08-2011 عند 18:02 +0200 ، كتب rastersoft:
> Hi all:
>
> I'm working with DBus and Vala, and I've been able to call to a method
> in UDisks; but now I want to do that call in an asynchronous manner,
> because it needs some time to be completed (format a disk).
>
> I tried something like this:
>
> [DBus (name = "org.freedesktop.UDisks.Device")]
> interface Device_if : GLib.Object {
> public abstract async void FilesystemCreate(string type, string[]
> options) throws IOError;
> }
>
> Device_if my_device = Bus.get_proxy_sync<Device_if> (BusType.SYSTEM,
> "org.freedesktop.UDisks","device_name");
> my_device.FilesystemCreate("reiserfs",null);
>
> and it worked; the problem is that I don't know how to know when the
> call ended. In the documentation I can't find any signal to connect to.
Just add another argument to your call ;-)
my_device.FilesystemCreate.begin ("reiserfs",null, () => {
// do whatever you want when the operation is finished
});
see http://live.gnome.org/Vala/Tutorial#Asynchronous_Methods
(and btw, I think you can use vala-ish method name filesystem_create and
valac will correctly translate it).
HTH,
Abderrahim
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list