Support dbus introspection in sugar-native-factory (#2477)

This commit is contained in:
Bert Freudenberg 2007-09-25 16:07:48 +02:00
parent b8318323de
commit 11df3e4eb2
2 changed files with 41 additions and 2 deletions

1
NEWS
View File

@ -1,3 +1,4 @@
* #2477 Support dbus introspection in sugar-native-factory (bertf)
* #2674 Add arrows to hint about the frame corner activation (marco) * #2674 Add arrows to hint about the frame corner activation (marco)
* #2665 Re-arrange device icons in a line at the bottom (marco) * #2665 Re-arrange device icons in a line at the bottom (marco)
* #3378 Support changes in activity scope (incomplete!) (smcv, marco) * #3378 Support changes in activity scope (incomplete!) (smcv, marco)

View File

@ -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
"<node>\n"
" <interface name=\"org.freedesktop.DBus.Introspectable\">\n"
" <method name=\"Introspect\">\n"
" <arg direction=\"out\" type=\"s\" />\n"
" </method>\n"
" </interface>\n"
" <interface name=\"org.laptop.ActivityFactory\">\n"
" <method name=\"create\">\n"
" <arg direction=\"in\" type=\"a{ss}\" />\n"
" </method>\n"
" </interface>\n"
"</node>\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 */ /* handle dbus create() call */
static DBusHandlerResult static DBusHandlerResult
@ -212,6 +246,10 @@ factory_message_func(DBusConnection *connection,
void *user_data) void *user_data)
{ {
if (dbus_message_is_method_call(message, if (dbus_message_is_method_call(message,
"org.freedesktop.DBus.Introspectable",
"Introspect"))
return handle_introspect(connection, message);
else if (dbus_message_is_method_call(message,
"org.laptop.ActivityFactory", "org.laptop.ActivityFactory",
"create")) "create"))
return handle_create(connection, message); return handle_create(connection, message);