Sunday, January 8, 2012

Heads Up: Sensitivity bug in GTK 3.2 (Ubuntu 11.10)

The GTK 3.2 package in Ubuntu 11.10 Oneiric Ocelot has a small bug that I confirmed on the GTK IRC channel: if you set the "sensitive" property of a widget to true, the widget will become sensitive even when its parent is not. So weird things like this can happen.


In the image above, the password entry has the "sensitive" property set to true because the SOCKS5 protocol allows passwords. However, "send credentials to proxy server" is not checked, so the entire GtkHBox that contains both the username and password entries is not sensitive. Notice how the password entry is sensitive anyway.

A workaround for this bug is "reminding" GTK that the parent is insensitive when the child becomes sensitive. So instead of just

    password_entry.set_sensitive(True)

you have something like

    password_entry.set_sensitive(True)

    if not authentication_box.get_sensitive():
        authentication_box.set_sensitive(True)
        authentication_box.set_sensitive(False)

and when the upstream bug is fixed you can simply remove the extra lines.

No comments:

Post a Comment