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 707153 - Add style for stack switcher items with the needs-attention property
Add style for stack switcher items with the needs-attention property
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Themes
3.13.x
Other All
: Normal normal
: future
Assigned To: Lapo Calamandrei
gtk-bugs
Depends on:
Blocks: 682060
 
 
Reported: 2013-08-30 20:35 UTC by Paolo Borelli
Modified: 2014-07-16 17:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a needs-attention child property to GtkStack (5.75 KB, patch)
2013-08-30 20:35 UTC, Paolo Borelli
reviewed Details | Review
Add a throbbing animation for stack switcher pages (1.11 KB, patch)
2013-08-30 20:36 UTC, Paolo Borelli
none Details | Review
Set "needs-attention" when the timer is running (3.45 KB, patch)
2013-08-30 20:38 UTC, Paolo Borelli
none Details | Review
Add a needs-attention child property to GtkStack (6.57 KB, patch)
2013-08-31 08:48 UTC, Paolo Borelli
committed Details | Review
Set "needs-attention" when the timer is running (3.45 KB, patch)
2013-08-31 08:48 UTC, Paolo Borelli
none Details | Review
Set "needs-attention" when the timer and stopwatcg are running (3.46 KB, patch)
2013-08-31 08:49 UTC, Paolo Borelli
none Details | Review
GtkLabel in stack switcher problem (5.11 KB, image/png)
2014-07-12 14:35 UTC, Lapo Calamandrei
  Details

Description Paolo Borelli 2013-08-30 20:35:05 UTC
The child property is watched by the StackSwicther which in turns sets a
needs-attention css class on the corresponding button, so that the theme
can for instance show a throbbing animation if one of the hidden pages
needs the user attention.
Comment 1 Paolo Borelli 2013-08-30 20:35:08 UTC
Created attachment 253656 [details] [review]
Add a needs-attention child property to GtkStack
Comment 2 Paolo Borelli 2013-08-30 20:36:51 UTC
Created attachment 253657 [details] [review]
Add a throbbing animation for stack switcher pages
Comment 3 Paolo Borelli 2013-08-30 20:38:06 UTC
Created attachment 253658 [details] [review]
Set "needs-attention" when the timer is running
Comment 4 Paolo Borelli 2013-08-30 20:40:35 UTC
The adwaita patch definitely needs tweaking by the designers (try different colors, maybe also change the text color etc)

The Clocks patch is for testing, if this gets in I'll do the same also for the stopwatch
Comment 5 Matthias Clasen 2013-08-31 03:54:32 UTC
Review of attachment 253656 [details] [review]:

::: gtk/gtkstack.c
@@ +419,3 @@
                       -1, G_MAXINT, 0,
                       GTK_PARAM_READWRITE));
+

Neeeds some documentation here. It should say when it is appropriate to set needs-attention on a page, "Since: 3.10", and also, it should explain the special 'auto-unset' semantics that you've implemented here.

@@ +888,3 @@
+          child_info->needs_attention = FALSE;
+          gtk_container_child_notify (GTK_CONTAINER (stack), child_info->widget, "needs-attention");
+        }

Not sure if this is the best way to go. You only clear needs-attention when the user enters the page. If it gets set again while the user is on the page, the button will start throbbing again. Might be cleaner to leave it to the app to clear the flag, and just stop the throbbing in the stack switcher when the button is active.

::: gtk/gtkstackswitcher.c
@@ +170,3 @@
+  }
+  else
+    gtk_style_context_remove_class (context, "needs-attention");

Should probably have a define for this.
Comment 6 Paolo Borelli 2013-08-31 08:48:07 UTC
Created attachment 253674 [details] [review]
Add a needs-attention child property to GtkStack

The child property is watched by the StackSwicther which in turns sets a
needs-attention css class on the corresponding button, so that the theme
can for instance show a throbbing animation if one of the hidden pages
needs the user attention.
Comment 7 Paolo Borelli 2013-08-31 08:48:41 UTC
Created attachment 253675 [details] [review]
Set "needs-attention" when the timer is running
Comment 8 Paolo Borelli 2013-08-31 08:49:54 UTC
Created attachment 253676 [details] [review]
Set "needs-attention" when the timer and stopwatcg are running
Comment 9 Matthias Clasen 2013-08-31 14:16:36 UTC
Review of attachment 253674 [details] [review]:

Thanks, looks basically as I would expect it now.

But lets keep it for the next cycle, at this point.
Comment 10 Matthias Clasen 2013-09-26 02:35:44 UTC
Attachment 253674 [details] pushed as e59c287 - Add a needs-attention child property to GtkStack
Comment 11 Paolo Borelli 2013-09-27 06:27:30 UTC
Reopening and reassigning to gnome-themes-standard to add the style bits to adwaita. Patch in comment #2
Comment 12 Bastien Nocera 2014-02-06 14:32:49 UTC
Totem's browser plugin (also copy/pasted in epiphany) does this:
https://git.gnome.org/browse/totem/tree/browser-plugin/totem-glow-button.c#n46

It would be great if it could be a separate class to apply to the widget.
Comment 13 Lapo Calamandrei 2014-07-03 07:24:04 UTC
I'd need something to test the style against, do we have a test?
Comment 14 Paolo Borelli 2014-07-03 07:43:59 UTC
(In reply to comment #13)
> I'd need something to test the style against, do we have a test?

You can apply the patch in comment #8 to clocks
Comment 15 Lapo Calamandrei 2014-07-09 13:02:58 UTC
I would like to defer this 'till labels are able to draw a background we can use to draw a little round of squareish indicator, will we get that before the release?
Comment 16 Jakub Steiner 2014-07-09 13:31:58 UTC
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/theming/experiments/tabs4.png shows the kind of dot we ended up liking for the 'updated content'/'needs attention' that goes well together with the explicit counter we already use in Software.
Comment 17 Lapo Calamandrei 2014-07-11 15:13:35 UTC
to be clear, atm the GtkLabel draws a background, but it's just underneat the text, if I set a padding there it works like a margin w/o expanding the background (which is something we need to draw the thingy)
Comment 18 Paolo Borelli 2014-07-11 15:28:09 UTC
What if instead of the label you match the GtkRadioButton?
Comment 19 Lapo Calamandrei 2014-07-12 13:04:38 UTC
Paolo, the decoration have to be accuratelly positioned wrt the text, so I can't rely on button box size, it needs to be done on the label itself.
Comment 20 Lapo Calamandrei 2014-07-12 14:35:49 UTC
Created attachment 280550 [details]
GtkLabel in stack switcher problem

Today GtkLabel background behaves, I still have a problem in the stack switcher tho. The yellow area is the label background box (both yellow buttons have the needs-attention class applied), as you can see I cannot position generally position the circle correctly. My idea would have been to add say 4px left and right padding to labels inside stack switcher buttons then set left padding to 0 and right to 8px to fit the circle in in case of needs attention class, but having the label background spanning the whole button padding box that's impossible do to.
Comment 21 Lapo Calamandrei 2014-07-12 14:41:13 UTC
P.S. background-clip: content-box; doesn't work. In case it will it won't help since it... ehm clips the background
Comment 22 Lapo Calamandrei 2014-07-16 17:52:12 UTC
fixed in master, closing