gtk4: gtk_box_pack_start()/end() porting

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

gtk4: gtk_box_pack_start()/end() porting

Murray Cumming-5
gtk4's gtk_box_pack_start() and gtk_box_pack_end() now no longer have
the expand and fill parameters that are in GTK+3:
https://developer.gnome.org/gtk3/stable/GtkBox.html#gtk-box-pack-start
these are the commits that removed them:
https://git.gnome.org/browse/gtk+/commit/?id=c92b7d4224b9cef1d08373fcc2
8f7fbd96c64e6d
https://git.gnome.org/browse/gtk+/commit/?id=5729ea7744c2a41ae8fb833db6
690a6aa5ad7a84

But, based on some experiments, it doesn't seem obvious to me exactly
how to replace these by setting halign, valign, hexpand or vexpand.
Could someone please add a mapping of the old fill/expand combinations
to the new halign/valign/hexpand/vexpand properties to the migrating
guide?
https://git.gnome.org/browse/gtk+/tree/docs/reference/gtk/migrating-3to
4.xml

There are only 4 possible fill/expand combinations, only 3 of which
ever made sense, so this should be doable.

--
Murray Cumming
[hidden email]
www.murrayc.com

_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gtk4: gtk_box_pack_start()/end() porting

Timm Bäder
On 28.04, Murray Cumming wrote:
> But, based on some experiments, it doesn't seem obvious to me exactly
> how to replace these by setting halign, valign, hexpand or vexpand.
> Could someone please add a mapping of the old fill/expand combinations
> to the new halign/valign/hexpand/vexpand properties to the migrating
> guide?
> https://git.gnome.org/browse/gtk+/tree/docs/reference/gtk/migrating-3to
> 4.xml

I've added notes about the fill and expand child properties to the
migration guide:
https://git.gnome.org/browse/gtk+/commit/?id=bb1deaafa42ccb03929d3cd5fdab685218bbac29
_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gtk4: gtk_box_pack_start()/end() porting

Murray Cumming-5
On Fri, 2017-04-28 at 17:20 +0200, Timm Bäder wrote:
> I've added notes about the fill and expand child properties to the
> migration guide:
> https://git.gnome.org/browse/gtk+/commit/?id=bb1deaafa42ccb03929d3cd5
> fdab685218bbac29

Thanks. I guess it's that last part about hexpand/vexpand affecting the
parent widgets too that explains what I've seen so far. So there is
really no simple mapping from the old API to the new API. Porting is
going to be rather awkward.

--
Murray Cumming
[hidden email]
www.murrayc.com

_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gtk4: gtk_box_pack_start()/end() porting

Murray Cumming-5
On Fri, 2017-04-28 at 17:50 +0200, Murray Cumming wrote:

> On Fri, 2017-04-28 at 17:20 +0200, Timm Bäder wrote:
> > I've added notes about the fill and expand child properties to the
> > migration guide:
> > https://git.gnome.org/browse/gtk+/commit/?id=bb1deaafa42ccb03929d3c
> > d5
> > fdab685218bbac29
>
> Thanks. I guess it's that last part about hexpand/vexpand affecting
> the
> parent widgets too that explains what I've seen so far. So there is
> really no simple mapping from the old API to the new API. Porting is
> going to be rather awkward.

Have some container widgets changed, or lost, some default
spacing/padding/margins too? For instance, it looks like GtkActionBar
used to have some hard-coded spacing between its child widgets (added
via gtk_action_bar_pack_start()), but not with gtk4.

--
Murray Cumming
[hidden email]
www.murrayc.com

_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gtk4: gtk_box_pack_start()/end() porting

Timm Bäder
On 03.05, Murray Cumming wrote:

