Re: Overriding iface implementations
- From: Tim Janik <timj gtk org>
 
- To: Federico Mena Quintero <federico ximian com>
 
- Cc: Owen Taylor <otaylor redhat com>,	GTK+ development mailing list <gtk-devel-list gnome org>
 
- Subject: Re: Overriding iface implementations
 
- Date: Wed, 25 Feb 2004 17:42:31 +0100 (CET)
 
On Wed, 25 Feb 2004, Federico Mena Quintero wrote:
> On Wed, 2004-02-25 at 09:03, Owen Taylor wrote:
>
> > > Namely, the file chooser uses a GtkListStore for the shortcuts list.  I
> > > want to make just the bookmarks part reorderable, so I need to override
> > > ::row_draggable on the source side, and ::row_drop_possible on the
> > > destination side.
> > You just add the interface again and set the functions you want
> > and don't set the others. g_type_interface_peek_parent() can
> > be used to chain up.
>
> That means deriving from GtkListStore and re-adding the interfaces,
> right?
>
> My question is more along the following lines.  Can I override interface
> methods for a particular instance of a class?
no, not generically, i.e. we don't type per-instance and allow per instance
method changes. that would have made the type+object system too complicated.
there're other OO languages out there if you need that ;)
>  E.g.
>
> 	GtkTreeDragSourceIface my_methods = {
> 	  my_row_draggable_func,
> 	  NULL,
> 	  NULL
> 	};
>
> 	list = gtk_list_store_new ();
> 	override_interface (list, GTK_TYPE_TREE_DRAG_SOURCE, my_methods);
well, this example looks more like an ordinary signal connection (despite
override vs. connect). in general, you can only customize per-instance methods
if they are signals. if you need to do something like tweak a specific objects
behaviour and can't connect, that usually indicates there's a signal missing
(in the object/interface type providing the method).
>
>   Federico
>
---
ciaoTJ
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]