Question with object_path registrations

Seth Nickell seth@gnome.org
20 Sep 2003 20:52:14 -0700


--=-fHevwQ9rI4XwGNQqFkZl
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

I'm trying to get dbus_connection_register_object_path and company
working, but they don't seem to do anything. As a simple test, I've
tried doing:

dbus_connection_register_object_path(..."/test/path"...)

And then:

dbus_connection_list_registered(..."/test/path"...)

But I always get back a blank list, despite having registered a handler
just one line above. Am I completely misunderstanding something? I'm
attaching the simple test program I am using.

-Seth

--=-fHevwQ9rI4XwGNQqFkZl
Content-Disposition: attachment; filename=test-seth.c
Content-Type: text/x-c; name=test-seth.c; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

#include "test-utils.h"

void unregister_func (DBusConnection *connection, void *user_data) {
  printf ("unregister_func_called\n");
}

DBusHandlerResult message_func (DBusConnection *connection, DBusMessage *message, void *user_data) {
  printf ("message_func_called\n");
  return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}

static DBusObjectPathVTable dbus_vtable = {
  unregister_func,
  message_func,
  NULL
};

int main () {
  DBusConnection *connection;
  char **object_path = malloc(sizeof(char *) * 3);
  char **children;
  int i = 0;

  object_path[0] = "test";
  object_path[1] = "path";
  object_path[2] = NULL;

  connection = dbus_bus_get(DBUS_BUS_SESSION, NULL);
  dbus_connection_register_object_path(connection, object_path, &dbus_vtable, NULL);

  dbus_connection_list_registered(connection, object_path, &children);

  while (children[i] != NULL) {
    printf ("children[%d] = %s\n", i, children[i]);
  }
}

--=-fHevwQ9rI4XwGNQqFkZl--