gtk dialog / purple_request window focus issues

Lucas Fisher lucas.fisher at
Fri Nov 25 21:26:05 EST 2011

I'm having a problem with the correct dialog getting focus when I
chain multiple dialogs.

In order to import certificates and keys from a PKCS12 file I need
have the user select a file (a file request) and then enter the
password for the file (a fields request). The file request is made
inside a button callback from within the certificate manager. The
fields request (for the password) is make with the ok callback for the
file request. The dialog's parent for each request is handled by
pidgin_auto_parent_window() which tries to guess what window should be
the parent. It appears look for and choose the currently focused
window. For the file request the last focused window is the
certificate manager. All is good.  For the fields request auto_parent
chooses the file request dialog as the parent. However, this results
in the password dialog ending up behind all the other pidgin windows
and hidden from the user. Not good for usability.

The best I can figure is that the file dialog "goes away" before the
fields dialog. That is, the fields dialog's parent has disappeared and
GTK's behavior is not to give it focus. I made some very ugly hacks
with global variables and found that when I forcably set the fields
dialog to have the cert manager as its parent the fields dialog shows
up on top of all other pidgin windows and is visible to the user.

The problem is, I don't know how to fix this properly? Or perhaps I
have run into a limitation of the API that forces guessing of the
parent? I guess I could try to change pidgin_auto_parent_window() to
be even smarter and use as the parent only non-dialog windows if that
is even possible?


More information about the Devel mailing list