Re: Why isn't GAsyncQueue derived from GObject?

Phil Lello wrote:
Hi All,

I'm learning my way around GLib/GObject/GTK+ at the moment, and I've
written a GtkWidget derived widget that wants a GAsyncQueue as a property.

I can implement that easily enough using g_param_spec_pointer(), however
it looks like I can't do type-checking, as GAsyncQueue doesn't seem to
have any type-related functions/macros. Indeed, if it did, I'd use
g_param_spec_object, with a type of G_TYPE_ASYNC_QUEUE.

Is there a reason that GAsyncQueue doesn't derive from GObject?

Because GAsyncQueue is provided in libglib (or is it libgthread?), which does not depend on libgobject. That is, it's assumed that people might have a use for GAsyncQueue but not want to pull in GObject and friends.

If so, I can easily enough write my own wrapper. If not, I can look into
writing a patch to change this.

No need to write a wrapper. You can implement a GBoxed type for GAsyncQueue, and use g_param_spec_boxed(). Actually, there might already be one in libgobject; I suggest you check there first; if not, that's the patch that's more likely to be accepted.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]