[gst-devel] good point from gnomedesktop

David I. Lehn dlehn at vt.edu
Wed Jan 8 09:18:05 CET 2003


* Thomas Vander Stichele <thomas at urgent.rug.ac.be> [20030108 11:03]:
>  Oh, one other thing - I wish they'd rename the Connect method of one of 
> the GST objects to something else, in non-GObject langauges (ie, all 
> except C) you can't have two different methods with the same name, and it 
> overrides the GObject connect method.
> 
> Is this a huge problem for us ? If it is, I'd want to fix this with an 
> API-compatible layer before 0.6.0.  What do you guys think ?
> 

Yes this is a problem.  Which is why I've been moaning about it for a a
long time. ;)  See the post and discussion from a while ago for possible
alternative names.  We need to rename disconnect too.  Only reason I
haven't done the switch myself is I can't decide what name to use.
Tradeoff's between verbose long names and names so short they are as bad
and generic as g_object_connect().

In Python this problem causes code that should be written like:

  element.connect('sig', handler)

to have to be called like:

  GObject.connect(element, 'sig', handler)

yuck.

I wouldn't bother with API-compatible stuff, just drop the old API and
let people fix their code.  It's not a complex change.

I assume most people want short names.  I'd suggest the following.  Keep
the _to_/_from_ part for consistancy in the API though it's not needed
to solve this problem for other than _[dis]connect():

_connect          -> _connect_to
_connect_many     -> _connect_to_many
_connect_filtered -> _connect_to_filtered

_disconnect       -> _disconnect_from
_disconnect_many  -> _disconnect_from_many

For a more descriptive, yet a bit long in C, names, I'd suggest:

_connect           -> _connect_to_element
_connect_many      -> _connect_to_elements
_connect_filtered  -> _connect_to_filtered
                   -> (or gst_element_connect_to_filtered_element?)

_disconnect        -> _disconnect_from_element
_disconnect_many   -> _disconnect_from_elements

-dave




More information about the gstreamer-devel mailing list