GNOME Bugzilla – Bug 734213
GtkSwitch showing up with "mixed" state when setting it active before showing
Last modified: 2014-08-04 12:37:05 UTC
Created attachment 282420 [details] Button with mixed state It seems that since the commit introducing animation, switches show up incorrectly when they are activated before they are shown. See attached test.c and screen shot. The first button is activated and the second button is deactivated before the window is shown. The second one shows up correctly, the first one not.
/* gcc `pkg-config --cflags gtk+-3.0` -o test test.c `pkg-config --libs gtk+-3.0` */ #include <gtk/gtk.h> int main (int argc, gchar *argv[]) { gtk_init (&argc, &argv); GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); GtkWidget *box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); GtkWidget *switch_off = gtk_switch_new (); GtkWidget *switch_on = gtk_switch_new (); gtk_switch_set_active (GTK_SWITCH (switch_off), FALSE); gtk_switch_set_active (GTK_SWITCH (switch_on), TRUE); gtk_box_pack_start (GTK_BOX (box), switch_on, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (box), switch_off, FALSE, FALSE, 0); gtk_container_add (GTK_CONTAINER (window), box); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_widget_show_all (window); gtk_main (); return 0; }
The same problem will probably occur if you call set_active after showing it as well, no ?