On Mon, 2010-04-19 at 18:15 +1000, Roman Joost wrote:

> thanks for your quick reply!
> On Sun, Apr 18, 2010 at 10:35:33AM +0200, Sven Neumann wrote:
> > On Sat, 2010-04-17 at 17:25 +1000, Roman Joost wrote:
> > How much code does the TextView class actually borrow from the Entry
> > class?
> It would borrow the
>     * get_text* (which returns a string if the XMPModel
>       changed) and
>     * set_text method (which sets the value in the XMPModel in case the
>       user entered something in the widget).
> I actually thought I would also be able to use some of the setup data
> structures or object construction methods. This is almost the same for
> the GtkEntry and the TextView and probably for any other widget. For
> example:
> static void   gimp_xmp_model_entry_set_property  (GObject      *object,
>                                                   guint         property_id,
>                                                   const GValue *value,
>                                                   GParamSpec   *pspec);
> static void   gimp_xmp_model_entry_get_property  (GObject      *object,
>                                                   guint         property_id,
>                                                   GValue       *value,
>                                                   GParamSpec   *pspec);
> the class_init, the constructor method need to be always re-declared?

You could use an interface and have your classes implement that
interface. GObject allows interfaces to have a default implementation.
You can for example implement common properties in an interface. There
are few examples of this in GIMP. The GimpSerializable interface is one,
GimpRectangleTool is also an interface.


Gimp-developer mailing list

Reply via email to