Lucas De Marchi | 27 Apr 2012 23:25

[BlueZ RFC 5/5] gdbus: add properties into interface introspection

---
 gdbus/object.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gdbus/object.c b/gdbus/object.c
index ff5380a..701352c 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
 <at>  <at>  -158,6 +158,7  <at>  <at>  static void generate_interface_xml(GString *gstr, struct interface_data *iface)
 {
 	const GDBusMethodTable *method;
 	const GDBusSignalTable *signal;
+	const GDBusPropertyTable *property;

 	for (method = iface->methods; method && method->name; method++) {
 		gboolean deprecated = method->flags &
 <at>  <at>  -205,6 +206,21  <at>  <at>  static void generate_interface_xml(GString *gstr, struct interface_data *iface)
 			g_string_append_printf(gstr, "\t\t</signal>\n");
 		}
 	}
+
+	for (property = iface->properties; property && property->name; property++) {
+		gboolean deprecated = property->flags &
+					G_DBUS_PROPERTY_FLAG_DEPRECATED;
+
+		g_string_append_printf(gstr, "\t\t<property name=\"%s\" type=\"%s\" access=\"%s%s\"",
+						property->name, property->type,
+						property->get ? "read" : "",
+						property->set ? "write" : "");
+
+		if (!deprecated)
+			g_string_append_printf(gstr, "/>\n");
+		else
+			g_string_append_printf(gstr, ">\n\t\t\t<annotation
name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n\t\t</property>\n");
+	}
 }

 static void generate_introspection_xml(DBusConnection *conn,
--

-- 
1.7.10


Gmane