DBusConnection -> DBusGConnection woes

Ross Burton ross at burtonini.com
Tue Mar 13 06:45:39 PDT 2007


Hi,

I'm writing an app that uses a peer-to-peer connection for speed, which
uses the glib bindings.  I have this so far:


{
  ...
  dbus_error_init (&error);
  server = dbus_server_listen (path, &error);
  if (!server) {
    g_warning ("Cannot create server: %s", error.message);
    return;
  }
  dbus_server_setup_with_g_main (server, NULL);
  dbus_server_set_new_connection_function (server, new_connection, view, NULL);
}

static void
new_connection_func (DBusServer *server, DBusConnection *conn, gpointer user_data)
{
  dbus_connection_ref (conn);
  dbus_connection_setup_with_g_main (conn, NULL);

  //dbus_g_connection_register_g_object (conn, "/", user_data);
}

Note that new_connection_func is being passed a DBusConnection (as is
reasonable), but dbus_g_connection_register_g_object will only take a
DBusGConnection*.

Is there a sane way to handle this?  There is
dbus_g_connection_get_connection()() but no way of going the other way.

Ross
-- 
Ross Burton                                 mail: ross at burtonini.com
                                          jabber: ross at burtonini.com
                                     www: http://www.burtonini.com./
 PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF





More information about the dbus mailing list