Re: gtk_window_set_transient_for



Jeff Franks <jcf tpg com au> writes: 
> void gtk_window_set_transient_for(GtkWindow *window, GtkWindow *parent)
> {
> 	g_return_if_fail(GTK_IS_WINDOW(window));
> 	g_return_if_fail(parent == NULL || GTK_IS_WINDOW(parent))
> 	g_return_if_fail(window != parent);
> 	...
> 	...
> }
> 
> Wont this function now fail if parent is anything other than NULL?
> Further down the function body there is an 'if (parent)' statement which
> suggests that you could set 'parent' to NULL or a pointer value.
> Shouldn't the second line be omitted altogether?
> 

I don't think so. Note that the test in g_return_if_fail() fails if
it's FALSE, not if it's TRUE. So that test means "parent must be
either NULL or a GtkWindow"

Havoc




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