make gen " /> make gen " /> make gen "/>

Gdbus property set form client not working

164 Views Asked by At

Based on the fatmimin hello world sample, I have added a property to the interface:

        <property name="Sputulant" type="i" access="readwrite"/>

make gen does its thing, resulting in two funcs called:

min_min_bus_gdbus_set_sputulant()
min_min_bus_gdbus_get_sputulant()

I havent added any code in server.c to 'connect' to this property (in the way the Hello World method is, with g_signal_connect())

When calling these from the client only the get function works. I cant set the value.

Using gdbus tool does work though:

gdbus call -e -d com.fatminmin -o /com/fatminmin/GDBUS -m org.freedesktop.DBus.Properties.Set "com.fatminmin.GDBUS" "Sputulant" "<123>"

I have been digging into this for days now and cant find any sample code for properties or any other suggestions, so what am I doing wrong here?

Thanks in advance

1

There are 1 best solutions below

0
Matt On

OK, the cause of this is you cant do a set property with the same proxy handle you used to do a get property.

So,

proxy = lkbr_bus_gdbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE,
"com.lkbr", "/com/lkbr/GDBUS", NULL, &error);

lkbr_bus_gdbus_set_sputulant(proxy,  235);
g_object_unref(proxy);

Works, create a new proxy, and unref it, for each call seems to be the way to go