Re: GtkAllocation accessor



Hi.

> This all seems odd to me because the widget contains the allocation already.
> I don't give the address of a GtkWidget to some_widget_new() for it to
> fill in the structure. I call some_widget_new() and it returns a pointer
> to the widget which contains the allocation... All I need is a pointer to
> that allocation. I don't understand the motivation for having to copy the
> allocation...

You're mixing two completely different things here. GtkWidget is
GObject and should not be treated as structure. It is opaque "thing"
that should be manipulated through accessors. It will also handle it's
memory with almost no intervention from programmer. GtkAllocation on
the other hand is simple struct that is completely in the hands of
programmer.

Also, GtkAllocation is part of the widget's internal structure and
returning pointer to it is problematic from two aspects: widget's
internal structure cannot be changed in the future without breaking
(again) applications; this structure can be directly manipulated by
programmer, which can screw internal workings of the widget.

Tadej

-- 
Tadej Borovšak
tadeboro.blogspot.com
tadeboro gmail com
tadej borovsak gmail com


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