From 11df3e4eb2bfc8c52306f19b044531a3df067e8f Mon Sep 17 00:00:00 2001 From: Bert Freudenberg Date: Tue, 25 Sep 2007 16:07:48 +0200 Subject: [PATCH] Support dbus introspection in sugar-native-factory (#2477) --- NEWS | 1 + bin/sugar-native-factory.c | 42 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 47c999a5..55157895 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ +* #2477 Support dbus introspection in sugar-native-factory (bertf) * #2674 Add arrows to hint about the frame corner activation (marco) * #2665 Re-arrange device icons in a line at the bottom (marco) * #3378 Support changes in activity scope (incomplete!) (smcv, marco) diff --git a/bin/sugar-native-factory.c b/bin/sugar-native-factory.c index e4913dd2..858249a2 100644 --- a/bin/sugar-native-factory.c +++ b/bin/sugar-native-factory.c @@ -137,6 +137,40 @@ create_instance(int argc) +/* handle dbus Introspect() call */ + +static DBusHandlerResult +handle_introspect(DBusConnection *connection, DBusMessage* message) +{ + DBusMessage *reply; + const char *introspect_xml = + DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE + "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n"; + + reply = dbus_message_new_method_return(message); + dbus_message_append_args(reply, + DBUS_TYPE_STRING, &introspect_xml, + DBUS_TYPE_INVALID); + + dbus_connection_send(connection, reply, NULL); + dbus_message_unref(reply); + + return DBUS_HANDLER_RESULT_HANDLED; +} + + + /* handle dbus create() call */ static DBusHandlerResult @@ -212,8 +246,12 @@ factory_message_func(DBusConnection *connection, void *user_data) { if (dbus_message_is_method_call(message, - "org.laptop.ActivityFactory", - "create")) + "org.freedesktop.DBus.Introspectable", + "Introspect")) + return handle_introspect(connection, message); + else if (dbus_message_is_method_call(message, + "org.laptop.ActivityFactory", + "create")) return handle_create(connection, message); else return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;