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 688519 - GtkRadioButton's label style not updated when programmatically toggled
GtkRadioButton's label style not updated when programmatically toggled
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkButton
3.7.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-11-17 10:20 UTC by Paolo Borelli
Modified: 2018-04-15 00:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test program (2.06 KB, text/x-csrc)
2012-11-17 10:20 UTC, Paolo Borelli
Details

Description Paolo Borelli 2012-11-17 10:20:18 UTC
The following test case changes the label widget inside a radio button on the fly when the button is toggled: you can see that from time to time the label is white and bold even when the button is not active. Hovering with the mouse refreshes the label properly.


Note this is needed to properly imeplement the gnome3 toolbar design (we cannot simply change the label's markup since we need to have two label and put them in  a size group to make sure we get the larger width).
Comment 1 Paolo Borelli 2012-11-17 10:20:49 UTC
Created attachment 229221 [details]
test program
Comment 2 Benjamin Otte (Company) 2012-11-17 13:16:42 UTC
This is actually a problem with state flag propagation. When you remove the non-bold widget, it has GTK_STATE_FLAG_ACTIVE set on it (due to the button just having become active). And then when you readd it later, the state flag is still set.

There is nothing we can do about it without reorganizing how we handle state flags. The only quickfix I can offer is this:

--- test.c.old   2012-11-17 13:01:06.201746549 +0100
+++ test.c    2012-11-17 14:09:46.959591319 +0100
@@ -34,6 +34,7 @@
  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio))) {
    gtk_container_add (GTK_CONTAINER (radio), labels->bold);
  } else {
+   gtk_widget_unset_state_flags (labels->plain, GTK_STATE_FLAG_ACTIVE);
    gtk_container_add (GTK_CONTAINER (radio), labels->plain
  }
  gtk_widget_show_all (radio);
Comment 3 Paolo Borelli 2012-11-17 16:04:34 UTC
Thanks. I have applied the workaround in clocks. I am leaving this open for a real fix as discussed in #gtk+
Comment 4 Matthias Clasen 2018-02-10 05:03:03 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 5 Matthias Clasen 2018-04-15 00:19:36 UTC
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla.

If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab:

https://gitlab.gnome.org/GNOME/gtk/issues/new