Is there any other way to set the properties of the interface in gbdus besides using this method?

367 Views Asked by At

Is there any other way to set the properties of the interface in gbdus besides using org.freedesktop.DBus.Properties:

g_dbus_connection_call_sync(conn,
                                "org.example",
                                "/org/example/object",
                                "org.freedesktop.DBus.Properties",
                                "Set",
                                g_variant_new(),
                                NULL,
                                G_DBUS_CALL_FLAGS_NONE,
                                -1,
                                NULL,
                                &error);

Is there a more convenient API?

1

There are 1 best solutions below

0
Philip Withnall On

Another approach, which may be more convenient if the interface you’re using has a lot of methods or properties, is to generate a GDBusProxy wrapper for it using gdbus-codegen. Then call methods on that generated wrapper to set properties.

Here is an example of how to use gdbus-codegen.