> On Fri, 2017-04-28 at 17:50 +0200, Murray Cumming wrote:
> > On Fri, 2017-04-28 at 17:20 +0200, Timm Bäder wrote:
> > > I've added notes about the fill and expand child properties to the
> > > migration guide:
> > > https://git.gnome.org/browse/gtk+/commit/?id=bb1deaafa42ccb03929d3c
> > > d5
> > > fdab685218bbac29
> >
> > Thanks. I guess it's that last part about hexpand/vexpand affecting
> > the
> > parent widgets too that explains what I've seen so far. So there is
> > really no simple mapping from the old API to the new API. Porting is
> > going to be rather awkward.
>
> Have some container widgets changed, or lost, some default
> spacing/padding/margins too? For instance, it looks like GtkActionBar
> used to have some hard-coded spacing between its child widgets (added
> via gtk_action_bar_pack_start()), but not with gtk4.

Yes, iirc GtkPopover with .menu and GtkFileChooserButton, etc. lost their
spacing. Since GtkBox supports border-spacing via CSS now, I think
themes should handle that instead, but Adwaita doesn't care yet.
_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gtk4: gtk_box_pack_start()/end() porting

Murray Cumming-5
On Wed, 2017-05-03 at 14:22 +0200, Timm Bäder wrote:

> > Have some container widgets changed, or lost, some default
> > spacing/padding/margins too? For instance, it looks like
> > GtkActionBar
> > used to have some hard-coded spacing between its child widgets
> > (added
> > via gtk_action_bar_pack_start()), but not with gtk4.
>
> Yes, iirc GtkPopover with .menu and GtkFileChooserButton, etc. lost
> their
> spacing. Since GtkBox supports border-spacing via CSS now, I think
> themes should handle that instead, but Adwaita doesn't care yet.

So, applications shouldn't generally need to specify any spacing at all
between child widgets in containers? For instance
- Gtk::Box::spacing
- margin of child widgets in a Gtk::ActionBar
- Gtk::Grid column-spacing and row-spacing
?

GTK 3 and GTK 4 themes are separate, right?


--
Murray Cumming
[hidden email]
www.murrayc.com

_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gtk4: gtk_box_pack_start()/end() porting

Timm Bäder
On 03.05, Murray Cumming wrote:

> On Wed, 2017-05-03 at 14:22 +0200, Timm Bäder wrote:
> > > Have some container widgets changed, or lost, some default
> > > spacing/padding/margins too? For instance, it looks like
> > > GtkActionBar
> > > used to have some hard-coded spacing between its child widgets
> > > (added
> > > via gtk_action_bar_pack_start()), but not with gtk4.
> >
> > Yes, iirc GtkPopover with .menu and GtkFileChooserButton, etc. lost
> > their
> > spacing. Since GtkBox supports border-spacing via CSS now, I think
> > themes should handle that instead, but Adwaita doesn't care yet.
>
> So, applications shouldn't generally need to specify any spacing at all
> between child widgets in containers? For instance
> - Gtk::Box::spacing
> - margin of child widgets in a Gtk::ActionBar
> - Gtk::Grid column-spacing and row-spacing
> ?

No, I'm talking about individual widgets, not applications and their
UI[1]. The default values of the properties are gone in GTK+, but not
the properties itself. GtkActionBar lost its spacing property I think,
but that's just because I didn't know if there's a real use case for it,
it seems like something the theme should control in this case.
Right now we still have all the spacing properties in GtBox,
GtkGrid, etc. as you mentioned and of course the widget margin
properties you can use and they still work like they did in gtk3.


[1]Even though spacing *should* probably be handled by the theme, so the
theme can decide whether UIs are more spacey or more narrow, nobody has
come up with a proper way for applications to specify that.
_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gtk4: gtk_box_pack_start()/end() porting

Murray Cumming-5
On Wed, 2017-05-03 at 15:45 +0200, Timm Bäder wrote:
[snip]
> [1]Even though spacing *should* probably be handled by the theme, so
> the
> theme can decide whether UIs are more spacey or more narrow, nobody
> has
> come up with a proper way for applications to specify that.

Yes, I've never liked how applications have all these magic values
sprinkled through their code.

Thanks for the explanation.

--
Murray Cumming
[hidden email]
www.murrayc.com

_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Loading...