Re: Undeprecate GtkAlignment ?



Hi;

you probably wanted to use gtk-devel-list, not gtk-list.

On 1 June 2015 at 20:01, Pierre Wieser <pwieser trychlos org> wrote:

After having migrated my laptop to last Fedora 22, I notice that the
GtkAlignment widget has been deprecated (since Gtk 3.14 according to
the doc).

As per usual: the widget may be deprecated, but it won't be removed
until GTK+ 4.0 is released — and, obviously, even then GTK+ 3.x will
keep the existing ABI.

Rightly or not, I do a heavy use of GtkAlignment as it provides in
Glade some sort of transparent container, where I am able to later
add any widget from the code.

You can use any container for that; GtkFrame is probably the preferred
placeholder container, these days.

Setting align and margin properties in each candidate child make my
code heavier and less agile.

That's a questionable assertion. Having an empty container that does
nothing but replicate those very same properties with its own, less
flexible ones is "less agile", and definitely less maintainable in the
long term. That's the reason why the GtkAlignment widget was
deprecated in the first place.

Intuitively, I am going to try to
factorize these alignment properties, thus recreating a GtkAlignment-
like bunch of functions.

Except you'd be using the generic API, instead of the
GtkAlignment-specific implementation of those very same properties;
you'd also miss things like baseline alignment and automatic
propagation of the expansion flags.

Since you're creating a widget programmatically, you should set the
expansion, alignment, and margin flags alongside the other widget
properties, where they belong, instead of setting them on the
container. Alternatively, and preferably, you could use GtkBuilder
templates and custom classes to avoid repeating the same code.

This appears to me as unneeded work, without any added value :(

Just because you don't yet use something, it does not mean it does not
have value.

Additionally, creating a new widget instead of setting properties
(something that can be done with Glade, or at widget creation time, if
you're adding widgets programmatically) it's likely more work.

Would it be possible to envisage undeprecation of GtkAlignment widget ?

I'm just one of the people working on GTK+, but I think that's not
likely to happen, unless we received a ton more bug reports. So far,
this is the only message about it in a year since the deprecation.

My strong suggestion is to start looking at widget templates and
GtkBuilder; they are a far easier and better way to create widgets
with pre-set packing properties than using an additional container.

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[ ] ebassi [ gmail com]


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