[patch] remove DBusGPendingCall

Ross Burton ross at burtonini.com
Thu Jul 7 11:58:44 PDT 2005


On Thu, 2005-07-07 at 13:08 -0400, Colin Walters wrote:
> Ok.  One thing to consider is - shouldn't you be passing the 
> DBusGProxy * into the async callbacks?

Not sure I follow.  This is the generated code:

typedef void (*BookFactory_get_book_reply) (char *OUT_path, GError *error, gpointer userdata);

static void
BookFactory_get_book_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
  DBusGAsyncData *data = user_data;
  GError *error = NULL;
  char* OUT_path;
  dbus_g_proxy_end_call (proxy, call, &error, DBUS_TYPE_G_OBJECT_PATH, &OUT_path, G_TYPE_INVALID);
  (*(BookFactory_get_book_reply)data->cb) (OUT_path, error, data->userdata);
  return;
}

static inline gboolean
BookFactory_get_book_async (DBusGProxy *proxy, const char * IN_source, BookFactory_get_book_reply callback, gpointer userdata)
{
  DBusGAsyncData *stuff;
  stuff = g_new (DBusGAsyncData, 1);
  stuff->cb = callback;
  stuff->userdata = userdata;
  dbus_g_proxy_begin_call (proxy, "getBook", BookFactory_get_book_async_callback, stuff, g_free, G_TYPE_STRING, IN_source, G_TYPE_INVALID);
  return TRUE;
}

Am I missing something, or did you misinterpret the horrendous code
involved in writing all that?

> About DBusGAsyncData: yeah, I guess you're right.  I had thought we
> could get rid of it but from a quick glance I think using GClosure would
> just add another level of indirection really.

Yes, it would involve everything going into GValue's again for no real
reason.

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