purple_request_file incompletely specified callbacks

William Ehlhardt williamehlhardt at gmail.com
Sun Jul 29 22:18:43 EDT 2007


The prototype required of callback functions for the ok_cb and
cancel_cb arguments to libpurple/request.c:purple_request_file seems
impossible to divine from the header file and function prototype; both
callback arguments are specified only as "GCallback", which is not
very descriptive [1].

With some grepping, I determined the expected prototype for the ok_cb,
going by pidgin/gtkdebug.c:save_writefile_cb, which is passed into
purple_request_file as ok_cb in save_cb a little ways down. Can this
information can be made explicit in libpurple/request.h without
forcing a major version bump? A PurpleRequestFileCb typedef already
exists in request.h; can it be used directly in the
purple_request_file prototype?

While I am aware that changing function signatures will force a major
bump, in this case, I think that the function signatures themselves
will not be affected, as the expected signature is already implicitly
defined somewhere deep in the code that calls the callbacks. For
general sanity, it should be possible for the programmer to figure out
the necessary prototype simply by looking at the purple_request_file
prototype in request.h.

-William

[1] http://developer.gnome.org/doc/API/2.0/gobject/gobject-Closures.html#GCallback




More information about the Devel mailing list