From 2922b0e88ba00b0067c23633075629108ad8a496 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 29 Jan 2005 20:12:22 +0000 Subject: 2005-01-29 Havoc Pennington * tools/dbus-tree-view.c: add support for displaying properties. (run dbus-viewer with an introspect xml file as arg, then resize the window so the tree elements show up, not sure what that is) * glib/dbus-gobject.c (handle_introspect): return org.freedesktop.Properties and org.freedesktop.Introspectable interfaces when we are introspected. * doc/dbus-specification.xml: allow empty interface name when Get/Set a property --- ChangeLog | 13 +++++++++++++ doc/dbus-specification.xml | 7 +++++++ glib/dbus-gobject.c | 28 ++++++++++++++++++++++++++-- tools/dbus-tree-view.c | 8 ++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5367edc..d964d45a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-01-29 Havoc Pennington + + * tools/dbus-tree-view.c: add support for displaying properties. + (run dbus-viewer with an introspect xml file as arg, then resize + the window so the tree elements show up, not sure what that is) + + * glib/dbus-gobject.c (handle_introspect): return + org.freedesktop.Properties and org.freedesktop.Introspectable + interfaces when we are introspected. + + * doc/dbus-specification.xml: allow empty interface name when + Get/Set a property + 2005-01-29 Havoc Pennington * glib/Makefile.am: rename dbus-glib-tool to dbus-binding-tool; diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index 973f390b..7a90e664 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -2147,6 +2147,13 @@ by calling org.freedesktop.Introspectable.Introspect, see . + + An empty string may be provided for the interface name; in this case, + if there are multiple properties on an object with the same name, + the results are undefined (picking one by according to an arbitrary + deterministic rule, or returning an error, are the reasonable + possibilities). + diff --git a/glib/dbus-gobject.c b/glib/dbus-gobject.c index 5aab4a68..f08bf39e 100644 --- a/glib/dbus-gobject.c +++ b/glib/dbus-gobject.c @@ -290,6 +290,27 @@ handle_introspect (DBusConnection *connection, xml = g_string_new (NULL); g_string_append (xml, "\n"); + + /* We are introspectable, though I guess that was pretty obvious */ + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + + /* We support get/set properties */ + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); + g_string_append (xml, " \n"); introspect_signals (G_OBJECT_TYPE (object), xml); introspect_properties (object, xml); @@ -409,7 +430,7 @@ gobject_message_function (DBusConnection *connection, gboolean getter; char *s; const char *wincaps_propname; - const char *wincaps_propiface; + /* const char *wincaps_propiface; */ DBusMessageIter iter; object = G_OBJECT (user_data); @@ -460,7 +481,10 @@ gobject_message_function (DBusConnection *connection, g_warning ("Property get or set does not have an interface string as first arg\n"); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } - dbus_message_iter_get_basic (&iter, &wincaps_propiface); + /* We never use the interface name; if we did, we'd need to + * remember that it can be empty string for "pick one for me" + */ + /* dbus_message_iter_get_basic (&iter, &wincaps_propiface); */ dbus_message_iter_next (&iter); if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRING) diff --git a/tools/dbus-tree-view.c b/tools/dbus-tree-view.c index afcda0fe..7c52935e 100644 --- a/tools/dbus-tree-view.c +++ b/tools/dbus-tree-view.c @@ -134,6 +134,8 @@ set_info (GtkTreeModel *model, interface_info_get_methods ((InterfaceInfo*)info)); append_child_list (model, root, interface_info_get_signals ((InterfaceInfo*)info)); + append_child_list (model, root, + interface_info_get_properties ((InterfaceInfo*)info)); break; case INFO_TYPE_METHOD: append_child_list (model, root, @@ -143,6 +145,9 @@ set_info (GtkTreeModel *model, append_child_list (model, root, signal_info_get_args ((SignalInfo*)info)); break; + case INFO_TYPE_PROPERTY: + /* no children */ + break; case INFO_TYPE_ARG: /* no children */ break; @@ -292,6 +297,9 @@ info_set_func_text (GtkTreeViewColumn *tree_column, case INFO_TYPE_SIGNAL: g_string_append (str, "signal"); break; + case INFO_TYPE_PROPERTY: + g_string_append (str, "property"); + break; case INFO_TYPE_ARG: g_string_append (str, "arg"); break; -- cgit