After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 744595 - Dbus disable automatic variant unboxing
Dbus disable automatic variant unboxing
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: D-Bus
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2015-02-16 15:34 UTC by ria.freelander
Modified: 2017-01-06 07:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
D-Bus: support [DBus (signature = ...)] for properties (9.72 KB, patch)
2016-12-27 16:16 UTC, Abderrahim Kitouni
committed Details | Review

Description ria.freelander 2015-02-16 15:34:02 UTC
I have dbus interface like this:

[DBus (name = "org.kde.StatusNotifierItem")]
public interface SNItemIface : Object
{
        /*More properties */
	/* Tooltip */
	[DBus(signature = "sa(iiay)ss")]
	public abstract Variant tool_tip {owned get;}
        /* More properties
}

When generating C code, I see this:
static GVariant* sn_item_iface_dbus_proxy_get_tool_tip (SNItemIface* self) {
	GVariant *_inner_reply;
	GVariant* _result;
	_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "ToolTip");
	if (!_inner_reply) {
		GVariant *_arguments;
		GVariant *_reply;
		GVariantBuilder _arguments_builder;
		g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.kde.StatusNotifierItem"));
		g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("ToolTip"));
		_arguments = g_variant_builder_end (&_arguments_builder);
		_reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
		if (!_reply) {
			return NULL;
		}
		g_variant_get (_reply, "(v)", &_inner_reply);
		g_variant_unref (_reply);
	_result = g_variant_get_variant (_inner_reply);
	g_variant_unref (_inner_reply);
	return _result;
}

But Vala must not use g_variant_get_variant to this properties, because it is not of "v" type.
Comment 1 Abderrahim Kitouni 2016-12-27 16:16:44 UTC
Created attachment 342504 [details] [review]
D-Bus: support [DBus (signature = ...)] for properties

This was working for methods and signals, but not for properties.
Also add tests for all cases.
Comment 2 Rico Tzschichholz 2017-01-06 07:44:11 UTC
Attachment 342504 [details] pushed as 415b300 - D-Bus: support [DBus (signature = ...)] for properties