Re: [Vala] Getting access to objects using an ObjectPath




-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I found the problem: I have to use "org.freedesktop.UDisks" in both
get_proxy_sync, because is the same program/connection who answers to
all objects.

El 15/08/11 11:51, rastersoft escribió:

Hi all:

I'm starting with DBus over Vala, and I'm having problems in
getting access to some elements.

I want to work with the UDisk system, so I started to connecto to
"org/freedesktop/Udisks" and get all the devices. This returns an
array of ObjectPaths. Now, I want to get the file associated with
each device, but it returns NULL, so I'm not sure if I'm not
getting access to the dbus object itself, or the code is fine and
the problem is in UDisk...

Here is the code (links to the DBus interfaces of UDisk is after
it):

------- cut here --------- cut here --------- cut here
---------------

using GLib;

[DBus (name = "org.freedesktop.UDisks")] interface DemoClient :
Object { public abstract ObjectPath[] EnumerateDevices() throws
IOError; public abstract string DaemonVersion { owned get; set; }
}

[DBus (name = "org.freedesktop.UDisks.Device")] interface
DemoClient2 : Object { public abstract string DeviceFile { owned
get; set; } }

void main () {

DemoClient client = Bus.get_proxy_sync (BusType.SYSTEM,
"org.freedesktop.UDisks","/org/freedesktop/UDisks"); var retval =
client.EnumerateDevices();

GLib.stdout.printf("Version %s\n",client.DaemonVersion);

DemoClient2 client2;

foreach (ObjectPath o in retval) { client2 = Bus.get_proxy_sync
(BusType.SYSTEM,
"org.freedesktop.UDisks.Device",o,DBusProxyFlags.NONE,null);
GLib.stdout.printf("Values: %s %s\n",o,client2.DeviceFile); } }

------- cut here --------- cut here --------- cut here
---------------

UDisks interfaces are here:

http://hal.freedesktop.org/docs/udisks/UDisks.html

UDisks.Device interfaces are here

http://hal.freedesktop.org/docs/udisks/Device.html#Device:DeviceFile



Thanks!


_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list


- -- 
Nos leemos
                 RASTER    (Linux user #228804)
raster rastersoft com              http://www.rastersoft.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5JPfkACgkQXEZvyfy1ha+mgwCfZJ2O6Dtql79B0n9s/FPiBEEm
Pj8AmwVZMeBfw7UJzYEGeWX+t1Jz6FgX
=20pL
-----END PGP SIGNATURE-----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]