0

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

Matt
  • 11
  • 2
  • Using this from the client works though: ``` con = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error); result = g_dbus_connection_call_sync (con, "com.fatminmin", "/com/fatminmin/GDBUS", "org.freedesktop.DBus.Properties", "Set", g_variant_new("(ssv)", "com.fatminmin.GDBUS", "Sputulant", g_variant_new("i", 235)), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); g_object_unref(con); ``` – Matt Jan 06 '22 at 14:21

1 Answers1

0

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

Matt
  • 11
  • 2