Pass introspection data structures back to user
Submitted by David Zeuthen
Assigned to David Zeuthen
Link to original bug (#641776)
Description
Suppose the types
GDBusInterfaceMethodCallFunc GDBusInterfaceGetPropertyFunc GDBusInterfaceSetPropertyFunc
and
GDBusSignalCallback
all passed pointers to the relevant introspection data structures, e.g. GDBusPropertyInfo, GDBusMethodInfo, GDBusSignalInfo
then it would be possible to write code like e.g. this
typedef struct { GDBusPropertyInfo parent_struct; const gchar hyphen_name; / Anything else you want here */ } _ExtendedGDBusPropertyInfo;
static const _ExtendedGDBusPropertyInfo _foo_bar_property_info_finally_normal_name = { { -1, "FinallyNormalName", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL }, "finally-normal-name" };
This would avoid time- and space-consuming lookup tables in the app since (at least for property and methods - signals are a bit trickier), the GDBus runtime already has this information.
Concretely, the proposed patch is something like this
typedef void (*GDBusInterfaceMethodCallFunc) ( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation,
- gpointer user_data);
- gpointer user_data,
- GDBusMethodInfo *method_info);
This is of course an API break (apps will have to adjust to the new type to avoid compilation warnings), but it is not an ABI break (apps keep working).
http://library.gnome.org/devel/gio/unstable/GDBusConnection.html#GDBusInterfaceMethodCallFunc http://library.gnome.org/devel/gio/unstable/GDBusConnection.html#GDBusInterfaceGetPropertyFunc http://library.gnome.org/devel/gio/unstable/GDBusConnection.html#GDBusInterfaceSetPropertyFunc
http://library.gnome.org/devel/gio/unstable/GDBusConnection.html#GDBusSignalCallback
http://library.gnome.org/devel/gio/unstable/gio-D-Bus-Introspection-Data.html#GDBusPropertyInfo http://library.gnome.org/devel/gio/unstable/gio-D-Bus-Introspection-Data.html#GDBusMethodInfo http://library.gnome.org/devel/gio/unstable/gio-D-Bus-Introspection-Data.html#GDBusSignalInfo