signal types



Hi gurus,

I've got a question related to glib object signal stuffing.

let's say that I want to create a signal that has one argument, for a
GObject derived object or a boxed type or so.

struct _GstTypeFindClass {
  GstElementClass       parent_class;

  /* signals */
  void                  (*have_type)    (GstElement *element,
                                         GstCaps    *caps);
};

Now the argument is a GstCaps, which is (in this case) a boxed type. So
to create the signal, I do:

  gst_type_find_signals[HAVE_TYPE] =
      g_signal_new ("have_type", G_TYPE_FROM_CLASS (klass),
                     G_SIGNAL_RUN_LAST,
                     G_STRUCT_OFFSET (GstTypeFindClass, have_type),
                     NULL, NULL,
                     g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1,
                     G_TYPE_POINTER);

This is definately wrong, since G_TYPE_POINTER is too generic. Wrappers
(like perl wrappers and so on) will have difficulties to parse this to
the right object type.

so my question is: what should we do then? should the last argument of
the g_signal_new() function be a G_TYPE_BOXED (this is what most apps
seem to do, currently)? Or should it be GST_TYPE_CAPS? And what about
the marshaller, should it be g_cclosuder_marshal_VOID_BOXED? or
_VOID_CAPS? Or something else? And if it (the argument) was a GObject
derived type, should it be G_TYPE_OBJECT or still it's own object type?

Thanks for any input,

Ronald

-- 
Ronald Bultje <rbultje ronald bitfreak net>




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