After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 398403 - Add a "tabs-alignment" style property
Add a "tabs-alignment" style property
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Widget: GtkNotebook
2.19.x
Other All
: Normal minor
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2007-01-19 16:18 UTC by Carlos Garnacho
Modified: 2013-04-24 23:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to implement the feature (2.98 KB, patch)
2007-01-19 16:19 UTC, Carlos Garnacho
none Details | Review
better approach codewise (2.31 KB, patch)
2007-01-29 14:44 UTC, Carlos Garnacho
reviewed Details | Review
Use a boolean, center-tabs for the alignment (2.40 KB, patch)
2009-07-30 20:38 UTC, Alberto Ruiz
none Details | Review

Description Carlos Garnacho 2007-01-19 16:18:51 UTC
Hi!,

I'm going to attach a patch to add to GtkNotebook a "tabs-alignment" style property to draw tabs in other places than aligned to the right/left.

The style property range is between 0.0 (aligned to borders) and 1.0 (centered). The default value is 0.0. Maybe it should be better a boolean style property to switch between these two modes? it seems to me that intermediate values will be pretty rare.
Comment 1 Carlos Garnacho 2007-01-19 16:19:45 UTC
Created attachment 80709 [details] [review]
patch to implement the feature
Comment 2 Carlos Garnacho 2007-01-29 14:44:11 UTC
Created attachment 81436 [details] [review]
better approach codewise
Comment 3 Matthias Clasen 2007-04-29 03:12:21 UTC
I don't think this makes a lot of sense as a style property.
I think applications usually want and need to have control over tab positioning.
Comment 4 Alberto Ruiz 2008-03-16 23:21:10 UTC
The fact that is centered as a style property doesn't steal any control over the application it just adds more flexibility to engine designers.

If you delegate that to the developer, you can't follow HIG standards on other platforms while writting an engine. As an example, the Apple HIG stands that the tabs should be centered, and no apps have control over that.

I'm right now implementing a patch to draw the native mac tabs on rhult's mac engine, and the lack of this style property makes impossible from the engine point of view to do the right thing.

If an application developer really wants to tweak that, he can use his own rc file for the app. But this behaviour should be in control of the theme/engine designer IMHO.
Comment 5 Matthias Clasen 2008-03-18 20:42:00 UTC
Ok, here is what I said on irc earlier:

<mclasen> arc: well, I basically think that notebooks are already well beyond the point of over-configurability
<mclasen> maybe we should add this anyway if this is essential for good os x theming

and yes, I think that a boolean "center-tabs" is probably better
Comment 6 Alberto Ruiz 2008-03-18 20:47:24 UTC
"center-tabs" sounds fine. Right/left alignment sounds more of a RTL/LTR based behaviour rather than style.
Comment 7 Carlos Garnacho 2008-03-18 21:07:01 UTC
All right! I'll work on it soon
Comment 8 Alberto Ruiz 2009-07-30 20:38:35 UTC
Created attachment 139587 [details] [review]
Use a boolean, center-tabs for the alignment
Comment 9 Matthias Clasen 2009-08-10 18:48:53 UTC
+  if (tabs_centered && !*show_arrows)
+    {
+      remaining_space = *max - *min - tab_overlap - *tab_space;
+      padding = (remaining_space / 2);
+
+      *min += padding;
+      *max -= padding;

This looks a little fishy to me. Does that mean that tabs will suddenly jump from the middle when scroll arrows are needed ? Or does this work out ok, because arrows are only needed in cases where the remaining_space is 0 anyway ? If so, why is the !*show_arrows condition needed in the first place ?
Comment 10 Alberto Ruiz 2009-08-10 19:00:19 UTC
When scroll arrows are needed, it means that the tabs occupy the whole horizontal area, so being centered or not is sort of irrelevant, in that regard, there's no need to calculate anything there, there's no difference at all. It works okay for me.

In any case I just adapted Carlos work here, I can change it if you really think it should be changed but IMHO I think it's alright.
Comment 11 Matthias Clasen 2013-04-24 23:49:45 UTC
I think GtkStack with its separate stack switcher is the way to go if you want this kind of appearance.