Re: file_chooser's parent: is NULL OK?



On Thu, 2005-02-03 at 13:23 -0500, Allin Cottrell wrote:
The second parameter to gtk_file_chooser_dialog_new() is
GtkWindow *parent.

I've been in the habit of putting my app's main window in as the 
parent, but I notice that this sometimes produces undesirable 
results.

For example, using the file chooser to save a displayed graph to 
file: when the file chooser is closed I'd like focus to return to 
the graph window -- but (at least with my desktop setup) if the main 
window is given as the file chooser's parent, then it's the main 
window that gets focused on closing the file chooser (and the graph 
is pushed into the background).

I've experimented, and see that if I pass NULL for parent, focus 
seems to return to the previously focused window when the chooser is 
closed, which is fine.  I just wanted to check if passing NULL in 
this context is "officially OK", or if it invokes undefined 
behavior.


It is ok. We should probably document that as we do for
gtk_dialog_new_with_buttons().

Matthias




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]