Method

GioDBusProxyset_cached_property

since: 2.26

Declaration [src]

void
g_dbus_proxy_set_cached_property (
  GDBusProxy* proxy,
  const gchar* property_name,
  GVariant* value
)

Description [src]

If value is not NULL, sets the cached value for the property with name property_name to the value in value.

If value is NULL, then the cached value is removed from the property cache.

If proxy has an expected interface (see GDBusProxy:g-interface-info) and property_name is referenced by it, then value is checked against the type of the property.

If the value GVariant is floating, it is consumed. This allows convenient ‘inline’ use of g_variant_new(), e.g.

 g_dbus_proxy_set_cached_property (proxy,
                                   "SomeProperty",
                                   g_variant_new ("(si)",
                                                 "A String",
                                                 42));

Normally you will not need to use this method since proxy is tracking changes using the org.freedesktop.DBus.Properties.PropertiesChanged D-Bus signal. However, for performance reasons an object may decide to not use this signal for some properties and instead use a proprietary out-of-band mechanism to transmit changes.

As a concrete example, consider an object with a property ChatroomParticipants which is an array of strings. Instead of transmitting the same (long) array every time the property changes, it is more efficient to only transmit the delta using e.g. signals ChatroomParticipantJoined(String name) and ChatroomParticipantParted(String name).

Available since: 2.26

Parameters

property_name

Type: const gchar*

Property name.

The data is owned by the caller of the method.
The value is a NUL terminated UTF-8 string.
value

Type: GVariant

Value for the property or NULL to remove it from the cache.

The argument can be NULL.
The data is owned by the caller of the method.